Page MenuHomeHEPForge

No OneTemporary

This file is larger than 256 KB, so syntax highlighting was skipped.
diff --git a/examples/B3piKMatrixMassProj.cc b/examples/B3piKMatrixMassProj.cc
index 9fd6622..71c8d5c 100644
--- a/examples/B3piKMatrixMassProj.cc
+++ b/examples/B3piKMatrixMassProj.cc
@@ -1,439 +1,462 @@
/*
Copyright 2016 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
// Plot the mass projections of K-matrix amplitude terms generated over the Dalitz plot so that
// we can see what shapes the poles and SVP components have. Also show the rho for comparison
#include <iostream>
using std::cout;
using std::endl;
#include "LauCartesianCPCoeffSet.hh"
#include "LauDaughters.hh"
#include "LauEffModel.hh"
#include "LauIsobarDynamics.hh"
#include "LauKMatrixPropagator.hh"
#include "LauParameter.hh"
#include "LauResonanceMaker.hh"
#include "LauSimpleFitModel.hh"
#include "LauVetoes.hh"
-#include "TGraph.h"
#include "TCanvas.h"
-#include "TStyle.h"
-#include "TROOT.h"
-#include "TSystem.h"
-#include "TString.h"
+#include "TFile.h"
+#include "TGraph.h"
#include "TH1.h"
#include "TH2.h"
-#include "TTree.h"
-#include "TFile.h"
#include "THStack.h"
#include "TLegend.h"
+#include "TROOT.h"
+#include "TString.h"
+#include "TStyle.h"
+#include "TSystem.h"
+#include "TTree.h"
#include <map>
#include <vector>
-void createHistos(const std::string& rootFileName);
-void plotHistos(const std::string& rootFileName);
-std::vector<TH1*> genMassHistos(Int_t index, Int_t NSignal);
+void createHistos( const std::string& rootFileName );
+void plotHistos( const std::string& rootFileName );
+std::vector<TH1*> genMassHistos( Int_t index, Int_t NSignal );
Bool_t useProdAdler = kFALSE;
-int main(const int argc, const char** argv) {
+int main( const int argc, const char** argv )
+{
- int histFlag(0), prodFlag(0);
- if (argc > 1) {
- histFlag = std::atoi(argv[1]);
+ int histFlag( 0 ), prodFlag( 0 );
+ if ( argc > 1 ) {
+ histFlag = std::atoi( argv[1] );
}
- if (argc > 2) {
- prodFlag = std::atoi(argv[2]);
- if (prodFlag != 0) {useProdAdler = kTRUE;}
+ if ( argc > 2 ) {
+ prodFlag = std::atoi( argv[2] );
+ if ( prodFlag != 0 ) {
+ useProdAdler = kTRUE;
+ }
}
- std::string rootFileName("KMatrixMassHistos.root");
- if (histFlag) {createHistos(rootFileName);}
-
- plotHistos(rootFileName);
+ std::string rootFileName( "KMatrixMassHistos.root" );
+ if ( histFlag ) {
+ createHistos( rootFileName );
+ }
+ plotHistos( rootFileName );
}
-void plotHistos(const std::string& rootFileName) {
+void plotHistos( const std::string& rootFileName )
+{
- cout<<"Running plotHistos for "<<rootFileName<<endl;
+ cout << "Running plotHistos for " << rootFileName << endl;
- TCanvas* theCanvas = new TCanvas("theCanvas", "", 1600, 1200);
- gROOT->SetStyle("Plain");
- gStyle->SetOptStat(0);
+ TCanvas* theCanvas = new TCanvas( "theCanvas", "", 1600, 1200 );
+ gROOT->SetStyle( "Plain" );
+ gStyle->SetOptStat( 0 );
theCanvas->Clear();
theCanvas->UseCurrentStyle();
- TFile* rootFile = TFile::Open(rootFileName.c_str(), "read");
+ TFile* rootFile = TFile::Open( rootFileName.c_str(), "read" );
rootFile->cd();
// Plot rho with K-matrix poles
- TLegend* poleLegend = new TLegend(0.7, 0.5, 0.90, 0.90, "");
- poleLegend->SetFillColor(0);
- poleLegend->SetTextSize(0.03);
+ TLegend* poleLegend = new TLegend( 0.7, 0.5, 0.90, 0.90, "" );
+ poleLegend->SetFillColor( 0 );
+ poleLegend->SetTextSize( 0.03 );
THStack* poleStack = new THStack();
- TH1* rhoHist = dynamic_cast<TH1*>(rootFile->Get("Rho_m13"));
- rhoHist->SetLineColor(kBlack);
- rhoHist->SetLineWidth(2);
- rhoHist->Scale(1.0/rhoHist->Integral());
+ TH1* rhoHist = dynamic_cast<TH1*>( rootFile->Get( "Rho_m13" ) );
+ rhoHist->SetLineColor( kBlack );
+ rhoHist->SetLineWidth( 2 );
+ rhoHist->Scale( 1.0 / rhoHist->Integral() );
- poleStack->Add(rhoHist);
- poleLegend->AddEntry(rhoHist, "#rho(770)", "l");
+ poleStack->Add( rhoHist );
+ poleLegend->AddEntry( rhoHist, "#rho(770)", "l" );
- Int_t colours[5] = {kRed, kViolet, kBlue, kGreen+2, kOrange+2};
+ Int_t colours[5] = { kRed, kViolet, kBlue, kGreen + 2, kOrange + 2 };
- Int_t i(0), iN(5);
- for (i = 0; i < iN; i++) {
+ Int_t i( 0 ), iN( 5 );
+ for ( i = 0; i < iN; i++ ) {
- Int_t j = i + 1;
- TString poleName("KMPole"); poleName += j; poleName += "_m13";
+ Int_t j = i + 1;
+ TString poleName( "KMPole" );
+ poleName += j;
+ poleName += "_m13";
- TH1* poleHist = dynamic_cast<TH1*>(rootFile->Get(poleName.Data()));
- poleHist->SetLineColor(colours[i]);
- poleHist->SetLineWidth(2);
+ TH1* poleHist = dynamic_cast<TH1*>( rootFile->Get( poleName.Data() ) );
+ poleHist->SetLineColor( colours[i] );
+ poleHist->SetLineWidth( 2 );
- // Normalise histogram to unit area
- poleHist->Scale(1.0/poleHist->Integral());
- poleStack->Add(poleHist);
-
- TString poleLabel("Pole"); poleLabel += j;
- poleLegend->AddEntry(poleHist, poleLabel, "l");
+ // Normalise histogram to unit area
+ poleHist->Scale( 1.0 / poleHist->Integral() );
+ poleStack->Add( poleHist );
+ TString poleLabel( "Pole" );
+ poleLabel += j;
+ poleLegend->AddEntry( poleHist, poleLabel, "l" );
}
- poleStack->Draw("nostackc");
+ poleStack->Draw( "nostackc" );
TAxis* poleXAxis = poleStack->GetXaxis();
- poleXAxis->SetTitle("m(#pi^{+}#pi^{-}) (GeV/c^{2})");
- poleXAxis->CenterTitle(kTRUE);
+ poleXAxis->SetTitle( "m(#pi^{+}#pi^{-}) (GeV/c^{2})" );
+ poleXAxis->CenterTitle( kTRUE );
TAxis* poleYAxis = poleStack->GetYaxis();
- poleYAxis->SetTitle("Normalised intensity");
- poleYAxis->CenterTitle(kTRUE);
- poleYAxis->SetTitleOffset(1.25);
+ poleYAxis->SetTitle( "Normalised intensity" );
+ poleYAxis->CenterTitle( kTRUE );
+ poleYAxis->SetTitleOffset( 1.25 );
poleLegend->Draw();
theCanvas->Update();
- theCanvas->Print("B3piKMatrixProjPoles.png");
- theCanvas->Print("B3piKMatrixProjPoles.eps");
+ theCanvas->Print( "B3piKMatrixProjPoles.png" );
+ theCanvas->Print( "B3piKMatrixProjPoles.eps" );
// Plot NR with K-matrix SVPs
- TLegend* SVPLegend = new TLegend(0.7, 0.5, 0.90, 0.90, "");
- SVPLegend->SetFillColor(0);
- SVPLegend->SetTextSize(0.03);
+ TLegend* SVPLegend = new TLegend( 0.7, 0.5, 0.90, 0.90, "" );
+ SVPLegend->SetFillColor( 0 );
+ SVPLegend->SetTextSize( 0.03 );
THStack* SVPStack = new THStack();
- SVPStack->Add(rhoHist);
- SVPLegend->AddEntry(rhoHist, "rho(770)", "l");
-
- for (i = 0; i < iN; i++) {
+ SVPStack->Add( rhoHist );
+ SVPLegend->AddEntry( rhoHist, "rho(770)", "l" );
- Int_t j = i + 1;
- TString SVPName("KMSVP"); SVPName += j; SVPName += "_m13";
+ for ( i = 0; i < iN; i++ ) {
- TH1* SVPHist = dynamic_cast<TH1*>(rootFile->Get(SVPName.Data()));
- SVPHist->SetLineColor(colours[i]);
- SVPHist->SetLineWidth(2);
+ Int_t j = i + 1;
+ TString SVPName( "KMSVP" );
+ SVPName += j;
+ SVPName += "_m13";
- SVPHist->Scale(1.0/SVPHist->Integral());
- SVPStack->Add(SVPHist);
+ TH1* SVPHist = dynamic_cast<TH1*>( rootFile->Get( SVPName.Data() ) );
+ SVPHist->SetLineColor( colours[i] );
+ SVPHist->SetLineWidth( 2 );
- TString SVPLabel("SVP"); SVPLabel += j;
- SVPLegend->AddEntry(SVPHist, SVPLabel, "l");
+ SVPHist->Scale( 1.0 / SVPHist->Integral() );
+ SVPStack->Add( SVPHist );
+ TString SVPLabel( "SVP" );
+ SVPLabel += j;
+ SVPLegend->AddEntry( SVPHist, SVPLabel, "l" );
}
- SVPStack->Draw("nostackc");
+ SVPStack->Draw( "nostackc" );
TAxis* SVPXAxis = SVPStack->GetXaxis();
- SVPXAxis->SetTitle("m(#pi^{+}#pi^{-}) (GeV/c^{2})");
- SVPXAxis->CenterTitle(kTRUE);
+ SVPXAxis->SetTitle( "m(#pi^{+}#pi^{-}) (GeV/c^{2})" );
+ SVPXAxis->CenterTitle( kTRUE );
TAxis* SVPYAxis = SVPStack->GetYaxis();
- SVPYAxis->SetTitle("Normalised intensity");
- SVPYAxis->CenterTitle(kTRUE);
- SVPYAxis->SetTitleOffset(1.25);
+ SVPYAxis->SetTitle( "Normalised intensity" );
+ SVPYAxis->CenterTitle( kTRUE );
+ SVPYAxis->SetTitleOffset( 1.25 );
SVPLegend->Draw();
theCanvas->Update();
- theCanvas->Print("B3piKMatrixProjSVPs.png");
- theCanvas->Print("B3piKMatrixProjSVPs.eps");
+ theCanvas->Print( "B3piKMatrixProjSVPs.png" );
+ theCanvas->Print( "B3piKMatrixProjSVPs.eps" );
delete SVPStack;
delete SVPLegend;
delete poleStack;
delete poleLegend;
rootFile->Close();
-
}
-void createHistos(const std::string& rootFileName) {
+void createHistos( const std::string& rootFileName )
+{
- cout<<"rootFileName = "<<rootFileName<<endl;
+ cout << "rootFileName = " << rootFileName << endl;
- Int_t i(0), iN(12);
+ Int_t i( 0 ), iN( 12 );
Int_t NSignal = 100000;
- std::map<int, std::vector<TH1*> > histMap;
+ std::map<int, std::vector<TH1*>> histMap;
// Create mass/DP histograms for the different amplitude terms
- for (i = 0; i < iN; i++) {
-
- std::vector<TH1*> histVect = genMassHistos(i, NSignal);
- histMap[i] = histVect;
+ for ( i = 0; i < iN; i++ ) {
+ std::vector<TH1*> histVect = genMassHistos( i, NSignal );
+ histMap[i] = histVect;
}
- TFile* rootFile = TFile::Open(rootFileName.c_str(), "recreate");
+ TFile* rootFile = TFile::Open( rootFileName.c_str(), "recreate" );
rootFile->cd();
- for (i = 0; i < iN; i++) {
+ for ( i = 0; i < iN; i++ ) {
- cout<<"Writing histograms for i = "<<i<<endl;
+ cout << "Writing histograms for i = " << i << endl;
- std::vector<TH1*> histVect = histMap[i];
- std::vector<TH1*>::iterator iter;
- for (iter = histVect.begin(); iter != histVect.end(); ++iter) {
-
- TH1* theHist = *iter;
- theHist->Write();
-
- }
+ std::vector<TH1*> histVect = histMap[i];
+ std::vector<TH1*>::iterator iter;
+ for ( iter = histVect.begin(); iter != histVect.end(); ++iter ) {
+ TH1* theHist = *iter;
+ theHist->Write();
+ }
}
rootFile->Close();
-
}
-std::vector<TH1*> genMassHistos(Int_t index, Int_t NSignal) {
+std::vector<TH1*> genMassHistos( Int_t index, Int_t NSignal )
+{
// Vector to store output mass/DP histograms
std::vector<TH1*> histVect;
// Define Dalitz plot: kinematics and resonances
- Bool_t squareDP = kTRUE;
- LauDaughters* theDaughters = new LauDaughters("B+", "pi+", "pi+", "pi-", squareDP);
+ Bool_t squareDP = kTRUE;
+ LauDaughters* theDaughters = new LauDaughters( "B+", "pi+", "pi+", "pi-", squareDP );
// Apply some vetoes to the DP
LauVetoes* vetoes = new LauVetoes();
// Define the efficiency model
- LauEffModel* theEffModel = new LauEffModel(theDaughters, vetoes);
+ LauEffModel* theEffModel = new LauEffModel( theDaughters, vetoes );
// Create the isobar model
LauResonanceMaker& resMaker = LauResonanceMaker::get();
- resMaker.setDefaultBWRadius(LauBlattWeisskopfFactor::Parent, 4.0);
- resMaker.setDefaultBWRadius(LauBlattWeisskopfFactor::Light, 4.0);
- resMaker.fixBWRadius(LauBlattWeisskopfFactor::Parent, kTRUE);
- resMaker.fixBWRadius(LauBlattWeisskopfFactor::Light, kTRUE);
+ resMaker.setDefaultBWRadius( LauBlattWeisskopfFactor::Parent, 4.0 );
+ resMaker.setDefaultBWRadius( LauBlattWeisskopfFactor::Light, 4.0 );
+ resMaker.fixBWRadius( LauBlattWeisskopfFactor::Parent, kTRUE );
+ resMaker.fixBWRadius( LauBlattWeisskopfFactor::Light, kTRUE );
// Define the "S-wave" K-matrix propagator
- Int_t nChannels = 5;
- Int_t nPoles = 5;
- Int_t resPairInt = 1;
- Int_t KMatrixIndex = 1; // for S-wave
+ Int_t nChannels = 5;
+ Int_t nPoles = 5;
+ Int_t resPairInt = 1;
+ Int_t KMatrixIndex = 1; // for S-wave
// Add one pole or SVP amplitude for the K-matrix and plot its mass projections
// so that we can see the amplitude/intensity shape of the different terms
Double_t aSqMaxValue = 0.3;
- Double_t nSigEvents = NSignal*1.0;
+ Double_t nSigEvents = NSignal * 1.0;
Bool_t fixNSigEvents = kTRUE;
- Int_t nExpt = 1;
- Int_t firstExpt = 0;
- Bool_t isToy = kTRUE;
+ Int_t nExpt = 1;
+ Int_t firstExpt = 0;
+ Bool_t isToy = kTRUE;
- LauIsobarDynamics* theSigModel = new LauIsobarDynamics(theDaughters, theEffModel);
- theSigModel->setASqMaxValue(aSqMaxValue);
+ LauIsobarDynamics* theSigModel = new LauIsobarDynamics( theDaughters, theEffModel );
+ theSigModel->setASqMaxValue( aSqMaxValue );
- TString theName("KMPole");
- if (index >= 5) {theName = "KMSVP";}
- TString parName("");
+ TString theName( "KMPole" );
+ if ( index >= 5 ) {
+ theName = "KMSVP";
+ }
+ TString parName( "" );
- if (index == 11) {
+ if ( index == 11 ) {
- // Simple Non-resonant
- cout<<"Non-resonant"<<endl;
- theName = "NR";
- parName = "NonReson";
- theSigModel->addResonance("NonReson", 0, LauAbsResonance::FlatNR);
+ // Simple Non-resonant
+ cout << "Non-resonant" << endl;
+ theName = "NR";
+ parName = "NonReson";
+ theSigModel->addResonance( "NonReson", 0, LauAbsResonance::FlatNR );
- } else if (index == 10) {
+ } else if ( index == 10 ) {
- // Rho resonance
- cout<<"Using rho(770)"<<endl;
+ // Rho resonance
+ cout << "Using rho(770)" << endl;
- theName = "Rho";
- parName = "rho0(770)";
- theSigModel->addResonance("rho0(770)", 1, LauAbsResonance::GS);
+ theName = "Rho";
+ parName = "rho0(770)";
+ theSigModel->addResonance( "rho0(770)", 1, LauAbsResonance::GS );
} else {
- // K-matrix amplitude
- theSigModel->defineKMatrixPropagator("KMSWave", "B3piKMatrixCoeff.dat", resPairInt,
- nChannels, nPoles, KMatrixIndex);
-
-
- cout<<"Implementing K matrix term number "<<index<<", name = "<<theName<<endl;
-
- Int_t j = index%5 + 1;
- theName += j;
- parName = theName;
-
- if (index < 5) {
- theSigModel->addKMatrixProdPole(theName.Data(), "KMSWave", j, useProdAdler);
- } else {
- theSigModel->addKMatrixProdSVP(theName.Data(), "KMSWave", j, useProdAdler);
- }
-
+ // K-matrix amplitude
+ theSigModel->defineKMatrixPropagator( "KMSWave",
+ "B3piKMatrixCoeff.dat",
+ resPairInt,
+ nChannels,
+ nPoles,
+ KMatrixIndex );
+
+ cout << "Implementing K matrix term number " << index << ", name = " << theName << endl;
+
+ Int_t j = index % 5 + 1;
+ theName += j;
+ parName = theName;
+
+ if ( index < 5 ) {
+ theSigModel->addKMatrixProdPole( theName.Data(), "KMSWave", j, useProdAdler );
+ } else {
+ theSigModel->addKMatrixProdSVP( theName.Data(), "KMSWave", j, useProdAdler );
+ }
}
// Create the fit model
- LauSimpleFitModel* fitModel = new LauSimpleFitModel(theSigModel);
+ LauSimpleFitModel* fitModel = new LauSimpleFitModel( theSigModel );
std::vector<LauCartesianCPCoeffSet*> coeffSet;
- Bool_t fixPar = kTRUE;
- Bool_t fixCP = kTRUE;
+ Bool_t fixPar = kTRUE;
+ Bool_t fixCP = kTRUE;
Bool_t doTwoStageFit = kFALSE;
- coeffSet.push_back(new LauCartesianCPCoeffSet(parName.Data(), 1.0, 0.0, 0.0, 0.0,
- fixPar, fixPar, fixCP, fixCP,
- doTwoStageFit, doTwoStageFit));
+ coeffSet.push_back( new LauCartesianCPCoeffSet( parName.Data(),
+ 1.0,
+ 0.0,
+ 0.0,
+ 0.0,
+ fixPar,
+ fixPar,
+ fixCP,
+ fixCP,
+ doTwoStageFit,
+ doTwoStageFit ) );
std::vector<LauCartesianCPCoeffSet*>::iterator coeffIter;
- for (coeffIter = coeffSet.begin(); coeffIter != coeffSet.end(); ++coeffIter) {
- fitModel->setAmpCoeffSet(*coeffIter);
+ for ( coeffIter = coeffSet.begin(); coeffIter != coeffSet.end(); ++coeffIter ) {
+ fitModel->setAmpCoeffSet( *coeffIter );
}
// Set the number of signal events and the number of experiments
- LauParameter* signalEvents = new LauParameter("signalEvents", nSigEvents, -2.0*nSigEvents,
- 2.0*nSigEvents, fixNSigEvents);
- fitModel->setNSigEvents(signalEvents);
- fitModel->setNExpts(nExpt, firstExpt, isToy);
+ LauParameter* signalEvents = new LauParameter( "signalEvents",
+ nSigEvents,
+ -2.0 * nSigEvents,
+ 2.0 * nSigEvents,
+ fixNSigEvents );
+ fitModel->setNSigEvents( signalEvents );
+ fitModel->setNExpts( nExpt, firstExpt, isToy );
// Execute the generation/fit
- TString treeName("");
- TString dummyName("");
- TString tableFileName("");
+ TString treeName( "" );
+ TString dummyName( "" );
+ TString tableFileName( "" );
- TString dataFileName("Gen");
+ TString dataFileName( "Gen" );
dataFileName += theName;
dataFileName += ".root";
- fitModel->run("gen", dataFileName, treeName, dummyName, tableFileName);
+ fitModel->run( "gen", dataFileName, treeName, dummyName, tableFileName );
// Create DP and mass projection plots so that we can see the K matrix
// amplitude term shapes
// Histogram of the invariant mass for pi+ pi- pairs: m13 & m23
- TString m13Name(theName); m13Name += "_m13";
+ TString m13Name( theName );
+ m13Name += "_m13";
- TH1D* m13Hist = new TH1D(m13Name.Data(), "", 100, 0.0, 5.5);
- m13Hist->SetXTitle("m(#pi^{+}#pi^{-})");
- m13Hist->SetDirectory(0);
- histVect.push_back(m13Hist);
+ TH1D* m13Hist = new TH1D( m13Name.Data(), "", 100, 0.0, 5.5 );
+ m13Hist->SetXTitle( "m(#pi^{+}#pi^{-})" );
+ m13Hist->SetDirectory( 0 );
+ histVect.push_back( m13Hist );
// Histogram of the wrong sign invariant mass pi+ pi+: m12
- TString m12Name(theName); m12Name += "_m12";
+ TString m12Name( theName );
+ m12Name += "_m12";
- TH1D* m12Hist = new TH1D(m12Name.Data(), "", 100, 0.0, 5.5);
- m12Hist->SetXTitle("m(#pi^{+}#pi^{+})");
- m12Hist->SetDirectory(0);
- histVect.push_back(m12Hist);
+ TH1D* m12Hist = new TH1D( m12Name.Data(), "", 100, 0.0, 5.5 );
+ m12Hist->SetXTitle( "m(#pi^{+}#pi^{+})" );
+ m12Hist->SetDirectory( 0 );
+ histVect.push_back( m12Hist );
// Dalitz plot 2d histogram
- TString DPName(theName); DPName += "_DP";
+ TString DPName( theName );
+ DPName += "_DP";
- TH2D* DPHist = new TH2D(DPName.Data(), "", 100, 0.0, 14.0, 100, 0.0, 28.0);
+ TH2D* DPHist = new TH2D( DPName.Data(), "", 100, 0.0, 14.0, 100, 0.0, 28.0 );
//TH2D* DPHist = new TH2D("DPHist", "", 100, 0.0, 28.0, 100, 0.0, 28.0);
- DPHist->SetXTitle("m^{2}(#pi^{+}#pi^{-})_{min}");
- DPHist->SetYTitle("m^{2}(#pi^{+}#pi^{-})_{max}");
- DPHist->SetDirectory(0);
- histVect.push_back(DPHist);
+ DPHist->SetXTitle( "m^{2}(#pi^{+}#pi^{-})_{min}" );
+ DPHist->SetYTitle( "m^{2}(#pi^{+}#pi^{-})_{max}" );
+ DPHist->SetDirectory( 0 );
+ histVect.push_back( DPHist );
// Simulation results file
- TFile* genFile = TFile::Open(dataFileName.Data(), "read");
+ TFile* genFile = TFile::Open( dataFileName.Data(), "read" );
genFile->cd();
- TTree* genTree = dynamic_cast<TTree*>(genFile->Get("genResults"));
- genTree->SetBranchStatus("*", 0);
- genTree->SetBranchStatus("m12", 1);
- genTree->SetBranchStatus("m23", 1);
- genTree->SetBranchStatus("m13", 1);
+ TTree* genTree = dynamic_cast<TTree*>( genFile->Get( "genResults" ) );
+ genTree->SetBranchStatus( "*", 0 );
+ genTree->SetBranchStatus( "m12", 1 );
+ genTree->SetBranchStatus( "m23", 1 );
+ genTree->SetBranchStatus( "m13", 1 );
Double_t m12, m23, m13;
- genTree->SetBranchAddress("m12", &m12);
- genTree->SetBranchAddress("m23", &m23);
- genTree->SetBranchAddress("m13", &m13);
+ genTree->SetBranchAddress( "m12", &m12 );
+ genTree->SetBranchAddress( "m23", &m23 );
+ genTree->SetBranchAddress( "m13", &m13 );
Int_t nEntries = genTree->GetEntries();
- cout<<"nEntries = "<<nEntries<<endl;
+ cout << "nEntries = " << nEntries << endl;
Int_t k;
// Fill mass and DP histograms
- for (k = 0; k < nEntries; k++) {
-
- genTree->GetEntry(k);
+ for ( k = 0; k < nEntries; k++ ) {
- Double_t mMin = m13;
- Double_t mMax = m23;
- if (m23 < m13) {
- mMin = m23; mMax = m13;
- }
+ genTree->GetEntry( k );
- m13Hist->Fill(mMin);
- m13Hist->Fill(mMax);
+ Double_t mMin = m13;
+ Double_t mMax = m23;
+ if ( m23 < m13 ) {
+ mMin = m23;
+ mMax = m13;
+ }
- m12Hist->Fill(m12);
+ m13Hist->Fill( mMin );
+ m13Hist->Fill( mMax );
- DPHist->Fill(mMin*mMin, mMax*mMax);
+ m12Hist->Fill( m12 );
+ DPHist->Fill( mMin * mMin, mMax * mMax );
}
// Cleanup
genFile->Close();
delete signalEvents;
- for (coeffIter = coeffSet.begin(); coeffIter != coeffSet.end(); ++coeffIter) {
- delete *coeffIter;
+ for ( coeffIter = coeffSet.begin(); coeffIter != coeffSet.end(); ++coeffIter ) {
+ delete *coeffIter;
}
delete fitModel;
delete theSigModel;
delete theEffModel;
delete vetoes;
delete theDaughters;
// Return histograms
return histVect;
-
}
diff --git a/examples/B3piKMatrixPlots.cc b/examples/B3piKMatrixPlots.cc
index 9cea8d8..3e2419b 100644
--- a/examples/B3piKMatrixPlots.cc
+++ b/examples/B3piKMatrixPlots.cc
@@ -1,1470 +1,1500 @@
/*
Copyright 2016 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
// Code to plot amplitudes for the pi pi K matrix used for B -> 3pi:
// K-matrix itself, propagator terms and production amplitudes
#include <iostream>
using std::cout;
using std::endl;
-#include "LauKMatrixPropagator.hh"
#include "LauComplex.hh"
#include "LauDaughters.hh"
#include "LauKMatrixProdPole.hh"
#include "LauKMatrixProdSVP.hh"
+#include "LauKMatrixPropagator.hh"
-#include "TGraph.h"
-#include "TCanvas.h"
-#include "TStyle.h"
-#include "TROOT.h"
-#include "TSystem.h"
#include "TAxis.h"
+#include "TCanvas.h"
+#include "TGraph.h"
+#include "TLegend.h"
#include "TLine.h"
+#include "TList.h"
#include "TMath.h"
#include "TMatrixD.h"
#include "TMultiGraph.h"
-#include "TString.h"
-#include "TList.h"
#include "TPad.h"
-#include "TLegend.h"
+#include "TROOT.h"
+#include "TString.h"
+#include "TStyle.h"
+#include "TSystem.h"
#include "TText.h"
#include <algorithm>
#include <string>
#include <vector>
-Double_t radToDeg = 180.0/TMath::Pi();
-Bool_t doEPS = kFALSE;
+Double_t radToDeg = 180.0 / TMath::Pi();
+Bool_t doEPS = kFALSE;
Bool_t doProdAdler = kFALSE;
-void doKScattPlots() {
+void doKScattPlots()
+{
// Create plots of K_ij (with i >= j, since its symmetric), showing
// only the pole and SVP contributions separately, along with the full
// K matrix without and with the Adler zero suppression term for low s.
// 1st page: K_1j (5), 2nd page: K_2j (4), 3rd page: K_3j, K_4j and K_55 (6)
- Int_t resPairInt(1);
- Int_t nChannels(5);
- Int_t KMatrixIndex(1); // pi pi S-wave
- Int_t nPoles(5);
+ Int_t resPairInt( 1 );
+ Int_t nChannels( 5 );
+ Int_t KMatrixIndex( 1 ); // pi pi S-wave
+ Int_t nPoles( 5 );
// Mass range for plots
- Double_t mMin(0.28);
- Double_t mMax(2.0);
+ Double_t mMin( 0.28 );
+ Double_t mMax( 2.0 );
Int_t nSteps = 2000;
- Double_t dm = (mMax - mMin)/(nSteps*1.0);
-
+ Double_t dm = ( mMax - mMin ) / ( nSteps * 1.0 );
// Propagator with only the pole terms
- TString KFile1("B3piKMPoles.dat");
- LauKMatrixPropagator* propPoles = new LauKMatrixPropagator("propPoles", KFile1,
- resPairInt, nChannels,
- nPoles, KMatrixIndex);
+ TString KFile1( "B3piKMPoles.dat" );
+ LauKMatrixPropagator* propPoles =
+ new LauKMatrixPropagator( "propPoles", KFile1, resPairInt, nChannels, nPoles, KMatrixIndex );
// Propagator with only the SVP terms
- TString KFile2("B3piKMSVPs.dat");
- LauKMatrixPropagator* propSVPs = new LauKMatrixPropagator("propSVPs", KFile2,
- resPairInt, nChannels,
- 0, KMatrixIndex);
+ TString KFile2( "B3piKMSVPs.dat" );
+ LauKMatrixPropagator* propSVPs =
+ new LauKMatrixPropagator( "propSVPs", KFile2, resPairInt, nChannels, 0, KMatrixIndex );
// Propagator with poles and SVP terms, but no Adler zero scaling factor
- TString KFile3("B3piKMNoAdler.dat");
- LauKMatrixPropagator* propNoAdler = new LauKMatrixPropagator("propNoAdler", KFile3,
- resPairInt, nChannels,
- nPoles, KMatrixIndex);
+ TString KFile3( "B3piKMNoAdler.dat" );
+ LauKMatrixPropagator* propNoAdler =
+ new LauKMatrixPropagator( "propNoAdler", KFile3, resPairInt, nChannels, nPoles, KMatrixIndex );
// Full K-matrix parameterisation with Adler zero
- TString KFile4("B3piKMatrixCoeff.dat");
- LauKMatrixPropagator* propFull = new LauKMatrixPropagator("propFull", KFile4,
- resPairInt, nChannels,
- nPoles, KMatrixIndex);
+ TString KFile4( "B3piKMatrixCoeff.dat" );
+ LauKMatrixPropagator* propFull =
+ new LauKMatrixPropagator( "propFull", KFile4, resPairInt, nChannels, nPoles, KMatrixIndex );
// For each K_ij, there are 4 graphs. Therefore, need 15 K_ij multigraphs
std::vector<TMultiGraph*> multiGraphVect;
// Legend for the graphs (same for all multigraphs)
- TLegend* theLegend = new TLegend(0.2, 0.2, 0.8, 0.7);
- theLegend->SetHeader("Symmetric K matrix components");
-
- Int_t iColours[4] = {kRed, kBlue, kMagenta, kBlack};
- Double_t yLimit(5.0);
-
- Bool_t initLegend(kFALSE);
-
- Int_t iChannel(0), jChannel(0);
- for (iChannel = 0; iChannel < nChannels; iChannel++) {
-
- for (jChannel = iChannel; jChannel < nChannels; jChannel++) {
-
- TString label("Graphs_"); label += iChannel;
- label += "_"; label += jChannel;
-
- TString multiName("KMatrix"); multiName += label;
-
- TMultiGraph* multiGraph = new TMultiGraph();
- multiGraph->SetName(multiName.Data());
-
- // To limit the graphs abscissas getting to large (pole "singularities")
- multiGraph->SetMaximum(yLimit);
- multiGraph->SetMinimum(-yLimit);
-
- // Add to the storage vector
- multiGraphVect.push_back(multiGraph);
-
- // Graph with poles only
- TGraph* poleGraph = new TGraph(nSteps);
- TString poleName("Pole"); poleName += label;
- poleGraph->SetName(poleName.Data());
- poleGraph->SetMarkerColor(iColours[0]);
- poleGraph->SetLineColor(iColours[0]);
- poleGraph->SetLineWidth(1);
- multiGraph->Add(poleGraph, "lp");
-
- // Graph with SVPs only
- TGraph* SVPGraph = new TGraph(nSteps);
- TString SVPName("SVP"); SVPName += label;
- SVPGraph->SetName(SVPName.Data());
- SVPGraph->SetMarkerColor(iColours[1]);
- SVPGraph->SetLineColor(iColours[1]);
- SVPGraph->SetLineWidth(1);
- multiGraph->Add(SVPGraph, "lp");
-
- // Graph with poles and SVP, but no Adler zero factor
- TGraph* noAdlerGraph = new TGraph(nSteps);
- TString noAdlerName("NoAdler"); noAdlerName += label;
- noAdlerGraph->SetName(noAdlerName.Data());
- noAdlerGraph->SetMarkerColor(iColours[2]);
- noAdlerGraph->SetLineColor(iColours[2]);
- noAdlerGraph->SetLineWidth(1);
- multiGraph->Add(noAdlerGraph, "lp");
-
- // Full K matrix graphs
- TGraph* fullGraph = new TGraph(nSteps);
- TString fullName("Full"); fullName += label;
- fullGraph->SetName(fullName.Data());
- fullGraph->SetMarkerColor(iColours[3]);
- fullGraph->SetLineColor(iColours[3]);
- fullGraph->SetLineWidth(1);
- multiGraph->Add(fullGraph, "lp");
-
- // Initialise the graph legend
- if (!initLegend) {
-
- theLegend->AddEntry(poleGraph, "Poles only", "l");
- theLegend->AddEntry(SVPGraph, "SVPs only (f_{1j} #neq 0)", "l");
- theLegend->AddEntry(noAdlerGraph, "Poles & SVPs, no Adler zero", "l");
- theLegend->AddEntry(fullGraph, "Poles & SVPs with Adler zero", "l");
-
- initLegend = kTRUE;
-
- }
-
- }
-
+ TLegend* theLegend = new TLegend( 0.2, 0.2, 0.8, 0.7 );
+ theLegend->SetHeader( "Symmetric K matrix components" );
+
+ Int_t iColours[4] = { kRed, kBlue, kMagenta, kBlack };
+ Double_t yLimit( 5.0 );
+
+ Bool_t initLegend( kFALSE );
+
+ Int_t iChannel( 0 ), jChannel( 0 );
+ for ( iChannel = 0; iChannel < nChannels; iChannel++ ) {
+
+ for ( jChannel = iChannel; jChannel < nChannels; jChannel++ ) {
+
+ TString label( "Graphs_" );
+ label += iChannel;
+ label += "_";
+ label += jChannel;
+
+ TString multiName( "KMatrix" );
+ multiName += label;
+
+ TMultiGraph* multiGraph = new TMultiGraph();
+ multiGraph->SetName( multiName.Data() );
+
+ // To limit the graphs abscissas getting to large (pole "singularities")
+ multiGraph->SetMaximum( yLimit );
+ multiGraph->SetMinimum( -yLimit );
+
+ // Add to the storage vector
+ multiGraphVect.push_back( multiGraph );
+
+ // Graph with poles only
+ TGraph* poleGraph = new TGraph( nSteps );
+ TString poleName( "Pole" );
+ poleName += label;
+ poleGraph->SetName( poleName.Data() );
+ poleGraph->SetMarkerColor( iColours[0] );
+ poleGraph->SetLineColor( iColours[0] );
+ poleGraph->SetLineWidth( 1 );
+ multiGraph->Add( poleGraph, "lp" );
+
+ // Graph with SVPs only
+ TGraph* SVPGraph = new TGraph( nSteps );
+ TString SVPName( "SVP" );
+ SVPName += label;
+ SVPGraph->SetName( SVPName.Data() );
+ SVPGraph->SetMarkerColor( iColours[1] );
+ SVPGraph->SetLineColor( iColours[1] );
+ SVPGraph->SetLineWidth( 1 );
+ multiGraph->Add( SVPGraph, "lp" );
+
+ // Graph with poles and SVP, but no Adler zero factor
+ TGraph* noAdlerGraph = new TGraph( nSteps );
+ TString noAdlerName( "NoAdler" );
+ noAdlerName += label;
+ noAdlerGraph->SetName( noAdlerName.Data() );
+ noAdlerGraph->SetMarkerColor( iColours[2] );
+ noAdlerGraph->SetLineColor( iColours[2] );
+ noAdlerGraph->SetLineWidth( 1 );
+ multiGraph->Add( noAdlerGraph, "lp" );
+
+ // Full K matrix graphs
+ TGraph* fullGraph = new TGraph( nSteps );
+ TString fullName( "Full" );
+ fullName += label;
+ fullGraph->SetName( fullName.Data() );
+ fullGraph->SetMarkerColor( iColours[3] );
+ fullGraph->SetLineColor( iColours[3] );
+ fullGraph->SetLineWidth( 1 );
+ multiGraph->Add( fullGraph, "lp" );
+
+ // Initialise the graph legend
+ if ( ! initLegend ) {
+
+ theLegend->AddEntry( poleGraph, "Poles only", "l" );
+ theLegend->AddEntry( SVPGraph, "SVPs only (f_{1j} #neq 0)", "l" );
+ theLegend->AddEntry( noAdlerGraph, "Poles & SVPs, no Adler zero", "l" );
+ theLegend->AddEntry( fullGraph, "Poles & SVPs with Adler zero", "l" );
+
+ initLegend = kTRUE;
+ }
+ }
}
- for (Int_t iM = 0; iM < nSteps; iM++) {
-
- Double_t m = dm*iM + mMin;
- Double_t s = m*m;
+ for ( Int_t iM = 0; iM < nSteps; iM++ ) {
- // Find the K matrices for each pole/SVP/Adler condition
- propPoles->updatePropagator(s);
- propSVPs->updatePropagator(s);
- propNoAdler->updatePropagator(s);
- propFull->updatePropagator(s);
+ Double_t m = dm * iM + mMin;
+ Double_t s = m * m;
- TMatrixD KMPoles = propPoles->getKMatrix();
- TMatrixD KMSVPs = propSVPs->getKMatrix();
- TMatrixD KMNoAdler = propNoAdler->getKMatrix();
- TMatrixD KMFull = propFull->getKMatrix();
+ // Find the K matrices for each pole/SVP/Adler condition
+ propPoles->updatePropagator( s );
+ propSVPs->updatePropagator( s );
+ propNoAdler->updatePropagator( s );
+ propFull->updatePropagator( s );
- Int_t vectIndex(-1);
+ TMatrixD KMPoles = propPoles->getKMatrix();
+ TMatrixD KMSVPs = propSVPs->getKMatrix();
+ TMatrixD KMNoAdler = propNoAdler->getKMatrix();
+ TMatrixD KMFull = propFull->getKMatrix();
- for (iChannel = 0; iChannel < nChannels; iChannel++) {
+ Int_t vectIndex( -1 );
- for (jChannel = iChannel; jChannel < nChannels; jChannel++) {
+ for ( iChannel = 0; iChannel < nChannels; iChannel++ ) {
- vectIndex++;
- TMultiGraph* theGraphs = multiGraphVect[vectIndex];
- TList* graphList = theGraphs->GetListOfGraphs();
+ for ( jChannel = iChannel; jChannel < nChannels; jChannel++ ) {
- TGraph* poleGraph = dynamic_cast<TGraph*>(graphList->At(0));
- poleGraph->SetPoint(iM, m, KMPoles[iChannel][jChannel]);
+ vectIndex++;
+ TMultiGraph* theGraphs = multiGraphVect[vectIndex];
+ TList* graphList = theGraphs->GetListOfGraphs();
- TGraph* SVPGraph = dynamic_cast<TGraph*>(graphList->At(1));
- SVPGraph->SetPoint(iM, m, KMSVPs[iChannel][jChannel]);
+ TGraph* poleGraph = dynamic_cast<TGraph*>( graphList->At( 0 ) );
+ poleGraph->SetPoint( iM, m, KMPoles[iChannel][jChannel] );
- TGraph* noAdlerGraph = dynamic_cast<TGraph*>(graphList->At(2));
- noAdlerGraph->SetPoint(iM, m, KMNoAdler[iChannel][jChannel]);
+ TGraph* SVPGraph = dynamic_cast<TGraph*>( graphList->At( 1 ) );
+ SVPGraph->SetPoint( iM, m, KMSVPs[iChannel][jChannel] );
- TGraph* fullGraph = dynamic_cast<TGraph*>(graphList->At(3));
- fullGraph->SetPoint(iM, m, KMFull[iChannel][jChannel]);
-
- }
-
- }
+ TGraph* noAdlerGraph = dynamic_cast<TGraph*>( graphList->At( 2 ) );
+ noAdlerGraph->SetPoint( iM, m, KMNoAdler[iChannel][jChannel] );
+ TGraph* fullGraph = dynamic_cast<TGraph*>( graphList->At( 3 ) );
+ fullGraph->SetPoint( iM, m, KMFull[iChannel][jChannel] );
+ }
+ }
}
// Create plots
- TCanvas* theCanvas = new TCanvas("theCanvas", "", 1400, 1000);
- gROOT->SetStyle("Plain");
- gStyle->SetOptStat(0);
+ TCanvas* theCanvas = new TCanvas( "theCanvas", "", 1400, 1000 );
+ gROOT->SetStyle( "Plain" );
+ gStyle->SetOptStat( 0 );
theCanvas->Clear();
theCanvas->UseCurrentStyle();
// K_1j graphs, j = 1 to 5
- theCanvas->Divide(2,3);
-
- for (Int_t iL = 0; iL < 5; iL++) {
-
- theCanvas->cd(iL+1);
- TMultiGraph* graphs = multiGraphVect[iL];
- graphs->Draw("a");
-
- // Update the axes, which can only be done after drawing the graphs
- TAxis* xAxis = graphs->GetXaxis();
- xAxis->SetTitle("m(#pi^{+}#pi^{-}) (GeV/c^{2})");
- xAxis->SetLabelSize(0.05);
- xAxis->SetTitleSize(0.05);
- xAxis->CenterTitle(kTRUE);
- xAxis->SetTitleOffset(0.9);
-
- TString yLabel("K(1,"); yLabel += (iL+1); yLabel += ")";
-
- TAxis* yAxis = graphs->GetYaxis();
- yAxis->SetTitleOffset(0.9);
- yAxis->SetTitle(yLabel.Data());
- yAxis->SetLabelSize(0.05);
- yAxis->SetTitleSize(0.05);
- yAxis->CenterTitle(kTRUE);
-
- // Update the canvas with the new axes settings
- theCanvas->Update();
-
+ theCanvas->Divide( 2, 3 );
+
+ for ( Int_t iL = 0; iL < 5; iL++ ) {
+
+ theCanvas->cd( iL + 1 );
+ TMultiGraph* graphs = multiGraphVect[iL];
+ graphs->Draw( "a" );
+
+ // Update the axes, which can only be done after drawing the graphs
+ TAxis* xAxis = graphs->GetXaxis();
+ xAxis->SetTitle( "m(#pi^{+}#pi^{-}) (GeV/c^{2})" );
+ xAxis->SetLabelSize( 0.05 );
+ xAxis->SetTitleSize( 0.05 );
+ xAxis->CenterTitle( kTRUE );
+ xAxis->SetTitleOffset( 0.9 );
+
+ TString yLabel( "K(1," );
+ yLabel += ( iL + 1 );
+ yLabel += ")";
+
+ TAxis* yAxis = graphs->GetYaxis();
+ yAxis->SetTitleOffset( 0.9 );
+ yAxis->SetTitle( yLabel.Data() );
+ yAxis->SetLabelSize( 0.05 );
+ yAxis->SetTitleSize( 0.05 );
+ yAxis->CenterTitle( kTRUE );
+
+ // Update the canvas with the new axes settings
+ theCanvas->Update();
}
// Print the graph legend
- theCanvas->cd(6);
+ theCanvas->cd( 6 );
theLegend->Draw();
- theCanvas->Print("K_1jPlots.png");
- if (doEPS) {theCanvas->Print("K_1jPlots.eps");}
+ theCanvas->Print( "K_1jPlots.png" );
+ if ( doEPS ) {
+ theCanvas->Print( "K_1jPlots.eps" );
+ }
// K_2j graphs, j = 2 to 5
theCanvas->Clear();
- theCanvas->Divide(2,2);
+ theCanvas->Divide( 2, 2 );
- for (Int_t iL = 0; iL < 4; iL++) {
+ for ( Int_t iL = 0; iL < 4; iL++ ) {
- theCanvas->cd(iL+1);
+ theCanvas->cd( iL + 1 );
- TMultiGraph* graphs = multiGraphVect[iL+5];
- graphs->Draw("a");
+ TMultiGraph* graphs = multiGraphVect[iL + 5];
+ graphs->Draw( "a" );
- // Update the axes, which can only be done after drawing the graphs
- TAxis* xAxis = graphs->GetXaxis();
- xAxis->SetTitle("m(#pi^{+}#pi^{-}) (GeV/c^{2})");
- xAxis->SetLabelSize(0.05);
- xAxis->SetTitleSize(0.05);
- xAxis->CenterTitle(kTRUE);
- xAxis->SetTitleOffset(0.9);
+ // Update the axes, which can only be done after drawing the graphs
+ TAxis* xAxis = graphs->GetXaxis();
+ xAxis->SetTitle( "m(#pi^{+}#pi^{-}) (GeV/c^{2})" );
+ xAxis->SetLabelSize( 0.05 );
+ xAxis->SetTitleSize( 0.05 );
+ xAxis->CenterTitle( kTRUE );
+ xAxis->SetTitleOffset( 0.9 );
- TString yLabel("K(2,"); yLabel += (iL+2); yLabel += ")";
+ TString yLabel( "K(2," );
+ yLabel += ( iL + 2 );
+ yLabel += ")";
- TAxis* yAxis = graphs->GetYaxis();
- yAxis->SetTitleOffset(0.9);
- yAxis->SetTitle(yLabel.Data());
- yAxis->SetLabelSize(0.05);
- yAxis->SetTitleSize(0.05);
- yAxis->CenterTitle(kTRUE);
-
- // Update the canvas with the new axes settings
- theCanvas->Update();
+ TAxis* yAxis = graphs->GetYaxis();
+ yAxis->SetTitleOffset( 0.9 );
+ yAxis->SetTitle( yLabel.Data() );
+ yAxis->SetLabelSize( 0.05 );
+ yAxis->SetTitleSize( 0.05 );
+ yAxis->CenterTitle( kTRUE );
+ // Update the canvas with the new axes settings
+ theCanvas->Update();
}
- theCanvas->Print("K_2jPlots.png");
- if (doEPS) {theCanvas->Print("K_2jPlots.eps");}
+ theCanvas->Print( "K_2jPlots.png" );
+ if ( doEPS ) {
+ theCanvas->Print( "K_2jPlots.eps" );
+ }
// K_3j (j = 3,4,5), K_4j (j = 4,5) and K_55
theCanvas->Clear();
- theCanvas->Divide(2,3);
-
- for (Int_t iL = 0; iL < 6; iL++) {
-
- theCanvas->cd(iL+1);
- TMultiGraph* graphs = multiGraphVect[iL+9];
- graphs->Draw("a");
-
- // Update the axes, which can only be done after drawing the graphs
- TAxis* xAxis = graphs->GetXaxis();
- xAxis->SetTitle("m(#pi^{+}#pi^{-}) (GeV/c^{2})");
- xAxis->SetLabelSize(0.05);
- xAxis->SetTitleSize(0.05);
- xAxis->CenterTitle(kTRUE);
- xAxis->SetTitleOffset(0.9);
-
- TString yLabel("K(");
- if (iL == 0) {
- yLabel += "3,3)";
- } else if (iL == 1) {
- yLabel += "3,4)";
- } else if (iL == 2) {
- yLabel += "3,5)";
- } else if (iL == 3) {
- yLabel += "4,4)";
- } else if (iL == 4) {
- yLabel += "4,5)";
- } else {
- yLabel += "5,5)";
- }
-
- TAxis* yAxis = graphs->GetYaxis();
- yAxis->SetTitleOffset(0.9);
- yAxis->SetTitle(yLabel.Data());
- yAxis->SetLabelSize(0.05);
- yAxis->SetTitleSize(0.05);
- yAxis->CenterTitle(kTRUE);
-
- // Update the canvas with the new axes settings
- theCanvas->Update();
-
+ theCanvas->Divide( 2, 3 );
+
+ for ( Int_t iL = 0; iL < 6; iL++ ) {
+
+ theCanvas->cd( iL + 1 );
+ TMultiGraph* graphs = multiGraphVect[iL + 9];
+ graphs->Draw( "a" );
+
+ // Update the axes, which can only be done after drawing the graphs
+ TAxis* xAxis = graphs->GetXaxis();
+ xAxis->SetTitle( "m(#pi^{+}#pi^{-}) (GeV/c^{2})" );
+ xAxis->SetLabelSize( 0.05 );
+ xAxis->SetTitleSize( 0.05 );
+ xAxis->CenterTitle( kTRUE );
+ xAxis->SetTitleOffset( 0.9 );
+
+ TString yLabel( "K(" );
+ if ( iL == 0 ) {
+ yLabel += "3,3)";
+ } else if ( iL == 1 ) {
+ yLabel += "3,4)";
+ } else if ( iL == 2 ) {
+ yLabel += "3,5)";
+ } else if ( iL == 3 ) {
+ yLabel += "4,4)";
+ } else if ( iL == 4 ) {
+ yLabel += "4,5)";
+ } else {
+ yLabel += "5,5)";
+ }
+
+ TAxis* yAxis = graphs->GetYaxis();
+ yAxis->SetTitleOffset( 0.9 );
+ yAxis->SetTitle( yLabel.Data() );
+ yAxis->SetLabelSize( 0.05 );
+ yAxis->SetTitleSize( 0.05 );
+ yAxis->CenterTitle( kTRUE );
+
+ // Update the canvas with the new axes settings
+ theCanvas->Update();
}
- theCanvas->Print("K_345jPlots.png");
- if (doEPS) {theCanvas->Print("K_345jPlots.eps");}
+ theCanvas->Print( "K_345jPlots.png" );
+ if ( doEPS ) {
+ theCanvas->Print( "K_345jPlots.eps" );
+ }
// Cleanup
delete propPoles;
delete propSVPs;
delete propNoAdler;
delete propFull;
std::vector<TMultiGraph*>::iterator multiIter;
- for (multiIter = multiGraphVect.begin(); multiIter != multiGraphVect.end(); ++multiIter) {
-
- TMultiGraph* multiGraph = *multiIter;
- delete multiGraph;
+ for ( multiIter = multiGraphVect.begin(); multiIter != multiGraphVect.end(); ++multiIter ) {
+ TMultiGraph* multiGraph = *multiIter;
+ delete multiGraph;
}
delete theLegend;
delete theCanvas;
-
}
-void doPropagatorPlots() {
+void doPropagatorPlots()
+{
// Create plots of the s variation of the elements of the
// propagator (I - i K rho)^-1
- Int_t resPairInt(1);
- Int_t nChannels(5);
- Int_t KMatrixIndex(1); // pi pi S-wave
- Int_t nPoles(5);
+ Int_t resPairInt( 1 );
+ Int_t nChannels( 5 );
+ Int_t KMatrixIndex( 1 ); // pi pi S-wave
+ Int_t nPoles( 5 );
// Mass range for plots
- Double_t mMin(0.28);
- Double_t mMax(2.0);
+ Double_t mMin( 0.28 );
+ Double_t mMax( 2.0 );
Int_t nSteps = 2000;
- Double_t dm = (mMax - mMin)/(nSteps*1.0);
+ Double_t dm = ( mMax - mMin ) / ( nSteps * 1.0 );
// Find the point numbers for m = mMin, 0.5, 0.75, 1, 1.25, 1.5, 1.75 and 2 GeV
std::vector<Int_t> points;
std::vector<Int_t> colours, styles;
std::vector<Double_t> massPoints;
- massPoints.push_back(mMin); massPoints.push_back(0.5); massPoints.push_back(0.75);
- massPoints.push_back(1.0); massPoints.push_back(1.25); massPoints.push_back(1.5);
- massPoints.push_back(1.75); massPoints.push_back(1.99999);
-
- Int_t NMain = static_cast<Int_t>(massPoints.size());
- for (Int_t iP = 0; iP < NMain; iP++) {
-
- Int_t pointInt = static_cast<Int_t>((massPoints[iP] - mMin)/dm);
- points.push_back(pointInt);
-
- // Red or Blue
- Int_t iColour = kRed;
- if (iP > 3) {iColour = kBlue;}
- Int_t iStyle = kFullCircle;
- Int_t iPMod = iP%4;
- if (iPMod == 1) {
- iStyle = kOpenCircle;
- } else if (iPMod == 2) {
- iStyle = kFullSquare;
- } else if (iPMod == 3) {
- iStyle = kOpenSquare;
- }
-
- colours.push_back(iColour);
- styles.push_back(iStyle);
-
+ massPoints.push_back( mMin );
+ massPoints.push_back( 0.5 );
+ massPoints.push_back( 0.75 );
+ massPoints.push_back( 1.0 );
+ massPoints.push_back( 1.25 );
+ massPoints.push_back( 1.5 );
+ massPoints.push_back( 1.75 );
+ massPoints.push_back( 1.99999 );
+
+ Int_t NMain = static_cast<Int_t>( massPoints.size() );
+ for ( Int_t iP = 0; iP < NMain; iP++ ) {
+
+ Int_t pointInt = static_cast<Int_t>( ( massPoints[iP] - mMin ) / dm );
+ points.push_back( pointInt );
+
+ // Red or Blue
+ Int_t iColour = kRed;
+ if ( iP > 3 ) {
+ iColour = kBlue;
+ }
+ Int_t iStyle = kFullCircle;
+ Int_t iPMod = iP % 4;
+ if ( iPMod == 1 ) {
+ iStyle = kOpenCircle;
+ } else if ( iPMod == 2 ) {
+ iStyle = kFullSquare;
+ } else if ( iPMod == 3 ) {
+ iStyle = kOpenSquare;
+ }
+
+ colours.push_back( iColour );
+ styles.push_back( iStyle );
}
// Full K-matrix parameterisation
- TString KFile("B3piKMatrixCoeff.dat");
- LauKMatrixPropagator* propFull = new LauKMatrixPropagator("propFull", KFile,
- resPairInt, nChannels,
- nPoles, KMatrixIndex);
+ TString KFile( "B3piKMatrixCoeff.dat" );
+ LauKMatrixPropagator* propFull =
+ new LauKMatrixPropagator( "propFull", KFile, resPairInt, nChannels, nPoles, KMatrixIndex );
// Maps of <channel row, vector of graph for channel column>
// Argand diagram graphs (full plot, then others showing only selected points)
- std::map<int, std::vector<TMultiGraph*> > argMap;
+ std::map<int, std::vector<TMultiGraph*>> argMap;
// Real, imaginary and magnitude amplitude multigraphs
- std::map<int, std::vector<TMultiGraph*> > ampMap;
+ std::map<int, std::vector<TMultiGraph*>> ampMap;
// TLegend for argand graphs
- TLegend* argLegend = new TLegend(0.1, 0.1, 0.7, 0.995);
- argLegend->SetHeader("m(#pi^{+}#pi^{-}) points (GeV/c^{2})");
- argLegend->SetTextSize(0.075);
- Bool_t initArgLegend(kFALSE);
+ TLegend* argLegend = new TLegend( 0.1, 0.1, 0.7, 0.995 );
+ argLegend->SetHeader( "m(#pi^{+}#pi^{-}) points (GeV/c^{2})" );
+ argLegend->SetTextSize( 0.075 );
+ Bool_t initArgLegend( kFALSE );
// Legend for the amplitude graphs (same for all multigraphs)
- TLegend* ampLegend = new TLegend(0.2, 0.2, 0.8, 0.7);
- ampLegend->SetHeader("Propagator (I - iK#rho)^{-1} components");
- Bool_t initAmpLegend(kFALSE);
-
- Int_t iChannel(0), jChannel(0);
-
- for (iChannel = 0; iChannel < nChannels; iChannel++) {
-
- std::vector<TMultiGraph*> argGraphVect;
- std::vector<TMultiGraph*> ampGraphVect;
-
- for (jChannel = 0; jChannel < nChannels; jChannel++) {
-
- // Common numbering scheme
- TString numbers(""); numbers += iChannel;
- numbers += "_"; numbers += jChannel;
-
- // Argand plot showing phase motion
- TMultiGraph* argGraphs = new TMultiGraph();
- TString argMultiLabel("PropMultiArg_"); argMultiLabel += numbers;
- argGraphs->SetName(argMultiLabel.Data());
- argGraphVect.push_back(argGraphs);
-
- TGraph* argGraph = new TGraph(nSteps);
- TString argLabel("PropArg_"); argLabel += numbers;
- argGraph->SetName(argLabel.Data());
- argGraph->SetLineWidth(1);
- argGraphs->Add(argGraph, "lp");
-
- // Argand graphs showing only one highlighted point
- for (Int_t iG = 0; iG < NMain; iG++) {
-
- TGraph* pointGraph = new TGraph(1);
- TString pointLabel("PropPoint_"); pointLabel += iG;
- pointLabel += "_"; pointLabel += numbers;
-
- pointGraph->SetName(pointLabel.Data());
- pointGraph->SetMarkerColor(colours[iG]);
- pointGraph->SetMarkerSize(1.1);
- pointGraph->SetMarkerStyle(styles[iG]);
- argGraphs->Add(pointGraph, "p");
-
- }
-
- if (!initArgLegend) {
- TList* argList = argGraphs->GetListOfGraphs();
- for (Int_t iG = 0; iG < NMain; iG++) {
- TGraph* pointGraph = dynamic_cast<TGraph*>(argList->At(iG+1));
- argLegend->AddEntry(pointGraph, Form("%.2f",massPoints[iG]), "p");
- initArgLegend = kTRUE;
- }
- }
-
- // Real, imaginary and magnitude amplitude
- TMultiGraph* ampGraphs = new TMultiGraph();
- TString multiLabel("PropMultiAmp_"); multiLabel += numbers;
- ampGraphs->SetName(multiLabel.Data());
- ampGraphVect.push_back(ampGraphs);
-
- TGraph* realGraph = new TGraph(nSteps);
- TString realLabel("PropReal_"); realLabel += numbers;
- realGraph->SetName(realLabel.Data());
- realGraph->SetLineColor(kRed);
- realGraph->SetMarkerColor(kRed);
- realGraph->SetLineWidth(1);
- ampGraphs->Add(realGraph, "lp");
-
- TGraph* imagGraph = new TGraph(nSteps);
- TString imagLabel("PropImag_"); imagLabel += numbers;
- imagGraph->SetName(imagLabel.Data());
- imagGraph->SetLineColor(kBlue);
- imagGraph->SetMarkerColor(kBlue);
- imagGraph->SetLineWidth(1);
- ampGraphs->Add(imagGraph, "lp");
-
- TGraph* magGraph = new TGraph(nSteps);
- TString magLabel("PropMag_"); magLabel += numbers;
- magGraph->SetName(magLabel.Data());
- magGraph->SetLineColor(kBlack);
- magGraph->SetMarkerColor(kBlack);
- magGraph->SetLineWidth(1);
- ampGraphs->Add(magGraph, "lp");
-
- if (!initAmpLegend) {
-
- ampLegend->AddEntry(realGraph, "Real part", "l");
- ampLegend->AddEntry(imagGraph, "Imag part", "l");
- ampLegend->AddEntry(magGraph, "Magnitude", "l");
-
- initAmpLegend = kTRUE;
-
- }
-
- }
-
- argMap[iChannel] = argGraphVect;
- ampMap[iChannel] = ampGraphVect;
-
+ TLegend* ampLegend = new TLegend( 0.2, 0.2, 0.8, 0.7 );
+ ampLegend->SetHeader( "Propagator (I - iK#rho)^{-1} components" );
+ Bool_t initAmpLegend( kFALSE );
+
+ Int_t iChannel( 0 ), jChannel( 0 );
+
+ for ( iChannel = 0; iChannel < nChannels; iChannel++ ) {
+
+ std::vector<TMultiGraph*> argGraphVect;
+ std::vector<TMultiGraph*> ampGraphVect;
+
+ for ( jChannel = 0; jChannel < nChannels; jChannel++ ) {
+
+ // Common numbering scheme
+ TString numbers( "" );
+ numbers += iChannel;
+ numbers += "_";
+ numbers += jChannel;
+
+ // Argand plot showing phase motion
+ TMultiGraph* argGraphs = new TMultiGraph();
+ TString argMultiLabel( "PropMultiArg_" );
+ argMultiLabel += numbers;
+ argGraphs->SetName( argMultiLabel.Data() );
+ argGraphVect.push_back( argGraphs );
+
+ TGraph* argGraph = new TGraph( nSteps );
+ TString argLabel( "PropArg_" );
+ argLabel += numbers;
+ argGraph->SetName( argLabel.Data() );
+ argGraph->SetLineWidth( 1 );
+ argGraphs->Add( argGraph, "lp" );
+
+ // Argand graphs showing only one highlighted point
+ for ( Int_t iG = 0; iG < NMain; iG++ ) {
+
+ TGraph* pointGraph = new TGraph( 1 );
+ TString pointLabel( "PropPoint_" );
+ pointLabel += iG;
+ pointLabel += "_";
+ pointLabel += numbers;
+
+ pointGraph->SetName( pointLabel.Data() );
+ pointGraph->SetMarkerColor( colours[iG] );
+ pointGraph->SetMarkerSize( 1.1 );
+ pointGraph->SetMarkerStyle( styles[iG] );
+ argGraphs->Add( pointGraph, "p" );
+ }
+
+ if ( ! initArgLegend ) {
+ TList* argList = argGraphs->GetListOfGraphs();
+ for ( Int_t iG = 0; iG < NMain; iG++ ) {
+ TGraph* pointGraph = dynamic_cast<TGraph*>( argList->At( iG + 1 ) );
+ argLegend->AddEntry( pointGraph, Form( "%.2f", massPoints[iG] ), "p" );
+ initArgLegend = kTRUE;
+ }
+ }
+
+ // Real, imaginary and magnitude amplitude
+ TMultiGraph* ampGraphs = new TMultiGraph();
+ TString multiLabel( "PropMultiAmp_" );
+ multiLabel += numbers;
+ ampGraphs->SetName( multiLabel.Data() );
+ ampGraphVect.push_back( ampGraphs );
+
+ TGraph* realGraph = new TGraph( nSteps );
+ TString realLabel( "PropReal_" );
+ realLabel += numbers;
+ realGraph->SetName( realLabel.Data() );
+ realGraph->SetLineColor( kRed );
+ realGraph->SetMarkerColor( kRed );
+ realGraph->SetLineWidth( 1 );
+ ampGraphs->Add( realGraph, "lp" );
+
+ TGraph* imagGraph = new TGraph( nSteps );
+ TString imagLabel( "PropImag_" );
+ imagLabel += numbers;
+ imagGraph->SetName( imagLabel.Data() );
+ imagGraph->SetLineColor( kBlue );
+ imagGraph->SetMarkerColor( kBlue );
+ imagGraph->SetLineWidth( 1 );
+ ampGraphs->Add( imagGraph, "lp" );
+
+ TGraph* magGraph = new TGraph( nSteps );
+ TString magLabel( "PropMag_" );
+ magLabel += numbers;
+ magGraph->SetName( magLabel.Data() );
+ magGraph->SetLineColor( kBlack );
+ magGraph->SetMarkerColor( kBlack );
+ magGraph->SetLineWidth( 1 );
+ ampGraphs->Add( magGraph, "lp" );
+
+ if ( ! initAmpLegend ) {
+
+ ampLegend->AddEntry( realGraph, "Real part", "l" );
+ ampLegend->AddEntry( imagGraph, "Imag part", "l" );
+ ampLegend->AddEntry( magGraph, "Magnitude", "l" );
+
+ initAmpLegend = kTRUE;
+ }
+ }
+
+ argMap[iChannel] = argGraphVect;
+ ampMap[iChannel] = ampGraphVect;
}
// Fill the graphs
- for (Int_t iM = 0; iM < nSteps; iM++) {
-
- Double_t m = dm*iM + mMin;
- Double_t s = m*m;
-
- propFull->updatePropagator(s);
+ for ( Int_t iM = 0; iM < nSteps; iM++ ) {
- TMatrixD realPropMatrix = propFull->getRealPropMatrix();
- TMatrixD negImagPropMatrix = propFull->getNegImagPropMatrix();
+ Double_t m = dm * iM + mMin;
+ Double_t s = m * m;
- for (iChannel = 0; iChannel < nChannels; iChannel++) {
+ propFull->updatePropagator( s );
- std::vector<TMultiGraph*> argGraphVect = argMap[iChannel];
- std::vector<TMultiGraph*> ampGraphVect = ampMap[iChannel];
+ TMatrixD realPropMatrix = propFull->getRealPropMatrix();
+ TMatrixD negImagPropMatrix = propFull->getNegImagPropMatrix();
- for (jChannel = 0; jChannel < nChannels; jChannel++) {
+ for ( iChannel = 0; iChannel < nChannels; iChannel++ ) {
- // Get the real and imaginary parts of the propagator term
- Double_t realProp = realPropMatrix[iChannel][jChannel];
- Double_t imagProp = -negImagPropMatrix[iChannel][jChannel];
- Double_t magProp = sqrt(realProp*realProp + imagProp*imagProp);
+ std::vector<TMultiGraph*> argGraphVect = argMap[iChannel];
+ std::vector<TMultiGraph*> ampGraphVect = ampMap[iChannel];
- // Argand diagram: full plot and only selected points
- TMultiGraph* argGraphs = argGraphVect[jChannel];
- TList* argList = argGraphs->GetListOfGraphs();
+ for ( jChannel = 0; jChannel < nChannels; jChannel++ ) {
- TGraph* argGraph = dynamic_cast<TGraph*>(argList->At(0));
- argGraph->SetPoint(iM, realProp, imagProp);
+ // Get the real and imaginary parts of the propagator term
+ Double_t realProp = realPropMatrix[iChannel][jChannel];
+ Double_t imagProp = -negImagPropMatrix[iChannel][jChannel];
+ Double_t magProp = sqrt( realProp * realProp + imagProp * imagProp );
- // Graphs showing specific points
- for (Int_t iP = 0; iP < NMain; iP++) {
+ // Argand diagram: full plot and only selected points
+ TMultiGraph* argGraphs = argGraphVect[jChannel];
+ TList* argList = argGraphs->GetListOfGraphs();
- if (points[iP] == iM) {
- TGraph* pointGraph = dynamic_cast<TGraph*>(argList->At(iP+1));
- pointGraph->SetPoint(0, realProp, imagProp);
- }
+ TGraph* argGraph = dynamic_cast<TGraph*>( argList->At( 0 ) );
+ argGraph->SetPoint( iM, realProp, imagProp );
- }
+ // Graphs showing specific points
+ for ( Int_t iP = 0; iP < NMain; iP++ ) {
- // Amplitude multigraphs
- TMultiGraph* ampGraphs = ampGraphVect[jChannel];
- TList* ampList = ampGraphs->GetListOfGraphs();
+ if ( points[iP] == iM ) {
+ TGraph* pointGraph = dynamic_cast<TGraph*>( argList->At( iP + 1 ) );
+ pointGraph->SetPoint( 0, realProp, imagProp );
+ }
+ }
- TGraph* realGraph = dynamic_cast<TGraph*>(ampList->At(0));
- realGraph->SetPoint(iM, m, realProp);
+ // Amplitude multigraphs
+ TMultiGraph* ampGraphs = ampGraphVect[jChannel];
+ TList* ampList = ampGraphs->GetListOfGraphs();
- TGraph* imagGraph = dynamic_cast<TGraph*>(ampList->At(1));
- imagGraph->SetPoint(iM, m, imagProp);
+ TGraph* realGraph = dynamic_cast<TGraph*>( ampList->At( 0 ) );
+ realGraph->SetPoint( iM, m, realProp );
- TGraph* magGraph = dynamic_cast<TGraph*>(ampList->At(2));
- magGraph->SetPoint(iM, m, magProp);
-
- }
-
- }
+ TGraph* imagGraph = dynamic_cast<TGraph*>( ampList->At( 1 ) );
+ imagGraph->SetPoint( iM, m, imagProp );
+ TGraph* magGraph = dynamic_cast<TGraph*>( ampList->At( 2 ) );
+ magGraph->SetPoint( iM, m, magProp );
+ }
+ }
}
// Create plots
- TCanvas* theCanvas = new TCanvas("theCanvas", "", 1000, 1000);
- gROOT->SetStyle("Plain");
- gStyle->SetOptStat(0);
-
- for (iChannel = 0; iChannel < nChannels; iChannel++) {
-
- std::vector<TMultiGraph*> argGraphVect = argMap[iChannel];
- std::vector<TMultiGraph*> ampGraphVect = ampMap[iChannel];
-
- theCanvas->Clear();
- theCanvas->UseCurrentStyle();
- theCanvas->Divide(2,3);
-
- // Argand plots
- for (jChannel = 0; jChannel < nChannels; jChannel++) {
-
- theCanvas->cd(jChannel+1);
- TMultiGraph* argGraphs = argGraphVect[jChannel];
- argGraphs->Draw("a");
-
- TString title("Propagator("); title += iChannel+1;
- title += ","; title += jChannel+1; title += ")";
- argGraphs->SetTitle(title.Data());
-
- TAxis* xAxis = argGraphs->GetXaxis();
- xAxis->SetTitle("Real");
- xAxis->SetLabelSize(0.05);
- xAxis->SetTitleSize(0.05);
- xAxis->CenterTitle(kTRUE);
- xAxis->SetTitleOffset(0.9);
-
- TAxis* yAxis = argGraphs->GetYaxis();
- yAxis->SetTitle("Imag");
- yAxis->SetLabelSize(0.05);
- yAxis->SetTitleSize(0.05);
- yAxis->CenterTitle(kTRUE);
-
- theCanvas->Update();
-
- }
-
- theCanvas->cd(6);
- argLegend->Draw();
-
- TString argPlotName("PropArg_"); argPlotName += iChannel;
- argPlotName += ".png";
- theCanvas->Print(argPlotName.Data());
-
- if (doEPS) {
- TString argEpsPlotName(argPlotName);
- argEpsPlotName.ReplaceAll(".png", ".eps");
- theCanvas->Print(argEpsPlotName.Data());
- }
-
- // Amplitude plots
- theCanvas->Clear();
- theCanvas->UseCurrentStyle();
- theCanvas->Divide(2,3);
-
- for (jChannel = 0; jChannel < nChannels; jChannel++) {
-
- theCanvas->cd(jChannel+1);
-
- TMultiGraph* ampGraphs = ampGraphVect[jChannel];
- ampGraphs->Draw("a");
-
- TAxis* xAxis = ampGraphs->GetXaxis();
- xAxis->SetTitle("m(#pi^{+}#pi^{-}) (GeV/c^{2})");
- xAxis->SetLabelSize(0.05);
- xAxis->SetTitleSize(0.05);
- xAxis->CenterTitle(kTRUE);
- xAxis->SetTitleOffset(0.9);
-
- TString yLabel("Propagator("); yLabel += iChannel+1;
- yLabel += ","; yLabel += jChannel+1; yLabel += ")";
-
- TAxis* yAxis = ampGraphs->GetYaxis();
- yAxis->SetTitleOffset(0.9);
- yAxis->SetTitle(yLabel.Data());
- yAxis->SetLabelSize(0.05);
- yAxis->SetTitleSize(0.05);
- yAxis->CenterTitle(kTRUE);
-
- theCanvas->Update();
-
- }
-
- theCanvas->cd(6);
- ampLegend->Draw();
-
- TString ampPlotName("PropAmp_"); ampPlotName += iChannel;
- ampPlotName += ".png";
- theCanvas->Print(ampPlotName.Data());
-
- if (doEPS) {
- TString ampEpsPlotName(ampPlotName);
- ampEpsPlotName.ReplaceAll(".png", ".eps");
- theCanvas->Print(ampEpsPlotName.Data());
- }
-
+ TCanvas* theCanvas = new TCanvas( "theCanvas", "", 1000, 1000 );
+ gROOT->SetStyle( "Plain" );
+ gStyle->SetOptStat( 0 );
+
+ for ( iChannel = 0; iChannel < nChannels; iChannel++ ) {
+
+ std::vector<TMultiGraph*> argGraphVect = argMap[iChannel];
+ std::vector<TMultiGraph*> ampGraphVect = ampMap[iChannel];
+
+ theCanvas->Clear();
+ theCanvas->UseCurrentStyle();
+ theCanvas->Divide( 2, 3 );
+
+ // Argand plots
+ for ( jChannel = 0; jChannel < nChannels; jChannel++ ) {
+
+ theCanvas->cd( jChannel + 1 );
+ TMultiGraph* argGraphs = argGraphVect[jChannel];
+ argGraphs->Draw( "a" );
+
+ TString title( "Propagator(" );
+ title += iChannel + 1;
+ title += ",";
+ title += jChannel + 1;
+ title += ")";
+ argGraphs->SetTitle( title.Data() );
+
+ TAxis* xAxis = argGraphs->GetXaxis();
+ xAxis->SetTitle( "Real" );
+ xAxis->SetLabelSize( 0.05 );
+ xAxis->SetTitleSize( 0.05 );
+ xAxis->CenterTitle( kTRUE );
+ xAxis->SetTitleOffset( 0.9 );
+
+ TAxis* yAxis = argGraphs->GetYaxis();
+ yAxis->SetTitle( "Imag" );
+ yAxis->SetLabelSize( 0.05 );
+ yAxis->SetTitleSize( 0.05 );
+ yAxis->CenterTitle( kTRUE );
+
+ theCanvas->Update();
+ }
+
+ theCanvas->cd( 6 );
+ argLegend->Draw();
+
+ TString argPlotName( "PropArg_" );
+ argPlotName += iChannel;
+ argPlotName += ".png";
+ theCanvas->Print( argPlotName.Data() );
+
+ if ( doEPS ) {
+ TString argEpsPlotName( argPlotName );
+ argEpsPlotName.ReplaceAll( ".png", ".eps" );
+ theCanvas->Print( argEpsPlotName.Data() );
+ }
+
+ // Amplitude plots
+ theCanvas->Clear();
+ theCanvas->UseCurrentStyle();
+ theCanvas->Divide( 2, 3 );
+
+ for ( jChannel = 0; jChannel < nChannels; jChannel++ ) {
+
+ theCanvas->cd( jChannel + 1 );
+
+ TMultiGraph* ampGraphs = ampGraphVect[jChannel];
+ ampGraphs->Draw( "a" );
+
+ TAxis* xAxis = ampGraphs->GetXaxis();
+ xAxis->SetTitle( "m(#pi^{+}#pi^{-}) (GeV/c^{2})" );
+ xAxis->SetLabelSize( 0.05 );
+ xAxis->SetTitleSize( 0.05 );
+ xAxis->CenterTitle( kTRUE );
+ xAxis->SetTitleOffset( 0.9 );
+
+ TString yLabel( "Propagator(" );
+ yLabel += iChannel + 1;
+ yLabel += ",";
+ yLabel += jChannel + 1;
+ yLabel += ")";
+
+ TAxis* yAxis = ampGraphs->GetYaxis();
+ yAxis->SetTitleOffset( 0.9 );
+ yAxis->SetTitle( yLabel.Data() );
+ yAxis->SetLabelSize( 0.05 );
+ yAxis->SetTitleSize( 0.05 );
+ yAxis->CenterTitle( kTRUE );
+
+ theCanvas->Update();
+ }
+
+ theCanvas->cd( 6 );
+ ampLegend->Draw();
+
+ TString ampPlotName( "PropAmp_" );
+ ampPlotName += iChannel;
+ ampPlotName += ".png";
+ theCanvas->Print( ampPlotName.Data() );
+
+ if ( doEPS ) {
+ TString ampEpsPlotName( ampPlotName );
+ ampEpsPlotName.ReplaceAll( ".png", ".eps" );
+ theCanvas->Print( ampEpsPlotName.Data() );
+ }
}
// Cleanup
delete propFull;
- std::map<int, std::vector<TMultiGraph*> >::iterator argIter;
- for (argIter = argMap.begin(); argIter != argMap.end(); ++argIter) {
-
- std::vector<TMultiGraph*> argGraphs = argIter->second;
+ std::map<int, std::vector<TMultiGraph*>>::iterator argIter;
+ for ( argIter = argMap.begin(); argIter != argMap.end(); ++argIter ) {
- std::vector<TMultiGraph*>::iterator theIter;
- for (theIter = argGraphs.begin(); theIter != argGraphs.end(); ++theIter) {
+ std::vector<TMultiGraph*> argGraphs = argIter->second;
- TMultiGraph* aGraph = *theIter;
- delete aGraph;
+ std::vector<TMultiGraph*>::iterator theIter;
+ for ( theIter = argGraphs.begin(); theIter != argGraphs.end(); ++theIter ) {
- }
-
- argGraphs.clear();
+ TMultiGraph* aGraph = *theIter;
+ delete aGraph;
+ }
+ argGraphs.clear();
}
- std::map<int, std::vector<TMultiGraph*> >::iterator ampIter;
- for (ampIter = ampMap.begin(); ampIter != ampMap.end(); ++ampIter) {
-
- std::vector<TMultiGraph*> ampGraphs = ampIter->second;
+ std::map<int, std::vector<TMultiGraph*>>::iterator ampIter;
+ for ( ampIter = ampMap.begin(); ampIter != ampMap.end(); ++ampIter ) {
- std::vector<TMultiGraph*>::iterator theIter;
- for (theIter = ampGraphs.begin(); theIter != ampGraphs.end(); ++theIter) {
+ std::vector<TMultiGraph*> ampGraphs = ampIter->second;
- TMultiGraph* aGraph = *theIter;
- delete aGraph;
+ std::vector<TMultiGraph*>::iterator theIter;
+ for ( theIter = ampGraphs.begin(); theIter != ampGraphs.end(); ++theIter ) {
- }
-
- ampGraphs.clear();
+ TMultiGraph* aGraph = *theIter;
+ delete aGraph;
+ }
+ ampGraphs.clear();
}
delete ampLegend;
delete theCanvas;
-
}
-
-void doProdPolePlots(Bool_t useProdAdler) {
+void doProdPolePlots( Bool_t useProdAdler )
+{
// Create plots of the pole production amplitudes using the first row of
// the propagator (for pi pi S-wave). For each pole we sum over all channels
- Int_t resPairInt(1);
- Int_t nChannels(5);
- Int_t KMatrixIndex(1); // pi pi S-wave
- Int_t nPoles(5);
+ Int_t resPairInt( 1 );
+ Int_t nChannels( 5 );
+ Int_t KMatrixIndex( 1 ); // pi pi S-wave
+ Int_t nPoles( 5 );
// Mass range for plots
- Double_t mMin(0.28);
- Double_t mMax(2.0);
+ Double_t mMin( 0.28 );
+ Double_t mMax( 2.0 );
Int_t nSteps = 2000;
- Double_t dm = (mMax - mMin)/(nSteps*1.0);
+ Double_t dm = ( mMax - mMin ) / ( nSteps * 1.0 );
// Find the point numbers for m = mMin, 0.5, 0.75, 1, 1.25, 1.5, 1.75 and 2 GeV
std::vector<Int_t> points;
std::vector<Int_t> colours, styles;
std::vector<Double_t> massPoints;
- massPoints.push_back(mMin); massPoints.push_back(0.5); massPoints.push_back(0.75);
- massPoints.push_back(1.0); massPoints.push_back(1.25); massPoints.push_back(1.5);
- massPoints.push_back(1.75); massPoints.push_back(1.99999);
-
- Int_t NMain = static_cast<Int_t>(massPoints.size());
- for (Int_t iP = 0; iP < NMain; iP++) {
-
- Int_t pointInt = static_cast<Int_t>((massPoints[iP] - mMin)/dm);
- points.push_back(pointInt);
-
- // Red or Blue
- Int_t iColour = kRed;
- if (iP > 3) {iColour = kBlue;}
- Int_t iStyle = kFullCircle;
- Int_t iPMod = iP%4;
- if (iPMod == 1) {
- iStyle = kOpenCircle;
- } else if (iPMod == 2) {
- iStyle = kFullSquare;
- } else if (iPMod == 3) {
- iStyle = kOpenSquare;
- }
-
- colours.push_back(iColour);
- styles.push_back(iStyle);
-
+ massPoints.push_back( mMin );
+ massPoints.push_back( 0.5 );
+ massPoints.push_back( 0.75 );
+ massPoints.push_back( 1.0 );
+ massPoints.push_back( 1.25 );
+ massPoints.push_back( 1.5 );
+ massPoints.push_back( 1.75 );
+ massPoints.push_back( 1.99999 );
+
+ Int_t NMain = static_cast<Int_t>( massPoints.size() );
+ for ( Int_t iP = 0; iP < NMain; iP++ ) {
+
+ Int_t pointInt = static_cast<Int_t>( ( massPoints[iP] - mMin ) / dm );
+ points.push_back( pointInt );
+
+ // Red or Blue
+ Int_t iColour = kRed;
+ if ( iP > 3 ) {
+ iColour = kBlue;
+ }
+ Int_t iStyle = kFullCircle;
+ Int_t iPMod = iP % 4;
+ if ( iPMod == 1 ) {
+ iStyle = kOpenCircle;
+ } else if ( iPMod == 2 ) {
+ iStyle = kFullSquare;
+ } else if ( iPMod == 3 ) {
+ iStyle = kOpenSquare;
+ }
+
+ colours.push_back( iColour );
+ styles.push_back( iStyle );
}
- Double_t mPi = 0.13957018;
- Double_t mPiSq = mPi*mPi;
- Double_t mB = 5.279;
- Double_t mBSq = mB*mB;
- Double_t mSqTerm = 2.0*((mBSq/3.0) + mPiSq);
+ Double_t mPi = 0.13957018;
+ Double_t mPiSq = mPi * mPi;
+ Double_t mB = 5.279;
+ Double_t mBSq = mB * mB;
+ Double_t mSqTerm = 2.0 * ( ( mBSq / 3.0 ) + mPiSq );
// Full K-matrix parameterisation
- TString KFile("B3piKMatrixCoeff.dat");
- LauKMatrixPropagator* propFull = new LauKMatrixPropagator("propFull", KFile,
- resPairInt, nChannels,
- nPoles, KMatrixIndex);
+ TString KFile( "B3piKMatrixCoeff.dat" );
+ LauKMatrixPropagator* propFull =
+ new LauKMatrixPropagator( "propFull", KFile, resPairInt, nChannels, nPoles, KMatrixIndex );
// Define kinematics pointer
- Bool_t squareDP = kTRUE;
- LauDaughters* theDaughters = new LauDaughters("B+", "pi+", "pi+", "pi-", squareDP);
+ Bool_t squareDP = kTRUE;
+ LauDaughters* theDaughters = new LauDaughters( "B+", "pi+", "pi+", "pi-", squareDP );
// Kinematics
LauKinematics* kinematics = theDaughters->getKinematics();
std::vector<LauKMatrixProdPole*> poleVect;
- Int_t iPole(0);
- for (iPole = 0; iPole < nPoles; iPole++) {
+ Int_t iPole( 0 );
+ for ( iPole = 0; iPole < nPoles; iPole++ ) {
- TString poleName("Pole"); poleName += iPole;
+ TString poleName( "Pole" );
+ poleName += iPole;
- LauKMatrixProdPole* thePole = new LauKMatrixProdPole(poleName, iPole+1, resPairInt,
- propFull, theDaughters, useProdAdler);
-
- poleVect.push_back(thePole);
+ LauKMatrixProdPole* thePole = new LauKMatrixProdPole( poleName,
+ iPole + 1,
+ resPairInt,
+ propFull,
+ theDaughters,
+ useProdAdler );
+ poleVect.push_back( thePole );
}
// Argand diagram graphs (full plot, then others showing only selected points)
std::vector<TMultiGraph*> argGraphVect;
// Real, imaginary and magnitude amplitude multigraphs
std::vector<TMultiGraph*> ampGraphVect;
// TLegend for argand graphs
- TLegend* argLegend = new TLegend(0.1, 0.1, 0.7, 0.995);
- argLegend->SetHeader("m(#pi^{+}#pi^{-}) points (GeV/c^{2})");
- argLegend->SetTextSize(0.075);
- Bool_t initArgLegend(kFALSE);
+ TLegend* argLegend = new TLegend( 0.1, 0.1, 0.7, 0.995 );
+ argLegend->SetHeader( "m(#pi^{+}#pi^{-}) points (GeV/c^{2})" );
+ argLegend->SetTextSize( 0.075 );
+ Bool_t initArgLegend( kFALSE );
// Legend for the graphs (same for all multigraphs)
- TLegend* ampLegend = new TLegend(0.2, 0.2, 0.8, 0.7);
- ampLegend->SetHeader("Production pole components");
- Bool_t initLegend(kFALSE);
-
- for (iPole = 0; iPole < nPoles; iPole++) {
-
- // Argand plot showing phase motion
- TMultiGraph* argGraphs = new TMultiGraph();
- TString argMultiLabel("PoleMultiArg_"); argMultiLabel += iPole;
- argGraphs->SetName(argMultiLabel.Data());
- argGraphVect.push_back(argGraphs);
-
- TGraph* argGraph = new TGraph(nSteps);
- TString argLabel("PoleArg_"); argLabel += iPole;
- argGraph->SetName(argLabel.Data());
- argGraph->SetLineWidth(1);
- argGraphs->Add(argGraph, "lp");
-
- // Argand graphs showing only one highlighted point
- for (Int_t iG = 0; iG < NMain; iG++) {
-
- TGraph* pointGraph = new TGraph(1);
- TString pointLabel("PolePoint_"); pointLabel += iG;
-
- pointGraph->SetName(pointLabel.Data());
- pointGraph->SetMarkerColor(colours[iG]);
- pointGraph->SetMarkerSize(1.1);
- pointGraph->SetMarkerStyle(styles[iG]);
- argGraphs->Add(pointGraph, "p");
-
- }
-
- if (!initArgLegend) {
- TList* argList = argGraphs->GetListOfGraphs();
- for (Int_t iG = 0; iG < NMain; iG++) {
- TGraph* pointGraph = dynamic_cast<TGraph*>(argList->At(iG+1));
- argLegend->AddEntry(pointGraph, Form("%.2f",massPoints[iG]), "p");
- initArgLegend = kTRUE;
- }
- }
-
- // Real, imaginary and magnitude amplitude
- TMultiGraph* ampGraphs = new TMultiGraph();
- TString multiLabel("PoleMulti_"); multiLabel += iPole;
- ampGraphs->SetName(multiLabel.Data());
- ampGraphVect.push_back(ampGraphs);
-
- TGraph* realGraph = new TGraph(nSteps);
- TString realLabel("PoleReal_"); realLabel += iPole;
- realGraph->SetName(realLabel.Data());
- realGraph->SetLineColor(kRed);
- realGraph->SetMarkerColor(kRed);
- realGraph->SetLineWidth(1);
- ampGraphs->Add(realGraph, "lp");
-
- TGraph* imagGraph = new TGraph(nSteps);
- TString imagLabel("PoleImag_"); imagLabel += iPole;
- imagGraph->SetName(imagLabel.Data());
- imagGraph->SetLineColor(kBlue);
- imagGraph->SetMarkerColor(kBlue);
- imagGraph->SetLineWidth(1);
- ampGraphs->Add(imagGraph, "lp");
-
- TGraph* magGraph = new TGraph(nSteps);
- TString magLabel("PoleMag_"); magLabel += iPole;
- magGraph->SetName(magLabel.Data());
- magGraph->SetLineColor(kBlack);
- magGraph->SetMarkerColor(kBlack);
- magGraph->SetLineWidth(1);
- ampGraphs->Add(magGraph, "lp");
-
- if (!initLegend) {
-
- ampLegend->AddEntry(realGraph, "Real part", "l");
- ampLegend->AddEntry(imagGraph, "Imag part", "l");
- ampLegend->AddEntry(magGraph, "Magnitude", "l");
-
- initLegend = kTRUE;
-
- }
-
+ TLegend* ampLegend = new TLegend( 0.2, 0.2, 0.8, 0.7 );
+ ampLegend->SetHeader( "Production pole components" );
+ Bool_t initLegend( kFALSE );
+
+ for ( iPole = 0; iPole < nPoles; iPole++ ) {
+
+ // Argand plot showing phase motion
+ TMultiGraph* argGraphs = new TMultiGraph();
+ TString argMultiLabel( "PoleMultiArg_" );
+ argMultiLabel += iPole;
+ argGraphs->SetName( argMultiLabel.Data() );
+ argGraphVect.push_back( argGraphs );
+
+ TGraph* argGraph = new TGraph( nSteps );
+ TString argLabel( "PoleArg_" );
+ argLabel += iPole;
+ argGraph->SetName( argLabel.Data() );
+ argGraph->SetLineWidth( 1 );
+ argGraphs->Add( argGraph, "lp" );
+
+ // Argand graphs showing only one highlighted point
+ for ( Int_t iG = 0; iG < NMain; iG++ ) {
+
+ TGraph* pointGraph = new TGraph( 1 );
+ TString pointLabel( "PolePoint_" );
+ pointLabel += iG;
+
+ pointGraph->SetName( pointLabel.Data() );
+ pointGraph->SetMarkerColor( colours[iG] );
+ pointGraph->SetMarkerSize( 1.1 );
+ pointGraph->SetMarkerStyle( styles[iG] );
+ argGraphs->Add( pointGraph, "p" );
+ }
+
+ if ( ! initArgLegend ) {
+ TList* argList = argGraphs->GetListOfGraphs();
+ for ( Int_t iG = 0; iG < NMain; iG++ ) {
+ TGraph* pointGraph = dynamic_cast<TGraph*>( argList->At( iG + 1 ) );
+ argLegend->AddEntry( pointGraph, Form( "%.2f", massPoints[iG] ), "p" );
+ initArgLegend = kTRUE;
+ }
+ }
+
+ // Real, imaginary and magnitude amplitude
+ TMultiGraph* ampGraphs = new TMultiGraph();
+ TString multiLabel( "PoleMulti_" );
+ multiLabel += iPole;
+ ampGraphs->SetName( multiLabel.Data() );
+ ampGraphVect.push_back( ampGraphs );
+
+ TGraph* realGraph = new TGraph( nSteps );
+ TString realLabel( "PoleReal_" );
+ realLabel += iPole;
+ realGraph->SetName( realLabel.Data() );
+ realGraph->SetLineColor( kRed );
+ realGraph->SetMarkerColor( kRed );
+ realGraph->SetLineWidth( 1 );
+ ampGraphs->Add( realGraph, "lp" );
+
+ TGraph* imagGraph = new TGraph( nSteps );
+ TString imagLabel( "PoleImag_" );
+ imagLabel += iPole;
+ imagGraph->SetName( imagLabel.Data() );
+ imagGraph->SetLineColor( kBlue );
+ imagGraph->SetMarkerColor( kBlue );
+ imagGraph->SetLineWidth( 1 );
+ ampGraphs->Add( imagGraph, "lp" );
+
+ TGraph* magGraph = new TGraph( nSteps );
+ TString magLabel( "PoleMag_" );
+ magLabel += iPole;
+ magGraph->SetName( magLabel.Data() );
+ magGraph->SetLineColor( kBlack );
+ magGraph->SetMarkerColor( kBlack );
+ magGraph->SetLineWidth( 1 );
+ ampGraphs->Add( magGraph, "lp" );
+
+ if ( ! initLegend ) {
+
+ ampLegend->AddEntry( realGraph, "Real part", "l" );
+ ampLegend->AddEntry( imagGraph, "Imag part", "l" );
+ ampLegend->AddEntry( magGraph, "Magnitude", "l" );
+
+ initLegend = kTRUE;
+ }
}
- for (Int_t iM = 0; iM < nSteps; iM++) {
+ for ( Int_t iM = 0; iM < nSteps; iM++ ) {
- Double_t m = dm*iM + mMin;
- Double_t s = m*m;
+ Double_t m = dm * iM + mMin;
+ Double_t s = m * m;
- // Update kinematics. The K-matrix only really needs s = m23Sq, i.e. m13Sq is "ignored".
- // Here, take the diagonal where m12Sq = 0.5*(mB^2 + 3mpi^2), the DP centre and use
- // m13Sq = mBSq + 3mPiSq - m12Sq - m23Sq
- Double_t m13Sq = mSqTerm - s;
+ // Update kinematics. The K-matrix only really needs s = m23Sq, i.e. m13Sq is "ignored".
+ // Here, take the diagonal where m12Sq = 0.5*(mB^2 + 3mpi^2), the DP centre and use
+ // m13Sq = mBSq + 3mPiSq - m12Sq - m23Sq
+ Double_t m13Sq = mSqTerm - s;
- kinematics->updateKinematics(m13Sq, s);
+ kinematics->updateKinematics( m13Sq, s );
- for (iPole = 0; iPole < nPoles; iPole++) {
+ for ( iPole = 0; iPole < nPoles; iPole++ ) {
- // Get the amplitude for the ith pole
- LauComplex amp = poleVect[iPole]->amplitude(kinematics);
- Double_t reAmp = amp.re();
- Double_t imAmp = amp.im();
- Double_t magAmp = sqrt(reAmp*reAmp + imAmp*imAmp);
+ // Get the amplitude for the ith pole
+ LauComplex amp = poleVect[iPole]->amplitude( kinematics );
+ Double_t reAmp = amp.re();
+ Double_t imAmp = amp.im();
+ Double_t magAmp = sqrt( reAmp * reAmp + imAmp * imAmp );
- // Argand diagrams: full plot and only selected points
- TMultiGraph* argGraphs = argGraphVect[iPole];
- TList* argList = argGraphs->GetListOfGraphs();
+ // Argand diagrams: full plot and only selected points
+ TMultiGraph* argGraphs = argGraphVect[iPole];
+ TList* argList = argGraphs->GetListOfGraphs();
- TGraph* argGraph = dynamic_cast<TGraph*>(argList->At(0));
- argGraph->SetPoint(iM, reAmp, imAmp);
+ TGraph* argGraph = dynamic_cast<TGraph*>( argList->At( 0 ) );
+ argGraph->SetPoint( iM, reAmp, imAmp );
- // Graphs showing specific points
- for (Int_t iP = 0; iP < NMain; iP++) {
+ // Graphs showing specific points
+ for ( Int_t iP = 0; iP < NMain; iP++ ) {
- if (points[iP] == iM) {
- TGraph* pointGraph = dynamic_cast<TGraph*>(argList->At(iP+1));
- pointGraph->SetPoint(0, reAmp, imAmp);
- }
+ if ( points[iP] == iM ) {
+ TGraph* pointGraph = dynamic_cast<TGraph*>( argList->At( iP + 1 ) );
+ pointGraph->SetPoint( 0, reAmp, imAmp );
+ }
+ }
- }
+ // Amplitude multigraphs
+ TMultiGraph* ampGraphs = ampGraphVect[iPole];
+ TList* graphList = ampGraphs->GetListOfGraphs();
- // Amplitude multigraphs
- TMultiGraph* ampGraphs = ampGraphVect[iPole];
- TList* graphList = ampGraphs->GetListOfGraphs();
+ TGraph* realGraph = dynamic_cast<TGraph*>( graphList->At( 0 ) );
+ realGraph->SetPoint( iM, m, reAmp );
- TGraph* realGraph = dynamic_cast<TGraph*>(graphList->At(0));
- realGraph->SetPoint(iM, m, reAmp);
-
- TGraph* imagGraph = dynamic_cast<TGraph*>(graphList->At(1));
- imagGraph->SetPoint(iM, m, imAmp);
-
- TGraph* magGraph = dynamic_cast<TGraph*>(graphList->At(2));
- magGraph->SetPoint(iM, m, magAmp);
-
- }
+ TGraph* imagGraph = dynamic_cast<TGraph*>( graphList->At( 1 ) );
+ imagGraph->SetPoint( iM, m, imAmp );
+ TGraph* magGraph = dynamic_cast<TGraph*>( graphList->At( 2 ) );
+ magGraph->SetPoint( iM, m, magAmp );
+ }
}
// Create plots
- TCanvas* theCanvas = new TCanvas("theCanvas", "", 1000, 1000);
- gROOT->SetStyle("Plain");
- gStyle->SetOptStat(0);
+ TCanvas* theCanvas = new TCanvas( "theCanvas", "", 1000, 1000 );
+ gROOT->SetStyle( "Plain" );
+ gStyle->SetOptStat( 0 );
theCanvas->Clear();
theCanvas->UseCurrentStyle();
- theCanvas->Divide(2,3);
+ theCanvas->Divide( 2, 3 );
// Argand plots
- for (iPole = 0; iPole < nPoles; iPole++) {
-
- theCanvas->cd(iPole+1);
- TMultiGraph* argGraphs = argGraphVect[iPole];
- argGraphs->Draw("a");
-
- TString title("Production Pole "); title += iPole+1;
- argGraphs->SetTitle(title.Data());
-
- TAxis* xAxis = argGraphs->GetXaxis();
- xAxis->SetTitle("Real");
- xAxis->SetLabelSize(0.05);
- xAxis->SetTitleSize(0.05);
- xAxis->CenterTitle(kTRUE);
- xAxis->SetTitleOffset(0.9);
-
- TAxis* yAxis = argGraphs->GetYaxis();
- yAxis->SetTitle("Imag");
- yAxis->SetLabelSize(0.05);
- yAxis->SetTitleSize(0.05);
- yAxis->CenterTitle(kTRUE);
-
- theCanvas->Update();
-
+ for ( iPole = 0; iPole < nPoles; iPole++ ) {
+
+ theCanvas->cd( iPole + 1 );
+ TMultiGraph* argGraphs = argGraphVect[iPole];
+ argGraphs->Draw( "a" );
+
+ TString title( "Production Pole " );
+ title += iPole + 1;
+ argGraphs->SetTitle( title.Data() );
+
+ TAxis* xAxis = argGraphs->GetXaxis();
+ xAxis->SetTitle( "Real" );
+ xAxis->SetLabelSize( 0.05 );
+ xAxis->SetTitleSize( 0.05 );
+ xAxis->CenterTitle( kTRUE );
+ xAxis->SetTitleOffset( 0.9 );
+
+ TAxis* yAxis = argGraphs->GetYaxis();
+ yAxis->SetTitle( "Imag" );
+ yAxis->SetLabelSize( 0.05 );
+ yAxis->SetTitleSize( 0.05 );
+ yAxis->CenterTitle( kTRUE );
+
+ theCanvas->Update();
}
- theCanvas->cd(6);
+ theCanvas->cd( 6 );
argLegend->Draw();
- theCanvas->Print("ProdPoleArgand.png");
- if (doEPS) {theCanvas->Print("ProdPoleArgand.eps");}
+ theCanvas->Print( "ProdPoleArgand.png" );
+ if ( doEPS ) {
+ theCanvas->Print( "ProdPoleArgand.eps" );
+ }
// Amplitude plots
theCanvas->Clear();
theCanvas->UseCurrentStyle();
- theCanvas->Divide(2,3);
-
- for (iPole = 0; iPole < nPoles; iPole++) {
+ theCanvas->Divide( 2, 3 );
- theCanvas->cd(iPole+1);
+ for ( iPole = 0; iPole < nPoles; iPole++ ) {
- TMultiGraph* ampGraphs = ampGraphVect[iPole];
- ampGraphs->Draw("a");
+ theCanvas->cd( iPole + 1 );
- TAxis* xAxis = ampGraphs->GetXaxis();
- xAxis->SetTitle("m(#pi^{+}#pi^{-}) (GeV/c^{2})");
- xAxis->SetLabelSize(0.05);
- xAxis->SetTitleSize(0.05);
- xAxis->CenterTitle(kTRUE);
- xAxis->SetTitleOffset(0.9);
+ TMultiGraph* ampGraphs = ampGraphVect[iPole];
+ ampGraphs->Draw( "a" );
- TString yLabel("Production Pole "); yLabel += iPole+1;
+ TAxis* xAxis = ampGraphs->GetXaxis();
+ xAxis->SetTitle( "m(#pi^{+}#pi^{-}) (GeV/c^{2})" );
+ xAxis->SetLabelSize( 0.05 );
+ xAxis->SetTitleSize( 0.05 );
+ xAxis->CenterTitle( kTRUE );
+ xAxis->SetTitleOffset( 0.9 );
- TAxis* yAxis = ampGraphs->GetYaxis();
- yAxis->SetTitleOffset(0.9);
- yAxis->SetTitle(yLabel.Data());
- yAxis->SetLabelSize(0.05);
- yAxis->SetTitleSize(0.05);
- yAxis->CenterTitle(kTRUE);
+ TString yLabel( "Production Pole " );
+ yLabel += iPole + 1;
- theCanvas->Update();
+ TAxis* yAxis = ampGraphs->GetYaxis();
+ yAxis->SetTitleOffset( 0.9 );
+ yAxis->SetTitle( yLabel.Data() );
+ yAxis->SetLabelSize( 0.05 );
+ yAxis->SetTitleSize( 0.05 );
+ yAxis->CenterTitle( kTRUE );
+ theCanvas->Update();
}
// Legend
- theCanvas->cd(6);
+ theCanvas->cd( 6 );
ampLegend->Draw();
- theCanvas->Print("ProdPoleAmp.png");
- if (doEPS) {theCanvas->Print("ProdPoleAmp.eps");}
+ theCanvas->Print( "ProdPoleAmp.png" );
+ if ( doEPS ) {
+ theCanvas->Print( "ProdPoleAmp.eps" );
+ }
// Cleanup
std::vector<TMultiGraph*>::iterator argIter;
- for (argIter = argGraphVect.begin(); argIter != argGraphVect.end(); ++argIter) {
-
- TMultiGraph* theGraph = *argIter;
- delete theGraph;
+ for ( argIter = argGraphVect.begin(); argIter != argGraphVect.end(); ++argIter ) {
+ TMultiGraph* theGraph = *argIter;
+ delete theGraph;
}
std::vector<TMultiGraph*>::iterator ampIter;
- for (ampIter = ampGraphVect.begin(); ampIter != ampGraphVect.end(); ++ampIter) {
-
- TMultiGraph* theGraph = *ampIter;
- delete theGraph;
+ for ( ampIter = ampGraphVect.begin(); ampIter != ampGraphVect.end(); ++ampIter ) {
+ TMultiGraph* theGraph = *ampIter;
+ delete theGraph;
}
std::vector<LauKMatrixProdPole*>::iterator poleIter;
- for (poleIter = poleVect.begin(); poleIter != poleVect.end(); ++poleIter) {
-
- LauKMatrixProdPole* thePole = *poleIter;
- delete thePole;
+ for ( poleIter = poleVect.begin(); poleIter != poleVect.end(); ++poleIter ) {
+ LauKMatrixProdPole* thePole = *poleIter;
+ delete thePole;
}
delete theDaughters;
delete propFull;
delete ampLegend;
delete theCanvas;
-
}
-void doProdSVPPlots(Bool_t useProdAdler) {
+void doProdSVPPlots( Bool_t useProdAdler )
+{
// Create plots of the SVP production amplitudes using the first row
// of the propagator (for pipi). Each SVP is a pipi -> channel mode
- Int_t resPairInt(1);
- Int_t nChannels(5);
- Int_t KMatrixIndex(1); // pi pi S-wave
- Int_t nSVPs(5);
+ Int_t resPairInt( 1 );
+ Int_t nChannels( 5 );
+ Int_t KMatrixIndex( 1 ); // pi pi S-wave
+ Int_t nSVPs( 5 );
// Mass range for plots
- Double_t mMin(0.28);
- Double_t mMax(2.0);
+ Double_t mMin( 0.28 );
+ Double_t mMax( 2.0 );
Int_t nSteps = 2000;
- Double_t dm = (mMax - mMin)/(nSteps*1.0);
+ Double_t dm = ( mMax - mMin ) / ( nSteps * 1.0 );
// Find the point numbers for m = mMin, 0.5, 0.75, 1, 1.25, 1.5, 1.75 and 2 GeV
std::vector<Int_t> points;
std::vector<Int_t> colours, styles;
std::vector<Double_t> massPoints;
- massPoints.push_back(mMin); massPoints.push_back(0.5); massPoints.push_back(0.75);
- massPoints.push_back(1.0); massPoints.push_back(1.25); massPoints.push_back(1.5);
- massPoints.push_back(1.75); massPoints.push_back(1.99999);
-
- Int_t NMain = static_cast<Int_t>(massPoints.size());
- for (Int_t iP = 0; iP < NMain; iP++) {
-
- Int_t pointInt = static_cast<Int_t>((massPoints[iP] - mMin)/dm);
- points.push_back(pointInt);
-
- // Red or Blue
- Int_t iColour = kRed;
- if (iP > 3) {iColour = kBlue;}
- Int_t iStyle = kFullCircle;
- Int_t iPMod = iP%4;
- if (iPMod == 1) {
- iStyle = kOpenCircle;
- } else if (iPMod == 2) {
- iStyle = kFullSquare;
- } else if (iPMod == 3) {
- iStyle = kOpenSquare;
- }
-
- colours.push_back(iColour);
- styles.push_back(iStyle);
-
+ massPoints.push_back( mMin );
+ massPoints.push_back( 0.5 );
+ massPoints.push_back( 0.75 );
+ massPoints.push_back( 1.0 );
+ massPoints.push_back( 1.25 );
+ massPoints.push_back( 1.5 );
+ massPoints.push_back( 1.75 );
+ massPoints.push_back( 1.99999 );
+
+ Int_t NMain = static_cast<Int_t>( massPoints.size() );
+ for ( Int_t iP = 0; iP < NMain; iP++ ) {
+
+ Int_t pointInt = static_cast<Int_t>( ( massPoints[iP] - mMin ) / dm );
+ points.push_back( pointInt );
+
+ // Red or Blue
+ Int_t iColour = kRed;
+ if ( iP > 3 ) {
+ iColour = kBlue;
+ }
+ Int_t iStyle = kFullCircle;
+ Int_t iPMod = iP % 4;
+ if ( iPMod == 1 ) {
+ iStyle = kOpenCircle;
+ } else if ( iPMod == 2 ) {
+ iStyle = kFullSquare;
+ } else if ( iPMod == 3 ) {
+ iStyle = kOpenSquare;
+ }
+
+ colours.push_back( iColour );
+ styles.push_back( iStyle );
}
- Double_t mPi = 0.13957018;
- Double_t mPiSq = mPi*mPi;
- Double_t mB = 5.279;
- Double_t mBSq = mB*mB;
- Double_t mSqTerm = 2.0*((mBSq/3.0) + mPiSq);
+ Double_t mPi = 0.13957018;
+ Double_t mPiSq = mPi * mPi;
+ Double_t mB = 5.279;
+ Double_t mBSq = mB * mB;
+ Double_t mSqTerm = 2.0 * ( ( mBSq / 3.0 ) + mPiSq );
// Full K-matrix parameterisation
- TString KFile("B3piKMatrixCoeff.dat");
- LauKMatrixPropagator* propFull = new LauKMatrixPropagator("propFull", KFile,
- resPairInt, nChannels,
- nSVPs, KMatrixIndex);
+ TString KFile( "B3piKMatrixCoeff.dat" );
+ LauKMatrixPropagator* propFull =
+ new LauKMatrixPropagator( "propFull", KFile, resPairInt, nChannels, nSVPs, KMatrixIndex );
// Define kinematics pointer
- Bool_t squareDP = kTRUE;
- LauDaughters* theDaughters = new LauDaughters("B+", "pi+", "pi+", "pi-", squareDP);
+ Bool_t squareDP = kTRUE;
+ LauDaughters* theDaughters = new LauDaughters( "B+", "pi+", "pi+", "pi-", squareDP );
// Kinematics
LauKinematics* kinematics = theDaughters->getKinematics();
std::vector<LauKMatrixProdSVP*> SVPVect;
- Int_t iSVP(0);
- for (iSVP = 0; iSVP < nSVPs; iSVP++) {
+ Int_t iSVP( 0 );
+ for ( iSVP = 0; iSVP < nSVPs; iSVP++ ) {
- TString SVPName("SVP"); SVPName += iSVP;
+ TString SVPName( "SVP" );
+ SVPName += iSVP;
- LauKMatrixProdSVP* theSVP = new LauKMatrixProdSVP(SVPName, iSVP+1, resPairInt,
- propFull, theDaughters, useProdAdler);
-
- SVPVect.push_back(theSVP);
+ LauKMatrixProdSVP* theSVP =
+ new LauKMatrixProdSVP( SVPName, iSVP + 1, resPairInt, propFull, theDaughters, useProdAdler );
+ SVPVect.push_back( theSVP );
}
// Argand diagram graphs (full plot, then others showing only selected points)
std::vector<TMultiGraph*> argGraphVect;
// Real, imaginary and magnitude amplitude multigraphs
std::vector<TMultiGraph*> ampGraphVect;
// TLegend for argand graphs
- TLegend* argLegend = new TLegend(0.1, 0.1, 0.7, 0.995);
- argLegend->SetHeader("m(#pi^{+}#pi^{-}) points (GeV/c^{2})");
- argLegend->SetTextSize(0.075);
- Bool_t initArgLegend(kFALSE);
+ TLegend* argLegend = new TLegend( 0.1, 0.1, 0.7, 0.995 );
+ argLegend->SetHeader( "m(#pi^{+}#pi^{-}) points (GeV/c^{2})" );
+ argLegend->SetTextSize( 0.075 );
+ Bool_t initArgLegend( kFALSE );
// Legend for the graphs (same for all multigraphs)
- TLegend* ampLegend = new TLegend(0.2, 0.2, 0.8, 0.7);
- ampLegend->SetHeader("Production SVP components");
- Bool_t initLegend(kFALSE);
-
- for (iSVP = 0; iSVP < nSVPs; iSVP++) {
-
- // Argand plot showing phase motion
- TMultiGraph* argGraphs = new TMultiGraph();
- TString argMultiLabel("SVPMultiArg_"); argMultiLabel += iSVP;
- argGraphs->SetName(argMultiLabel.Data());
- argGraphVect.push_back(argGraphs);
-
- TGraph* argGraph = new TGraph(nSteps);
- TString argLabel("SVPArg_"); argLabel += iSVP;
- argGraph->SetName(argLabel.Data());
- argGraph->SetLineWidth(1);
- argGraphs->Add(argGraph, "lp");
-
- // Argand graphs showing only one highlighted point
- for (Int_t iG = 0; iG < NMain; iG++) {
-
- TGraph* pointGraph = new TGraph(1);
- TString pointLabel("SVPPoint_"); pointLabel += iG;
-
- pointGraph->SetName(pointLabel.Data());
- pointGraph->SetMarkerColor(colours[iG]);
- pointGraph->SetMarkerSize(1.1);
- pointGraph->SetMarkerStyle(styles[iG]);
- argGraphs->Add(pointGraph, "p");
-
- }
-
- if (!initArgLegend) {
- TList* argList = argGraphs->GetListOfGraphs();
- for (Int_t iG = 0; iG < NMain; iG++) {
- TGraph* pointGraph = dynamic_cast<TGraph*>(argList->At(iG+1));
- argLegend->AddEntry(pointGraph, Form("%.2f",massPoints[iG]), "p");
- initArgLegend = kTRUE;
- }
- }
-
- // Real, imaginary and magnitude amplitude
- TMultiGraph* ampGraphs = new TMultiGraph();
- TString multiLabel("SVPMulti_"); multiLabel += iSVP;
- ampGraphs->SetName(multiLabel.Data());
- ampGraphVect.push_back(ampGraphs);
-
- TGraph* realGraph = new TGraph(nSteps);
- TString realLabel("SVPReal_"); realLabel += iSVP;
- realGraph->SetName(realLabel.Data());
- realGraph->SetLineColor(kRed);
- realGraph->SetMarkerColor(kRed);
- realGraph->SetLineWidth(1);
- ampGraphs->Add(realGraph, "lp");
-
- TGraph* imagGraph = new TGraph(nSteps);
- TString imagLabel("SVPImag_"); imagLabel += iSVP;
- imagGraph->SetName(imagLabel.Data());
- imagGraph->SetLineColor(kBlue);
- imagGraph->SetMarkerColor(kBlue);
- imagGraph->SetLineWidth(1);
- ampGraphs->Add(imagGraph, "lp");
-
- TGraph* magGraph = new TGraph(nSteps);
- TString magLabel("SVPMag_"); magLabel += iSVP;
- magGraph->SetName(magLabel.Data());
- magGraph->SetLineColor(kBlack);
- magGraph->SetMarkerColor(kBlack);
- magGraph->SetLineWidth(1);
- ampGraphs->Add(magGraph, "lp");
-
- if (!initLegend) {
-
- ampLegend->AddEntry(realGraph, "Real part", "l");
- ampLegend->AddEntry(imagGraph, "Imag part", "l");
- ampLegend->AddEntry(magGraph, "Magnitude", "l");
-
- initLegend = kTRUE;
-
- }
-
+ TLegend* ampLegend = new TLegend( 0.2, 0.2, 0.8, 0.7 );
+ ampLegend->SetHeader( "Production SVP components" );
+ Bool_t initLegend( kFALSE );
+
+ for ( iSVP = 0; iSVP < nSVPs; iSVP++ ) {
+
+ // Argand plot showing phase motion
+ TMultiGraph* argGraphs = new TMultiGraph();
+ TString argMultiLabel( "SVPMultiArg_" );
+ argMultiLabel += iSVP;
+ argGraphs->SetName( argMultiLabel.Data() );
+ argGraphVect.push_back( argGraphs );
+
+ TGraph* argGraph = new TGraph( nSteps );
+ TString argLabel( "SVPArg_" );
+ argLabel += iSVP;
+ argGraph->SetName( argLabel.Data() );
+ argGraph->SetLineWidth( 1 );
+ argGraphs->Add( argGraph, "lp" );
+
+ // Argand graphs showing only one highlighted point
+ for ( Int_t iG = 0; iG < NMain; iG++ ) {
+
+ TGraph* pointGraph = new TGraph( 1 );
+ TString pointLabel( "SVPPoint_" );
+ pointLabel += iG;
+
+ pointGraph->SetName( pointLabel.Data() );
+ pointGraph->SetMarkerColor( colours[iG] );
+ pointGraph->SetMarkerSize( 1.1 );
+ pointGraph->SetMarkerStyle( styles[iG] );
+ argGraphs->Add( pointGraph, "p" );
+ }
+
+ if ( ! initArgLegend ) {
+ TList* argList = argGraphs->GetListOfGraphs();
+ for ( Int_t iG = 0; iG < NMain; iG++ ) {
+ TGraph* pointGraph = dynamic_cast<TGraph*>( argList->At( iG + 1 ) );
+ argLegend->AddEntry( pointGraph, Form( "%.2f", massPoints[iG] ), "p" );
+ initArgLegend = kTRUE;
+ }
+ }
+
+ // Real, imaginary and magnitude amplitude
+ TMultiGraph* ampGraphs = new TMultiGraph();
+ TString multiLabel( "SVPMulti_" );
+ multiLabel += iSVP;
+ ampGraphs->SetName( multiLabel.Data() );
+ ampGraphVect.push_back( ampGraphs );
+
+ TGraph* realGraph = new TGraph( nSteps );
+ TString realLabel( "SVPReal_" );
+ realLabel += iSVP;
+ realGraph->SetName( realLabel.Data() );
+ realGraph->SetLineColor( kRed );
+ realGraph->SetMarkerColor( kRed );
+ realGraph->SetLineWidth( 1 );
+ ampGraphs->Add( realGraph, "lp" );
+
+ TGraph* imagGraph = new TGraph( nSteps );
+ TString imagLabel( "SVPImag_" );
+ imagLabel += iSVP;
+ imagGraph->SetName( imagLabel.Data() );
+ imagGraph->SetLineColor( kBlue );
+ imagGraph->SetMarkerColor( kBlue );
+ imagGraph->SetLineWidth( 1 );
+ ampGraphs->Add( imagGraph, "lp" );
+
+ TGraph* magGraph = new TGraph( nSteps );
+ TString magLabel( "SVPMag_" );
+ magLabel += iSVP;
+ magGraph->SetName( magLabel.Data() );
+ magGraph->SetLineColor( kBlack );
+ magGraph->SetMarkerColor( kBlack );
+ magGraph->SetLineWidth( 1 );
+ ampGraphs->Add( magGraph, "lp" );
+
+ if ( ! initLegend ) {
+
+ ampLegend->AddEntry( realGraph, "Real part", "l" );
+ ampLegend->AddEntry( imagGraph, "Imag part", "l" );
+ ampLegend->AddEntry( magGraph, "Magnitude", "l" );
+
+ initLegend = kTRUE;
+ }
}
- for (Int_t iM = 0; iM < nSteps; iM++) {
-
- Double_t m = dm*iM + mMin;
- Double_t s = m*m;
-
- // Update kinematics. The K-matrix only really needs s = m23Sq, i.e. m13Sq is "ignored".
- // Here, take the diagonal where m12Sq = 0.5*(mB^2 + 3mpi^2), the DP centre and use
- // m13Sq = mBSq + 3mPiSq - m12Sq - m23Sq
- Double_t m13Sq = mSqTerm - s;
+ for ( Int_t iM = 0; iM < nSteps; iM++ ) {
- kinematics->updateKinematics(m13Sq, s);
+ Double_t m = dm * iM + mMin;
+ Double_t s = m * m;
- for (iSVP = 0; iSVP < nSVPs; iSVP++) {
+ // Update kinematics. The K-matrix only really needs s = m23Sq, i.e. m13Sq is "ignored".
+ // Here, take the diagonal where m12Sq = 0.5*(mB^2 + 3mpi^2), the DP centre and use
+ // m13Sq = mBSq + 3mPiSq - m12Sq - m23Sq
+ Double_t m13Sq = mSqTerm - s;
- // Get the amplitude for the ith SVP
- LauComplex amp = SVPVect[iSVP]->amplitude(kinematics);
- Double_t reAmp = amp.re();
- Double_t imAmp = amp.im();
- Double_t magAmp = sqrt(reAmp*reAmp + imAmp*imAmp);
+ kinematics->updateKinematics( m13Sq, s );
- // Argand diagrams: full plot and only selected points
- TMultiGraph* argGraphs = argGraphVect[iSVP];
- TList* argList = argGraphs->GetListOfGraphs();
+ for ( iSVP = 0; iSVP < nSVPs; iSVP++ ) {
- TGraph* argGraph = dynamic_cast<TGraph*>(argList->At(0));
- argGraph->SetPoint(iM, reAmp, imAmp);
+ // Get the amplitude for the ith SVP
+ LauComplex amp = SVPVect[iSVP]->amplitude( kinematics );
+ Double_t reAmp = amp.re();
+ Double_t imAmp = amp.im();
+ Double_t magAmp = sqrt( reAmp * reAmp + imAmp * imAmp );
- // Graphs showing specific points
- for (Int_t iP = 0; iP < NMain; iP++) {
+ // Argand diagrams: full plot and only selected points
+ TMultiGraph* argGraphs = argGraphVect[iSVP];
+ TList* argList = argGraphs->GetListOfGraphs();
- if (points[iP] == iM) {
- TGraph* pointGraph = dynamic_cast<TGraph*>(argList->At(iP+1));
- pointGraph->SetPoint(0, reAmp, imAmp);
- }
+ TGraph* argGraph = dynamic_cast<TGraph*>( argList->At( 0 ) );
+ argGraph->SetPoint( iM, reAmp, imAmp );
- }
+ // Graphs showing specific points
+ for ( Int_t iP = 0; iP < NMain; iP++ ) {
- // Amplitude multigraphs
- TMultiGraph* ampGraphs = ampGraphVect[iSVP];
- TList* graphList = ampGraphs->GetListOfGraphs();
+ if ( points[iP] == iM ) {
+ TGraph* pointGraph = dynamic_cast<TGraph*>( argList->At( iP + 1 ) );
+ pointGraph->SetPoint( 0, reAmp, imAmp );
+ }
+ }
- TGraph* realGraph = dynamic_cast<TGraph*>(graphList->At(0));
- realGraph->SetPoint(iM, m, reAmp);
+ // Amplitude multigraphs
+ TMultiGraph* ampGraphs = ampGraphVect[iSVP];
+ TList* graphList = ampGraphs->GetListOfGraphs();
- TGraph* imagGraph = dynamic_cast<TGraph*>(graphList->At(1));
- imagGraph->SetPoint(iM, m, imAmp);
+ TGraph* realGraph = dynamic_cast<TGraph*>( graphList->At( 0 ) );
+ realGraph->SetPoint( iM, m, reAmp );
- TGraph* magGraph = dynamic_cast<TGraph*>(graphList->At(2));
- magGraph->SetPoint(iM, m, magAmp);
-
- }
+ TGraph* imagGraph = dynamic_cast<TGraph*>( graphList->At( 1 ) );
+ imagGraph->SetPoint( iM, m, imAmp );
+ TGraph* magGraph = dynamic_cast<TGraph*>( graphList->At( 2 ) );
+ magGraph->SetPoint( iM, m, magAmp );
+ }
}
// Create plots
- TCanvas* theCanvas = new TCanvas("theCanvas", "", 1000, 1000);
- gROOT->SetStyle("Plain");
- gStyle->SetOptStat(0);
+ TCanvas* theCanvas = new TCanvas( "theCanvas", "", 1000, 1000 );
+ gROOT->SetStyle( "Plain" );
+ gStyle->SetOptStat( 0 );
theCanvas->Clear();
theCanvas->UseCurrentStyle();
- theCanvas->Divide(2,3);
+ theCanvas->Divide( 2, 3 );
// Argand plots
- for (iSVP = 0; iSVP < nSVPs; iSVP++) {
-
- theCanvas->cd(iSVP+1);
- TMultiGraph* argGraphs = argGraphVect[iSVP];
- argGraphs->Draw("a");
-
- TString title("Production SVP "); title += iSVP+1;
- argGraphs->SetTitle(title.Data());
-
- TAxis* xAxis = argGraphs->GetXaxis();
- xAxis->SetTitle("Real");
- xAxis->SetLabelSize(0.05);
- xAxis->SetTitleSize(0.05);
- xAxis->CenterTitle(kTRUE);
- xAxis->SetTitleOffset(0.9);
-
- TAxis* yAxis = argGraphs->GetYaxis();
- yAxis->SetTitle("Imag");
- yAxis->SetLabelSize(0.05);
- yAxis->SetTitleSize(0.05);
- yAxis->CenterTitle(kTRUE);
-
- theCanvas->Update();
-
+ for ( iSVP = 0; iSVP < nSVPs; iSVP++ ) {
+
+ theCanvas->cd( iSVP + 1 );
+ TMultiGraph* argGraphs = argGraphVect[iSVP];
+ argGraphs->Draw( "a" );
+
+ TString title( "Production SVP " );
+ title += iSVP + 1;
+ argGraphs->SetTitle( title.Data() );
+
+ TAxis* xAxis = argGraphs->GetXaxis();
+ xAxis->SetTitle( "Real" );
+ xAxis->SetLabelSize( 0.05 );
+ xAxis->SetTitleSize( 0.05 );
+ xAxis->CenterTitle( kTRUE );
+ xAxis->SetTitleOffset( 0.9 );
+
+ TAxis* yAxis = argGraphs->GetYaxis();
+ yAxis->SetTitle( "Imag" );
+ yAxis->SetLabelSize( 0.05 );
+ yAxis->SetTitleSize( 0.05 );
+ yAxis->CenterTitle( kTRUE );
+
+ theCanvas->Update();
}
- theCanvas->cd(6);
+ theCanvas->cd( 6 );
argLegend->Draw();
- theCanvas->Print("ProdSVPArgand.png");
- if (doEPS) {theCanvas->Print("ProdSVPArgand.eps");}
+ theCanvas->Print( "ProdSVPArgand.png" );
+ if ( doEPS ) {
+ theCanvas->Print( "ProdSVPArgand.eps" );
+ }
// Amplitude plots
theCanvas->Clear();
theCanvas->UseCurrentStyle();
- theCanvas->Divide(2,3);
+ theCanvas->Divide( 2, 3 );
- for (iSVP = 0; iSVP < nSVPs; iSVP++) {
+ for ( iSVP = 0; iSVP < nSVPs; iSVP++ ) {
- theCanvas->cd(iSVP+1);
+ theCanvas->cd( iSVP + 1 );
- TMultiGraph* ampGraphs = ampGraphVect[iSVP];
- ampGraphs->Draw("a");
+ TMultiGraph* ampGraphs = ampGraphVect[iSVP];
+ ampGraphs->Draw( "a" );
- TAxis* xAxis = ampGraphs->GetXaxis();
- xAxis->SetTitle("m(#pi^{+}#pi^{-}) (GeV/c^{2})");
- xAxis->SetLabelSize(0.05);
- xAxis->SetTitleSize(0.05);
- xAxis->CenterTitle(kTRUE);
- xAxis->SetTitleOffset(0.9);
+ TAxis* xAxis = ampGraphs->GetXaxis();
+ xAxis->SetTitle( "m(#pi^{+}#pi^{-}) (GeV/c^{2})" );
+ xAxis->SetLabelSize( 0.05 );
+ xAxis->SetTitleSize( 0.05 );
+ xAxis->CenterTitle( kTRUE );
+ xAxis->SetTitleOffset( 0.9 );
- TAxis* yAxis = ampGraphs->GetYaxis();
+ TAxis* yAxis = ampGraphs->GetYaxis();
- TString yLabel("Production SVP "); yLabel += iSVP+1;
+ TString yLabel( "Production SVP " );
+ yLabel += iSVP + 1;
- yAxis->SetTitleOffset(0.9);
- yAxis->SetTitle(yLabel.Data());
- yAxis->SetLabelSize(0.05);
- yAxis->SetTitleSize(0.05);
- yAxis->CenterTitle(kTRUE);
-
- theCanvas->Update();
+ yAxis->SetTitleOffset( 0.9 );
+ yAxis->SetTitle( yLabel.Data() );
+ yAxis->SetLabelSize( 0.05 );
+ yAxis->SetTitleSize( 0.05 );
+ yAxis->CenterTitle( kTRUE );
+ theCanvas->Update();
}
// Legend
- theCanvas->cd(6);
+ theCanvas->cd( 6 );
ampLegend->Draw();
- theCanvas->Print("ProdSVPAmp.png");
- if (doEPS) {theCanvas->Print("ProdSVPAmp.eps");}
+ theCanvas->Print( "ProdSVPAmp.png" );
+ if ( doEPS ) {
+ theCanvas->Print( "ProdSVPAmp.eps" );
+ }
// Cleanup
std::vector<TMultiGraph*>::iterator argIter;
- for (argIter = argGraphVect.begin(); argIter != argGraphVect.end(); ++argIter) {
-
- TMultiGraph* theGraph = *argIter;
- delete theGraph;
+ for ( argIter = argGraphVect.begin(); argIter != argGraphVect.end(); ++argIter ) {
+ TMultiGraph* theGraph = *argIter;
+ delete theGraph;
}
std::vector<TMultiGraph*>::iterator ampIter;
- for (ampIter = ampGraphVect.begin(); ampIter != ampGraphVect.end(); ++ampIter) {
-
- TMultiGraph* theGraph = *ampIter;
- delete theGraph;
+ for ( ampIter = ampGraphVect.begin(); ampIter != ampGraphVect.end(); ++ampIter ) {
+ TMultiGraph* theGraph = *ampIter;
+ delete theGraph;
}
std::vector<LauKMatrixProdSVP*>::iterator SVPIter;
- for (SVPIter = SVPVect.begin(); SVPIter != SVPVect.end(); ++SVPIter) {
-
- LauKMatrixProdSVP* theSVP = *SVPIter;
- delete theSVP;
+ for ( SVPIter = SVPVect.begin(); SVPIter != SVPVect.end(); ++SVPIter ) {
+ LauKMatrixProdSVP* theSVP = *SVPIter;
+ delete theSVP;
}
delete theDaughters;
delete propFull;
delete ampLegend;
delete theCanvas;
-
}
+int main( const int argc, const char** argv )
+{
-int main(const int argc, const char** argv) {
+ Int_t prodAdlerInt( 0 ), epsInt( 0 );
- Int_t prodAdlerInt(0), epsInt(0);
-
- if (argc > 1) {
- prodAdlerInt = std::atoi(argv[1]);
- if (prodAdlerInt != 0) {doProdAdler = kTRUE;}
+ if ( argc > 1 ) {
+ prodAdlerInt = std::atoi( argv[1] );
+ if ( prodAdlerInt != 0 ) {
+ doProdAdler = kTRUE;
+ }
}
- if (argc > 2) {
- epsInt = std::atoi(argv[2]);
- if (epsInt != 0) {doEPS = kTRUE;}
+ if ( argc > 2 ) {
+ epsInt = std::atoi( argv[2] );
+ if ( epsInt != 0 ) {
+ doEPS = kTRUE;
+ }
}
// Scattering K-matrix components
doKScattPlots();
// First row of the propagator (pi pi channel)
doPropagatorPlots();
// SVP and SVP production amplitudes (pi pi channel)
- doProdPolePlots(doProdAdler);
- doProdSVPPlots(doProdAdler);
+ doProdPolePlots( doProdAdler );
+ doProdSVPPlots( doProdAdler );
return 0;
-
}
diff --git a/examples/CalcChiSq.cc b/examples/CalcChiSq.cc
index 9fd61a3..cc84812 100644
--- a/examples/CalcChiSq.cc
+++ b/examples/CalcChiSq.cc
@@ -1,44 +1,44 @@
/*
Copyright 2013 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
#include "LauCalcChiSq.hh"
#include "TString.h"
-int main(const int argc, const char** argv)
+int main( const int argc, const char** argv )
{
- TString inputFile("chiSqInput.txt");
+ TString inputFile( "chiSqInput.txt" );
- if (argc > 1) {inputFile = TString(argv[1]);}
+ if ( argc > 1 ) {
+ inputFile = TString( argv[1] );
+ }
- LauCalcChiSq a(inputFile);
+ LauCalcChiSq a( inputFile );
- //a.setVerbose(kTRUE);
- a.run();
-
- return 0;
+ //a.setVerbose(kTRUE);
+ a.run();
+ return 0;
}
-
diff --git a/examples/FlatPhaseSpace-CustomMasses.cc b/examples/FlatPhaseSpace-CustomMasses.cc
index a771b8c..8a1004f 100644
--- a/examples/FlatPhaseSpace-CustomMasses.cc
+++ b/examples/FlatPhaseSpace-CustomMasses.cc
@@ -1,100 +1,101 @@
/*
Copyright 2022 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
-#include <cstdlib>
-#include <iostream>
-#include <string>
-#include <vector>
+#include "LauKinematics.hh"
+#include "LauRandom.hh"
#include "TFile.h"
#include "TRandom.h"
#include "TTree.h"
-#include "LauKinematics.hh"
-#include "LauRandom.hh"
+#include <cstdlib>
+#include <iostream>
+#include <string>
+#include <vector>
/*
* Generates toy MC uniformly in the Dalitz plot
*
* Usage: FlatPhaseSpace-CustomMasses <parent mass> <child_1 mass> <child_2 mass> <child_3 mass> <nevents> <output file name>
*/
int main( int argc, char** argv )
{
- // Convert the command-line arguments into a useful format
- const std::vector<std::string> cmdLineArgs{ argv, argv+argc };
-
- if ( cmdLineArgs.size() != 7 ) {
- std::cout << "Usage: " << cmdLineArgs[0] << " <parent mass> <child_1 mass> <child_2 mass> <child_3 mass> <nevents> <output file name>" << std::endl;
- return 0;
- }
-
- const Double_t parent_mass { std::stod( cmdLineArgs[1] ) };
- const Double_t child_1_mass { std::stod( cmdLineArgs[2] ) };
- const Double_t child_2_mass { std::stod( cmdLineArgs[3] ) };
- const Double_t child_3_mass { std::stod( cmdLineArgs[4] ) };
- const ULong_t nEvents { std::stoul( cmdLineArgs[5] ) };
- const TString outputFileName { cmdLineArgs[6] };
-
- const Bool_t squareDP { kTRUE };
-
- LauKinematics kinematics { child_1_mass, child_2_mass, child_3_mass, parent_mass, squareDP };
-
- Double_t m12Sq{0.0}, m13Sq{0.0}, m23Sq{0.0}, mPrime{0.0}, thPrime{0.0};
-
- TFile * file { TFile::Open(outputFileName,"recreate") };
- TTree * tree { new TTree("genResults","genResults") };
-
- tree->Branch("m12Sq",&m12Sq,"m12Sq/D");
- tree->Branch("m13Sq",&m13Sq,"m13Sq/D");
- tree->Branch("m23Sq",&m23Sq,"m23Sq/D");
- if ( squareDP ) {
- tree->Branch("mPrime",&mPrime,"mPrime/D");
- tree->Branch("thPrime",&thPrime,"thPrime/D");
- }
-
- for ( ULong_t i{0}; i < nEvents; ++i ) {
-
- if ( nEvents > 1000 && i%(nEvents/1000)==0 ) {
- std::cout << "Generating event " << i << std::endl;
- }
-
- kinematics.genFlatPhaseSpace( m13Sq, m23Sq );
- kinematics.updateKinematics( m13Sq, m23Sq );
- m12Sq = kinematics.getm12Sq();
- if ( squareDP ) {
- mPrime = kinematics.getmPrime();
- thPrime = kinematics.getThetaPrime();
- }
-
- tree->Fill();
- }
-
- file->Write();
- file->Close();
- delete file;
-
- return EXIT_SUCCESS;
+ // Convert the command-line arguments into a useful format
+ const std::vector<std::string> cmdLineArgs { argv, argv + argc };
+
+ if ( cmdLineArgs.size() != 7 ) {
+ std::cout << "Usage: " << cmdLineArgs[0]
+ << " <parent mass> <child_1 mass> <child_2 mass> <child_3 mass> <nevents> <output file name>"
+ << std::endl;
+ return 0;
+ }
+
+ const Double_t parent_mass { std::stod( cmdLineArgs[1] ) };
+ const Double_t child_1_mass { std::stod( cmdLineArgs[2] ) };
+ const Double_t child_2_mass { std::stod( cmdLineArgs[3] ) };
+ const Double_t child_3_mass { std::stod( cmdLineArgs[4] ) };
+ const ULong_t nEvents { std::stoul( cmdLineArgs[5] ) };
+ const TString outputFileName { cmdLineArgs[6] };
+
+ const Bool_t squareDP { kTRUE };
+
+ LauKinematics kinematics { child_1_mass, child_2_mass, child_3_mass, parent_mass, squareDP };
+
+ Double_t m12Sq { 0.0 }, m13Sq { 0.0 }, m23Sq { 0.0 }, mPrime { 0.0 }, thPrime { 0.0 };
+
+ TFile* file { TFile::Open( outputFileName, "recreate" ) };
+ TTree* tree { new TTree( "genResults", "genResults" ) };
+
+ tree->Branch( "m12Sq", &m12Sq, "m12Sq/D" );
+ tree->Branch( "m13Sq", &m13Sq, "m13Sq/D" );
+ tree->Branch( "m23Sq", &m23Sq, "m23Sq/D" );
+ if ( squareDP ) {
+ tree->Branch( "mPrime", &mPrime, "mPrime/D" );
+ tree->Branch( "thPrime", &thPrime, "thPrime/D" );
+ }
+
+ for ( ULong_t i { 0 }; i < nEvents; ++i ) {
+
+ if ( nEvents > 1000 && i % ( nEvents / 1000 ) == 0 ) {
+ std::cout << "Generating event " << i << std::endl;
+ }
+
+ kinematics.genFlatPhaseSpace( m13Sq, m23Sq );
+ kinematics.updateKinematics( m13Sq, m23Sq );
+ m12Sq = kinematics.getm12Sq();
+ if ( squareDP ) {
+ mPrime = kinematics.getmPrime();
+ thPrime = kinematics.getThetaPrime();
+ }
+
+ tree->Fill();
+ }
+
+ file->Write();
+ file->Close();
+ delete file;
+
+ return EXIT_SUCCESS;
}
-
diff --git a/examples/FlatPhaseSpace.cc b/examples/FlatPhaseSpace.cc
index c505a9b..4ffcc65 100644
--- a/examples/FlatPhaseSpace.cc
+++ b/examples/FlatPhaseSpace.cc
@@ -1,102 +1,106 @@
/*
Copyright 2022 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
-#include <cstdlib>
-#include <iostream>
-#include <string>
-#include <vector>
+#include "LauDaughters.hh"
+#include "LauKinematics.hh"
+#include "LauRandom.hh"
#include "TFile.h"
#include "TRandom.h"
#include "TTree.h"
-#include "LauDaughters.hh"
-#include "LauKinematics.hh"
-#include "LauRandom.hh"
+#include <cstdlib>
+#include <iostream>
+#include <string>
+#include <vector>
/*
* Generates toy MC uniformly in the Dalitz plot
*
* Usage: FlatPhaseSpace <parent> <child_1> <child_2> <child_3> <nevents>
*/
int main( int argc, char** argv )
{
- // Convert the command-line arguments into a useful format
- const std::vector<TString> cmdLineArgs{ argv, argv+argc };
-
- if ( cmdLineArgs.size() != 6 ) {
- std::cout << "Usage: " << cmdLineArgs[0] << " <parent> <child_1> <child_2> <child_3> <nevents>" << std::endl;
- return 0;
- }
-
- const TString& parent { cmdLineArgs[1] };
- const TString& child_1 { cmdLineArgs[2] };
- const TString& child_2 { cmdLineArgs[3] };
- const TString& child_3 { cmdLineArgs[4] };
- const ULong_t nEvents { std::stoul( cmdLineArgs[5].Data() ) };
-
- const Bool_t squareDP { kTRUE };
-
- LauDaughters* daughters { new LauDaughters(parent, child_1, child_2, child_3, squareDP) };
- LauKinematics* kinematics { daughters->getKinematics() };
-
- Double_t m12Sq{0.0}, m13Sq{0.0}, m23Sq{0.0}, mPrime{0.0}, thPrime{0.0};
-
- const TString outputFileName { TString::Format( "%s_%s_%s_%s.root", daughters->getSanitisedNameParent().Data(), daughters->getSanitisedNameDaug1().Data(), daughters->getSanitisedNameDaug2().Data(), daughters->getSanitisedNameDaug3().Data() ) };
- TFile * file { TFile::Open(outputFileName,"recreate") };
- TTree * tree { new TTree("genResults","genResults") };
-
- tree->Branch("m12Sq",&m12Sq,"m12Sq/D");
- tree->Branch("m13Sq",&m13Sq,"m13Sq/D");
- tree->Branch("m23Sq",&m23Sq,"m23Sq/D");
- if ( squareDP ) {
- tree->Branch("mPrime",&mPrime,"mPrime/D");
- tree->Branch("thPrime",&thPrime,"thPrime/D");
- }
-
- for ( ULong_t i{0}; i < nEvents; ++i ) {
-
- if ( nEvents > 1000 && i%(nEvents/1000)==0 ) {
- std::cout << "Generating event " << i << std::endl;
- }
-
- kinematics->genFlatPhaseSpace( m13Sq, m23Sq );
- kinematics->updateKinematics( m13Sq, m23Sq );
- m12Sq = kinematics->getm12Sq();
- if ( squareDP ) {
- mPrime = kinematics->getmPrime();
- thPrime = kinematics->getThetaPrime();
- }
-
- tree->Fill();
- }
-
- file->Write();
- file->Close();
- delete file;
-
- return EXIT_SUCCESS;
+ // Convert the command-line arguments into a useful format
+ const std::vector<TString> cmdLineArgs { argv, argv + argc };
+
+ if ( cmdLineArgs.size() != 6 ) {
+ std::cout << "Usage: " << cmdLineArgs[0]
+ << " <parent> <child_1> <child_2> <child_3> <nevents>" << std::endl;
+ return 0;
+ }
+
+ const TString& parent { cmdLineArgs[1] };
+ const TString& child_1 { cmdLineArgs[2] };
+ const TString& child_2 { cmdLineArgs[3] };
+ const TString& child_3 { cmdLineArgs[4] };
+ const ULong_t nEvents { std::stoul( cmdLineArgs[5].Data() ) };
+
+ const Bool_t squareDP { kTRUE };
+
+ LauDaughters* daughters { new LauDaughters( parent, child_1, child_2, child_3, squareDP ) };
+ LauKinematics* kinematics { daughters->getKinematics() };
+
+ Double_t m12Sq { 0.0 }, m13Sq { 0.0 }, m23Sq { 0.0 }, mPrime { 0.0 }, thPrime { 0.0 };
+
+ const TString outputFileName { TString::Format( "%s_%s_%s_%s.root",
+ daughters->getSanitisedNameParent().Data(),
+ daughters->getSanitisedNameDaug1().Data(),
+ daughters->getSanitisedNameDaug2().Data(),
+ daughters->getSanitisedNameDaug3().Data() ) };
+ TFile* file { TFile::Open( outputFileName, "recreate" ) };
+ TTree* tree { new TTree( "genResults", "genResults" ) };
+
+ tree->Branch( "m12Sq", &m12Sq, "m12Sq/D" );
+ tree->Branch( "m13Sq", &m13Sq, "m13Sq/D" );
+ tree->Branch( "m23Sq", &m23Sq, "m23Sq/D" );
+ if ( squareDP ) {
+ tree->Branch( "mPrime", &mPrime, "mPrime/D" );
+ tree->Branch( "thPrime", &thPrime, "thPrime/D" );
+ }
+
+ for ( ULong_t i { 0 }; i < nEvents; ++i ) {
+
+ if ( nEvents > 1000 && i % ( nEvents / 1000 ) == 0 ) {
+ std::cout << "Generating event " << i << std::endl;
+ }
+
+ kinematics->genFlatPhaseSpace( m13Sq, m23Sq );
+ kinematics->updateKinematics( m13Sq, m23Sq );
+ m12Sq = kinematics->getm12Sq();
+ if ( squareDP ) {
+ mPrime = kinematics->getmPrime();
+ thPrime = kinematics->getThetaPrime();
+ }
+
+ tree->Fill();
+ }
+
+ file->Write();
+ file->Close();
+ delete file;
+
+ return EXIT_SUCCESS;
}
-
diff --git a/examples/FlatSqDalitz-CustomMasses.cc b/examples/FlatSqDalitz-CustomMasses.cc
index a63a2f8..79aaeb9 100644
--- a/examples/FlatSqDalitz-CustomMasses.cc
+++ b/examples/FlatSqDalitz-CustomMasses.cc
@@ -1,98 +1,99 @@
/*
Copyright 2022 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
-#include <cstdlib>
-#include <iostream>
-#include <string>
-#include <vector>
+#include "LauKinematics.hh"
+#include "LauRandom.hh"
#include "TFile.h"
#include "TRandom.h"
#include "TTree.h"
-#include "LauKinematics.hh"
-#include "LauRandom.hh"
+#include <cstdlib>
+#include <iostream>
+#include <string>
+#include <vector>
/*
* Generates toy MC uniformly in the square Dalitz plot
*
* Usage: FlatSqDalitz-CustomMasses <parent mass> <child_1 mass> <child_2 mass> <child_3 mass> <nevents> <output file name>
*/
int main( int argc, char** argv )
{
- // Convert the command-line arguments into a useful format
- const std::vector<std::string> cmdLineArgs{ argv, argv+argc };
+ // Convert the command-line arguments into a useful format
+ const std::vector<std::string> cmdLineArgs { argv, argv + argc };
- if ( cmdLineArgs.size() != 7 ) {
- std::cout << "Usage: " << cmdLineArgs[0] << " <parent mass> <child_1 mass> <child_2 mass> <child_3 mass> <nevents> <output file name>" << std::endl;
- return 0;
- }
+ if ( cmdLineArgs.size() != 7 ) {
+ std::cout << "Usage: " << cmdLineArgs[0]
+ << " <parent mass> <child_1 mass> <child_2 mass> <child_3 mass> <nevents> <output file name>"
+ << std::endl;
+ return 0;
+ }
- const Double_t parent_mass { std::stod( cmdLineArgs[1] ) };
- const Double_t child_1_mass { std::stod( cmdLineArgs[2] ) };
- const Double_t child_2_mass { std::stod( cmdLineArgs[3] ) };
- const Double_t child_3_mass { std::stod( cmdLineArgs[4] ) };
- const ULong_t nEvents { std::stoul( cmdLineArgs[5] ) };
- const TString outputFileName { cmdLineArgs[6] };
+ const Double_t parent_mass { std::stod( cmdLineArgs[1] ) };
+ const Double_t child_1_mass { std::stod( cmdLineArgs[2] ) };
+ const Double_t child_2_mass { std::stod( cmdLineArgs[3] ) };
+ const Double_t child_3_mass { std::stod( cmdLineArgs[4] ) };
+ const ULong_t nEvents { std::stoul( cmdLineArgs[5] ) };
+ const TString outputFileName { cmdLineArgs[6] };
- // Do not change this!
- const Bool_t squareDP { kTRUE };
+ // Do not change this!
+ const Bool_t squareDP { kTRUE };
- LauKinematics kinematics { child_1_mass, child_2_mass, child_3_mass, parent_mass, squareDP };
+ LauKinematics kinematics { child_1_mass, child_2_mass, child_3_mass, parent_mass, squareDP };
- Double_t m12Sq{0.0}, m13Sq{0.0}, m23Sq{0.0}, mPrime{0.0}, thPrime{0.0};
+ Double_t m12Sq { 0.0 }, m13Sq { 0.0 }, m23Sq { 0.0 }, mPrime { 0.0 }, thPrime { 0.0 };
- TFile * file { TFile::Open(outputFileName,"recreate") };
- TTree * tree { new TTree("genResults","genResults") };
+ TFile* file { TFile::Open( outputFileName, "recreate" ) };
+ TTree* tree { new TTree( "genResults", "genResults" ) };
- tree->Branch("m12Sq",&m12Sq,"m12Sq/D");
- tree->Branch("m13Sq",&m13Sq,"m13Sq/D");
- tree->Branch("m23Sq",&m23Sq,"m23Sq/D");
- tree->Branch("mPrime",&mPrime,"mPrime/D");
- tree->Branch("thPrime",&thPrime,"thPrime/D");
+ tree->Branch( "m12Sq", &m12Sq, "m12Sq/D" );
+ tree->Branch( "m13Sq", &m13Sq, "m13Sq/D" );
+ tree->Branch( "m23Sq", &m23Sq, "m23Sq/D" );
+ tree->Branch( "mPrime", &mPrime, "mPrime/D" );
+ tree->Branch( "thPrime", &thPrime, "thPrime/D" );
- for ( ULong_t i{0}; i < nEvents; ++i ) {
+ for ( ULong_t i { 0 }; i < nEvents; ++i ) {
- if ( nEvents > 1000 && i%(nEvents/1000)==0 ) {
- std::cout << "Generating event " << i << std::endl;
- }
+ if ( nEvents > 1000 && i % ( nEvents / 1000 ) == 0 ) {
+ std::cout << "Generating event " << i << std::endl;
+ }
- kinematics.genFlatSqDP( mPrime, thPrime );
- kinematics.updateSqDPKinematics( mPrime, thPrime );
+ kinematics.genFlatSqDP( mPrime, thPrime );
+ kinematics.updateSqDPKinematics( mPrime, thPrime );
- m13Sq = kinematics.getm13Sq();
- m23Sq = kinematics.getm23Sq();
- m12Sq = kinematics.getm12Sq();
+ m13Sq = kinematics.getm13Sq();
+ m23Sq = kinematics.getm23Sq();
+ m12Sq = kinematics.getm12Sq();
- tree->Fill();
- }
+ tree->Fill();
+ }
- file->Write();
- file->Close();
- delete file;
+ file->Write();
+ file->Close();
+ delete file;
- return EXIT_SUCCESS;
+ return EXIT_SUCCESS;
}
-
diff --git a/examples/FlatSqDalitz.cc b/examples/FlatSqDalitz.cc
index e43dcf8..a076140 100644
--- a/examples/FlatSqDalitz.cc
+++ b/examples/FlatSqDalitz.cc
@@ -1,100 +1,104 @@
/*
Copyright 2022 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
-#include <cstdlib>
-#include <iostream>
-#include <string>
-#include <vector>
+#include "LauDaughters.hh"
+#include "LauKinematics.hh"
+#include "LauRandom.hh"
#include "TFile.h"
#include "TRandom.h"
#include "TTree.h"
-#include "LauDaughters.hh"
-#include "LauKinematics.hh"
-#include "LauRandom.hh"
+#include <cstdlib>
+#include <iostream>
+#include <string>
+#include <vector>
/*
* Generates toy MC uniformly in the square Dalitz plot
*
* Usage: FlatSqDalitz <parent> <child_1> <child_2> <child_3> <nevents>
*/
int main( int argc, char** argv )
{
- // Convert the command-line arguments into a useful format
- const std::vector<TString> cmdLineArgs{ argv, argv+argc };
+ // Convert the command-line arguments into a useful format
+ const std::vector<TString> cmdLineArgs { argv, argv + argc };
- if ( cmdLineArgs.size() != 6 ) {
- std::cout << "Usage: " << cmdLineArgs[0] << " <parent> <child_1> <child_2> <child_3> <nevents>" << std::endl;
- return 0;
- }
+ if ( cmdLineArgs.size() != 6 ) {
+ std::cout << "Usage: " << cmdLineArgs[0]
+ << " <parent> <child_1> <child_2> <child_3> <nevents>" << std::endl;
+ return 0;
+ }
- const TString& parent { cmdLineArgs[1] };
- const TString& child_1 { cmdLineArgs[2] };
- const TString& child_2 { cmdLineArgs[3] };
- const TString& child_3 { cmdLineArgs[4] };
- const ULong_t nEvents { std::stoul( cmdLineArgs[5].Data() ) };
+ const TString& parent { cmdLineArgs[1] };
+ const TString& child_1 { cmdLineArgs[2] };
+ const TString& child_2 { cmdLineArgs[3] };
+ const TString& child_3 { cmdLineArgs[4] };
+ const ULong_t nEvents { std::stoul( cmdLineArgs[5].Data() ) };
- // Do not change this!
- const Bool_t squareDP { kTRUE };
+ // Do not change this!
+ const Bool_t squareDP { kTRUE };
- LauDaughters* daughters { new LauDaughters(parent, child_1, child_2, child_3, squareDP) };
- LauKinematics* kinematics { daughters->getKinematics() };
+ LauDaughters* daughters { new LauDaughters( parent, child_1, child_2, child_3, squareDP ) };
+ LauKinematics* kinematics { daughters->getKinematics() };
- Double_t m12Sq{0.0}, m13Sq{0.0}, m23Sq{0.0}, mPrime{0.0}, thPrime{0.0};
+ Double_t m12Sq { 0.0 }, m13Sq { 0.0 }, m23Sq { 0.0 }, mPrime { 0.0 }, thPrime { 0.0 };
- const TString outputFileName { TString::Format( "%s_%s_%s_%s.root", daughters->getSanitisedNameParent().Data(), daughters->getSanitisedNameDaug1().Data(), daughters->getSanitisedNameDaug2().Data(), daughters->getSanitisedNameDaug3().Data() ) };
- TFile * file { TFile::Open(outputFileName,"recreate") };
- TTree * tree { new TTree("genResults","genResults") };
+ const TString outputFileName { TString::Format( "%s_%s_%s_%s.root",
+ daughters->getSanitisedNameParent().Data(),
+ daughters->getSanitisedNameDaug1().Data(),
+ daughters->getSanitisedNameDaug2().Data(),
+ daughters->getSanitisedNameDaug3().Data() ) };
+ TFile* file { TFile::Open( outputFileName, "recreate" ) };
+ TTree* tree { new TTree( "genResults", "genResults" ) };
- tree->Branch("m12Sq",&m12Sq,"m12Sq/D");
- tree->Branch("m13Sq",&m13Sq,"m13Sq/D");
- tree->Branch("m23Sq",&m23Sq,"m23Sq/D");
- tree->Branch("mPrime",&mPrime,"mPrime/D");
- tree->Branch("thPrime",&thPrime,"thPrime/D");
+ tree->Branch( "m12Sq", &m12Sq, "m12Sq/D" );
+ tree->Branch( "m13Sq", &m13Sq, "m13Sq/D" );
+ tree->Branch( "m23Sq", &m23Sq, "m23Sq/D" );
+ tree->Branch( "mPrime", &mPrime, "mPrime/D" );
+ tree->Branch( "thPrime", &thPrime, "thPrime/D" );
- for ( ULong_t i{0}; i < nEvents; ++i ) {
+ for ( ULong_t i { 0 }; i < nEvents; ++i ) {
- if ( nEvents > 1000 && i%(nEvents/1000)==0 ) {
- std::cout << "Generating event " << i << std::endl;
- }
+ if ( nEvents > 1000 && i % ( nEvents / 1000 ) == 0 ) {
+ std::cout << "Generating event " << i << std::endl;
+ }
- kinematics->genFlatSqDP( mPrime, thPrime );
- kinematics->updateSqDPKinematics( mPrime, thPrime );
+ kinematics->genFlatSqDP( mPrime, thPrime );
+ kinematics->updateSqDPKinematics( mPrime, thPrime );
- m13Sq = kinematics->getm13Sq();
- m23Sq = kinematics->getm23Sq();
- m12Sq = kinematics->getm12Sq();
+ m13Sq = kinematics->getm13Sq();
+ m23Sq = kinematics->getm23Sq();
+ m12Sq = kinematics->getm12Sq();
- tree->Fill();
- }
+ tree->Fill();
+ }
- file->Write();
- file->Close();
- delete file;
+ file->Write();
+ file->Close();
+ delete file;
- return EXIT_SUCCESS;
+ return EXIT_SUCCESS;
}
-
diff --git a/examples/GenFit3K.cc b/examples/GenFit3K.cc
index a26ebc3..70fd2ae 100644
--- a/examples/GenFit3K.cc
+++ b/examples/GenFit3K.cc
@@ -1,228 +1,236 @@
/*
Copyright 2014 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
-#include <cstdlib>
-#include <iostream>
-#include <vector>
-
-#include "TFile.h"
-#include "TH2.h"
-#include "TString.h"
-#include "TTree.h"
-
-#include "LauSimpleFitModel.hh"
#include "LauBkgndDPModel.hh"
#include "LauDaughters.hh"
#include "LauEffModel.hh"
#include "LauIsobarDynamics.hh"
#include "LauRealImagCoeffSet.hh"
#include "LauResonanceMaker.hh"
+#include "LauSimpleFitModel.hh"
#include "LauVetoes.hh"
+#include "TFile.h"
+#include "TH2.h"
+#include "TString.h"
+#include "TTree.h"
+
+#include <cstdlib>
+#include <iostream>
+#include <vector>
+
void usage( std::ostream& out, const TString& progName )
{
- out<<"Usage:\n";
- out<<progName<<" gen [nExpt = 1] [firstExpt = 0]\n";
- out<<"or\n";
- out<<progName<<" fit <iFit> [nExpt = 1] [firstExpt = 0]"<<std::endl;
+ out << "Usage:\n";
+ out << progName << " gen [nExpt = 1] [firstExpt = 0]\n";
+ out << "or\n";
+ out << progName << " fit <iFit> [nExpt = 1] [firstExpt = 0]" << std::endl;
}
int main( int argc, char** argv )
{
- // Process command-line arguments
- // Usage:
- // ./GenFit3pi gen [nExpt = 1] [firstExpt = 0]
- // or
- // ./GenFit3pi fit <iFit> [nExpt = 1] [firstExpt = 0]
- if ( argc < 2 ) {
- usage( std::cerr, argv[0] );
- return EXIT_FAILURE;
- }
-
- TString command = argv[1];
- command.ToLower();
- Int_t iFit(0);
- Int_t nExpt(1);
- Int_t firstExpt(0);
- Bool_t isToy(kTRUE);
- if ( command == "gen" ) {
- if ( argc > 2 ) {
- nExpt = atoi( argv[2] );
- if ( argc > 3 ) {
- firstExpt = atoi( argv[3] );
- }
- }
- } else if ( command == "fit" ) {
- if ( argc < 3 ) {
- usage( std::cerr, argv[0] );
- return EXIT_FAILURE;
- }
- iFit = atoi( argv[2] );
- if ( argc > 3 ) {
- nExpt = atoi( argv[3] );
- if ( argc > 4 ) {
- firstExpt = atoi( argv[4] );
- }
- }
- } else {
- usage( std::cerr, argv[0] );
- return EXIT_FAILURE;
- }
-
- // If you want to use square DP histograms for efficiency,
- // backgrounds or you just want the square DP co-ordinates
- // stored in the toy MC ntuple then set this to kTRUE
- Bool_t squareDP = kFALSE;
-
- // This defines the DP => decay is B+ -> K+ K+ K-
- // Particle 1 = K+
- // Particle 2 = K+
- // Particle 3 = K-
- // The DP is defined in terms of m13Sq and m23Sq
- LauDaughters* daughters = new LauDaughters("B+", "K+", "K+", "K-", squareDP);
-
- // Define the efficiency model (defaults to unity everywhere)
- LauVetoes* vetoes = new LauVetoes();
- LauEffModel* effModel = new LauEffModel(daughters, vetoes);
-
- // Create the isobar model
-
- // Set the spin formalism, the form and values of the Blatt-Weisskopf barrier radii and whether they are fixed or floating
- LauResonanceMaker& resMaker = LauResonanceMaker::get();
- resMaker.setSpinFormalism( LauAbsResonance::Covariant );
- resMaker.setBWBachelorRestFrame( LauBlattWeisskopfFactor::Covariant );
- resMaker.setDefaultBWRadius( LauBlattWeisskopfFactor::Parent, 5.0 );
- resMaker.setDefaultBWRadius( LauBlattWeisskopfFactor::Light, 4.0 );
- resMaker.fixBWRadius( LauBlattWeisskopfFactor::Parent, kTRUE );
- resMaker.fixBWRadius( LauBlattWeisskopfFactor::Light, kTRUE );
-
- LauIsobarDynamics* sigModel = new LauIsobarDynamics(daughters, effModel);
-
- // Add various components to the isobar model,
- // modifying some resonance masses and widths
- // and allowing them to float in the fit
- LauAbsResonance* res(0);
-
- // addResonance arguments: resName, resPairAmpInt, resType
- res = sigModel->addResonance("phi(1020)", 1, LauAbsResonance::RelBW);
- // changeResonance arguments: newMass, newWidth, newSpin
- res->changeResonance(1.019460, 0.004247, 1);
- // Float the mass and width parameters
- res->fixMass(kFALSE);
- res->fixWidth(kFALSE);
-
- res = sigModel->addResonance("f'_2(1525)", 1, LauAbsResonance::RelBW);
- // Float the mass and width parameters
- res->fixMass(kFALSE);
- res->fixWidth(kFALSE);
-
- res = sigModel->addResonance("NonReson", 0, LauAbsResonance::FlatNR);
-
- // Set the maximum signal DP ASq value
- // If you do not provide a value, one will be determined automatically,
- // which should be close to the true maximum but is not guaranteed to
- // be optimal.
- // Any value, whether manually provided or automatically determined,
- // will be automatically adjusted to avoid bias or extreme inefficiency
- // but it is best to set this by hand once you've found the right value
- // through some trial and error.
- sigModel->setASqMaxValue(15.8);
-
- // Create the fit model
- LauSimpleFitModel* fitModel = new LauSimpleFitModel(sigModel);
-
- // Create the complex coefficients for the isobar model
- // Here we're using the form with real and imaginary parts:
- // c_j = x_j + i * y_j
- std::vector<LauAbsCoeffSet*> coeffset;
- coeffset.push_back( new LauRealImagCoeffSet("phi(1020)", 1.0, 0.0, kTRUE, kTRUE) );
- coeffset.push_back( new LauRealImagCoeffSet("f'_2(1525)", 0.0, 1.0, kFALSE, kFALSE) );
- coeffset.push_back( new LauRealImagCoeffSet("NonReson", 1.0, 0.0, kFALSE, kFALSE) );
- for (std::vector<LauAbsCoeffSet*>::iterator iter=coeffset.begin(); iter!=coeffset.end(); ++iter) {
- fitModel->setAmpCoeffSet(*iter);
- }
-
- // Set the signal yield and define whether it is fixed or floated
- const Double_t nSigEvents = 5000.0;
- Bool_t fixNSigEvents = kFALSE;
- LauParameter * signalEvents = new LauParameter("signalEvents", nSigEvents, -1.0*nSigEvents, 2.0*nSigEvents, fixNSigEvents);
- fitModel->setNSigEvents(signalEvents);
-
- // Set the number of experiments to generate or fit and which
- // experiment to start with
- fitModel->setNExpts( nExpt, firstExpt, isToy );
-
-
- // Configure various fit options
-
- // Switch on/off calculation of asymmetric errors.
- fitModel->useAsymmFitErrors(kFALSE);
-
- // Randomise initial fit values for the signal mode
- fitModel->useRandomInitFitPars(kFALSE);
-
- const Bool_t haveBkgnds = ( fitModel->nBkgndClasses() > 0 );
-
- // Switch on/off Poissonian smearing of total number of events
- fitModel->doPoissonSmearing(haveBkgnds);
-
- // Switch on/off Extended ML Fit option
- fitModel->doEMLFit(haveBkgnds);
-
- // Switch on the two-stage fit (for the resonance parameters)
- fitModel->twoStageFit(kTRUE);
-
- // Generate toy from the fitted parameters
- //TString fitToyFileName("fitToyMC_3K_");
- //fitToyFileName += iFit;
- //fitToyFileName += ".root";
- //fitModel->compareFitData(10, fitToyFileName);
-
- // Write out per-event likelihoods and sWeights
- //TString splotFileName("splot_3K_");
- //splotFileName += iFit;
- //splotFileName += ".root";
- //fitModel->writeSPlotData(splotFileName, "splot", kFALSE);
-
- // Set the names of the files to read/write
- TString dataFile("gen-3K.root");
- TString treeName("genResults");
- TString rootFileName("");
- TString tableFileName("");
- if (command == "fit") {
- rootFileName = "fit3K_"; rootFileName += iFit;
- rootFileName += "_expt_"; rootFileName += firstExpt;
- rootFileName += "-"; rootFileName += (firstExpt+nExpt-1);
- rootFileName += ".root";
- tableFileName = "fit3KResults_"; tableFileName += iFit;
- } else {
- rootFileName = "dummy.root";
- tableFileName = "gen3KResults";
- }
-
- // Execute the generation/fit
- fitModel->run( command, dataFile, treeName, rootFileName, tableFileName );
-
- return EXIT_SUCCESS;
+ // Process command-line arguments
+ // Usage:
+ // ./GenFit3pi gen [nExpt = 1] [firstExpt = 0]
+ // or
+ // ./GenFit3pi fit <iFit> [nExpt = 1] [firstExpt = 0]
+ if ( argc < 2 ) {
+ usage( std::cerr, argv[0] );
+ return EXIT_FAILURE;
+ }
+
+ TString command = argv[1];
+ command.ToLower();
+ Int_t iFit( 0 );
+ Int_t nExpt( 1 );
+ Int_t firstExpt( 0 );
+ Bool_t isToy( kTRUE );
+ if ( command == "gen" ) {
+ if ( argc > 2 ) {
+ nExpt = atoi( argv[2] );
+ if ( argc > 3 ) {
+ firstExpt = atoi( argv[3] );
+ }
+ }
+ } else if ( command == "fit" ) {
+ if ( argc < 3 ) {
+ usage( std::cerr, argv[0] );
+ return EXIT_FAILURE;
+ }
+ iFit = atoi( argv[2] );
+ if ( argc > 3 ) {
+ nExpt = atoi( argv[3] );
+ if ( argc > 4 ) {
+ firstExpt = atoi( argv[4] );
+ }
+ }
+ } else {
+ usage( std::cerr, argv[0] );
+ return EXIT_FAILURE;
+ }
+
+ // If you want to use square DP histograms for efficiency,
+ // backgrounds or you just want the square DP co-ordinates
+ // stored in the toy MC ntuple then set this to kTRUE
+ Bool_t squareDP = kFALSE;
+
+ // This defines the DP => decay is B+ -> K+ K+ K-
+ // Particle 1 = K+
+ // Particle 2 = K+
+ // Particle 3 = K-
+ // The DP is defined in terms of m13Sq and m23Sq
+ LauDaughters* daughters = new LauDaughters( "B+", "K+", "K+", "K-", squareDP );
+
+ // Define the efficiency model (defaults to unity everywhere)
+ LauVetoes* vetoes = new LauVetoes();
+ LauEffModel* effModel = new LauEffModel( daughters, vetoes );
+
+ // Create the isobar model
+
+ // Set the spin formalism, the form and values of the Blatt-Weisskopf barrier radii and whether they are fixed or floating
+ LauResonanceMaker& resMaker = LauResonanceMaker::get();
+ resMaker.setSpinFormalism( LauAbsResonance::Covariant );
+ resMaker.setBWBachelorRestFrame( LauBlattWeisskopfFactor::Covariant );
+ resMaker.setDefaultBWRadius( LauBlattWeisskopfFactor::Parent, 5.0 );
+ resMaker.setDefaultBWRadius( LauBlattWeisskopfFactor::Light, 4.0 );
+ resMaker.fixBWRadius( LauBlattWeisskopfFactor::Parent, kTRUE );
+ resMaker.fixBWRadius( LauBlattWeisskopfFactor::Light, kTRUE );
+
+ LauIsobarDynamics* sigModel = new LauIsobarDynamics( daughters, effModel );
+
+ // Add various components to the isobar model,
+ // modifying some resonance masses and widths
+ // and allowing them to float in the fit
+ LauAbsResonance* res( 0 );
+
+ // addResonance arguments: resName, resPairAmpInt, resType
+ res = sigModel->addResonance( "phi(1020)", 1, LauAbsResonance::RelBW );
+ // changeResonance arguments: newMass, newWidth, newSpin
+ res->changeResonance( 1.019460, 0.004247, 1 );
+ // Float the mass and width parameters
+ res->fixMass( kFALSE );
+ res->fixWidth( kFALSE );
+
+ res = sigModel->addResonance( "f'_2(1525)", 1, LauAbsResonance::RelBW );
+ // Float the mass and width parameters
+ res->fixMass( kFALSE );
+ res->fixWidth( kFALSE );
+
+ res = sigModel->addResonance( "NonReson", 0, LauAbsResonance::FlatNR );
+
+ // Set the maximum signal DP ASq value
+ // If you do not provide a value, one will be determined automatically,
+ // which should be close to the true maximum but is not guaranteed to
+ // be optimal.
+ // Any value, whether manually provided or automatically determined,
+ // will be automatically adjusted to avoid bias or extreme inefficiency
+ // but it is best to set this by hand once you've found the right value
+ // through some trial and error.
+ sigModel->setASqMaxValue( 15.8 );
+
+ // Create the fit model
+ LauSimpleFitModel* fitModel = new LauSimpleFitModel( sigModel );
+
+ // Create the complex coefficients for the isobar model
+ // Here we're using the form with real and imaginary parts:
+ // c_j = x_j + i * y_j
+ std::vector<LauAbsCoeffSet*> coeffset;
+ coeffset.push_back( new LauRealImagCoeffSet( "phi(1020)", 1.0, 0.0, kTRUE, kTRUE ) );
+ coeffset.push_back( new LauRealImagCoeffSet( "f'_2(1525)", 0.0, 1.0, kFALSE, kFALSE ) );
+ coeffset.push_back( new LauRealImagCoeffSet( "NonReson", 1.0, 0.0, kFALSE, kFALSE ) );
+ for ( std::vector<LauAbsCoeffSet*>::iterator iter = coeffset.begin(); iter != coeffset.end();
+ ++iter ) {
+ fitModel->setAmpCoeffSet( *iter );
+ }
+
+ // Set the signal yield and define whether it is fixed or floated
+ const Double_t nSigEvents = 5000.0;
+ Bool_t fixNSigEvents = kFALSE;
+ LauParameter* signalEvents = new LauParameter( "signalEvents",
+ nSigEvents,
+ -1.0 * nSigEvents,
+ 2.0 * nSigEvents,
+ fixNSigEvents );
+ fitModel->setNSigEvents( signalEvents );
+
+ // Set the number of experiments to generate or fit and which
+ // experiment to start with
+ fitModel->setNExpts( nExpt, firstExpt, isToy );
+
+ // Configure various fit options
+
+ // Switch on/off calculation of asymmetric errors.
+ fitModel->useAsymmFitErrors( kFALSE );
+
+ // Randomise initial fit values for the signal mode
+ fitModel->useRandomInitFitPars( kFALSE );
+
+ const Bool_t haveBkgnds = ( fitModel->nBkgndClasses() > 0 );
+
+ // Switch on/off Poissonian smearing of total number of events
+ fitModel->doPoissonSmearing( haveBkgnds );
+
+ // Switch on/off Extended ML Fit option
+ fitModel->doEMLFit( haveBkgnds );
+
+ // Switch on the two-stage fit (for the resonance parameters)
+ fitModel->twoStageFit( kTRUE );
+
+ // Generate toy from the fitted parameters
+ //TString fitToyFileName("fitToyMC_3K_");
+ //fitToyFileName += iFit;
+ //fitToyFileName += ".root";
+ //fitModel->compareFitData(10, fitToyFileName);
+
+ // Write out per-event likelihoods and sWeights
+ //TString splotFileName("splot_3K_");
+ //splotFileName += iFit;
+ //splotFileName += ".root";
+ //fitModel->writeSPlotData(splotFileName, "splot", kFALSE);
+
+ // Set the names of the files to read/write
+ TString dataFile( "gen-3K.root" );
+ TString treeName( "genResults" );
+ TString rootFileName( "" );
+ TString tableFileName( "" );
+ if ( command == "fit" ) {
+ rootFileName = "fit3K_";
+ rootFileName += iFit;
+ rootFileName += "_expt_";
+ rootFileName += firstExpt;
+ rootFileName += "-";
+ rootFileName += ( firstExpt + nExpt - 1 );
+ rootFileName += ".root";
+ tableFileName = "fit3KResults_";
+ tableFileName += iFit;
+ } else {
+ rootFileName = "dummy.root";
+ tableFileName = "gen3KResults";
+ }
+
+ // Execute the generation/fit
+ fitModel->run( command, dataFile, treeName, rootFileName, tableFileName );
+
+ return EXIT_SUCCESS;
}
diff --git a/examples/GenFit3KS.cc b/examples/GenFit3KS.cc
index 842e879..5a4fb2d 100644
--- a/examples/GenFit3KS.cc
+++ b/examples/GenFit3KS.cc
@@ -1,201 +1,205 @@
/*
Copyright 2014 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
-#include <cstdlib>
-#include <iostream>
-#include <vector>
-
-#include "TFile.h"
-#include "TH2.h"
-#include "TString.h"
-#include "TTree.h"
-
-#include "LauSimpleFitModel.hh"
#include "LauBkgndDPModel.hh"
#include "LauDaughters.hh"
#include "LauEffModel.hh"
#include "LauIsobarDynamics.hh"
#include "LauMagPhaseCoeffSet.hh"
+#include "LauSimpleFitModel.hh"
#include "LauVetoes.hh"
+#include "TFile.h"
+#include "TH2.h"
+#include "TString.h"
+#include "TTree.h"
+
+#include <cstdlib>
+#include <iostream>
+#include <vector>
+
void usage( std::ostream& out, const char* progName )
{
- out<<"Usage:\n";
- out<<progName<<" gen [nExpt = 1] [firstExpt = 0]\n";
- out<<"or\n";
- out<<progName<<" fit <iFit> [nExpt = 1] [firstExpt = 0]"<<std::endl;
+ out << "Usage:\n";
+ out << progName << " gen [nExpt = 1] [firstExpt = 0]\n";
+ out << "or\n";
+ out << progName << " fit <iFit> [nExpt = 1] [firstExpt = 0]" << std::endl;
}
int main( int argc, char** argv )
{
- // Process command-line arguments
- // Usage:
- // ./GenFit3KS gen [nExpt = 1] [firstExpt = 0]
- // or
- // ./GenFit3KS fit <iFit> [nExpt = 1] [firstExpt = 0]
- if ( argc < 2 ) {
- usage( std::cerr, argv[0] );
- return EXIT_FAILURE;
- }
-
- TString command = argv[1];
- command.ToLower();
- Int_t iFit(0);
- Int_t nExpt(1);
- Int_t firstExpt(0);
- Bool_t isToy(kTRUE);
- if ( command == "gen" ) {
- if ( argc > 2 ) {
- nExpt = atoi( argv[2] );
- if ( argc > 3 ) {
- firstExpt = atoi( argv[3] );
- }
- }
- } else if ( command == "fit" ) {
- if ( argc < 3 ) {
- usage( std::cerr, argv[0] );
- return EXIT_FAILURE;
- }
- iFit = atoi( argv[2] );
- if ( argc > 3 ) {
- nExpt = atoi( argv[3] );
- if ( argc > 4 ) {
- firstExpt = atoi( argv[4] );
- }
- }
- } else {
- usage( std::cerr, argv[0] );
- return EXIT_FAILURE;
- }
-
- // If you want to use square DP histograms for efficiency,
- // backgrounds or you just want the square DP co-ordinates
- // stored in the toy MC ntuple then set this to kTRUE
- Bool_t squareDP = kFALSE;
-
- // This defines the DP => decay is B0 -> KS KS KS
- // Particle 1 = KS
- // Particle 2 = KS
- // Particle 3 = KS
- // The DP is defined in terms of m13Sq and m23Sq
- LauDaughters* daughters = new LauDaughters("B0", "K_S0", "K_S0", "K_S0", squareDP);
-
- // Optionally apply some vetoes to the DP
- LauVetoes* vetoes = new LauVetoes();
-
- // Define the efficiency model (defaults to unity everywhere)
- // Can optionally provide a histogram to model variation over DP
- LauEffModel* effModel = new LauEffModel(daughters, vetoes);
-
- // Create the isobar model
- LauIsobarDynamics* sigModel = new LauIsobarDynamics(daughters, effModel);
- //LauAbsResonance* reson(0);
- /*reson =*/ sigModel->addResonance("f_0(980)", 3, LauAbsResonance::Flatte);
- /*reson =*/ sigModel->addResonance("f_0(1710)", 3, LauAbsResonance::RelBW);
- /*reson =*/ sigModel->addResonance("f_2(2010)", 3, LauAbsResonance::RelBW);
- /*reson =*/ sigModel->addResonance("chi_c0", 3, LauAbsResonance::RelBW);
-
- // Set the maximum signal DP ASq value
- // If you do not provide a value, one will be determined automatically,
- // which should be close to the true maximum but is not guaranteed to
- // be optimal.
- // Any value, whether manually provided or automatically determined,
- // will be automatically adjusted to avoid bias or extreme inefficiency
- // but it is best to set this by hand once you've found the right value
- // through some trial and error.
- sigModel->setASqMaxValue(0.285);
-
- // Create the fit model
- LauSimpleFitModel* fitModel = new LauSimpleFitModel(sigModel);
-
- // Create the complex coefficients for the isobar model
- // Here we're using the magnitude and phase form:
- // c_j = a_j exp(i*delta_j)
- std::vector<LauAbsCoeffSet*> coeffset;
- coeffset.push_back( new LauMagPhaseCoeffSet("f_0(980)", 1.00, 0.00, kTRUE, kTRUE) );
- coeffset.push_back( new LauMagPhaseCoeffSet("f_0(1710)", 0.40, 1.11, kFALSE, kFALSE) );
- coeffset.push_back( new LauMagPhaseCoeffSet("f_2(2010)", 0.45, 2.50, kFALSE, kFALSE) );
- coeffset.push_back( new LauMagPhaseCoeffSet("chi_c0", 0.40, 0.63, kFALSE, kFALSE) );
- for (std::vector<LauAbsCoeffSet*>::iterator iter=coeffset.begin(); iter!=coeffset.end(); ++iter) {
- fitModel->setAmpCoeffSet(*iter);
- }
-
- // Set the signal yield and define whether it is fixed or floated
- LauParameter * nSigEvents = new LauParameter("nSigEvents",10000.0,-50000.0,50000.0,kFALSE);
- fitModel->setNSigEvents(nSigEvents);
-
- // Set the number of experiments to generate or fit and which
- // experiment to start with
- fitModel->setNExpts( nExpt, firstExpt, isToy );
-
-
- // Configure various fit options
-
- // Switch on/off calculation of asymmetric errors.
- fitModel->useAsymmFitErrors(kFALSE);
-
- // Randomise initial fit values for the signal mode
- fitModel->useRandomInitFitPars(kTRUE);
-
- const Bool_t haveBkgnds = ( fitModel->nBkgndClasses() > 0 );
-
- // Switch on/off Poissonian smearing of total number of events
- fitModel->doPoissonSmearing(haveBkgnds);
-
- // Switch on/off Extended ML Fit option
- fitModel->doEMLFit(haveBkgnds);
-
- // Generate toy from the fitted parameters
- //TString fitToyFileName("fitToyMC_3KS_");
- //fitToyFileName += iFit;
- //fitToyFileName += ".root";
- //fitModel->compareFitData(100, fitToyFileName);
-
- // Write out per-event likelihoods and sWeights
- //TString splotFileName("splot_3KS_");
- //splotFileName += iFit;
- //splotFileName += ".root";
- //fitModel->writeSPlotData(splotFileName, "splot", kFALSE);
-
- // Set the names of the files to read/write
- TString dataFile("gen-3KS.root");
- TString treeName("genResults");
- TString rootFileName("");
- TString tableFileName("");
- if (command == "fit") {
- rootFileName = "fit3KS_"; rootFileName += iFit;
- rootFileName += "_expt_"; rootFileName += firstExpt;
- rootFileName += "-"; rootFileName += (firstExpt+nExpt-1);
- rootFileName += ".root";
- tableFileName = "fit3KSResults_"; tableFileName += iFit;
- } else {
- rootFileName = "dummy.root";
- tableFileName = "gen3KSResults";
- }
-
- // Execute the generation/fit
- fitModel->run( command, dataFile, treeName, rootFileName, tableFileName );
-
- return EXIT_SUCCESS;
+ // Process command-line arguments
+ // Usage:
+ // ./GenFit3KS gen [nExpt = 1] [firstExpt = 0]
+ // or
+ // ./GenFit3KS fit <iFit> [nExpt = 1] [firstExpt = 0]
+ if ( argc < 2 ) {
+ usage( std::cerr, argv[0] );
+ return EXIT_FAILURE;
+ }
+
+ TString command = argv[1];
+ command.ToLower();
+ Int_t iFit( 0 );
+ Int_t nExpt( 1 );
+ Int_t firstExpt( 0 );
+ Bool_t isToy( kTRUE );
+ if ( command == "gen" ) {
+ if ( argc > 2 ) {
+ nExpt = atoi( argv[2] );
+ if ( argc > 3 ) {
+ firstExpt = atoi( argv[3] );
+ }
+ }
+ } else if ( command == "fit" ) {
+ if ( argc < 3 ) {
+ usage( std::cerr, argv[0] );
+ return EXIT_FAILURE;
+ }
+ iFit = atoi( argv[2] );
+ if ( argc > 3 ) {
+ nExpt = atoi( argv[3] );
+ if ( argc > 4 ) {
+ firstExpt = atoi( argv[4] );
+ }
+ }
+ } else {
+ usage( std::cerr, argv[0] );
+ return EXIT_FAILURE;
+ }
+
+ // If you want to use square DP histograms for efficiency,
+ // backgrounds or you just want the square DP co-ordinates
+ // stored in the toy MC ntuple then set this to kTRUE
+ Bool_t squareDP = kFALSE;
+
+ // This defines the DP => decay is B0 -> KS KS KS
+ // Particle 1 = KS
+ // Particle 2 = KS
+ // Particle 3 = KS
+ // The DP is defined in terms of m13Sq and m23Sq
+ LauDaughters* daughters = new LauDaughters( "B0", "K_S0", "K_S0", "K_S0", squareDP );
+
+ // Optionally apply some vetoes to the DP
+ LauVetoes* vetoes = new LauVetoes();
+
+ // Define the efficiency model (defaults to unity everywhere)
+ // Can optionally provide a histogram to model variation over DP
+ LauEffModel* effModel = new LauEffModel( daughters, vetoes );
+
+ // Create the isobar model
+ LauIsobarDynamics* sigModel = new LauIsobarDynamics( daughters, effModel );
+ //LauAbsResonance* reson(0);
+ /*reson =*/sigModel->addResonance( "f_0(980)", 3, LauAbsResonance::Flatte );
+ /*reson =*/sigModel->addResonance( "f_0(1710)", 3, LauAbsResonance::RelBW );
+ /*reson =*/sigModel->addResonance( "f_2(2010)", 3, LauAbsResonance::RelBW );
+ /*reson =*/sigModel->addResonance( "chi_c0", 3, LauAbsResonance::RelBW );
+
+ // Set the maximum signal DP ASq value
+ // If you do not provide a value, one will be determined automatically,
+ // which should be close to the true maximum but is not guaranteed to
+ // be optimal.
+ // Any value, whether manually provided or automatically determined,
+ // will be automatically adjusted to avoid bias or extreme inefficiency
+ // but it is best to set this by hand once you've found the right value
+ // through some trial and error.
+ sigModel->setASqMaxValue( 0.285 );
+
+ // Create the fit model
+ LauSimpleFitModel* fitModel = new LauSimpleFitModel( sigModel );
+
+ // Create the complex coefficients for the isobar model
+ // Here we're using the magnitude and phase form:
+ // c_j = a_j exp(i*delta_j)
+ std::vector<LauAbsCoeffSet*> coeffset;
+ coeffset.push_back( new LauMagPhaseCoeffSet( "f_0(980)", 1.00, 0.00, kTRUE, kTRUE ) );
+ coeffset.push_back( new LauMagPhaseCoeffSet( "f_0(1710)", 0.40, 1.11, kFALSE, kFALSE ) );
+ coeffset.push_back( new LauMagPhaseCoeffSet( "f_2(2010)", 0.45, 2.50, kFALSE, kFALSE ) );
+ coeffset.push_back( new LauMagPhaseCoeffSet( "chi_c0", 0.40, 0.63, kFALSE, kFALSE ) );
+ for ( std::vector<LauAbsCoeffSet*>::iterator iter = coeffset.begin(); iter != coeffset.end();
+ ++iter ) {
+ fitModel->setAmpCoeffSet( *iter );
+ }
+
+ // Set the signal yield and define whether it is fixed or floated
+ LauParameter* nSigEvents = new LauParameter( "nSigEvents", 10000.0, -50000.0, 50000.0, kFALSE );
+ fitModel->setNSigEvents( nSigEvents );
+
+ // Set the number of experiments to generate or fit and which
+ // experiment to start with
+ fitModel->setNExpts( nExpt, firstExpt, isToy );
+
+ // Configure various fit options
+
+ // Switch on/off calculation of asymmetric errors.
+ fitModel->useAsymmFitErrors( kFALSE );
+
+ // Randomise initial fit values for the signal mode
+ fitModel->useRandomInitFitPars( kTRUE );
+
+ const Bool_t haveBkgnds = ( fitModel->nBkgndClasses() > 0 );
+
+ // Switch on/off Poissonian smearing of total number of events
+ fitModel->doPoissonSmearing( haveBkgnds );
+
+ // Switch on/off Extended ML Fit option
+ fitModel->doEMLFit( haveBkgnds );
+
+ // Generate toy from the fitted parameters
+ //TString fitToyFileName("fitToyMC_3KS_");
+ //fitToyFileName += iFit;
+ //fitToyFileName += ".root";
+ //fitModel->compareFitData(100, fitToyFileName);
+
+ // Write out per-event likelihoods and sWeights
+ //TString splotFileName("splot_3KS_");
+ //splotFileName += iFit;
+ //splotFileName += ".root";
+ //fitModel->writeSPlotData(splotFileName, "splot", kFALSE);
+
+ // Set the names of the files to read/write
+ TString dataFile( "gen-3KS.root" );
+ TString treeName( "genResults" );
+ TString rootFileName( "" );
+ TString tableFileName( "" );
+ if ( command == "fit" ) {
+ rootFileName = "fit3KS_";
+ rootFileName += iFit;
+ rootFileName += "_expt_";
+ rootFileName += firstExpt;
+ rootFileName += "-";
+ rootFileName += ( firstExpt + nExpt - 1 );
+ rootFileName += ".root";
+ tableFileName = "fit3KSResults_";
+ tableFileName += iFit;
+ } else {
+ rootFileName = "dummy.root";
+ tableFileName = "gen3KSResults";
+ }
+
+ // Execute the generation/fit
+ fitModel->run( command, dataFile, treeName, rootFileName, tableFileName );
+
+ return EXIT_SUCCESS;
}
diff --git a/examples/GenFit3pi.cc b/examples/GenFit3pi.cc
index 84f7a1e..7ea38a4 100644
--- a/examples/GenFit3pi.cc
+++ b/examples/GenFit3pi.cc
@@ -1,265 +1,269 @@
/*
Copyright 2005 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
-#include <cstdlib>
-#include <iostream>
-#include <vector>
-
-#include "TFile.h"
-#include "TH2.h"
-#include "TString.h"
-#include "TTree.h"
-
-#include "LauSimpleFitModel.hh"
#include "LauBkgndDPModel.hh"
#include "LauDaughters.hh"
#include "LauEffModel.hh"
#include "LauIsobarDynamics.hh"
#include "LauMagPhaseCoeffSet.hh"
#include "LauResonanceMaker.hh"
+#include "LauSimpleFitModel.hh"
#include "LauVetoes.hh"
+#include "TFile.h"
+#include "TH2.h"
+#include "TString.h"
+#include "TTree.h"
+
+#include <cstdlib>
+#include <iostream>
+#include <vector>
+
void usage( std::ostream& out, const TString& progName )
{
- out<<"Usage:\n";
- out<<progName<<" gen [nExpt = 1] [firstExpt = 0]\n";
- out<<"or\n";
- out<<progName<<" fit <iFit> [nExpt = 1] [firstExpt = 0]"<<std::endl;
+ out << "Usage:\n";
+ out << progName << " gen [nExpt = 1] [firstExpt = 0]\n";
+ out << "or\n";
+ out << progName << " fit <iFit> [nExpt = 1] [firstExpt = 0]" << std::endl;
}
int main( int argc, char** argv )
{
- // Process command-line arguments
- // Usage:
- // ./GenFit3pi gen [nExpt = 1] [firstExpt = 0]
- // or
- // ./GenFit3pi fit <iFit> [nExpt = 1] [firstExpt = 0]
- if ( argc < 2 ) {
- usage( std::cerr, argv[0] );
- return EXIT_FAILURE;
- }
-
- TString command = argv[1];
- command.ToLower();
- Int_t iFit(0);
- Int_t nExpt(1);
- Int_t firstExpt(0);
- Bool_t isToy(kTRUE);
- if ( command == "gen" ) {
- if ( argc > 2 ) {
- nExpt = atoi( argv[2] );
- if ( argc > 3 ) {
- firstExpt = atoi( argv[3] );
- }
- }
- } else if ( command == "fit" ) {
- if ( argc < 3 ) {
- usage( std::cerr, argv[0] );
- return EXIT_FAILURE;
- }
- iFit = atoi( argv[2] );
- if ( argc > 3 ) {
- nExpt = atoi( argv[3] );
- if ( argc > 4 ) {
- firstExpt = atoi( argv[4] );
- }
- }
- } else {
- usage( std::cerr, argv[0] );
- return EXIT_FAILURE;
- }
-
- // If you want to use square DP histograms for efficiency,
- // backgrounds or you just want the square DP co-ordinates
- // stored in the toy MC ntuple then set this to kTRUE
- Bool_t squareDP = kFALSE;
-
- // This defines the DP => decay is B+ -> pi+ pi+ pi-
- // Particle 1 = pi+
- // Particle 2 = pi+
- // Particle 3 = pi-
- // The DP is defined in terms of m13Sq and m23Sq
- LauDaughters* daughters = new LauDaughters("B+", "pi+", "pi+", "pi-", squareDP);
-
- // Optionally apply some vetoes to the DP
- // (example syntax given but commented-out)
- LauVetoes* vetoes = new LauVetoes();
- //Double_t DMin = 1.70;
- //Double_t DMax = 1.925;
- //Double_t JpsiMin = 3.051;
- //Double_t JpsiMax = 3.222;
- //Double_t psi2SMin = 3.676;
- //Double_t psi2SMax = 3.866;
- //vetoes->addMassVeto(1, DMin, DMax); // D0 veto, m23 (and automatically m13)
- //vetoes->addMassVeto(1, JpsiMin, JpsiMax); // J/psi veto, m23 (and automatically m13)
- //vetoes->addMassVeto(1, psi2SMin, psi2SMax); // psi(2S) veto, m23 (and automatically m13)
-
- // Define the efficiency model (defaults to unity everywhere)
- LauEffModel* effModel = new LauEffModel(daughters, vetoes);
-
- // Can optionally provide a histogram to model variation over DP
- // (example syntax given but commented-out)
- //TFile *effHistFile = TFile::Open("histoFiles/B3piNRDPEff.root", "read");
- //TH2* effHist = dynamic_cast<TH2*>(effHistFile->Get("effHist"));
- //Bool_t useInterpolation = kTRUE;
- //Bool_t fluctuateBins = kFALSE;
- //Bool_t useUpperHalf = kTRUE;
- //effModel->setEffHisto(effHist, useInterpolation, fluctuateBins, 0.0, 0.0, useUpperHalf, squareDP);
-
- // Create the isobar model
-
- // Set the values of the Blatt-Weisskopf barrier radii and whether they are fixed or floating
- LauResonanceMaker& resMaker = LauResonanceMaker::get();
- resMaker.setDefaultBWRadius( LauBlattWeisskopfFactor::Parent, 5.0 );
- resMaker.setDefaultBWRadius( LauBlattWeisskopfFactor::Light, 4.0 );
- resMaker.fixBWRadius( LauBlattWeisskopfFactor::Parent, kTRUE );
- resMaker.fixBWRadius( LauBlattWeisskopfFactor::Light, kTRUE );
-
- LauIsobarDynamics* sigModel = new LauIsobarDynamics(daughters, effModel);
- // Add various components to the isobar model,
- // modifying some resonance parameters
- LauAbsResonance* reson(0);
- // addResonance arguments: resName, resPairAmpInt, resType
- // resPairAmpInt = 1 => resonance mass is m23.
- reson = sigModel->addResonance("rho0(770)", 1, LauAbsResonance::GS);
- reson = sigModel->addResonance("rho0(1450)", 1, LauAbsResonance::RelBW);
- reson = sigModel->addResonance("f_0(980)", 1, LauAbsResonance::Flatte);
- reson->setResonanceParameter("g1",0.2);
- reson->setResonanceParameter("g2",1.0);
- reson = sigModel->addResonance("f_2(1270)", 1, LauAbsResonance::RelBW);
- const TString nrName { "BelleNR_Swave" };
- reson = sigModel->addResonance(nrName, 0, LauAbsResonance::BelleSymNRNoInter);
- reson->setResonanceParameter("alpha", 0.2);
-
- // Set the maximum signal DP ASq value
- // If you do not provide a value, one will be determined automatically,
- // which should be close to the true maximum but is not guaranteed to
- // be optimal.
- // Any value, whether manually provided or automatically determined,
- // will be automatically adjusted to avoid bias or extreme inefficiency
- // but it is best to set this by hand once you've found the right value
- // through some trial and error.
- sigModel->setASqMaxValue(0.35);
-
- // Create the fit model
- LauSimpleFitModel* fitModel = new LauSimpleFitModel(sigModel);
-
- // Create the complex coefficients for the isobar model
- // Here we're using the magnitude and phase form:
- // c_j = a_j exp(i*delta_j)
- std::vector<LauAbsCoeffSet*> coeffset;
- coeffset.push_back( new LauMagPhaseCoeffSet("rho0(770)", 1.00, 0.00, kTRUE, kTRUE) );
- coeffset.push_back( new LauMagPhaseCoeffSet("rho0(1450)", 0.37, 1.99, kFALSE, kFALSE) );
- coeffset.push_back( new LauMagPhaseCoeffSet("f_0(980)", 0.27, -1.59, kFALSE, kFALSE) );
- coeffset.push_back( new LauMagPhaseCoeffSet("f_2(1270)", 0.53, 1.39, kFALSE, kFALSE) );
- coeffset.push_back( new LauMagPhaseCoeffSet(nrName, 0.54, -0.84, kFALSE, kFALSE) );
- for (std::vector<LauAbsCoeffSet*>::iterator iter=coeffset.begin(); iter!=coeffset.end(); ++iter) {
- fitModel->setAmpCoeffSet(*iter);
- }
-
- // Set the signal yield and define whether it is fixed or floated
- const Double_t nSigEvents = 1500.0;
- LauParameter * signalEvents = new LauParameter("signalEvents",nSigEvents,-1.0*nSigEvents,2.0*nSigEvents,kFALSE);
- fitModel->setNSigEvents(signalEvents);
-
- // Set the number of experiments to generate or fit and which
- // experiment to start with
- fitModel->setNExpts( nExpt, firstExpt, isToy );
-
-
- // Set up a background model
-
- // First declare the names of the background class(es)
- std::vector<TString> bkgndNames(1);
- bkgndNames[0] = "qqbar";
- fitModel->setBkgndClassNames( bkgndNames );
-
- // Define and set the yield parameter for the background
- const Double_t nBkg = 1250.0;
- LauParameter* nBkgndEvents = new LauParameter("qqbar",nBkg,-2.0*nBkg,2.0*nBkg,kFALSE);
- fitModel->setNBkgndEvents( nBkgndEvents );
-
- // Create the background DP model
- LauBkgndDPModel* qqbarModel = new LauBkgndDPModel(daughters, vetoes);
-
- // Load in background DP model histogram
- // (example syntax given but commented-out - the background will be treated as being uniform in the DP in the absence of a histogram)
- //TString qqFileName("histoFiles/offResDP.root");
- //TFile* qqFile = TFile::Open(qqFileName.Data(), "read");
- //TH2* qqDP = dynamic_cast<TH2*>(qqFile->Get("AllmTheta")); // m', theta'
- //qqbarModel->setBkgndHisto(qqDP, useInterpolation, fluctuateBins, useUpperHalf, squareDP);
-
- // Add the background DP model into the fit model
- fitModel->setBkgndDPModel( "qqbar", qqbarModel );
-
-
- // Configure various fit options
-
- // Switch on/off calculation of asymmetric errors.
- fitModel->useAsymmFitErrors(kFALSE);
-
- // Randomise initial fit values for the signal mode
- fitModel->useRandomInitFitPars(kTRUE);
-
- const Bool_t haveBkgnds = ( fitModel->nBkgndClasses() > 0 );
-
- // Switch on/off Poissonian smearing of total number of events
- fitModel->doPoissonSmearing(haveBkgnds);
-
- // Switch on/off Extended ML Fit option
- fitModel->doEMLFit(haveBkgnds);
-
- // Generate toy from the fitted parameters
- //TString fitToyFileName("fitToyMC_3pi_");
- //fitToyFileName += iFit;
- //fitToyFileName += ".root";
- //fitModel->compareFitData(100, fitToyFileName);
-
- // Write out per-event likelihoods and sWeights
- //TString splotFileName("splot_3pi_");
- //splotFileName += iFit;
- //splotFileName += ".root";
- //fitModel->writeSPlotData(splotFileName, "splot", kFALSE);
-
- // Set the names of the files to read/write
- TString dataFile("gen-3pi.root");
- TString treeName("genResults");
- TString rootFileName("");
- TString tableFileName("");
- if (command == "fit") {
- rootFileName = "fit3pi_"; rootFileName += iFit;
- rootFileName += "_expt_"; rootFileName += firstExpt;
- rootFileName += "-"; rootFileName += (firstExpt+nExpt-1);
- rootFileName += ".root";
- tableFileName = "fit3piResults_"; tableFileName += iFit;
- } else {
- rootFileName = "dummy.root";
- tableFileName = "gen3piResults";
- }
-
- // Execute the generation/fit
- fitModel->run( command, dataFile, treeName, rootFileName, tableFileName );
-
- return EXIT_SUCCESS;
+ // Process command-line arguments
+ // Usage:
+ // ./GenFit3pi gen [nExpt = 1] [firstExpt = 0]
+ // or
+ // ./GenFit3pi fit <iFit> [nExpt = 1] [firstExpt = 0]
+ if ( argc < 2 ) {
+ usage( std::cerr, argv[0] );
+ return EXIT_FAILURE;
+ }
+
+ TString command = argv[1];
+ command.ToLower();
+ Int_t iFit( 0 );
+ Int_t nExpt( 1 );
+ Int_t firstExpt( 0 );
+ Bool_t isToy( kTRUE );
+ if ( command == "gen" ) {
+ if ( argc > 2 ) {
+ nExpt = atoi( argv[2] );
+ if ( argc > 3 ) {
+ firstExpt = atoi( argv[3] );
+ }
+ }
+ } else if ( command == "fit" ) {
+ if ( argc < 3 ) {
+ usage( std::cerr, argv[0] );
+ return EXIT_FAILURE;
+ }
+ iFit = atoi( argv[2] );
+ if ( argc > 3 ) {
+ nExpt = atoi( argv[3] );
+ if ( argc > 4 ) {
+ firstExpt = atoi( argv[4] );
+ }
+ }
+ } else {
+ usage( std::cerr, argv[0] );
+ return EXIT_FAILURE;
+ }
+
+ // If you want to use square DP histograms for efficiency,
+ // backgrounds or you just want the square DP co-ordinates
+ // stored in the toy MC ntuple then set this to kTRUE
+ Bool_t squareDP = kFALSE;
+
+ // This defines the DP => decay is B+ -> pi+ pi+ pi-
+ // Particle 1 = pi+
+ // Particle 2 = pi+
+ // Particle 3 = pi-
+ // The DP is defined in terms of m13Sq and m23Sq
+ LauDaughters* daughters = new LauDaughters( "B+", "pi+", "pi+", "pi-", squareDP );
+
+ // Optionally apply some vetoes to the DP
+ // (example syntax given but commented-out)
+ LauVetoes* vetoes = new LauVetoes();
+ //Double_t DMin = 1.70;
+ //Double_t DMax = 1.925;
+ //Double_t JpsiMin = 3.051;
+ //Double_t JpsiMax = 3.222;
+ //Double_t psi2SMin = 3.676;
+ //Double_t psi2SMax = 3.866;
+ //vetoes->addMassVeto(1, DMin, DMax); // D0 veto, m23 (and automatically m13)
+ //vetoes->addMassVeto(1, JpsiMin, JpsiMax); // J/psi veto, m23 (and automatically m13)
+ //vetoes->addMassVeto(1, psi2SMin, psi2SMax); // psi(2S) veto, m23 (and automatically m13)
+
+ // Define the efficiency model (defaults to unity everywhere)
+ LauEffModel* effModel = new LauEffModel( daughters, vetoes );
+
+ // Can optionally provide a histogram to model variation over DP
+ // (example syntax given but commented-out)
+ //TFile *effHistFile = TFile::Open("histoFiles/B3piNRDPEff.root", "read");
+ //TH2* effHist = dynamic_cast<TH2*>(effHistFile->Get("effHist"));
+ //Bool_t useInterpolation = kTRUE;
+ //Bool_t fluctuateBins = kFALSE;
+ //Bool_t useUpperHalf = kTRUE;
+ //effModel->setEffHisto(effHist, useInterpolation, fluctuateBins, 0.0, 0.0, useUpperHalf, squareDP);
+
+ // Create the isobar model
+
+ // Set the values of the Blatt-Weisskopf barrier radii and whether they are fixed or floating
+ LauResonanceMaker& resMaker = LauResonanceMaker::get();
+ resMaker.setDefaultBWRadius( LauBlattWeisskopfFactor::Parent, 5.0 );
+ resMaker.setDefaultBWRadius( LauBlattWeisskopfFactor::Light, 4.0 );
+ resMaker.fixBWRadius( LauBlattWeisskopfFactor::Parent, kTRUE );
+ resMaker.fixBWRadius( LauBlattWeisskopfFactor::Light, kTRUE );
+
+ LauIsobarDynamics* sigModel = new LauIsobarDynamics( daughters, effModel );
+ // Add various components to the isobar model,
+ // modifying some resonance parameters
+ LauAbsResonance* reson( 0 );
+ // addResonance arguments: resName, resPairAmpInt, resType
+ // resPairAmpInt = 1 => resonance mass is m23.
+ reson = sigModel->addResonance( "rho0(770)", 1, LauAbsResonance::GS );
+ reson = sigModel->addResonance( "rho0(1450)", 1, LauAbsResonance::RelBW );
+ reson = sigModel->addResonance( "f_0(980)", 1, LauAbsResonance::Flatte );
+ reson->setResonanceParameter( "g1", 0.2 );
+ reson->setResonanceParameter( "g2", 1.0 );
+ reson = sigModel->addResonance( "f_2(1270)", 1, LauAbsResonance::RelBW );
+ const TString nrName { "BelleNR_Swave" };
+ reson = sigModel->addResonance( nrName, 0, LauAbsResonance::BelleSymNRNoInter );
+ reson->setResonanceParameter( "alpha", 0.2 );
+
+ // Set the maximum signal DP ASq value
+ // If you do not provide a value, one will be determined automatically,
+ // which should be close to the true maximum but is not guaranteed to
+ // be optimal.
+ // Any value, whether manually provided or automatically determined,
+ // will be automatically adjusted to avoid bias or extreme inefficiency
+ // but it is best to set this by hand once you've found the right value
+ // through some trial and error.
+ sigModel->setASqMaxValue( 0.35 );
+
+ // Create the fit model
+ LauSimpleFitModel* fitModel = new LauSimpleFitModel( sigModel );
+
+ // Create the complex coefficients for the isobar model
+ // Here we're using the magnitude and phase form:
+ // c_j = a_j exp(i*delta_j)
+ std::vector<LauAbsCoeffSet*> coeffset;
+ coeffset.push_back( new LauMagPhaseCoeffSet( "rho0(770)", 1.00, 0.00, kTRUE, kTRUE ) );
+ coeffset.push_back( new LauMagPhaseCoeffSet( "rho0(1450)", 0.37, 1.99, kFALSE, kFALSE ) );
+ coeffset.push_back( new LauMagPhaseCoeffSet( "f_0(980)", 0.27, -1.59, kFALSE, kFALSE ) );
+ coeffset.push_back( new LauMagPhaseCoeffSet( "f_2(1270)", 0.53, 1.39, kFALSE, kFALSE ) );
+ coeffset.push_back( new LauMagPhaseCoeffSet( nrName, 0.54, -0.84, kFALSE, kFALSE ) );
+ for ( std::vector<LauAbsCoeffSet*>::iterator iter = coeffset.begin(); iter != coeffset.end();
+ ++iter ) {
+ fitModel->setAmpCoeffSet( *iter );
+ }
+
+ // Set the signal yield and define whether it is fixed or floated
+ const Double_t nSigEvents = 1500.0;
+ LauParameter* signalEvents =
+ new LauParameter( "signalEvents", nSigEvents, -1.0 * nSigEvents, 2.0 * nSigEvents, kFALSE );
+ fitModel->setNSigEvents( signalEvents );
+
+ // Set the number of experiments to generate or fit and which
+ // experiment to start with
+ fitModel->setNExpts( nExpt, firstExpt, isToy );
+
+ // Set up a background model
+
+ // First declare the names of the background class(es)
+ std::vector<TString> bkgndNames( 1 );
+ bkgndNames[0] = "qqbar";
+ fitModel->setBkgndClassNames( bkgndNames );
+
+ // Define and set the yield parameter for the background
+ const Double_t nBkg = 1250.0;
+ LauParameter* nBkgndEvents = new LauParameter( "qqbar", nBkg, -2.0 * nBkg, 2.0 * nBkg, kFALSE );
+ fitModel->setNBkgndEvents( nBkgndEvents );
+
+ // Create the background DP model
+ LauBkgndDPModel* qqbarModel = new LauBkgndDPModel( daughters, vetoes );
+
+ // Load in background DP model histogram
+ // (example syntax given but commented-out - the background will be treated as being uniform in the DP in the absence of a histogram)
+ //TString qqFileName("histoFiles/offResDP.root");
+ //TFile* qqFile = TFile::Open(qqFileName.Data(), "read");
+ //TH2* qqDP = dynamic_cast<TH2*>(qqFile->Get("AllmTheta")); // m', theta'
+ //qqbarModel->setBkgndHisto(qqDP, useInterpolation, fluctuateBins, useUpperHalf, squareDP);
+
+ // Add the background DP model into the fit model
+ fitModel->setBkgndDPModel( "qqbar", qqbarModel );
+
+ // Configure various fit options
+
+ // Switch on/off calculation of asymmetric errors.
+ fitModel->useAsymmFitErrors( kFALSE );
+
+ // Randomise initial fit values for the signal mode
+ fitModel->useRandomInitFitPars( kTRUE );
+
+ const Bool_t haveBkgnds = ( fitModel->nBkgndClasses() > 0 );
+
+ // Switch on/off Poissonian smearing of total number of events
+ fitModel->doPoissonSmearing( haveBkgnds );
+
+ // Switch on/off Extended ML Fit option
+ fitModel->doEMLFit( haveBkgnds );
+
+ // Generate toy from the fitted parameters
+ //TString fitToyFileName("fitToyMC_3pi_");
+ //fitToyFileName += iFit;
+ //fitToyFileName += ".root";
+ //fitModel->compareFitData(100, fitToyFileName);
+
+ // Write out per-event likelihoods and sWeights
+ //TString splotFileName("splot_3pi_");
+ //splotFileName += iFit;
+ //splotFileName += ".root";
+ //fitModel->writeSPlotData(splotFileName, "splot", kFALSE);
+
+ // Set the names of the files to read/write
+ TString dataFile( "gen-3pi.root" );
+ TString treeName( "genResults" );
+ TString rootFileName( "" );
+ TString tableFileName( "" );
+ if ( command == "fit" ) {
+ rootFileName = "fit3pi_";
+ rootFileName += iFit;
+ rootFileName += "_expt_";
+ rootFileName += firstExpt;
+ rootFileName += "-";
+ rootFileName += ( firstExpt + nExpt - 1 );
+ rootFileName += ".root";
+ tableFileName = "fit3piResults_";
+ tableFileName += iFit;
+ } else {
+ rootFileName = "dummy.root";
+ tableFileName = "gen3piResults";
+ }
+
+ // Execute the generation/fit
+ fitModel->run( command, dataFile, treeName, rootFileName, tableFileName );
+
+ return EXIT_SUCCESS;
}
diff --git a/examples/GenFitBelleCPKpipi.cc b/examples/GenFitBelleCPKpipi.cc
index 83b7287..e5a2c49 100644
--- a/examples/GenFitBelleCPKpipi.cc
+++ b/examples/GenFitBelleCPKpipi.cc
@@ -1,255 +1,313 @@
/*
Copyright 2005 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
-#include <cstdlib>
-#include <iostream>
-#include <vector>
-
-#include "TFile.h"
-#include "TH2.h"
-#include "TString.h"
-#include "TTree.h"
-
+#include "LauBelleCPCoeffSet.hh"
#include "LauBkgndDPModel.hh"
#include "LauCPFitModel.hh"
#include "LauDaughters.hh"
#include "LauEffModel.hh"
#include "LauIsobarDynamics.hh"
-#include "LauBelleCPCoeffSet.hh"
#include "LauVetoes.hh"
+#include "TFile.h"
+#include "TH2.h"
+#include "TString.h"
+#include "TTree.h"
+
+#include <cstdlib>
+#include <iostream>
+#include <vector>
+
void usage( std::ostream& out, const TString& progName )
{
- out<<"Usage:\n";
- out<<progName<<" gen [nExpt = 1] [firstExpt = 0]\n";
- out<<"or\n";
- out<<progName<<" fit <iFit> [nExpt = 1] [firstExpt = 0]"<<std::endl;
+ out << "Usage:\n";
+ out << progName << " gen [nExpt = 1] [firstExpt = 0]\n";
+ out << "or\n";
+ out << progName << " fit <iFit> [nExpt = 1] [firstExpt = 0]" << std::endl;
}
int main( int argc, char** argv )
{
- // Process command-line arguments
- // Usage:
- // ./GenFitBelleCPKpipi gen [nExpt = 1] [firstExpt = 0]
- // or
- // ./GenFitBelleCPKpipi fit <iFit> [nExpt = 1] [firstExpt = 0]
- if ( argc < 2 ) {
- usage( std::cerr, argv[0] );
- return EXIT_FAILURE;
- }
-
- TString command = argv[1];
- command.ToLower();
- Int_t iFit(0);
- Int_t nExpt(1);
- Int_t firstExpt(0);
- Bool_t isToy(kTRUE);
- if ( command == "gen" ) {
- if ( argc > 2 ) {
- nExpt = atoi( argv[2] );
- if ( argc > 3 ) {
- firstExpt = atoi( argv[3] );
- }
- }
- } else if ( command == "fit" ) {
- if ( argc < 3 ) {
- usage( std::cerr, argv[0] );
- return EXIT_FAILURE;
- }
- iFit = atoi( argv[2] );
- if ( argc > 3 ) {
- nExpt = atoi( argv[3] );
- if ( argc > 4 ) {
- firstExpt = atoi( argv[4] );
- }
- }
- } else {
- usage( std::cerr, argv[0] );
- return EXIT_FAILURE;
- }
-
- // If you want to use square DP histograms for efficiency,
- // backgrounds or you just want the square DP co-ordinates
- // stored in the toy MC ntuple then set this to kTRUE
- Bool_t squareDP = kFALSE;
-
- // These define the DP => decay is B+ -> K+ pi+ pi- and it's charge conjugate
- // The DP is defined in terms of m13Sq and m23Sq
- LauDaughters* negDaughters = new LauDaughters("B-", "K-", "pi-", "pi+", squareDP);
- LauDaughters* posDaughters = new LauDaughters("B+", "K+", "pi+", "pi-", squareDP);
-
- // Create the isobar models
- LauAbsResonance* res(0);
- LauIsobarDynamics* negSigModel = new LauIsobarDynamics(negDaughters, 0);
- // resPairAmpInt = 1 => resonance mass is m23.
- // resPairAmpInt = 2 => resonance mass is m13.
- res = negSigModel->addResonance("K*0(892)", 2, LauAbsResonance::RelBW);
- res = negSigModel->addResonance("K*0_0(1430)", 2, LauAbsResonance::LASS_BW);
- res->floatResonanceParameter("a");
- res->floatResonanceParameter("r");
- res = negSigModel->addResonance("LASSNR0", 2, LauAbsResonance::LASS_NR);
- res = negSigModel->addResonance("rho0(770)", 1, LauAbsResonance::RelBW);
- res = negSigModel->addResonance("f_0(980)", 1, LauAbsResonance::Flatte);
- res = negSigModel->addResonance("chi_c0", 1, LauAbsResonance::RelBW);
- res = negSigModel->addResonance("NonReson", 1, LauAbsResonance::BelleNR);
- res->setResonanceParameter("alpha", 0.50);
- res->floatResonanceParameter("alpha");
-
- LauIsobarDynamics* posSigModel = new LauIsobarDynamics(posDaughters, 0);
- res = posSigModel->addResonance("K*0(892)", 2, LauAbsResonance::RelBW);
- res = posSigModel->addResonance("K*0_0(1430)", 2, LauAbsResonance::LASS_BW);
- res->floatResonanceParameter("a");
- res->floatResonanceParameter("r");
- res = posSigModel->addResonance("LASSNR0", 2, LauAbsResonance::LASS_NR);
- res = posSigModel->addResonance("rho0(770)", 1, LauAbsResonance::RelBW);
- res = posSigModel->addResonance("f_0(980)", 1, LauAbsResonance::Flatte);
- res = posSigModel->addResonance("chi_c0", 1, LauAbsResonance::RelBW);
- res = posSigModel->addResonance("NonReson", 1, LauAbsResonance::BelleNR);
- res->setResonanceParameter("alpha", 0.50);
- res->floatResonanceParameter("alpha");
-
- // Set the file names for the integrals information (can be useful for debugging)
- negSigModel->setIntFileName("integ_neg.dat");
- posSigModel->setIntFileName("integ_pos.dat");
-
- // Set the maximum signal DP ASq value
- // If you do not provide a value, one will be determined automatically,
- // which should be close to the true maximum but is not guaranteed to
- // be optimal.
- // Any value, whether manually provided or automatically determined,
- // will be automatically adjusted to avoid bias or extreme inefficiency
- // but it is best to set this by hand once you've found the right value
- // through some trial and error.
- const Double_t aSqMaxValue{1.62};
- negSigModel->setASqMaxValue(aSqMaxValue);
- posSigModel->setASqMaxValue(aSqMaxValue);
-
- // Create the fit model, giving it both isobar models
- LauCPFitModel* fitModel = new LauCPFitModel( negSigModel, posSigModel );
-
- // Create the complex coefficients for the isobar model
- // Here we're using the "Belle" form:
- // The amplitude has the form a * exp(i*delta) * ( 1 +/- b * exp(i*phi) ) where
- // a is a CP conserving magnitude,
- // b is a CP violating magnitude,
- // delta is the strong phase
- // and phi is the weak phase.
- // The last two arguments indicate that the CP-violating parameters
- // should only be floated in the second-stage of the two-stage fit
- LauAbsCoeffSet* a0CoeffSet = new LauBelleCPCoeffSet("K*0(892)", 1.00, 0.00, 0.00, 0.00, kTRUE, kTRUE, kFALSE, kTRUE, kTRUE, kTRUE);
-
- // Here we show how to use the coefficient cloning mechanism to clone
- // only the CP-violating parameters. This means that the K*0_0(1430)
- // component will have identical CPV parameters to the K*0(892).
- // But the CP-conserving parameters will be independent and as such we
- // need to set their values and, in this case because we're cloning
- // from the reference amplitude, also set them to float.
- //LauAbsCoeffSet* a1CoeffSet = new LauBelleCPCoeffSet("K*0_0(1430)", 2.00, 3.00, 0.00, 0.00, kFALSE, kFALSE, kFALSE, kFALSE, kTRUE, kTRUE);
- LauAbsCoeffSet* a1CoeffSet = a0CoeffSet->createClone("K*0_0(1430)", LauAbsCoeffSet::TieCPPars);
- a1CoeffSet->setParameterValue("A",2.0,kTRUE);
- a1CoeffSet->setParameterValue("Delta",3.0,kTRUE);
- a1CoeffSet->floatParameter("A");
- a1CoeffSet->floatParameter("Delta");
- LauAbsCoeffSet* a2CoeffSet = a1CoeffSet->createClone("LASSNR0", LauAbsCoeffSet::TieCPPars);
-
- LauAbsCoeffSet* a3CoeffSet = new LauBelleCPCoeffSet("rho0(770)", 0.66, 1.00, 0.00, 0.00, kFALSE, kFALSE, kFALSE, kFALSE, kTRUE, kTRUE);
- LauAbsCoeffSet* a4CoeffSet = new LauBelleCPCoeffSet("f_0(980)", 1.00, -1.00, 0.00, 0.00, kFALSE, kFALSE, kFALSE, kFALSE, kTRUE, kTRUE);
- LauAbsCoeffSet* a5CoeffSet = new LauBelleCPCoeffSet("chi_c0", 0.33, 0.50, 0.00, 0.00, kFALSE, kFALSE, kFALSE, kFALSE, kTRUE, kTRUE);
- LauAbsCoeffSet* a6CoeffSet = new LauBelleCPCoeffSet("NonReson", 0.50, 1.50, 0.00, 0.00, kFALSE, kFALSE, kFALSE, kFALSE, kTRUE, kTRUE);
-
- std::vector<LauAbsCoeffSet*> coeffset;
- coeffset.push_back( a0CoeffSet );
- coeffset.push_back( a1CoeffSet );
- coeffset.push_back( a2CoeffSet );
- coeffset.push_back( a3CoeffSet );
- coeffset.push_back( a4CoeffSet );
- coeffset.push_back( a5CoeffSet );
- coeffset.push_back( a6CoeffSet );
- for (std::vector<LauAbsCoeffSet*>::iterator iter=coeffset.begin(); iter!=coeffset.end(); ++iter) {
- fitModel->setAmpCoeffSet(*iter);
- }
-
- // Set the signal yield and define whether it is fixed or floated
- const Double_t nSigEvents = 5000.0;
- Bool_t fixNSigEvents = kFALSE;
- LauParameter * signalEvents = new LauParameter("signalEvents",nSigEvents,-1.0*nSigEvents,2.0*nSigEvents,fixNSigEvents);
- fitModel->setNSigEvents(signalEvents);
-
- // Set the number of experiments to generate or fit and which
- // experiment to start with
- fitModel->setNExpts( nExpt, firstExpt, isToy );
-
-
- // Configure various fit options
-
- // Switch on/off calculation of asymmetric errors.
- fitModel->useAsymmFitErrors(kFALSE);
-
- // Randomise initial fit values for the signal mode
- fitModel->useRandomInitFitPars(kTRUE);
-
- const Bool_t haveBkgnds = ( fitModel->nBkgndClasses() > 0 );
-
- // Switch on/off Poissonian smearing of total number of events
- fitModel->doPoissonSmearing(haveBkgnds);
-
- // Switch on/off Extended ML Fit option
- fitModel->doEMLFit(haveBkgnds);
-
- // Switch on/off two-stage fit
- fitModel->twoStageFit(kTRUE);
-
- // Generate toy from the fitted parameters
- //TString fitToyFileName("fitToyMC_BelleCPKpipi_");
- //fitToyFileName += iFit;
- //fitToyFileName += ".root";
- //fitModel->compareFitData(100, fitToyFileName);
-
- // Write out per-event likelihoods and sWeights
- //TString splotFileName("splot_BelleCPKpipi_");
- //splotFileName += iFit;
- //splotFileName += ".root";
- //fitModel->writeSPlotData(splotFileName, "splot", kFALSE);
-
- // Set the names of the files to read/write
- TString dataFile("gen-BelleCPKpipi.root");
- TString treeName("genResults");
- TString rootFileName("");
- TString tableFileName("");
- if (command == "fit") {
- rootFileName = "fitBelleCPKpipi_"; rootFileName += iFit;
- rootFileName += "_expt_"; rootFileName += firstExpt;
- rootFileName += "-"; rootFileName += (firstExpt+nExpt-1);
- rootFileName += ".root";
- tableFileName = "fitBelleCPKpipiResults_"; tableFileName += iFit;
- } else {
- rootFileName = "dummy.root";
- tableFileName = "genBelleCPKpipiResults";
- }
-
- // Execute the generation/fit
- fitModel->run( command, dataFile, treeName, rootFileName, tableFileName );
-
- return EXIT_SUCCESS;
+ // Process command-line arguments
+ // Usage:
+ // ./GenFitBelleCPKpipi gen [nExpt = 1] [firstExpt = 0]
+ // or
+ // ./GenFitBelleCPKpipi fit <iFit> [nExpt = 1] [firstExpt = 0]
+ if ( argc < 2 ) {
+ usage( std::cerr, argv[0] );
+ return EXIT_FAILURE;
+ }
+
+ TString command = argv[1];
+ command.ToLower();
+ Int_t iFit( 0 );
+ Int_t nExpt( 1 );
+ Int_t firstExpt( 0 );
+ Bool_t isToy( kTRUE );
+ if ( command == "gen" ) {
+ if ( argc > 2 ) {
+ nExpt = atoi( argv[2] );
+ if ( argc > 3 ) {
+ firstExpt = atoi( argv[3] );
+ }
+ }
+ } else if ( command == "fit" ) {
+ if ( argc < 3 ) {
+ usage( std::cerr, argv[0] );
+ return EXIT_FAILURE;
+ }
+ iFit = atoi( argv[2] );
+ if ( argc > 3 ) {
+ nExpt = atoi( argv[3] );
+ if ( argc > 4 ) {
+ firstExpt = atoi( argv[4] );
+ }
+ }
+ } else {
+ usage( std::cerr, argv[0] );
+ return EXIT_FAILURE;
+ }
+
+ // If you want to use square DP histograms for efficiency,
+ // backgrounds or you just want the square DP co-ordinates
+ // stored in the toy MC ntuple then set this to kTRUE
+ Bool_t squareDP = kFALSE;
+
+ // These define the DP => decay is B+ -> K+ pi+ pi- and it's charge conjugate
+ // The DP is defined in terms of m13Sq and m23Sq
+ LauDaughters* negDaughters = new LauDaughters( "B-", "K-", "pi-", "pi+", squareDP );
+ LauDaughters* posDaughters = new LauDaughters( "B+", "K+", "pi+", "pi-", squareDP );
+
+ // Create the isobar models
+ LauAbsResonance* res( 0 );
+ LauIsobarDynamics* negSigModel = new LauIsobarDynamics( negDaughters, 0 );
+ // resPairAmpInt = 1 => resonance mass is m23.
+ // resPairAmpInt = 2 => resonance mass is m13.
+ res = negSigModel->addResonance( "K*0(892)", 2, LauAbsResonance::RelBW );
+ res = negSigModel->addResonance( "K*0_0(1430)", 2, LauAbsResonance::LASS_BW );
+ res->floatResonanceParameter( "a" );
+ res->floatResonanceParameter( "r" );
+ res = negSigModel->addResonance( "LASSNR0", 2, LauAbsResonance::LASS_NR );
+ res = negSigModel->addResonance( "rho0(770)", 1, LauAbsResonance::RelBW );
+ res = negSigModel->addResonance( "f_0(980)", 1, LauAbsResonance::Flatte );
+ res = negSigModel->addResonance( "chi_c0", 1, LauAbsResonance::RelBW );
+ res = negSigModel->addResonance( "NonReson", 1, LauAbsResonance::BelleNR );
+ res->setResonanceParameter( "alpha", 0.50 );
+ res->floatResonanceParameter( "alpha" );
+
+ LauIsobarDynamics* posSigModel = new LauIsobarDynamics( posDaughters, 0 );
+ res = posSigModel->addResonance( "K*0(892)", 2, LauAbsResonance::RelBW );
+ res = posSigModel->addResonance( "K*0_0(1430)", 2, LauAbsResonance::LASS_BW );
+ res->floatResonanceParameter( "a" );
+ res->floatResonanceParameter( "r" );
+ res = posSigModel->addResonance( "LASSNR0", 2, LauAbsResonance::LASS_NR );
+ res = posSigModel->addResonance( "rho0(770)", 1, LauAbsResonance::RelBW );
+ res = posSigModel->addResonance( "f_0(980)", 1, LauAbsResonance::Flatte );
+ res = posSigModel->addResonance( "chi_c0", 1, LauAbsResonance::RelBW );
+ res = posSigModel->addResonance( "NonReson", 1, LauAbsResonance::BelleNR );
+ res->setResonanceParameter( "alpha", 0.50 );
+ res->floatResonanceParameter( "alpha" );
+
+ // Set the file names for the integrals information (can be useful for debugging)
+ negSigModel->setIntFileName( "integ_neg.dat" );
+ posSigModel->setIntFileName( "integ_pos.dat" );
+
+ // Set the maximum signal DP ASq value
+ // If you do not provide a value, one will be determined automatically,
+ // which should be close to the true maximum but is not guaranteed to
+ // be optimal.
+ // Any value, whether manually provided or automatically determined,
+ // will be automatically adjusted to avoid bias or extreme inefficiency
+ // but it is best to set this by hand once you've found the right value
+ // through some trial and error.
+ const Double_t aSqMaxValue { 1.62 };
+ negSigModel->setASqMaxValue( aSqMaxValue );
+ posSigModel->setASqMaxValue( aSqMaxValue );
+
+ // Create the fit model, giving it both isobar models
+ LauCPFitModel* fitModel = new LauCPFitModel( negSigModel, posSigModel );
+
+ // Create the complex coefficients for the isobar model
+ // Here we're using the "Belle" form:
+ // The amplitude has the form a * exp(i*delta) * ( 1 +/- b * exp(i*phi) ) where
+ // a is a CP conserving magnitude,
+ // b is a CP violating magnitude,
+ // delta is the strong phase
+ // and phi is the weak phase.
+ // The last two arguments indicate that the CP-violating parameters
+ // should only be floated in the second-stage of the two-stage fit
+ LauAbsCoeffSet* a0CoeffSet = new LauBelleCPCoeffSet( "K*0(892)",
+ 1.00,
+ 0.00,
+ 0.00,
+ 0.00,
+ kTRUE,
+ kTRUE,
+ kFALSE,
+ kTRUE,
+ kTRUE,
+ kTRUE );
+
+ // Here we show how to use the coefficient cloning mechanism to clone
+ // only the CP-violating parameters. This means that the K*0_0(1430)
+ // component will have identical CPV parameters to the K*0(892).
+ // But the CP-conserving parameters will be independent and as such we
+ // need to set their values and, in this case because we're cloning
+ // from the reference amplitude, also set them to float.
+ //LauAbsCoeffSet* a1CoeffSet = new LauBelleCPCoeffSet("K*0_0(1430)", 2.00, 3.00, 0.00, 0.00, kFALSE, kFALSE, kFALSE, kFALSE, kTRUE, kTRUE);
+ LauAbsCoeffSet* a1CoeffSet = a0CoeffSet->createClone( "K*0_0(1430)", LauAbsCoeffSet::TieCPPars );
+ a1CoeffSet->setParameterValue( "A", 2.0, kTRUE );
+ a1CoeffSet->setParameterValue( "Delta", 3.0, kTRUE );
+ a1CoeffSet->floatParameter( "A" );
+ a1CoeffSet->floatParameter( "Delta" );
+ LauAbsCoeffSet* a2CoeffSet = a1CoeffSet->createClone( "LASSNR0", LauAbsCoeffSet::TieCPPars );
+
+ LauAbsCoeffSet* a3CoeffSet = new LauBelleCPCoeffSet( "rho0(770)",
+ 0.66,
+ 1.00,
+ 0.00,
+ 0.00,
+ kFALSE,
+ kFALSE,
+ kFALSE,
+ kFALSE,
+ kTRUE,
+ kTRUE );
+ LauAbsCoeffSet* a4CoeffSet = new LauBelleCPCoeffSet( "f_0(980)",
+ 1.00,
+ -1.00,
+ 0.00,
+ 0.00,
+ kFALSE,
+ kFALSE,
+ kFALSE,
+ kFALSE,
+ kTRUE,
+ kTRUE );
+ LauAbsCoeffSet* a5CoeffSet = new LauBelleCPCoeffSet( "chi_c0",
+ 0.33,
+ 0.50,
+ 0.00,
+ 0.00,
+ kFALSE,
+ kFALSE,
+ kFALSE,
+ kFALSE,
+ kTRUE,
+ kTRUE );
+ LauAbsCoeffSet* a6CoeffSet = new LauBelleCPCoeffSet( "NonReson",
+ 0.50,
+ 1.50,
+ 0.00,
+ 0.00,
+ kFALSE,
+ kFALSE,
+ kFALSE,
+ kFALSE,
+ kTRUE,
+ kTRUE );
+
+ std::vector<LauAbsCoeffSet*> coeffset;
+ coeffset.push_back( a0CoeffSet );
+ coeffset.push_back( a1CoeffSet );
+ coeffset.push_back( a2CoeffSet );
+ coeffset.push_back( a3CoeffSet );
+ coeffset.push_back( a4CoeffSet );
+ coeffset.push_back( a5CoeffSet );
+ coeffset.push_back( a6CoeffSet );
+ for ( std::vector<LauAbsCoeffSet*>::iterator iter = coeffset.begin(); iter != coeffset.end();
+ ++iter ) {
+ fitModel->setAmpCoeffSet( *iter );
+ }
+
+ // Set the signal yield and define whether it is fixed or floated
+ const Double_t nSigEvents = 5000.0;
+ Bool_t fixNSigEvents = kFALSE;
+ LauParameter* signalEvents = new LauParameter( "signalEvents",
+ nSigEvents,
+ -1.0 * nSigEvents,
+ 2.0 * nSigEvents,
+ fixNSigEvents );
+ fitModel->setNSigEvents( signalEvents );
+
+ // Set the number of experiments to generate or fit and which
+ // experiment to start with
+ fitModel->setNExpts( nExpt, firstExpt, isToy );
+
+ // Configure various fit options
+
+ // Switch on/off calculation of asymmetric errors.
+ fitModel->useAsymmFitErrors( kFALSE );
+
+ // Randomise initial fit values for the signal mode
+ fitModel->useRandomInitFitPars( kTRUE );
+
+ const Bool_t haveBkgnds = ( fitModel->nBkgndClasses() > 0 );
+
+ // Switch on/off Poissonian smearing of total number of events
+ fitModel->doPoissonSmearing( haveBkgnds );
+
+ // Switch on/off Extended ML Fit option
+ fitModel->doEMLFit( haveBkgnds );
+
+ // Switch on/off two-stage fit
+ fitModel->twoStageFit( kTRUE );
+
+ // Generate toy from the fitted parameters
+ //TString fitToyFileName("fitToyMC_BelleCPKpipi_");
+ //fitToyFileName += iFit;
+ //fitToyFileName += ".root";
+ //fitModel->compareFitData(100, fitToyFileName);
+
+ // Write out per-event likelihoods and sWeights
+ //TString splotFileName("splot_BelleCPKpipi_");
+ //splotFileName += iFit;
+ //splotFileName += ".root";
+ //fitModel->writeSPlotData(splotFileName, "splot", kFALSE);
+
+ // Set the names of the files to read/write
+ TString dataFile( "gen-BelleCPKpipi.root" );
+ TString treeName( "genResults" );
+ TString rootFileName( "" );
+ TString tableFileName( "" );
+ if ( command == "fit" ) {
+ rootFileName = "fitBelleCPKpipi_";
+ rootFileName += iFit;
+ rootFileName += "_expt_";
+ rootFileName += firstExpt;
+ rootFileName += "-";
+ rootFileName += ( firstExpt + nExpt - 1 );
+ rootFileName += ".root";
+ tableFileName = "fitBelleCPKpipiResults_";
+ tableFileName += iFit;
+ } else {
+ rootFileName = "dummy.root";
+ tableFileName = "genBelleCPKpipiResults";
+ }
+
+ // Execute the generation/fit
+ fitModel->run( command, dataFile, treeName, rootFileName, tableFileName );
+
+ return EXIT_SUCCESS;
}
diff --git a/examples/GenFitDpipi.cc b/examples/GenFitDpipi.cc
index 0a511da..9446851 100644
--- a/examples/GenFitDpipi.cc
+++ b/examples/GenFitDpipi.cc
@@ -1,226 +1,231 @@
-#include <cstdlib>
-#include <iostream>
-#include <vector>
-
-#include "TFile.h"
-#include "TH2.h"
-#include "TString.h"
-#include "TTree.h"
-
-#include "LauSimpleFitModel.hh"
-#include "LauResonanceMaker.hh"
+#include "LauAbsModIndPartWave.hh"
#include "LauBkgndDPModel.hh"
#include "LauDaughters.hh"
#include "LauEffModel.hh"
#include "LauIsobarDynamics.hh"
#include "LauMagPhaseCoeffSet.hh"
-#include "LauRealImagCoeffSet.hh"
+#include "LauModIndPartWaveMagPhase.hh"
+#include "LauModIndPartWaveRealImag.hh"
#include "LauRandom.hh"
+#include "LauRealImagCoeffSet.hh"
+#include "LauResonanceMaker.hh"
+#include "LauSimpleFitModel.hh"
#include "LauVetoes.hh"
-#include "LauAbsModIndPartWave.hh"
-#include "LauModIndPartWaveRealImag.hh"
-#include "LauModIndPartWaveMagPhase.hh"
+
+#include "TFile.h"
+#include "TH2.h"
+#include "TString.h"
+#include "TTree.h"
+
+#include <cstdlib>
+#include <iostream>
+#include <vector>
void usage( std::ostream& out, const TString& progName )
{
- out<<"Usage:\n";
- out<<progName<<" gen [nExpt = 1] [firstExpt = 0]\n";
- out<<"or\n";
- out<<progName<<" fit <iFit> [nExpt = 1] [firstExpt = 0]"<<std::endl;
- out<<"or\n";
- out<<progName<<" plot"<<std::endl;
+ out << "Usage:\n";
+ out << progName << " gen [nExpt = 1] [firstExpt = 0]\n";
+ out << "or\n";
+ out << progName << " fit <iFit> [nExpt = 1] [firstExpt = 0]" << std::endl;
+ out << "or\n";
+ out << progName << " plot" << std::endl;
}
int main( int argc, char** argv )
{
- // Process command-line arguments
- // Usage:
- // ./GenFitDpipi gen [nExpt = 1] [firstExpt = 0]
- // or
- // ./GenFitDpipi fit <iFit> [nExpt = 1] [firstExpt = 0]
- if ( argc < 2 ) {
- usage( std::cerr, argv[0] );
- return EXIT_FAILURE;
- }
-
- TString command = argv[1];
- command.ToLower();
- Int_t iFit(0);
- Int_t nExpt(1);
- Int_t firstExpt(0);
- Bool_t isToy(kTRUE);
- if ( command == "gen" ) {
- if ( argc > 2 ) {
- nExpt = atoi( argv[2] );
- if ( argc > 3 ) {
- firstExpt = atoi( argv[3] );
- }
- }
- } else if ( command == "fit" ) {
- if ( argc < 3 ) {
- usage( std::cerr, argv[0] );
- return EXIT_FAILURE;
- }
- iFit = atoi( argv[2] );
- if ( argc > 3 ) {
- nExpt = atoi( argv[3] );
- if ( argc > 4 ) {
- firstExpt = atoi( argv[4] );
- }
- }
- } else {
- usage( std::cerr, argv[0] );
- return EXIT_FAILURE;
- }
-
- // If you want to use square DP histograms for efficiency,
- // backgrounds or you just want the square DP co-ordinates
- // stored in the toy MC ntuple then set this to kTRUE
- Bool_t squareDP = kTRUE;
-
- // This defines the DP => decay is B+ -> pi+ pi+ D-
- // Particle 1 = pi+
- // Particle 2 = pi+
- // Particle 3 = D-
- // The DP is defined in terms of m13Sq and m23Sq
- LauDaughters* daughters = new LauDaughters("B+", "pi+", "pi+", "D-", squareDP);
-
- // Optionally apply some vetoes to the DP
- LauVetoes* vetoes = new LauVetoes();
-
- LauEffModel* effModel = new LauEffModel(daughters, vetoes);
-
- // Set the values of the Blatt-Weisskopf barrier radii and whether they are fixed or floating
- LauResonanceMaker& resMaker = LauResonanceMaker::get();
- resMaker.setDefaultBWRadius( LauBlattWeisskopfFactor::Parent, 4.0 );
- resMaker.setDefaultBWRadius( LauBlattWeisskopfFactor::Charm, 4.0 );
- resMaker.setDefaultBWRadius( LauBlattWeisskopfFactor::Light, 4.0 );
- resMaker.setDefaultBWRadius( LauBlattWeisskopfFactor::Beauty, 4.0 );
- resMaker.fixBWRadius( LauBlattWeisskopfFactor::Parent, kTRUE);
- resMaker.fixBWRadius( LauBlattWeisskopfFactor::Charm, kTRUE);
- resMaker.fixBWRadius( LauBlattWeisskopfFactor::Light, kTRUE);
- resMaker.fixBWRadius( LauBlattWeisskopfFactor::Beauty, kTRUE);
- // Create the isobar model
-
- std::vector<LauAbsCoeffSet*> coeffset;
- LauIsobarDynamics* sigModel = new LauIsobarDynamics(daughters, effModel);
- LauAbsResonance* reson(0);
-
- reson = sigModel->addResonance("D*0", 2, LauAbsResonance::RelBW);
- reson = sigModel->addResonance("D*0_0", 2, LauAbsResonance::MIPW_MagPhase);
- LauModIndPartWaveMagPhase* mipw = dynamic_cast<LauModIndPartWaveMagPhase*>(reson);
- if (mipw==nullptr){
- std::cout << "MIPW pointer is null" << std::endl;
- return 0;
- }
-
- //vector of knot masses - ignore ends as they are dealt with internally
- std::set<Double_t> knot_mass{
- 2.10,
- 2.20,
- 2.30,
- 2.40,
- 2.50,
- 2.60,
- 2.70,
- 2.80,
- 2.90,
- 3.10,
- 4.10,
- };
-
- mipw->defineKnots(knot_mass);
- mipw->floatKnotsSecondStage(kFALSE);
-
- //Set magnitude and phase for the knots (including the end points here)
- mipw->setKnotAmp(0, 0.12, -2.82,kFALSE,kFALSE);
- mipw->setKnotAmp(1, 0.58, -1.56,kFALSE,kFALSE);
- mipw->setKnotAmp(2, 0.73, -1.00,kFALSE,kFALSE);
- mipw->setKnotAmp(3, 0.68, -0.42,kFALSE,kFALSE);
- mipw->setKnotAmp(4, 0.5, 0.0,kTRUE,kTRUE);
- mipw->setKnotAmp(5, 0.23, -0.00,kFALSE,kFALSE);
- mipw->setKnotAmp(6, 0.23, -0.42,kFALSE,kFALSE);
- mipw->setKnotAmp(7, 0.15, -0.31,kFALSE,kFALSE);
- mipw->setKnotAmp(8, 0.17, -0.63,kFALSE,kFALSE);
- mipw->setKnotAmp(9, 0.20, -0.87,kFALSE,kFALSE);
- mipw->setKnotAmp(10, 0.14, -1.16,kFALSE,kFALSE);
- mipw->setKnotAmp(11, 0.08, 1.02,kFALSE,kFALSE);
- mipw->setKnotAmp(12, 0.0, 0.0,kTRUE, kTRUE);
-
- reson = sigModel->addResonance("D*0_2", 2, LauAbsResonance::RelBW);
- reson = sigModel->addResonance("D*0_1(2680)", 2, LauAbsResonance::RelBW);
- reson = sigModel->addResonance("B*0", 2, LauAbsResonance::RelBW);
- reson = sigModel->addResonance("D*0_3(2760)", 2, LauAbsResonance::RelBW);
- reson = sigModel->addResonance("D0(3000)", 2, LauAbsResonance::RelBW);
-
- sigModel->setASqMaxValue(1.0);
-
- // Create the fit model
- LauSimpleFitModel* fitModel = new LauSimpleFitModel(sigModel);
-
- coeffset.push_back( new LauMagPhaseCoeffSet("D*0", 0.55, -0.38, kFALSE, kFALSE) );
- // Still need a total mag/phase for the MIPW shape
- coeffset.push_back( new LauMagPhaseCoeffSet("D*0_0", 1.26, -0.28, kFALSE, kFALSE) );
- coeffset.push_back( new LauMagPhaseCoeffSet("D*0_2", 1.00, 0.00, kTRUE, kTRUE) );
- coeffset.push_back( new LauMagPhaseCoeffSet("D*0_1(2680)", 0.48, 2.47, kFALSE, kFALSE) );
- coeffset.push_back( new LauMagPhaseCoeffSet("B*0", 0.27, 0.14, kFALSE, kFALSE) );
- coeffset.push_back( new LauMagPhaseCoeffSet("D*0_3(2760)", 0.17, 0.01, kFALSE, kFALSE) );
- coeffset.push_back( new LauMagPhaseCoeffSet("D0(3000)", 0.08, -0.84, kFALSE, kFALSE) );
-
- for (std::vector<LauAbsCoeffSet*>::iterator iter=coeffset.begin(); iter!=coeffset.end(); ++iter) {
- fitModel->setAmpCoeffSet(*iter);
- }
-
- Double_t nSig(50000);
-
- TString sigEventsName = "signalEvents";
- LauParameter* nSigEvents = new LauParameter(sigEventsName,nSig,-2.0*nSig,2.0*nSig,kTRUE);
- fitModel->setNSigEvents(nSigEvents);
-
- // Set the number of experiments to generate or fit and which
- // experiment to start with
- fitModel->setNExpts( nExpt, firstExpt, isToy );
-
- // Switch on/off calculation of asymmetric errors.
- fitModel->useAsymmFitErrors(kFALSE);
-
- // Randomise initial fit values for the signal mode
- fitModel->useRandomInitFitPars(kTRUE);
-
- // Switch on/off Poissonian smearing of total number of events
- fitModel->doPoissonSmearing(kTRUE);
-
- // Switch on/off Extended ML Fit option
- fitModel->doEMLFit(kFALSE);
-
- // Switch on the two-stage fit (for the resonance parameters)
- fitModel->twoStageFit(kFALSE);
-
- // Generate toy from the fitted parameters
- //TString fitToyFileName("fitToyMC_Dpipi_");
- //fitToyFileName += iFit;
- //fitToyFileName += ".root";
- //fitModel->compareFitData(100, fitToyFileName);
-
- // Set the names of the files to read/write
- TString dataFile("gen-Dpipi.root");
- TString treeName("genResults");
- TString rootFileName("");
- TString tableFileName("");
- if (command == "fit") {
- rootFileName = "fitDpipi_"; rootFileName += iFit;
- rootFileName += "_expt_"; rootFileName += firstExpt;
- rootFileName += "-"; rootFileName += (firstExpt+nExpt-1);
- rootFileName += ".root";
- tableFileName = "fitDpipiResults_"; tableFileName += iFit;
- } else {
- rootFileName = "dummy.root";
- tableFileName = "genDpipiResults";
- }
-
- // Execute the generation/fit
- fitModel->run( command, dataFile, treeName, rootFileName, tableFileName );
-
- return EXIT_SUCCESS;
+ // Process command-line arguments
+ // Usage:
+ // ./GenFitDpipi gen [nExpt = 1] [firstExpt = 0]
+ // or
+ // ./GenFitDpipi fit <iFit> [nExpt = 1] [firstExpt = 0]
+ if ( argc < 2 ) {
+ usage( std::cerr, argv[0] );
+ return EXIT_FAILURE;
+ }
+
+ TString command = argv[1];
+ command.ToLower();
+ Int_t iFit( 0 );
+ Int_t nExpt( 1 );
+ Int_t firstExpt( 0 );
+ Bool_t isToy( kTRUE );
+ if ( command == "gen" ) {
+ if ( argc > 2 ) {
+ nExpt = atoi( argv[2] );
+ if ( argc > 3 ) {
+ firstExpt = atoi( argv[3] );
+ }
+ }
+ } else if ( command == "fit" ) {
+ if ( argc < 3 ) {
+ usage( std::cerr, argv[0] );
+ return EXIT_FAILURE;
+ }
+ iFit = atoi( argv[2] );
+ if ( argc > 3 ) {
+ nExpt = atoi( argv[3] );
+ if ( argc > 4 ) {
+ firstExpt = atoi( argv[4] );
+ }
+ }
+ } else {
+ usage( std::cerr, argv[0] );
+ return EXIT_FAILURE;
+ }
+
+ // If you want to use square DP histograms for efficiency,
+ // backgrounds or you just want the square DP co-ordinates
+ // stored in the toy MC ntuple then set this to kTRUE
+ Bool_t squareDP = kTRUE;
+
+ // This defines the DP => decay is B+ -> pi+ pi+ D-
+ // Particle 1 = pi+
+ // Particle 2 = pi+
+ // Particle 3 = D-
+ // The DP is defined in terms of m13Sq and m23Sq
+ LauDaughters* daughters = new LauDaughters( "B+", "pi+", "pi+", "D-", squareDP );
+
+ // Optionally apply some vetoes to the DP
+ LauVetoes* vetoes = new LauVetoes();
+
+ LauEffModel* effModel = new LauEffModel( daughters, vetoes );
+
+ // Set the values of the Blatt-Weisskopf barrier radii and whether they are fixed or floating
+ LauResonanceMaker& resMaker = LauResonanceMaker::get();
+ resMaker.setDefaultBWRadius( LauBlattWeisskopfFactor::Parent, 4.0 );
+ resMaker.setDefaultBWRadius( LauBlattWeisskopfFactor::Charm, 4.0 );
+ resMaker.setDefaultBWRadius( LauBlattWeisskopfFactor::Light, 4.0 );
+ resMaker.setDefaultBWRadius( LauBlattWeisskopfFactor::Beauty, 4.0 );
+ resMaker.fixBWRadius( LauBlattWeisskopfFactor::Parent, kTRUE );
+ resMaker.fixBWRadius( LauBlattWeisskopfFactor::Charm, kTRUE );
+ resMaker.fixBWRadius( LauBlattWeisskopfFactor::Light, kTRUE );
+ resMaker.fixBWRadius( LauBlattWeisskopfFactor::Beauty, kTRUE );
+ // Create the isobar model
+
+ std::vector<LauAbsCoeffSet*> coeffset;
+ LauIsobarDynamics* sigModel = new LauIsobarDynamics( daughters, effModel );
+ LauAbsResonance* reson( 0 );
+
+ reson = sigModel->addResonance( "D*0", 2, LauAbsResonance::RelBW );
+ reson = sigModel->addResonance( "D*0_0", 2, LauAbsResonance::MIPW_MagPhase );
+ LauModIndPartWaveMagPhase* mipw = dynamic_cast<LauModIndPartWaveMagPhase*>( reson );
+ if ( mipw == nullptr ) {
+ std::cout << "MIPW pointer is null" << std::endl;
+ return 0;
+ }
+
+ //vector of knot masses - ignore ends as they are dealt with internally
+ std::set<Double_t> knot_mass {
+ 2.10,
+ 2.20,
+ 2.30,
+ 2.40,
+ 2.50,
+ 2.60,
+ 2.70,
+ 2.80,
+ 2.90,
+ 3.10,
+ 4.10,
+ };
+
+ mipw->defineKnots( knot_mass );
+ mipw->floatKnotsSecondStage( kFALSE );
+
+ //Set magnitude and phase for the knots (including the end points here)
+ mipw->setKnotAmp( 0, 0.12, -2.82, kFALSE, kFALSE );
+ mipw->setKnotAmp( 1, 0.58, -1.56, kFALSE, kFALSE );
+ mipw->setKnotAmp( 2, 0.73, -1.00, kFALSE, kFALSE );
+ mipw->setKnotAmp( 3, 0.68, -0.42, kFALSE, kFALSE );
+ mipw->setKnotAmp( 4, 0.5, 0.0, kTRUE, kTRUE );
+ mipw->setKnotAmp( 5, 0.23, -0.00, kFALSE, kFALSE );
+ mipw->setKnotAmp( 6, 0.23, -0.42, kFALSE, kFALSE );
+ mipw->setKnotAmp( 7, 0.15, -0.31, kFALSE, kFALSE );
+ mipw->setKnotAmp( 8, 0.17, -0.63, kFALSE, kFALSE );
+ mipw->setKnotAmp( 9, 0.20, -0.87, kFALSE, kFALSE );
+ mipw->setKnotAmp( 10, 0.14, -1.16, kFALSE, kFALSE );
+ mipw->setKnotAmp( 11, 0.08, 1.02, kFALSE, kFALSE );
+ mipw->setKnotAmp( 12, 0.0, 0.0, kTRUE, kTRUE );
+
+ reson = sigModel->addResonance( "D*0_2", 2, LauAbsResonance::RelBW );
+ reson = sigModel->addResonance( "D*0_1(2680)", 2, LauAbsResonance::RelBW );
+ reson = sigModel->addResonance( "B*0", 2, LauAbsResonance::RelBW );
+ reson = sigModel->addResonance( "D*0_3(2760)", 2, LauAbsResonance::RelBW );
+ reson = sigModel->addResonance( "D0(3000)", 2, LauAbsResonance::RelBW );
+
+ sigModel->setASqMaxValue( 1.0 );
+
+ // Create the fit model
+ LauSimpleFitModel* fitModel = new LauSimpleFitModel( sigModel );
+
+ coeffset.push_back( new LauMagPhaseCoeffSet( "D*0", 0.55, -0.38, kFALSE, kFALSE ) );
+ // Still need a total mag/phase for the MIPW shape
+ coeffset.push_back( new LauMagPhaseCoeffSet( "D*0_0", 1.26, -0.28, kFALSE, kFALSE ) );
+ coeffset.push_back( new LauMagPhaseCoeffSet( "D*0_2", 1.00, 0.00, kTRUE, kTRUE ) );
+ coeffset.push_back( new LauMagPhaseCoeffSet( "D*0_1(2680)", 0.48, 2.47, kFALSE, kFALSE ) );
+ coeffset.push_back( new LauMagPhaseCoeffSet( "B*0", 0.27, 0.14, kFALSE, kFALSE ) );
+ coeffset.push_back( new LauMagPhaseCoeffSet( "D*0_3(2760)", 0.17, 0.01, kFALSE, kFALSE ) );
+ coeffset.push_back( new LauMagPhaseCoeffSet( "D0(3000)", 0.08, -0.84, kFALSE, kFALSE ) );
+
+ for ( std::vector<LauAbsCoeffSet*>::iterator iter = coeffset.begin(); iter != coeffset.end();
+ ++iter ) {
+ fitModel->setAmpCoeffSet( *iter );
+ }
+
+ Double_t nSig( 50000 );
+
+ TString sigEventsName = "signalEvents";
+ LauParameter* nSigEvents = new LauParameter( sigEventsName, nSig, -2.0 * nSig, 2.0 * nSig, kTRUE );
+ fitModel->setNSigEvents( nSigEvents );
+
+ // Set the number of experiments to generate or fit and which
+ // experiment to start with
+ fitModel->setNExpts( nExpt, firstExpt, isToy );
+
+ // Switch on/off calculation of asymmetric errors.
+ fitModel->useAsymmFitErrors( kFALSE );
+
+ // Randomise initial fit values for the signal mode
+ fitModel->useRandomInitFitPars( kTRUE );
+
+ // Switch on/off Poissonian smearing of total number of events
+ fitModel->doPoissonSmearing( kTRUE );
+
+ // Switch on/off Extended ML Fit option
+ fitModel->doEMLFit( kFALSE );
+
+ // Switch on the two-stage fit (for the resonance parameters)
+ fitModel->twoStageFit( kFALSE );
+
+ // Generate toy from the fitted parameters
+ //TString fitToyFileName("fitToyMC_Dpipi_");
+ //fitToyFileName += iFit;
+ //fitToyFileName += ".root";
+ //fitModel->compareFitData(100, fitToyFileName);
+
+ // Set the names of the files to read/write
+ TString dataFile( "gen-Dpipi.root" );
+ TString treeName( "genResults" );
+ TString rootFileName( "" );
+ TString tableFileName( "" );
+ if ( command == "fit" ) {
+ rootFileName = "fitDpipi_";
+ rootFileName += iFit;
+ rootFileName += "_expt_";
+ rootFileName += firstExpt;
+ rootFileName += "-";
+ rootFileName += ( firstExpt + nExpt - 1 );
+ rootFileName += ".root";
+ tableFileName = "fitDpipiResults_";
+ tableFileName += iFit;
+ } else {
+ rootFileName = "dummy.root";
+ tableFileName = "genDpipiResults";
+ }
+
+ // Execute the generation/fit
+ fitModel->run( command, dataFile, treeName, rootFileName, tableFileName );
+
+ return EXIT_SUCCESS;
}
diff --git a/examples/GenFitDs2KKpi.cc b/examples/GenFitDs2KKpi.cc
index c112ff9..c2dfda6 100644
--- a/examples/GenFitDs2KKpi.cc
+++ b/examples/GenFitDs2KKpi.cc
@@ -1,199 +1,204 @@
/*
Copyright 2017 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
-#include <cstdlib>
-#include <iostream>
-#include <vector>
-
-#include "TFile.h"
-#include "TH2.h"
-#include "TString.h"
-#include "TTree.h"
-
-#include "LauSimpleFitModel.hh"
#include "LauBkgndDPModel.hh"
#include "LauDaughters.hh"
#include "LauEffModel.hh"
#include "LauIsobarDynamics.hh"
#include "LauMagPhaseCoeffSet.hh"
+#include "LauSimpleFitModel.hh"
#include "LauVetoes.hh"
+#include "TFile.h"
+#include "TH2.h"
+#include "TString.h"
+#include "TTree.h"
+
+#include <cstdlib>
+#include <iostream>
+#include <vector>
+
void usage( std::ostream& out, const TString& progName )
{
- out<<"Usage:\n";
- out<<progName<<" gen [nExpt = 1] [firstExpt = 0]\n";
- out<<"or\n";
- out<<progName<<" fit <iFit> [nExpt = 1] [firstExpt = 0]"<<std::endl;
+ out << "Usage:\n";
+ out << progName << " gen [nExpt = 1] [firstExpt = 0]\n";
+ out << "or\n";
+ out << progName << " fit <iFit> [nExpt = 1] [firstExpt = 0]" << std::endl;
}
int main( int argc, char** argv )
{
- // Process command-line arguments
- // Usage:
- // ./GenFitDs2KKpi gen [nExpt = 1] [firstExpt = 0]
- // or
- // ./GenFitDs2KKpi fit <iFit> [nExpt = 1] [firstExpt = 0]
- if ( argc < 2 ) {
- usage( std::cerr, argv[0] );
- return EXIT_FAILURE;
- }
-
- TString command = argv[1];
- command.ToLower();
- Int_t iFit(0);
- Int_t nExpt(1);
- Int_t firstExpt(0);
- Bool_t isToy(kTRUE);
- if ( command == "gen" ) {
- if ( argc > 2 ) {
- nExpt = atoi( argv[2] );
- if ( argc > 3 ) {
- firstExpt = atoi( argv[3] );
- }
- }
- } else if ( command == "fit" ) {
- if ( argc < 3 ) {
- usage( std::cerr, argv[0] );
- return EXIT_FAILURE;
- }
- iFit = atoi( argv[2] );
- if ( argc > 3 ) {
- nExpt = atoi( argv[3] );
- if ( argc > 4 ) {
- firstExpt = atoi( argv[4] );
- }
- }
- } else {
- usage( std::cerr, argv[0] );
- return EXIT_FAILURE;
- }
-
- // If you want to use square DP histograms for efficiency,
- // backgrounds or you just want the square DP co-ordinates
- // stored in the toy MC ntuple then set this to kTRUE
- Bool_t squareDP = kFALSE;
-
- // This defines the DP => decay is D_s+ -> pi+ K+ K-
- // Particle 1 = pi+
- // Particle 2 = K+
- // Particle 3 = K-
- // The DP is defined in terms of m13Sq and m23Sq
- LauDaughters* daughters = new LauDaughters("D_s+", "pi+", "K+", "K-", squareDP);
-
- // Define the efficiency model (defaults to unity everywhere)
- LauVetoes* vetoes = new LauVetoes();
- LauEffModel* effModel = new LauEffModel(daughters, vetoes);
-
- // Create the isobar model
- // resPairAmpInt = 1 => resonance mass is m23.
- // resPairAmpInt = 2 => resonance mass is m13.
- LauIsobarDynamics* sigModel = new LauIsobarDynamics(daughters, effModel);
- //LauAbsResonance* reson(0);
- /*reson =*/ sigModel->addResonance("phi(1020)", 1, LauAbsResonance::RelBW);
- /*reson =*/ sigModel->addResonance("K*0(892)", 2, LauAbsResonance::RelBW);
- /*reson =*/ sigModel->addResonance("NonReson", 0, LauAbsResonance::FlatNR);
-
- // Set the maximum signal DP ASq value
- // If you do not provide a value, one will be determined automatically,
- // which should be close to the true maximum but is not guaranteed to
- // be optimal.
- // Any value, whether manually provided or automatically determined,
- // will be automatically adjusted to avoid bias or extreme inefficiency
- // but it is best to set this by hand once you've found the right value
- // through some trial and error.
- sigModel->setASqMaxValue(310.0);
-
- // Create the fit model
- LauSimpleFitModel* fitModel = new LauSimpleFitModel(sigModel);
-
- // Create the complex coefficients for the isobar model
- // Here we're using the magnitude and phase form:
- // c_j = a_j exp(i*delta_j)
- std::vector<LauAbsCoeffSet*> coeffset;
- coeffset.push_back( new LauMagPhaseCoeffSet("phi(1020)", 1.00, 0.00, kTRUE, kTRUE) );
- coeffset.push_back( new LauMagPhaseCoeffSet("K*0(892)", 1.00, 0.00, kFALSE, kFALSE) );
- coeffset.push_back( new LauMagPhaseCoeffSet("NonReson", 1.00, 0.00, kFALSE, kFALSE) );
- for (std::vector<LauAbsCoeffSet*>::iterator iter=coeffset.begin(); iter!=coeffset.end(); ++iter) {
- fitModel->setAmpCoeffSet(*iter);
- }
-
- // Set the signal yield and define whether it is fixed or floated
- const Double_t nSigEvents = 10000.0;
- LauParameter * signalEvents = new LauParameter("signalEvents",nSigEvents,-1.0*nSigEvents,2.0*nSigEvents,kFALSE);
- fitModel->setNSigEvents(signalEvents);
-
- // Set the number of experiments to generate or fit and which
- // experiment to start with
- fitModel->setNExpts( nExpt, firstExpt, isToy );
-
-
- // Configure various fit options
-
- // Switch on/off calculation of asymmetric errors.
- fitModel->useAsymmFitErrors(kFALSE);
-
- // Randomise initial fit values for the signal mode
- fitModel->useRandomInitFitPars(kTRUE);
-
- const Bool_t haveBkgnds = ( fitModel->nBkgndClasses() > 0 );
-
- // Switch on/off Poissonian smearing of total number of events
- fitModel->doPoissonSmearing(haveBkgnds);
-
- // Switch on/off Extended ML Fit option
- fitModel->doEMLFit(haveBkgnds);
-
- // Generate toy from the fitted parameters
- //TString fitToyFileName("fitToyMC_Ds2KKpi_");
- //fitToyFileName += iFit;
- //fitToyFileName += ".root";
- //fitModel->compareFitData(100, fitToyFileName);
-
- // Write out per-event likelihoods and sWeights
- //TString splotFileName("splot_Ds2KKpi_");
- //splotFileName += iFit;
- //splotFileName += ".root";
- //fitModel->writeSPlotData(splotFileName, "splot", kFALSE);
-
- // Set the names of the files to read/write
- TString dataFile("gen-Ds2KKpi.root");
- TString treeName("genResults");
- TString rootFileName("");
- TString tableFileName("");
- if (command == "fit") {
- rootFileName = "fitDs2KKpi_"; rootFileName += iFit;
- rootFileName += "_expt_"; rootFileName += firstExpt;
- rootFileName += "-"; rootFileName += (firstExpt+nExpt-1);
- rootFileName += ".root";
- tableFileName = "fitDs2KKpiResults_"; tableFileName += iFit;
- } else {
- rootFileName = "dummy.root";
- tableFileName = "genDs2KKpiResults";
- }
-
- // Execute the generation/fit
- fitModel->run( command, dataFile, treeName, rootFileName, tableFileName );
-
- return EXIT_SUCCESS;
+ // Process command-line arguments
+ // Usage:
+ // ./GenFitDs2KKpi gen [nExpt = 1] [firstExpt = 0]
+ // or
+ // ./GenFitDs2KKpi fit <iFit> [nExpt = 1] [firstExpt = 0]
+ if ( argc < 2 ) {
+ usage( std::cerr, argv[0] );
+ return EXIT_FAILURE;
+ }
+
+ TString command = argv[1];
+ command.ToLower();
+ Int_t iFit( 0 );
+ Int_t nExpt( 1 );
+ Int_t firstExpt( 0 );
+ Bool_t isToy( kTRUE );
+ if ( command == "gen" ) {
+ if ( argc > 2 ) {
+ nExpt = atoi( argv[2] );
+ if ( argc > 3 ) {
+ firstExpt = atoi( argv[3] );
+ }
+ }
+ } else if ( command == "fit" ) {
+ if ( argc < 3 ) {
+ usage( std::cerr, argv[0] );
+ return EXIT_FAILURE;
+ }
+ iFit = atoi( argv[2] );
+ if ( argc > 3 ) {
+ nExpt = atoi( argv[3] );
+ if ( argc > 4 ) {
+ firstExpt = atoi( argv[4] );
+ }
+ }
+ } else {
+ usage( std::cerr, argv[0] );
+ return EXIT_FAILURE;
+ }
+
+ // If you want to use square DP histograms for efficiency,
+ // backgrounds or you just want the square DP co-ordinates
+ // stored in the toy MC ntuple then set this to kTRUE
+ Bool_t squareDP = kFALSE;
+
+ // This defines the DP => decay is D_s+ -> pi+ K+ K-
+ // Particle 1 = pi+
+ // Particle 2 = K+
+ // Particle 3 = K-
+ // The DP is defined in terms of m13Sq and m23Sq
+ LauDaughters* daughters = new LauDaughters( "D_s+", "pi+", "K+", "K-", squareDP );
+
+ // Define the efficiency model (defaults to unity everywhere)
+ LauVetoes* vetoes = new LauVetoes();
+ LauEffModel* effModel = new LauEffModel( daughters, vetoes );
+
+ // Create the isobar model
+ // resPairAmpInt = 1 => resonance mass is m23.
+ // resPairAmpInt = 2 => resonance mass is m13.
+ LauIsobarDynamics* sigModel = new LauIsobarDynamics( daughters, effModel );
+ //LauAbsResonance* reson(0);
+ /*reson =*/sigModel->addResonance( "phi(1020)", 1, LauAbsResonance::RelBW );
+ /*reson =*/sigModel->addResonance( "K*0(892)", 2, LauAbsResonance::RelBW );
+ /*reson =*/sigModel->addResonance( "NonReson", 0, LauAbsResonance::FlatNR );
+
+ // Set the maximum signal DP ASq value
+ // If you do not provide a value, one will be determined automatically,
+ // which should be close to the true maximum but is not guaranteed to
+ // be optimal.
+ // Any value, whether manually provided or automatically determined,
+ // will be automatically adjusted to avoid bias or extreme inefficiency
+ // but it is best to set this by hand once you've found the right value
+ // through some trial and error.
+ sigModel->setASqMaxValue( 310.0 );
+
+ // Create the fit model
+ LauSimpleFitModel* fitModel = new LauSimpleFitModel( sigModel );
+
+ // Create the complex coefficients for the isobar model
+ // Here we're using the magnitude and phase form:
+ // c_j = a_j exp(i*delta_j)
+ std::vector<LauAbsCoeffSet*> coeffset;
+ coeffset.push_back( new LauMagPhaseCoeffSet( "phi(1020)", 1.00, 0.00, kTRUE, kTRUE ) );
+ coeffset.push_back( new LauMagPhaseCoeffSet( "K*0(892)", 1.00, 0.00, kFALSE, kFALSE ) );
+ coeffset.push_back( new LauMagPhaseCoeffSet( "NonReson", 1.00, 0.00, kFALSE, kFALSE ) );
+ for ( std::vector<LauAbsCoeffSet*>::iterator iter = coeffset.begin(); iter != coeffset.end();
+ ++iter ) {
+ fitModel->setAmpCoeffSet( *iter );
+ }
+
+ // Set the signal yield and define whether it is fixed or floated
+ const Double_t nSigEvents = 10000.0;
+ LauParameter* signalEvents =
+ new LauParameter( "signalEvents", nSigEvents, -1.0 * nSigEvents, 2.0 * nSigEvents, kFALSE );
+ fitModel->setNSigEvents( signalEvents );
+
+ // Set the number of experiments to generate or fit and which
+ // experiment to start with
+ fitModel->setNExpts( nExpt, firstExpt, isToy );
+
+ // Configure various fit options
+
+ // Switch on/off calculation of asymmetric errors.
+ fitModel->useAsymmFitErrors( kFALSE );
+
+ // Randomise initial fit values for the signal mode
+ fitModel->useRandomInitFitPars( kTRUE );
+
+ const Bool_t haveBkgnds = ( fitModel->nBkgndClasses() > 0 );
+
+ // Switch on/off Poissonian smearing of total number of events
+ fitModel->doPoissonSmearing( haveBkgnds );
+
+ // Switch on/off Extended ML Fit option
+ fitModel->doEMLFit( haveBkgnds );
+
+ // Generate toy from the fitted parameters
+ //TString fitToyFileName("fitToyMC_Ds2KKpi_");
+ //fitToyFileName += iFit;
+ //fitToyFileName += ".root";
+ //fitModel->compareFitData(100, fitToyFileName);
+
+ // Write out per-event likelihoods and sWeights
+ //TString splotFileName("splot_Ds2KKpi_");
+ //splotFileName += iFit;
+ //splotFileName += ".root";
+ //fitModel->writeSPlotData(splotFileName, "splot", kFALSE);
+
+ // Set the names of the files to read/write
+ TString dataFile( "gen-Ds2KKpi.root" );
+ TString treeName( "genResults" );
+ TString rootFileName( "" );
+ TString tableFileName( "" );
+ if ( command == "fit" ) {
+ rootFileName = "fitDs2KKpi_";
+ rootFileName += iFit;
+ rootFileName += "_expt_";
+ rootFileName += firstExpt;
+ rootFileName += "-";
+ rootFileName += ( firstExpt + nExpt - 1 );
+ rootFileName += ".root";
+ tableFileName = "fitDs2KKpiResults_";
+ tableFileName += iFit;
+ } else {
+ rootFileName = "dummy.root";
+ tableFileName = "genDs2KKpiResults";
+ }
+
+ // Execute the generation/fit
+ fitModel->run( command, dataFile, treeName, rootFileName, tableFileName );
+
+ return EXIT_SUCCESS;
}
diff --git a/examples/GenFitEFKLLM.cc b/examples/GenFitEFKLLM.cc
index 4a05e2c..56e19ae 100644
--- a/examples/GenFitEFKLLM.cc
+++ b/examples/GenFitEFKLLM.cc
@@ -1,206 +1,214 @@
/*
Copyright 2015 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
-#include <cstdlib>
-#include <iostream>
-#include <vector>
+#include "LauDaughters.hh"
+#include "LauEFKLLMRes.hh"
+#include "LauEffModel.hh"
+#include "LauIsobarDynamics.hh"
+#include "LauMagPhaseCoeffSet.hh"
+#include "LauSimpleFitModel.hh"
+#include "LauVetoes.hh"
#include "TFile.h"
#include "TH2.h"
#include "TString.h"
#include "TTree.h"
-#include "LauSimpleFitModel.hh"
-#include "LauDaughters.hh"
-#include "LauEffModel.hh"
-#include "LauEFKLLMRes.hh"
-#include "LauIsobarDynamics.hh"
-#include "LauMagPhaseCoeffSet.hh"
-#include "LauVetoes.hh"
+#include <cstdlib>
+#include <iostream>
+#include <vector>
void usage( std::ostream& out, const TString& progName )
{
- out<<"Usage:\n";
- out<<progName<<" gen [nExpt = 1] [firstExpt = 0]\n";
- out<<"or\n";
- out<<progName<<" fit <iFit> [nExpt = 1] [firstExpt = 0]"<<std::endl;
+ out << "Usage:\n";
+ out << progName << " gen [nExpt = 1] [firstExpt = 0]\n";
+ out << "or\n";
+ out << progName << " fit <iFit> [nExpt = 1] [firstExpt = 0]" << std::endl;
}
int main( int argc, char** argv )
{
- // Process command-line arguments
- // Usage:
- // ./GenFitEFKLLM gen [nExpt = 1] [firstExpt = 0]
- // or
- // ./GenFitEFKLLM fit <iFit> [nExpt = 1] [firstExpt = 0]
- if ( argc < 2 ) {
- usage( std::cerr, argv[0] );
- return EXIT_FAILURE;
- }
-
- TString command = argv[1];
- command.ToLower();
- Int_t iFit(0);
- Int_t nExpt(1);
- Int_t firstExpt(0);
- Bool_t isToy(kTRUE);
- if ( command == "gen" ) {
- if ( argc > 2 ) {
- nExpt = atoi( argv[2] );
- if ( argc > 3 ) {
- firstExpt = atoi( argv[3] );
- }
- }
- } else if ( command == "fit" ) {
- if ( argc < 3 ) {
- usage( std::cerr, argv[0] );
- return EXIT_FAILURE;
- }
- iFit = atoi( argv[2] );
- if ( argc > 3 ) {
- nExpt = atoi( argv[3] );
- if ( argc > 4 ) {
- firstExpt = atoi( argv[4] );
- }
- }
- } else {
- usage( std::cerr, argv[0] );
- return EXIT_FAILURE;
- }
-
- // If you want to use square DP histograms for efficiency,
- // backgrounds or you just want the square DP co-ordinates
- // stored in the toy MC ntuple then set this to kTRUE
- Bool_t squareDP = kFALSE;
-
- // This defines the DP => decay is B0 -> D0_bar K+ pi-
- // Particle 1 = D0_bar
- // Particle 2 = K+
- // Particle 3 = pi-
- // The DP is defined in terms of m13Sq and m23Sq
- LauDaughters* daughters = new LauDaughters("B0", "D0_bar", "K+", "pi-", squareDP);
-
- // Define the efficiency model (defaults to unity everywhere)
- LauVetoes* vetoes = new LauVetoes();
- LauEffModel* effModel = new LauEffModel(daughters, vetoes);
-
- // Create the isobar model
- LauIsobarDynamics* sigModel = new LauIsobarDynamics(daughters, effModel);
- LauEFKLLMRes::setupFormFactor("usfactor.dat");
-
- // Add various components to the isobar model,
- // optionally allowing the masses and width to float in the fit
- LauAbsResonance* res(0);
-
- //addResonance arguments: resName, resPairAmpInt, resType
- res = sigModel->addResonance("kappa0", 1, LauAbsResonance::EFKLLM);
- res->setResonanceParameter("massFactor", 0.0);
- res = sigModel->addResonance("K*0_0(1430)", 1, LauAbsResonance::EFKLLM);
- res->setResonanceParameter("massFactor", -2.0);
-
- // Set the maximum signal DP ASq value
- // If you do not provide a value, one will be determined automatically,
- // which should be close to the true maximum but is not guaranteed to
- // be optimal.
- // Any value, whether manually provided or automatically determined,
- // will be automatically adjusted to avoid bias or extreme inefficiency
- // but it is best to set this by hand once you've found the right value
- // through some trial and error.
- sigModel->setASqMaxValue(14.5);
-
- // Create the fit model
- LauSimpleFitModel* fitModel = new LauSimpleFitModel(sigModel);
-
- // Create the complex coefficients for the isobar model
- // Here we're using the magnitude and phase form:
- // c_j = a_j exp(i*delta_j)
- std::vector<LauAbsCoeffSet*> coeffset;
- coeffset.push_back( new LauMagPhaseCoeffSet("kappa0", 1.0, 0.0, kTRUE, kTRUE) );
- coeffset.push_back( new LauMagPhaseCoeffSet("K*0_0(1430)", 1.0, 0.0, kFALSE, kFALSE) );
- for (std::vector<LauAbsCoeffSet*>::iterator iter=coeffset.begin(); iter!=coeffset.end(); ++iter) {
- fitModel->setAmpCoeffSet(*iter);
- }
-
- // Set the signal yield and define whether it is fixed or floated
- const Double_t nSigEvents = 5000.0;
- Bool_t fixNSigEvents = kFALSE;
- LauParameter * signalEvents = new LauParameter("signalEvents", nSigEvents, -1.0*nSigEvents, 2.0*nSigEvents, fixNSigEvents);
- fitModel->setNSigEvents(signalEvents);
-
- // Set the number of experiments to generate or fit and which
- // experiment to start with
- fitModel->setNExpts( nExpt, firstExpt, isToy );
-
-
- // Configure various fit options
-
- // Switch on/off calculation of asymmetric errors.
- fitModel->useAsymmFitErrors(kFALSE);
-
- // Randomise initial fit values for the signal mode
- fitModel->useRandomInitFitPars(kFALSE);
-
- const Bool_t haveBkgnds = ( fitModel->nBkgndClasses() > 0 );
-
- // Switch on/off Poissonian smearing of total number of events
- fitModel->doPoissonSmearing(haveBkgnds);
-
- // Switch on/off Extended ML Fit option
- fitModel->doEMLFit(haveBkgnds);
-
- // Switch on the two-stage fit (for the resonance parameters)
- fitModel->twoStageFit(kTRUE);
-
- // Generate toy from the fitted parameters
- //TString fitToyFileName("fitToyMC_EFKLLM_");
- //fitToyFileName += iFit;
- //fitToyFileName += ".root";
- //fitModel->compareFitData(10, fitToyFileName);
-
- // Write out per-event likelihoods and sWeights
- //TString splotFileName("splot_EFKLLM_");
- //splotFileName += iFit;
- //splotFileName += ".root";
- //fitModel->writeSPlotData(splotFileName, "splot", kFALSE);
-
- TString dataFile("gen-EFKLLM.root");
- TString treeName("genResults");
- TString rootFileName("");
- TString tableFileName("");
- if (command == "fit") {
- rootFileName = "fitEFKLLM_"; rootFileName += iFit;
- rootFileName += "_expt_"; rootFileName += firstExpt;
- rootFileName += "-"; rootFileName += (firstExpt+nExpt-1);
- rootFileName += ".root";
- tableFileName = "fitEFKLLMResults_"; tableFileName += iFit;
- } else {
- rootFileName = "dummy.root";
- tableFileName = "genEFKLLMResults";
- }
-
- // Execute the generation/fit
- fitModel->run( command, dataFile, treeName, rootFileName, tableFileName );
-
- return EXIT_SUCCESS;
+ // Process command-line arguments
+ // Usage:
+ // ./GenFitEFKLLM gen [nExpt = 1] [firstExpt = 0]
+ // or
+ // ./GenFitEFKLLM fit <iFit> [nExpt = 1] [firstExpt = 0]
+ if ( argc < 2 ) {
+ usage( std::cerr, argv[0] );
+ return EXIT_FAILURE;
+ }
+
+ TString command = argv[1];
+ command.ToLower();
+ Int_t iFit( 0 );
+ Int_t nExpt( 1 );
+ Int_t firstExpt( 0 );
+ Bool_t isToy( kTRUE );
+ if ( command == "gen" ) {
+ if ( argc > 2 ) {
+ nExpt = atoi( argv[2] );
+ if ( argc > 3 ) {
+ firstExpt = atoi( argv[3] );
+ }
+ }
+ } else if ( command == "fit" ) {
+ if ( argc < 3 ) {
+ usage( std::cerr, argv[0] );
+ return EXIT_FAILURE;
+ }
+ iFit = atoi( argv[2] );
+ if ( argc > 3 ) {
+ nExpt = atoi( argv[3] );
+ if ( argc > 4 ) {
+ firstExpt = atoi( argv[4] );
+ }
+ }
+ } else {
+ usage( std::cerr, argv[0] );
+ return EXIT_FAILURE;
+ }
+
+ // If you want to use square DP histograms for efficiency,
+ // backgrounds or you just want the square DP co-ordinates
+ // stored in the toy MC ntuple then set this to kTRUE
+ Bool_t squareDP = kFALSE;
+
+ // This defines the DP => decay is B0 -> D0_bar K+ pi-
+ // Particle 1 = D0_bar
+ // Particle 2 = K+
+ // Particle 3 = pi-
+ // The DP is defined in terms of m13Sq and m23Sq
+ LauDaughters* daughters = new LauDaughters( "B0", "D0_bar", "K+", "pi-", squareDP );
+
+ // Define the efficiency model (defaults to unity everywhere)
+ LauVetoes* vetoes = new LauVetoes();
+ LauEffModel* effModel = new LauEffModel( daughters, vetoes );
+
+ // Create the isobar model
+ LauIsobarDynamics* sigModel = new LauIsobarDynamics( daughters, effModel );
+ LauEFKLLMRes::setupFormFactor( "usfactor.dat" );
+
+ // Add various components to the isobar model,
+ // optionally allowing the masses and width to float in the fit
+ LauAbsResonance* res( 0 );
+
+ //addResonance arguments: resName, resPairAmpInt, resType
+ res = sigModel->addResonance( "kappa0", 1, LauAbsResonance::EFKLLM );
+ res->setResonanceParameter( "massFactor", 0.0 );
+ res = sigModel->addResonance( "K*0_0(1430)", 1, LauAbsResonance::EFKLLM );
+ res->setResonanceParameter( "massFactor", -2.0 );
+
+ // Set the maximum signal DP ASq value
+ // If you do not provide a value, one will be determined automatically,
+ // which should be close to the true maximum but is not guaranteed to
+ // be optimal.
+ // Any value, whether manually provided or automatically determined,
+ // will be automatically adjusted to avoid bias or extreme inefficiency
+ // but it is best to set this by hand once you've found the right value
+ // through some trial and error.
+ sigModel->setASqMaxValue( 14.5 );
+
+ // Create the fit model
+ LauSimpleFitModel* fitModel = new LauSimpleFitModel( sigModel );
+
+ // Create the complex coefficients for the isobar model
+ // Here we're using the magnitude and phase form:
+ // c_j = a_j exp(i*delta_j)
+ std::vector<LauAbsCoeffSet*> coeffset;
+ coeffset.push_back( new LauMagPhaseCoeffSet( "kappa0", 1.0, 0.0, kTRUE, kTRUE ) );
+ coeffset.push_back( new LauMagPhaseCoeffSet( "K*0_0(1430)", 1.0, 0.0, kFALSE, kFALSE ) );
+ for ( std::vector<LauAbsCoeffSet*>::iterator iter = coeffset.begin(); iter != coeffset.end();
+ ++iter ) {
+ fitModel->setAmpCoeffSet( *iter );
+ }
+
+ // Set the signal yield and define whether it is fixed or floated
+ const Double_t nSigEvents = 5000.0;
+ Bool_t fixNSigEvents = kFALSE;
+ LauParameter* signalEvents = new LauParameter( "signalEvents",
+ nSigEvents,
+ -1.0 * nSigEvents,
+ 2.0 * nSigEvents,
+ fixNSigEvents );
+ fitModel->setNSigEvents( signalEvents );
+
+ // Set the number of experiments to generate or fit and which
+ // experiment to start with
+ fitModel->setNExpts( nExpt, firstExpt, isToy );
+
+ // Configure various fit options
+
+ // Switch on/off calculation of asymmetric errors.
+ fitModel->useAsymmFitErrors( kFALSE );
+
+ // Randomise initial fit values for the signal mode
+ fitModel->useRandomInitFitPars( kFALSE );
+
+ const Bool_t haveBkgnds = ( fitModel->nBkgndClasses() > 0 );
+
+ // Switch on/off Poissonian smearing of total number of events
+ fitModel->doPoissonSmearing( haveBkgnds );
+
+ // Switch on/off Extended ML Fit option
+ fitModel->doEMLFit( haveBkgnds );
+
+ // Switch on the two-stage fit (for the resonance parameters)
+ fitModel->twoStageFit( kTRUE );
+
+ // Generate toy from the fitted parameters
+ //TString fitToyFileName("fitToyMC_EFKLLM_");
+ //fitToyFileName += iFit;
+ //fitToyFileName += ".root";
+ //fitModel->compareFitData(10, fitToyFileName);
+
+ // Write out per-event likelihoods and sWeights
+ //TString splotFileName("splot_EFKLLM_");
+ //splotFileName += iFit;
+ //splotFileName += ".root";
+ //fitModel->writeSPlotData(splotFileName, "splot", kFALSE);
+
+ TString dataFile( "gen-EFKLLM.root" );
+ TString treeName( "genResults" );
+ TString rootFileName( "" );
+ TString tableFileName( "" );
+ if ( command == "fit" ) {
+ rootFileName = "fitEFKLLM_";
+ rootFileName += iFit;
+ rootFileName += "_expt_";
+ rootFileName += firstExpt;
+ rootFileName += "-";
+ rootFileName += ( firstExpt + nExpt - 1 );
+ rootFileName += ".root";
+ tableFileName = "fitEFKLLMResults_";
+ tableFileName += iFit;
+ } else {
+ rootFileName = "dummy.root";
+ tableFileName = "genEFKLLMResults";
+ }
+
+ // Execute the generation/fit
+ fitModel->run( command, dataFile, treeName, rootFileName, tableFileName );
+
+ return EXIT_SUCCESS;
}
diff --git a/examples/GenFitKpipi.cc b/examples/GenFitKpipi.cc
index ca1c840..ba8f37e 100644
--- a/examples/GenFitKpipi.cc
+++ b/examples/GenFitKpipi.cc
@@ -1,584 +1,715 @@
/*
Copyright 2005 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
-#include <cstdlib>
-#include <iostream>
-#include <vector>
-
-#include "TFile.h"
-#include "TH2.h"
-#include "TString.h"
-
#include "Lau1DHistPdf.hh"
#include "LauArgusPdf.hh"
#include "LauBkgndDPModel.hh"
-#include "LauCartesianCPCoeffSet.hh"
#include "LauCPFitModel.hh"
+#include "LauCartesianCPCoeffSet.hh"
#include "LauDaughters.hh"
#include "LauEffModel.hh"
#include "LauGaussPdf.hh"
#include "LauIsobarDynamics.hh"
#include "LauLinearPdf.hh"
#include "LauResonanceMaker.hh"
#include "LauSumPdf.hh"
#include "LauVetoes.hh"
+#include "TFile.h"
+#include "TH2.h"
+#include "TString.h"
+
+#include <cstdlib>
+#include <iostream>
+#include <vector>
+
/*
* Histogram ROOT files for this example are available at the following URL:
* http://www.slac.stanford.edu/~tlatham/public/Laura++-example-histograms/histos.tar.gz
*\ Please copy the "histos" directory into the working directory.
*/
void usage( std::ostream& out, const TString& progName )
{
- out<<"Usage:\n";
- out<<progName<<" gen [nExpt = 1] [firstExpt = 0]\n";
- out<<"or\n";
- out<<progName<<" fit <iFit> [nExpt = 1] [firstExpt = 0]"<<std::endl;
+ out << "Usage:\n";
+ out << progName << " gen [nExpt = 1] [firstExpt = 0]\n";
+ out << "or\n";
+ out << progName << " fit <iFit> [nExpt = 1] [firstExpt = 0]" << std::endl;
}
int main( int argc, char** argv )
{
- // Process command-line arguments
- // Usage:
- // ./GenFitKpipi gen [nExpt = 1] [firstExpt = 0]
- // or
- // ./GenFitKpipi fit <iFit> [nExpt = 1] [firstExpt = 0]
- if ( argc < 2 ) {
- usage( std::cerr, argv[0] );
- return EXIT_FAILURE;
- }
-
- TString command = argv[1];
- command.ToLower();
- Int_t iFit(0);
- Int_t nExpt(1);
- Int_t firstExpt(0);
- Bool_t isToy(kTRUE);
- if ( command == "gen" ) {
- if ( argc > 2 ) {
- nExpt = atoi( argv[2] );
- if ( argc > 3 ) {
- firstExpt = atoi( argv[3] );
- }
- }
- } else if ( command == "fit" ) {
- if ( argc < 3 ) {
- usage( std::cerr, argv[0] );
- return EXIT_FAILURE;
- }
- iFit = atoi( argv[2] );
- if ( argc > 3 ) {
- nExpt = atoi( argv[3] );
- if ( argc > 4 ) {
- firstExpt = atoi( argv[4] );
- }
- }
- } else {
- usage( std::cerr, argv[0] );
- return EXIT_FAILURE;
- }
-
- // If you want to use square DP histograms for efficiency,
- // backgrounds or you just want the square DP co-ordinates
- // stored in the toy MC ntuple then set this to kTRUE
- const Bool_t squareDP = kTRUE;
-
- // Set this to kFALSE if you want to remove the DP from the fit
- const Bool_t doDP = kTRUE;
-
- // Set this to kTRUE if you want to fix the CPV parameters
- const Bool_t fixCP = kFALSE;
- const Bool_t doTwoStageFit = !fixCP;
-
- // General histogram booleans
- const Bool_t useInterpolation = kTRUE;
- const Bool_t fluctuateBins = kFALSE;
- const Bool_t useUpperHalfOnly = kFALSE;
-
- // Signal and continuum yields - from Phys.Rev.D78:012004,2008
- const Double_t nSigEvents = 4585.0;
- const Bool_t fixNSigEvents = kFALSE;
- const Double_t nBgEvents = 6830.0;
- const Bool_t fixNBgEvents = kFALSE;
-
- // Signal and continuum asymmetries
- // NB the signal asymmetry value here is only used if the DP is NOT
- // in the fit, otherwise the asymmetry is included within the
- // isobar model.
- const Double_t sigAsym = 0.028;
- const Bool_t fixSigAsym = kFALSE;
- const Double_t bgAsym = -0.028;
- const Bool_t fixBgAsym = kFALSE;
-
- // Define the DP (for both B+ and B- candidates)
- LauDaughters* negDaughters = new LauDaughters("B-", "K-", "pi-", "pi+", squareDP);
- LauDaughters* posDaughters = new LauDaughters("B+", "K+", "pi+", "pi-", squareDP);
-
- // Add some vetoes
- LauVetoes* vetoes = new LauVetoes();
- const Double_t D_KpiMin = 1.756;
- const Double_t D_KpiMax = 1.931;
- const Double_t D_pipiMin = 1.660;
- const Double_t D_pipiMax = 1.800;
- const Double_t JpsiMin = 3.019;
- const Double_t JpsiMax = 3.179;
- const Double_t psi2SMin = 3.627;
- const Double_t psi2SMax = 3.747;
- vetoes->addMassVeto(2, D_KpiMin, D_KpiMax); // D0 veto, m13
- vetoes->addMassVeto(1, D_pipiMin, D_pipiMax); // D0 veto, m23
- vetoes->addMassVeto(1, JpsiMin, JpsiMax); // J/psi veto, m23
- vetoes->addMassVeto(1, psi2SMin, psi2SMax); // psi(2S) veto, m23
-
- // Create the efficiency models
- TFile* effHistoFile = TFile::Open("histos/eff/Kpipi_50x50.root", "read");
-
- LauEffModel* negEffModel = new LauEffModel(negDaughters, vetoes);
- TString negEffHistoName("eff_all_neg");
- TH2* negEffHisto = dynamic_cast<TH2*>(effHistoFile->Get(negEffHistoName));
- negEffModel->setEffHisto(negEffHisto, useInterpolation, fluctuateBins, 0.0, 0.0, useUpperHalfOnly, squareDP);
-
- LauEffModel* posEffModel = new LauEffModel(posDaughters, vetoes);
- TString posEffHistoName("eff_all_pos");
- TH2* posEffHisto = dynamic_cast<TH2*>(effHistoFile->Get(posEffHistoName));
- posEffModel->setEffHisto(posEffHisto, useInterpolation, fluctuateBins, 0.0, 0.0, useUpperHalfOnly, squareDP);
-
-
- // Create the signal dynamics
- LauResonanceMaker& resMaker = LauResonanceMaker::get();
- resMaker.setDefaultBWRadius( LauBlattWeisskopfFactor::Parent, 4.0 );
- resMaker.setDefaultBWRadius( LauBlattWeisskopfFactor::Kstar, 4.0 );
- resMaker.setDefaultBWRadius( LauBlattWeisskopfFactor::Light, 4.0 );
- resMaker.setDefaultBWRadius( LauBlattWeisskopfFactor::Charmonium, 4.0 );
-
- LauIsobarDynamics* negSigModel = new LauIsobarDynamics(negDaughters, negEffModel);
- negSigModel->setIntFileName("integ_neg.dat");
- negSigModel->setASqMaxValue(0.45);
-
- LauAbsResonance* res(0);
- res = negSigModel->addResonance("K*0(892)", 2, LauAbsResonance::RelBW);
- res = negSigModel->addResonance("K*0_0(1430)", 2, LauAbsResonance::LASS);
- res = negSigModel->addResonance("rho0(770)", 1, LauAbsResonance::RelBW);
- res = negSigModel->addResonance("f_0(980)", 1, LauAbsResonance::Flatte);
- res->changeResonance( 0.965, -1.0, -1 );
- res = negSigModel->addResonance("chi_c0", 1, LauAbsResonance::RelBW);
- res = negSigModel->addResonance("NonReson", 0, LauAbsResonance::FlatNR);
-
- res = negSigModel->addResonance("K*0_2(1430)", 2, LauAbsResonance::RelBW);
- res = negSigModel->addResonance("omega(782)", 1, LauAbsResonance::RelBW);
- res = negSigModel->addResonance("f_2(1270)", 1, LauAbsResonance::RelBW);
- res = negSigModel->addResonance("f'_0(1300)", 1, LauAbsResonance::RelBW);
- res->changeResonance( 1.479, 0.080, -1 );
-
- LauIsobarDynamics* posSigModel = new LauIsobarDynamics(posDaughters, posEffModel);
- posSigModel->setIntFileName("integ_pos.dat");
- posSigModel->setASqMaxValue(0.45);
-
- res = posSigModel->addResonance("K*0(892)", 2, LauAbsResonance::RelBW);
- res = posSigModel->addResonance("K*0_0(1430)", 2, LauAbsResonance::LASS);
- res = posSigModel->addResonance("rho0(770)", 1, LauAbsResonance::RelBW);
- res = posSigModel->addResonance("f_0(980)", 1, LauAbsResonance::Flatte);
- res->changeResonance( 0.965, -1.0, -1 );
- res = posSigModel->addResonance("chi_c0", 1, LauAbsResonance::RelBW);
- res = posSigModel->addResonance("NonReson", 0, LauAbsResonance::FlatNR);
-
- res = posSigModel->addResonance("K*0_2(1430)", 2, LauAbsResonance::RelBW);
- res = posSigModel->addResonance("omega(782)", 1, LauAbsResonance::RelBW);
- res = posSigModel->addResonance("f_2(1270)", 1, LauAbsResonance::RelBW);
- res = posSigModel->addResonance("f'_0(1300)", 1, LauAbsResonance::RelBW);
- res->changeResonance( 1.479, 0.080, -1 );
-
-
- // Create the fit model, passing it the two signal dynamics models
- LauCPFitModel* fitModel = new LauCPFitModel(negSigModel,posSigModel);
- fitModel->useDP(doDP);
-
- // Set isobar coefficients - taken from Phys.Rev.D78:012004,2008
- std::vector<LauAbsCoeffSet*> coeffset;
- coeffset.push_back(new LauCartesianCPCoeffSet("K*0(892)", 1.000, 0.000, -0.017, -0.238, kTRUE, kTRUE, fixCP, fixCP, doTwoStageFit, doTwoStageFit));
- coeffset.push_back(new LauCartesianCPCoeffSet("K*0_0(1430)", 1.718, -0.727, -0.154, -0.285, kFALSE, kFALSE, fixCP, fixCP, doTwoStageFit, doTwoStageFit));
- coeffset.push_back(new LauCartesianCPCoeffSet("rho0(770)", 0.683, -0.025, -0.160, 0.169, kFALSE, kFALSE, fixCP, fixCP, doTwoStageFit, doTwoStageFit));
- coeffset.push_back(new LauCartesianCPCoeffSet("f_0(980)", -0.220, 1.203, -0.109, 0.047, kFALSE, kFALSE, fixCP, fixCP, doTwoStageFit, doTwoStageFit));
- coeffset.push_back(new LauCartesianCPCoeffSet("chi_c0", -0.263, 0.180, -0.033, -0.007, kFALSE, kFALSE, fixCP, fixCP, doTwoStageFit, doTwoStageFit));
- coeffset.push_back(new LauCartesianCPCoeffSet("NonReson", -0.594, 0.068, 0.000, 0.000, kFALSE, kFALSE, kTRUE, kTRUE));
- coeffset.push_back(new LauCartesianCPCoeffSet("K*0_2(1430)", -0.301, 0.424, 0.032, 0.007, kFALSE, kFALSE, fixCP, fixCP, doTwoStageFit, doTwoStageFit));
- coeffset.push_back(new LauCartesianCPCoeffSet("omega(782)", -0.058, 0.100, 0.000, 0.000, kFALSE, kFALSE, kTRUE, kTRUE));
- coeffset.push_back(new LauCartesianCPCoeffSet("f_2(1270)", -0.193, 0.110, -0.089, 0.125, kFALSE, kFALSE, fixCP, fixCP, doTwoStageFit, doTwoStageFit));
- coeffset.push_back(new LauCartesianCPCoeffSet("f'_0(1300)", -0.290, -0.136, 0.024, 0.056, kFALSE, kFALSE, fixCP, fixCP, doTwoStageFit, doTwoStageFit));
- for (std::vector<LauAbsCoeffSet*>::iterator iter=coeffset.begin(); iter!=coeffset.end(); ++iter) {
- fitModel->setAmpCoeffSet(*iter);
- }
-
- // Set the number of signal events and the number of experiments
- LauParameter * signalEvents = new LauParameter("signalEvents",nSigEvents,-1.0*nSigEvents,2.0*nSigEvents,fixNSigEvents);
- LauParameter * signalAsym = new LauParameter("signalAsym",sigAsym,-1.0,1.0,fixSigAsym);
-
- fitModel->setNSigEvents(signalEvents, signalAsym);
- fitModel->setNExpts(nExpt, firstExpt, isToy);
-
- // Set up the background configuration
- const Int_t nBBs(1);
- TString vetoCorrHistName("");
- TString qqDPName = "";
- std::vector<TString> BBNames(nBBs);
- std::vector<TString> BBDPNames(nBBs);
- std::vector<TString> BBMESNames(nBBs);
- std::vector<TString> BBDENames(nBBs);
- if (squareDP) {
- vetoCorrHistName = "correctionSqDPHisto";
- qqDPName = "onres_sqDP_histo";
- for (Int_t i(0); i<nBBs; ++i) {
- TString name("BB");
- name += i+1;
- TString dpName(name);
- TString mesName(name);
- TString deName(name);
- dpName += "_sqDP_histo";
- mesName += "_mES_histo";
- deName += "_deltaEsig_histo";
- BBNames[i] = name;
- BBDPNames[i] = dpName;
- BBMESNames[i] = mesName;
- BBDENames[i] = deName;
- }
- } else {
- vetoCorrHistName = "correctionDPHisto";
- qqDPName = "onres_DP_histo";
- for (Int_t i(0); i<nBBs; ++i) {
- TString name("BB");
- name += i+1;
- TString dpName(name);
- TString mesName(name);
- TString deName(name);
- dpName += "_DP_histo";
- mesName += "_mES_histo";
- deName += "_deltaEsig_histo";
- BBNames[i] = name;
- BBDPNames[i] = dpName;
- BBMESNames[i] = mesName;
- BBDENames[i] = deName;
- }
- }
-
-
- std::vector<TString> bkgndNames( nBBs + 1 );
- bkgndNames[0] = "qqbar";
- for (Int_t i(0); i<nBBs; ++i) {
- bkgndNames[i+1] = BBNames[i];
- }
- fitModel->setBkgndClassNames( bkgndNames );
-
-
- // Get the histogram for correcting the other histograms for the
- // effect of the vetoes on bins on a veto boundary
- TString vetoCorrFileName("histos/veto-correction/vetoCorrectionHisto_50.root");
- TFile* vetoCorrFile = TFile::Open(vetoCorrFileName, "read");
- TH2* vetoCorrHist = dynamic_cast<TH2*>(vetoCorrFile->Get(vetoCorrHistName));
-
- // Load the qqbar DP histograms
- TString negqqFileName("histos/qqbar/qqbarBackgroundHistos_50_neg.root");
- TFile* negqqFile = TFile::Open(negqqFileName, "read");
- TH2* negqqDP = dynamic_cast<TH2*>(negqqFile->Get(qqDPName));
- negqqDP->Divide(vetoCorrHist);
- LauBkgndDPModel* negqqbarModel= new LauBkgndDPModel(negDaughters, vetoes);
- negqqbarModel->setBkgndHisto( negqqDP, useInterpolation, fluctuateBins, useUpperHalfOnly, squareDP );
-
- TString posqqFileName("histos/qqbar/qqbarBackgroundHistos_50_pos.root");
- TFile* posqqFile = TFile::Open(posqqFileName, "read");
- TH2* posqqDP = dynamic_cast<TH2*>(posqqFile->Get(qqDPName));
- posqqDP->Divide(vetoCorrHist);
- LauBkgndDPModel* posqqbarModel= new LauBkgndDPModel(posDaughters, vetoes);
- posqqbarModel->setBkgndHisto( posqqDP, useInterpolation, fluctuateBins, useUpperHalfOnly, squareDP );
-
- LauParameter* backgroundEvents = new LauParameter("qqbar",nBgEvents,-1.0*nBgEvents,2.0*nBgEvents,fixNBgEvents);
- LauParameter* backgroundAsym = new LauParameter("qqbar",bgAsym,-1.0,1.0,fixBgAsym);
-
- fitModel->setNBkgndEvents( backgroundEvents, backgroundAsym );
- fitModel->setBkgndDPModels( "qqbar", negqqbarModel, posqqbarModel );
-
- // Load the BBbar DP histograms
- TString negBBFileName("histos/BBbar/BbackgroundHistos_50_neg_categories.root");
- TFile* negBBFile = TFile::Open(negBBFileName, "read");
- TString posBBFileName("histos/BBbar/BbackgroundHistos_50_pos_categories.root");
- TFile* posBBFile = TFile::Open(posBBFileName, "read");
-
- std::vector<TH2*> negBBDP(nBBs);
- std::vector<TH2*> posBBDP(nBBs);
- std::vector<LauParameter*> nBBEvents(nBBs);
- std::vector<LauParameter*> BBAsym(nBBs);
- std::vector<LauBkgndDPModel*> negBBModels(nBBs);
- std::vector<LauBkgndDPModel*> posBBModels(nBBs);
-
- for (Int_t i(0); i<nBBs; ++i) {
- negBBFile->cd();
- negBBDP[i] = dynamic_cast<TH2*>(negBBFile->Get(BBDPNames[i]));
- if (negBBDP[i] == 0) {
- std::cerr<<"Problem finding histogram \""<<BBDPNames[i]<<"\" in B- file."<<std::endl;
- return EXIT_FAILURE;
- }
- Double_t negBBEvents = negBBDP[i]->Integral();
- negBBDP[i]->Divide(vetoCorrHist);
- negBBModels[i] = new LauBkgndDPModel(negDaughters, vetoes);
- negBBModels[i]->setBkgndHisto(negBBDP[i], useInterpolation, fluctuateBins, useUpperHalfOnly, squareDP);
-
- posBBFile->cd();
- posBBDP[i] = dynamic_cast<TH2*>(posBBFile->Get(BBDPNames[i]));
- if (posBBDP[i] == 0) {
- std::cerr<<"Problem finding histogram \""<<BBDPNames[i]<<"\" in B+ file."<<std::endl;
- return EXIT_FAILURE;
- }
- Double_t posBBEvents = posBBDP[i]->Integral();
- posBBDP[i]->Divide(vetoCorrHist);
- posBBModels[i] = new LauBkgndDPModel(posDaughters, vetoes);
- posBBModels[i]->setBkgndHisto(posBBDP[i], useInterpolation, fluctuateBins, useUpperHalfOnly, squareDP);
-
- Double_t totalBBEvents = negBBEvents + posBBEvents;
- Double_t asym = ( negBBEvents - posBBEvents ) / totalBBEvents ;
-
- nBBEvents[i] = new LauParameter(BBNames[i],totalBBEvents,-2.0*totalBBEvents,2.0*totalBBEvents,kTRUE);
- BBAsym[i] = new LauParameter(BBNames[i],asym,-1.0,1.0,kTRUE);
-
- fitModel->setBkgndDPModels(BBNames[i], negBBModels[i], posBBModels[i] );
- fitModel->setNBkgndEvents( nBBEvents[i], BBAsym[i] );
- }
-
-
- // Signal mES and DeltaEsig PDF parameter values, shifts and scale factors
- Double_t mes_mean1_value = 5.279443;
- Double_t mes_mean2_value = 5.275484;
- Double_t mes_sigma1_value = 0.0023974;
- Double_t mes_frac_value = 0.9094;
- Double_t de_mean1_value = -0.00955;
- Double_t de_mean2_value = -0.632;
- Double_t de_sigma1_value = 1.0771;
- Double_t de_sigma2_value = 2.258;
- Double_t de_frac_value = 0.8069;
-
- // mES PDFs
- // PDFs for B+ and B- are set to be identical here but could be different in general
- Double_t mesMin = 5.272;
- Double_t mesMax = 5.286;
-
- // Signal PDF is a double Gaussian with the widths constrained to be the same
- LauParameter* mes_mean1_neg = new LauParameter("mes_mean1_neg", mes_mean1_value, 5.272, 5.286, kTRUE);
- LauParameter* mes_sigma1_neg = new LauParameter("mes_sigma1_neg", mes_sigma1_value, 0.000, 0.010, kTRUE);
- LauParameter* mes_mean2_neg = new LauParameter("mes_mean2_neg", mes_mean2_value, 5.272, 5.286, kTRUE);
- LauParameter* mes_sigma2_neg = mes_sigma1_neg->createClone();
- LauParameter* mes_frac_neg = new LauParameter("mes_frac_neg", mes_frac_value, 0.000, 1.000, kTRUE);
- std::vector<LauAbsRValue*> mesPars; mesPars.reserve(2);
- mesPars.push_back(mes_mean1_neg);
- mesPars.push_back(mes_sigma1_neg);
- LauAbsPdf* sigNegMESPdf1 = new LauGaussPdf("mES", mesPars, mesMin, mesMax);
- mesPars.clear();
- mesPars.push_back(mes_mean2_neg);
- mesPars.push_back(mes_sigma2_neg);
- LauAbsPdf* sigNegMESPdf2 = new LauGaussPdf("mES", mesPars, mesMin, mesMax);
- LauAbsPdf* sigNegMESPdf = new LauSumPdf(sigNegMESPdf1, sigNegMESPdf2, mes_frac_neg);
- mesPars.clear();
- LauParameter* mes_mean1_pos = mes_mean1_neg->createClone();
- LauParameter* mes_sigma1_pos = mes_sigma1_neg->createClone();
- LauParameter* mes_mean2_pos = mes_mean2_neg->createClone();
- LauParameter* mes_sigma2_pos = mes_sigma1_pos->createClone();
- LauParameter* mes_frac_pos = mes_frac_neg->createClone();
- mesPars.push_back(mes_mean1_pos);
- mesPars.push_back(mes_sigma1_pos);
- LauAbsPdf* sigPosMESPdf1 = new LauGaussPdf("mES", mesPars, mesMin, mesMax);
- mesPars.clear();
- mesPars.push_back(mes_mean2_pos);
- mesPars.push_back(mes_sigma2_pos);
- LauAbsPdf* sigPosMESPdf2 = new LauGaussPdf("mES", mesPars, mesMin, mesMax);
- LauAbsPdf* sigPosMESPdf = new LauSumPdf(sigPosMESPdf1, sigPosMESPdf2, mes_frac_pos);
-
- fitModel->setSignalPdfs(sigNegMESPdf, sigPosMESPdf);
-
- // Continuum PDF is an ARGUS function
- mesPars.clear();
- LauParameter* mes_qqbar_m0_neg = new LauParameter("mes_qqbar_m0", 5.289);
- LauParameter* mes_qqbar_xi_neg = new LauParameter("mes_qqbar_xi_neg", 13.3, 0.0, 50.0, kTRUE);
- mesPars.push_back(mes_qqbar_m0_neg);
- mesPars.push_back(mes_qqbar_xi_neg);
- LauAbsPdf* qqbarNegMESPdf = new LauArgusPdf("mES", mesPars, mesMin, mesMax);
-
- mesPars.clear();
- LauParameter* mes_qqbar_m0_pos = mes_qqbar_m0_neg->createClone();
- LauParameter* mes_qqbar_xi_pos = mes_qqbar_xi_neg->createClone();
- mesPars.push_back(mes_qqbar_m0_pos);
- mesPars.push_back(mes_qqbar_xi_pos);
- LauAbsPdf* qqbarPosMESPdf = new LauArgusPdf("mES", mesPars, mesMin, mesMax);
-
- fitModel->setBkgndPdfs( "qqbar", qqbarNegMESPdf, qqbarPosMESPdf );
-
- // BB background PDFs are 1D histograms
- std::vector<TH1F*> negBBMES(nBBs);
- std::vector<TH1F*> posBBMES(nBBs);
- std::vector<LauAbsPdf*> negBBMESPdfs(nBBs);
- std::vector<LauAbsPdf*> posBBMESPdfs(nBBs);
- for (Int_t i(0); i<nBBs; ++i) {
- negBBFile->cd();
- negBBMES[i] = dynamic_cast<TH1F*>(negBBFile->Get(BBMESNames[i]));
- if (negBBMES[i] == 0) {
- std::cerr<<"Problem finding histogram \""<<BBMESNames[i]<<"\" in B- file."<<std::endl;
- return EXIT_FAILURE;
- }
- negBBMESPdfs[i] = new Lau1DHistPdf("mES", negBBMES[i], mesMin, mesMax, useInterpolation, fluctuateBins);
-
- posBBFile->cd();
- posBBMES[i] = dynamic_cast<TH1F*>(posBBFile->Get(BBMESNames[i]));
- if (posBBMES[i] == 0) {
- std::cerr<<"Problem finding histogram \""<<BBMESNames[i]<<"\" in B+ file."<<std::endl;
- return EXIT_FAILURE;
- }
- posBBMESPdfs[i] = new Lau1DHistPdf("mES", posBBMES[i], mesMin, mesMax, useInterpolation, fluctuateBins);
-
- fitModel->setBkgndPdfs( BBNames[i], negBBMESPdfs[i], posBBMESPdfs[i] );
- }
-
-
-
- // deltaE significance PDFs
- // PDFs for B+ and B- are set to be identical here but could be different in general
- Double_t deMin = -4.0;
- Double_t deMax = 4.0;
-
- // Signal PDF is a double Gaussian
- LauParameter* de_sig_mean1_neg = new LauParameter("de_sig_mean1_neg", de_mean1_value, -4.0, 4.0, kTRUE);
- LauParameter* de_sig_sigma1_neg = new LauParameter("de_sig_sigma1_neg", de_sigma1_value, 0.0, 4.0, kTRUE);
- LauParameter* de_sig_mean2_neg = new LauParameter("de_sig_mean2_neg", de_mean2_value, -4.0, 4.0, kTRUE);
- LauParameter* de_sig_sigma2_neg = new LauParameter("de_sig_sigma2_neg", de_sigma2_value, 0.0, 4.0, kTRUE);
- LauParameter* de_sig_frac_neg = new LauParameter("de_sig_frac_neg", de_frac_value, 0.0, 1.0, kTRUE);
- std::vector<LauAbsRValue*> dePars; dePars.reserve(2);
- dePars.push_back(de_sig_mean1_neg);
- dePars.push_back(de_sig_sigma1_neg);
- LauAbsPdf* sigNegDE1Pdf = new LauGaussPdf("deltaEsig", dePars, deMin, deMax);
- dePars.clear();
- dePars.push_back(de_sig_mean2_neg);
- dePars.push_back(de_sig_sigma2_neg);
- LauAbsPdf* sigNegDE2Pdf = new LauGaussPdf("deltaEsig", dePars, deMin, deMax);
- LauAbsPdf* sigNegDEPdf = new LauSumPdf(sigNegDE1Pdf, sigNegDE2Pdf, de_sig_frac_neg);
-
- dePars.clear();
- LauParameter* de_sig_mean1_pos = de_sig_mean1_neg->createClone();
- LauParameter* de_sig_sigma1_pos = de_sig_sigma1_neg->createClone();
- LauParameter* de_sig_mean2_pos = de_sig_mean2_neg->createClone();
- LauParameter* de_sig_sigma2_pos = de_sig_sigma2_neg->createClone();
- LauParameter* de_sig_frac_pos = de_sig_frac_neg->createClone();
- dePars.push_back(de_sig_mean1_pos);
- dePars.push_back(de_sig_sigma1_pos);
- LauAbsPdf* sigPosDE1Pdf = new LauGaussPdf("deltaEsig", dePars, deMin, deMax);
- dePars.clear();
- dePars.push_back(de_sig_mean2_pos);
- dePars.push_back(de_sig_sigma2_pos);
- LauAbsPdf* sigPosDE2Pdf = new LauGaussPdf("deltaEsig", dePars, deMin, deMax);
- LauAbsPdf* sigPosDEPdf = new LauSumPdf(sigPosDE1Pdf, sigPosDE2Pdf, de_sig_frac_pos);
-
- fitModel->setSignalPdfs(sigNegDEPdf, sigPosDEPdf);
-
- // Continuum PDF is a 1st order polynomial
- dePars.clear();
- LauParameter* de_qqbar_slope_neg = new LauParameter("de_qqbar_slope_neg", -0.00241, -0.01, 0.01, kFALSE);
- dePars.push_back(de_qqbar_slope_neg);
- LauAbsPdf * qqbarNegDEPdf = new LauLinearPdf("deltaEsig", dePars, deMin, deMax);
-
- dePars.clear();
- LauParameter* de_qqbar_slope_pos = de_qqbar_slope_neg->createClone();
- dePars.push_back(de_qqbar_slope_pos);
- LauAbsPdf * qqbarPosDEPdf = new LauLinearPdf("deltaEsig", dePars, deMin, deMax);
-
- fitModel->setBkgndPdfs( "qqbar", qqbarNegDEPdf, qqbarPosDEPdf );
-
- // BB background PDFs are 1D histograms
- std::vector<TH1F*> negBBDE(nBBs);
- std::vector<TH1F*> posBBDE(nBBs);
- std::vector<LauAbsPdf*> negBBDEPdfs(nBBs);
- std::vector<LauAbsPdf*> posBBDEPdfs(nBBs);
- for (Int_t i(0); i<nBBs; ++i) {
- negBBFile->cd();
- negBBDE[i] = dynamic_cast<TH1F*>(negBBFile->Get(BBDENames[i]));
- if (negBBDE[i] == 0) {
- std::cerr<<"Problem finding histogram \""<<BBDENames[i]<<"\" in B- file."<<std::endl;
- return EXIT_FAILURE;
- }
- negBBDEPdfs[i] = new Lau1DHistPdf("deltaEsig", negBBDE[i], deMin, deMax, useInterpolation, fluctuateBins);
-
- posBBFile->cd();
- posBBDE[i] = dynamic_cast<TH1F*>(posBBFile->Get(BBDENames[i]));
- if (posBBDE[i] == 0) {
- std::cerr<<"Problem finding histogram \""<<BBDENames[i]<<"\" in B+ file."<<std::endl;
- return EXIT_FAILURE;
- }
- posBBDEPdfs[i] = new Lau1DHistPdf("deltaEsig", posBBDE[i], deMin, deMax, useInterpolation, fluctuateBins);
-
- fitModel->setBkgndPdfs( BBNames[i], negBBDEPdfs[i], posBBDEPdfs[i] );
- }
-
-
- // Configure various fit options
-
- // Do not calculate asymmetric errors.
- fitModel->useAsymmFitErrors(kFALSE);
-
- // Randomise initial fit values for the signal isobar parameters
- fitModel->useRandomInitFitPars(kTRUE);
-
- // Switch on/off Poissonian smearing of total number of events
- fitModel->doPoissonSmearing(kTRUE);
-
- // Switch on/off Extended ML Fit option
- fitModel->doEMLFit(kTRUE);
-
- // Switch on/off two-stage fitting for CPV parameters
- fitModel->twoStageFit(doTwoStageFit);
-
- // Generate toy from the fitted parameters
- //TString fitToyFileName("fitToyMC_Kpipi_");
- //fitToyFileName += iFit;
- //fitToyFileName += ".root";
- //fitModel->compareFitData(100, fitToyFileName);
-
- // Write out per-event likelihoods and sWeights
- //TString splotFileName("splot_Kpipi_");
- //splotFileName += iFit;
- //splotFileName += ".root";
- //fitModel->writeSPlotData(splotFileName, "splot", kFALSE);
-
- // Set the names of the files to read/write
- TString dataFile("gen-Kpipi.root");
- TString treeName("genResults");
- TString rootFileName("");
- TString tableFileName("");
- if (command == "fit") {
- rootFileName = "fitKpipi_"; rootFileName += iFit;
- rootFileName += "_expts"; rootFileName += firstExpt; rootFileName += "-"; rootFileName += firstExpt+nExpt-1;
- rootFileName += ".root";
- tableFileName = "fitKpipiResults_"; tableFileName += iFit;
- } else {
- rootFileName = "dummy.root";
- tableFileName = "genKpipiResults";
- }
-
- // Execute the generation/fit
- fitModel->run(command, dataFile, treeName, rootFileName, tableFileName);
-
- return EXIT_SUCCESS;
+ // Process command-line arguments
+ // Usage:
+ // ./GenFitKpipi gen [nExpt = 1] [firstExpt = 0]
+ // or
+ // ./GenFitKpipi fit <iFit> [nExpt = 1] [firstExpt = 0]
+ if ( argc < 2 ) {
+ usage( std::cerr, argv[0] );
+ return EXIT_FAILURE;
+ }
+
+ TString command = argv[1];
+ command.ToLower();
+ Int_t iFit( 0 );
+ Int_t nExpt( 1 );
+ Int_t firstExpt( 0 );
+ Bool_t isToy( kTRUE );
+ if ( command == "gen" ) {
+ if ( argc > 2 ) {
+ nExpt = atoi( argv[2] );
+ if ( argc > 3 ) {
+ firstExpt = atoi( argv[3] );
+ }
+ }
+ } else if ( command == "fit" ) {
+ if ( argc < 3 ) {
+ usage( std::cerr, argv[0] );
+ return EXIT_FAILURE;
+ }
+ iFit = atoi( argv[2] );
+ if ( argc > 3 ) {
+ nExpt = atoi( argv[3] );
+ if ( argc > 4 ) {
+ firstExpt = atoi( argv[4] );
+ }
+ }
+ } else {
+ usage( std::cerr, argv[0] );
+ return EXIT_FAILURE;
+ }
+
+ // If you want to use square DP histograms for efficiency,
+ // backgrounds or you just want the square DP co-ordinates
+ // stored in the toy MC ntuple then set this to kTRUE
+ const Bool_t squareDP = kTRUE;
+
+ // Set this to kFALSE if you want to remove the DP from the fit
+ const Bool_t doDP = kTRUE;
+
+ // Set this to kTRUE if you want to fix the CPV parameters
+ const Bool_t fixCP = kFALSE;
+ const Bool_t doTwoStageFit = ! fixCP;
+
+ // General histogram booleans
+ const Bool_t useInterpolation = kTRUE;
+ const Bool_t fluctuateBins = kFALSE;
+ const Bool_t useUpperHalfOnly = kFALSE;
+
+ // Signal and continuum yields - from Phys.Rev.D78:012004,2008
+ const Double_t nSigEvents = 4585.0;
+ const Bool_t fixNSigEvents = kFALSE;
+ const Double_t nBgEvents = 6830.0;
+ const Bool_t fixNBgEvents = kFALSE;
+
+ // Signal and continuum asymmetries
+ // NB the signal asymmetry value here is only used if the DP is NOT
+ // in the fit, otherwise the asymmetry is included within the
+ // isobar model.
+ const Double_t sigAsym = 0.028;
+ const Bool_t fixSigAsym = kFALSE;
+ const Double_t bgAsym = -0.028;
+ const Bool_t fixBgAsym = kFALSE;
+
+ // Define the DP (for both B+ and B- candidates)
+ LauDaughters* negDaughters = new LauDaughters( "B-", "K-", "pi-", "pi+", squareDP );
+ LauDaughters* posDaughters = new LauDaughters( "B+", "K+", "pi+", "pi-", squareDP );
+
+ // Add some vetoes
+ LauVetoes* vetoes = new LauVetoes();
+ const Double_t D_KpiMin = 1.756;
+ const Double_t D_KpiMax = 1.931;
+ const Double_t D_pipiMin = 1.660;
+ const Double_t D_pipiMax = 1.800;
+ const Double_t JpsiMin = 3.019;
+ const Double_t JpsiMax = 3.179;
+ const Double_t psi2SMin = 3.627;
+ const Double_t psi2SMax = 3.747;
+ vetoes->addMassVeto( 2, D_KpiMin, D_KpiMax ); // D0 veto, m13
+ vetoes->addMassVeto( 1, D_pipiMin, D_pipiMax ); // D0 veto, m23
+ vetoes->addMassVeto( 1, JpsiMin, JpsiMax ); // J/psi veto, m23
+ vetoes->addMassVeto( 1, psi2SMin, psi2SMax ); // psi(2S) veto, m23
+
+ // Create the efficiency models
+ TFile* effHistoFile = TFile::Open( "histos/eff/Kpipi_50x50.root", "read" );
+
+ LauEffModel* negEffModel = new LauEffModel( negDaughters, vetoes );
+ TString negEffHistoName( "eff_all_neg" );
+ TH2* negEffHisto = dynamic_cast<TH2*>( effHistoFile->Get( negEffHistoName ) );
+ negEffModel->setEffHisto( negEffHisto,
+ useInterpolation,
+ fluctuateBins,
+ 0.0,
+ 0.0,
+ useUpperHalfOnly,
+ squareDP );
+
+ LauEffModel* posEffModel = new LauEffModel( posDaughters, vetoes );
+ TString posEffHistoName( "eff_all_pos" );
+ TH2* posEffHisto = dynamic_cast<TH2*>( effHistoFile->Get( posEffHistoName ) );
+ posEffModel->setEffHisto( posEffHisto,
+ useInterpolation,
+ fluctuateBins,
+ 0.0,
+ 0.0,
+ useUpperHalfOnly,
+ squareDP );
+
+ // Create the signal dynamics
+ LauResonanceMaker& resMaker = LauResonanceMaker::get();
+ resMaker.setDefaultBWRadius( LauBlattWeisskopfFactor::Parent, 4.0 );
+ resMaker.setDefaultBWRadius( LauBlattWeisskopfFactor::Kstar, 4.0 );
+ resMaker.setDefaultBWRadius( LauBlattWeisskopfFactor::Light, 4.0 );
+ resMaker.setDefaultBWRadius( LauBlattWeisskopfFactor::Charmonium, 4.0 );
+
+ LauIsobarDynamics* negSigModel = new LauIsobarDynamics( negDaughters, negEffModel );
+ negSigModel->setIntFileName( "integ_neg.dat" );
+ negSigModel->setASqMaxValue( 0.45 );
+
+ LauAbsResonance* res( 0 );
+ res = negSigModel->addResonance( "K*0(892)", 2, LauAbsResonance::RelBW );
+ res = negSigModel->addResonance( "K*0_0(1430)", 2, LauAbsResonance::LASS );
+ res = negSigModel->addResonance( "rho0(770)", 1, LauAbsResonance::RelBW );
+ res = negSigModel->addResonance( "f_0(980)", 1, LauAbsResonance::Flatte );
+ res->changeResonance( 0.965, -1.0, -1 );
+ res = negSigModel->addResonance( "chi_c0", 1, LauAbsResonance::RelBW );
+ res = negSigModel->addResonance( "NonReson", 0, LauAbsResonance::FlatNR );
+
+ res = negSigModel->addResonance( "K*0_2(1430)", 2, LauAbsResonance::RelBW );
+ res = negSigModel->addResonance( "omega(782)", 1, LauAbsResonance::RelBW );
+ res = negSigModel->addResonance( "f_2(1270)", 1, LauAbsResonance::RelBW );
+ res = negSigModel->addResonance( "f'_0(1300)", 1, LauAbsResonance::RelBW );
+ res->changeResonance( 1.479, 0.080, -1 );
+
+ LauIsobarDynamics* posSigModel = new LauIsobarDynamics( posDaughters, posEffModel );
+ posSigModel->setIntFileName( "integ_pos.dat" );
+ posSigModel->setASqMaxValue( 0.45 );
+
+ res = posSigModel->addResonance( "K*0(892)", 2, LauAbsResonance::RelBW );
+ res = posSigModel->addResonance( "K*0_0(1430)", 2, LauAbsResonance::LASS );
+ res = posSigModel->addResonance( "rho0(770)", 1, LauAbsResonance::RelBW );
+ res = posSigModel->addResonance( "f_0(980)", 1, LauAbsResonance::Flatte );
+ res->changeResonance( 0.965, -1.0, -1 );
+ res = posSigModel->addResonance( "chi_c0", 1, LauAbsResonance::RelBW );
+ res = posSigModel->addResonance( "NonReson", 0, LauAbsResonance::FlatNR );
+
+ res = posSigModel->addResonance( "K*0_2(1430)", 2, LauAbsResonance::RelBW );
+ res = posSigModel->addResonance( "omega(782)", 1, LauAbsResonance::RelBW );
+ res = posSigModel->addResonance( "f_2(1270)", 1, LauAbsResonance::RelBW );
+ res = posSigModel->addResonance( "f'_0(1300)", 1, LauAbsResonance::RelBW );
+ res->changeResonance( 1.479, 0.080, -1 );
+
+ // Create the fit model, passing it the two signal dynamics models
+ LauCPFitModel* fitModel = new LauCPFitModel( negSigModel, posSigModel );
+ fitModel->useDP( doDP );
+
+ // Set isobar coefficients - taken from Phys.Rev.D78:012004,2008
+ std::vector<LauAbsCoeffSet*> coeffset;
+ coeffset.push_back( new LauCartesianCPCoeffSet( "K*0(892)",
+ 1.000,
+ 0.000,
+ -0.017,
+ -0.238,
+ kTRUE,
+ kTRUE,
+ fixCP,
+ fixCP,
+ doTwoStageFit,
+ doTwoStageFit ) );
+ coeffset.push_back( new LauCartesianCPCoeffSet( "K*0_0(1430)",
+ 1.718,
+ -0.727,
+ -0.154,
+ -0.285,
+ kFALSE,
+ kFALSE,
+ fixCP,
+ fixCP,
+ doTwoStageFit,
+ doTwoStageFit ) );
+ coeffset.push_back( new LauCartesianCPCoeffSet( "rho0(770)",
+ 0.683,
+ -0.025,
+ -0.160,
+ 0.169,
+ kFALSE,
+ kFALSE,
+ fixCP,
+ fixCP,
+ doTwoStageFit,
+ doTwoStageFit ) );
+ coeffset.push_back( new LauCartesianCPCoeffSet( "f_0(980)",
+ -0.220,
+ 1.203,
+ -0.109,
+ 0.047,
+ kFALSE,
+ kFALSE,
+ fixCP,
+ fixCP,
+ doTwoStageFit,
+ doTwoStageFit ) );
+ coeffset.push_back( new LauCartesianCPCoeffSet( "chi_c0",
+ -0.263,
+ 0.180,
+ -0.033,
+ -0.007,
+ kFALSE,
+ kFALSE,
+ fixCP,
+ fixCP,
+ doTwoStageFit,
+ doTwoStageFit ) );
+ coeffset.push_back(
+ new LauCartesianCPCoeffSet( "NonReson", -0.594, 0.068, 0.000, 0.000, kFALSE, kFALSE, kTRUE, kTRUE ) );
+ coeffset.push_back( new LauCartesianCPCoeffSet( "K*0_2(1430)",
+ -0.301,
+ 0.424,
+ 0.032,
+ 0.007,
+ kFALSE,
+ kFALSE,
+ fixCP,
+ fixCP,
+ doTwoStageFit,
+ doTwoStageFit ) );
+ coeffset.push_back(
+ new LauCartesianCPCoeffSet( "omega(782)", -0.058, 0.100, 0.000, 0.000, kFALSE, kFALSE, kTRUE, kTRUE ) );
+ coeffset.push_back( new LauCartesianCPCoeffSet( "f_2(1270)",
+ -0.193,
+ 0.110,
+ -0.089,
+ 0.125,
+ kFALSE,
+ kFALSE,
+ fixCP,
+ fixCP,
+ doTwoStageFit,
+ doTwoStageFit ) );
+ coeffset.push_back( new LauCartesianCPCoeffSet( "f'_0(1300)",
+ -0.290,
+ -0.136,
+ 0.024,
+ 0.056,
+ kFALSE,
+ kFALSE,
+ fixCP,
+ fixCP,
+ doTwoStageFit,
+ doTwoStageFit ) );
+ for ( std::vector<LauAbsCoeffSet*>::iterator iter = coeffset.begin(); iter != coeffset.end();
+ ++iter ) {
+ fitModel->setAmpCoeffSet( *iter );
+ }
+
+ // Set the number of signal events and the number of experiments
+ LauParameter* signalEvents = new LauParameter( "signalEvents",
+ nSigEvents,
+ -1.0 * nSigEvents,
+ 2.0 * nSigEvents,
+ fixNSigEvents );
+ LauParameter* signalAsym = new LauParameter( "signalAsym", sigAsym, -1.0, 1.0, fixSigAsym );
+
+ fitModel->setNSigEvents( signalEvents, signalAsym );
+ fitModel->setNExpts( nExpt, firstExpt, isToy );
+
+ // Set up the background configuration
+ const Int_t nBBs( 1 );
+ TString vetoCorrHistName( "" );
+ TString qqDPName = "";
+ std::vector<TString> BBNames( nBBs );
+ std::vector<TString> BBDPNames( nBBs );
+ std::vector<TString> BBMESNames( nBBs );
+ std::vector<TString> BBDENames( nBBs );
+ if ( squareDP ) {
+ vetoCorrHistName = "correctionSqDPHisto";
+ qqDPName = "onres_sqDP_histo";
+ for ( Int_t i( 0 ); i < nBBs; ++i ) {
+ TString name( "BB" );
+ name += i + 1;
+ TString dpName( name );
+ TString mesName( name );
+ TString deName( name );
+ dpName += "_sqDP_histo";
+ mesName += "_mES_histo";
+ deName += "_deltaEsig_histo";
+ BBNames[i] = name;
+ BBDPNames[i] = dpName;
+ BBMESNames[i] = mesName;
+ BBDENames[i] = deName;
+ }
+ } else {
+ vetoCorrHistName = "correctionDPHisto";
+ qqDPName = "onres_DP_histo";
+ for ( Int_t i( 0 ); i < nBBs; ++i ) {
+ TString name( "BB" );
+ name += i + 1;
+ TString dpName( name );
+ TString mesName( name );
+ TString deName( name );
+ dpName += "_DP_histo";
+ mesName += "_mES_histo";
+ deName += "_deltaEsig_histo";
+ BBNames[i] = name;
+ BBDPNames[i] = dpName;
+ BBMESNames[i] = mesName;
+ BBDENames[i] = deName;
+ }
+ }
+
+ std::vector<TString> bkgndNames( nBBs + 1 );
+ bkgndNames[0] = "qqbar";
+ for ( Int_t i( 0 ); i < nBBs; ++i ) {
+ bkgndNames[i + 1] = BBNames[i];
+ }
+ fitModel->setBkgndClassNames( bkgndNames );
+
+ // Get the histogram for correcting the other histograms for the
+ // effect of the vetoes on bins on a veto boundary
+ TString vetoCorrFileName( "histos/veto-correction/vetoCorrectionHisto_50.root" );
+ TFile* vetoCorrFile = TFile::Open( vetoCorrFileName, "read" );
+ TH2* vetoCorrHist = dynamic_cast<TH2*>( vetoCorrFile->Get( vetoCorrHistName ) );
+
+ // Load the qqbar DP histograms
+ TString negqqFileName( "histos/qqbar/qqbarBackgroundHistos_50_neg.root" );
+ TFile* negqqFile = TFile::Open( negqqFileName, "read" );
+ TH2* negqqDP = dynamic_cast<TH2*>( negqqFile->Get( qqDPName ) );
+ negqqDP->Divide( vetoCorrHist );
+ LauBkgndDPModel* negqqbarModel = new LauBkgndDPModel( negDaughters, vetoes );
+ negqqbarModel->setBkgndHisto( negqqDP, useInterpolation, fluctuateBins, useUpperHalfOnly, squareDP );
+
+ TString posqqFileName( "histos/qqbar/qqbarBackgroundHistos_50_pos.root" );
+ TFile* posqqFile = TFile::Open( posqqFileName, "read" );
+ TH2* posqqDP = dynamic_cast<TH2*>( posqqFile->Get( qqDPName ) );
+ posqqDP->Divide( vetoCorrHist );
+ LauBkgndDPModel* posqqbarModel = new LauBkgndDPModel( posDaughters, vetoes );
+ posqqbarModel->setBkgndHisto( posqqDP, useInterpolation, fluctuateBins, useUpperHalfOnly, squareDP );
+
+ LauParameter* backgroundEvents =
+ new LauParameter( "qqbar", nBgEvents, -1.0 * nBgEvents, 2.0 * nBgEvents, fixNBgEvents );
+ LauParameter* backgroundAsym = new LauParameter( "qqbar", bgAsym, -1.0, 1.0, fixBgAsym );
+
+ fitModel->setNBkgndEvents( backgroundEvents, backgroundAsym );
+ fitModel->setBkgndDPModels( "qqbar", negqqbarModel, posqqbarModel );
+
+ // Load the BBbar DP histograms
+ TString negBBFileName( "histos/BBbar/BbackgroundHistos_50_neg_categories.root" );
+ TFile* negBBFile = TFile::Open( negBBFileName, "read" );
+ TString posBBFileName( "histos/BBbar/BbackgroundHistos_50_pos_categories.root" );
+ TFile* posBBFile = TFile::Open( posBBFileName, "read" );
+
+ std::vector<TH2*> negBBDP( nBBs );
+ std::vector<TH2*> posBBDP( nBBs );
+ std::vector<LauParameter*> nBBEvents( nBBs );
+ std::vector<LauParameter*> BBAsym( nBBs );
+ std::vector<LauBkgndDPModel*> negBBModels( nBBs );
+ std::vector<LauBkgndDPModel*> posBBModels( nBBs );
+
+ for ( Int_t i( 0 ); i < nBBs; ++i ) {
+ negBBFile->cd();
+ negBBDP[i] = dynamic_cast<TH2*>( negBBFile->Get( BBDPNames[i] ) );
+ if ( negBBDP[i] == 0 ) {
+ std::cerr << "Problem finding histogram \"" << BBDPNames[i] << "\" in B- file."
+ << std::endl;
+ return EXIT_FAILURE;
+ }
+ Double_t negBBEvents = negBBDP[i]->Integral();
+ negBBDP[i]->Divide( vetoCorrHist );
+ negBBModels[i] = new LauBkgndDPModel( negDaughters, vetoes );
+ negBBModels[i]->setBkgndHisto( negBBDP[i],
+ useInterpolation,
+ fluctuateBins,
+ useUpperHalfOnly,
+ squareDP );
+
+ posBBFile->cd();
+ posBBDP[i] = dynamic_cast<TH2*>( posBBFile->Get( BBDPNames[i] ) );
+ if ( posBBDP[i] == 0 ) {
+ std::cerr << "Problem finding histogram \"" << BBDPNames[i] << "\" in B+ file."
+ << std::endl;
+ return EXIT_FAILURE;
+ }
+ Double_t posBBEvents = posBBDP[i]->Integral();
+ posBBDP[i]->Divide( vetoCorrHist );
+ posBBModels[i] = new LauBkgndDPModel( posDaughters, vetoes );
+ posBBModels[i]->setBkgndHisto( posBBDP[i],
+ useInterpolation,
+ fluctuateBins,
+ useUpperHalfOnly,
+ squareDP );
+
+ Double_t totalBBEvents = negBBEvents + posBBEvents;
+ Double_t asym = ( negBBEvents - posBBEvents ) / totalBBEvents;
+
+ nBBEvents[i] = new LauParameter( BBNames[i],
+ totalBBEvents,
+ -2.0 * totalBBEvents,
+ 2.0 * totalBBEvents,
+ kTRUE );
+ BBAsym[i] = new LauParameter( BBNames[i], asym, -1.0, 1.0, kTRUE );
+
+ fitModel->setBkgndDPModels( BBNames[i], negBBModels[i], posBBModels[i] );
+ fitModel->setNBkgndEvents( nBBEvents[i], BBAsym[i] );
+ }
+
+ // Signal mES and DeltaEsig PDF parameter values, shifts and scale factors
+ Double_t mes_mean1_value = 5.279443;
+ Double_t mes_mean2_value = 5.275484;
+ Double_t mes_sigma1_value = 0.0023974;
+ Double_t mes_frac_value = 0.9094;
+ Double_t de_mean1_value = -0.00955;
+ Double_t de_mean2_value = -0.632;
+ Double_t de_sigma1_value = 1.0771;
+ Double_t de_sigma2_value = 2.258;
+ Double_t de_frac_value = 0.8069;
+
+ // mES PDFs
+ // PDFs for B+ and B- are set to be identical here but could be different in general
+ Double_t mesMin = 5.272;
+ Double_t mesMax = 5.286;
+
+ // Signal PDF is a double Gaussian with the widths constrained to be the same
+ LauParameter* mes_mean1_neg =
+ new LauParameter( "mes_mean1_neg", mes_mean1_value, 5.272, 5.286, kTRUE );
+ LauParameter* mes_sigma1_neg =
+ new LauParameter( "mes_sigma1_neg", mes_sigma1_value, 0.000, 0.010, kTRUE );
+ LauParameter* mes_mean2_neg =
+ new LauParameter( "mes_mean2_neg", mes_mean2_value, 5.272, 5.286, kTRUE );
+ LauParameter* mes_sigma2_neg = mes_sigma1_neg->createClone();
+ LauParameter* mes_frac_neg =
+ new LauParameter( "mes_frac_neg", mes_frac_value, 0.000, 1.000, kTRUE );
+ std::vector<LauAbsRValue*> mesPars;
+ mesPars.reserve( 2 );
+ mesPars.push_back( mes_mean1_neg );
+ mesPars.push_back( mes_sigma1_neg );
+ LauAbsPdf* sigNegMESPdf1 = new LauGaussPdf( "mES", mesPars, mesMin, mesMax );
+ mesPars.clear();
+ mesPars.push_back( mes_mean2_neg );
+ mesPars.push_back( mes_sigma2_neg );
+ LauAbsPdf* sigNegMESPdf2 = new LauGaussPdf( "mES", mesPars, mesMin, mesMax );
+ LauAbsPdf* sigNegMESPdf = new LauSumPdf( sigNegMESPdf1, sigNegMESPdf2, mes_frac_neg );
+ mesPars.clear();
+ LauParameter* mes_mean1_pos = mes_mean1_neg->createClone();
+ LauParameter* mes_sigma1_pos = mes_sigma1_neg->createClone();
+ LauParameter* mes_mean2_pos = mes_mean2_neg->createClone();
+ LauParameter* mes_sigma2_pos = mes_sigma1_pos->createClone();
+ LauParameter* mes_frac_pos = mes_frac_neg->createClone();
+ mesPars.push_back( mes_mean1_pos );
+ mesPars.push_back( mes_sigma1_pos );
+ LauAbsPdf* sigPosMESPdf1 = new LauGaussPdf( "mES", mesPars, mesMin, mesMax );
+ mesPars.clear();
+ mesPars.push_back( mes_mean2_pos );
+ mesPars.push_back( mes_sigma2_pos );
+ LauAbsPdf* sigPosMESPdf2 = new LauGaussPdf( "mES", mesPars, mesMin, mesMax );
+ LauAbsPdf* sigPosMESPdf = new LauSumPdf( sigPosMESPdf1, sigPosMESPdf2, mes_frac_pos );
+
+ fitModel->setSignalPdfs( sigNegMESPdf, sigPosMESPdf );
+
+ // Continuum PDF is an ARGUS function
+ mesPars.clear();
+ LauParameter* mes_qqbar_m0_neg = new LauParameter( "mes_qqbar_m0", 5.289 );
+ LauParameter* mes_qqbar_xi_neg = new LauParameter( "mes_qqbar_xi_neg", 13.3, 0.0, 50.0, kTRUE );
+ mesPars.push_back( mes_qqbar_m0_neg );
+ mesPars.push_back( mes_qqbar_xi_neg );
+ LauAbsPdf* qqbarNegMESPdf = new LauArgusPdf( "mES", mesPars, mesMin, mesMax );
+
+ mesPars.clear();
+ LauParameter* mes_qqbar_m0_pos = mes_qqbar_m0_neg->createClone();
+ LauParameter* mes_qqbar_xi_pos = mes_qqbar_xi_neg->createClone();
+ mesPars.push_back( mes_qqbar_m0_pos );
+ mesPars.push_back( mes_qqbar_xi_pos );
+ LauAbsPdf* qqbarPosMESPdf = new LauArgusPdf( "mES", mesPars, mesMin, mesMax );
+
+ fitModel->setBkgndPdfs( "qqbar", qqbarNegMESPdf, qqbarPosMESPdf );
+
+ // BB background PDFs are 1D histograms
+ std::vector<TH1F*> negBBMES( nBBs );
+ std::vector<TH1F*> posBBMES( nBBs );
+ std::vector<LauAbsPdf*> negBBMESPdfs( nBBs );
+ std::vector<LauAbsPdf*> posBBMESPdfs( nBBs );
+ for ( Int_t i( 0 ); i < nBBs; ++i ) {
+ negBBFile->cd();
+ negBBMES[i] = dynamic_cast<TH1F*>( negBBFile->Get( BBMESNames[i] ) );
+ if ( negBBMES[i] == 0 ) {
+ std::cerr << "Problem finding histogram \"" << BBMESNames[i] << "\" in B- file."
+ << std::endl;
+ return EXIT_FAILURE;
+ }
+ negBBMESPdfs[i] =
+ new Lau1DHistPdf( "mES", negBBMES[i], mesMin, mesMax, useInterpolation, fluctuateBins );
+
+ posBBFile->cd();
+ posBBMES[i] = dynamic_cast<TH1F*>( posBBFile->Get( BBMESNames[i] ) );
+ if ( posBBMES[i] == 0 ) {
+ std::cerr << "Problem finding histogram \"" << BBMESNames[i] << "\" in B+ file."
+ << std::endl;
+ return EXIT_FAILURE;
+ }
+ posBBMESPdfs[i] =
+ new Lau1DHistPdf( "mES", posBBMES[i], mesMin, mesMax, useInterpolation, fluctuateBins );
+
+ fitModel->setBkgndPdfs( BBNames[i], negBBMESPdfs[i], posBBMESPdfs[i] );
+ }
+
+ // deltaE significance PDFs
+ // PDFs for B+ and B- are set to be identical here but could be different in general
+ Double_t deMin = -4.0;
+ Double_t deMax = 4.0;
+
+ // Signal PDF is a double Gaussian
+ LauParameter* de_sig_mean1_neg =
+ new LauParameter( "de_sig_mean1_neg", de_mean1_value, -4.0, 4.0, kTRUE );
+ LauParameter* de_sig_sigma1_neg =
+ new LauParameter( "de_sig_sigma1_neg", de_sigma1_value, 0.0, 4.0, kTRUE );
+ LauParameter* de_sig_mean2_neg =
+ new LauParameter( "de_sig_mean2_neg", de_mean2_value, -4.0, 4.0, kTRUE );
+ LauParameter* de_sig_sigma2_neg =
+ new LauParameter( "de_sig_sigma2_neg", de_sigma2_value, 0.0, 4.0, kTRUE );
+ LauParameter* de_sig_frac_neg =
+ new LauParameter( "de_sig_frac_neg", de_frac_value, 0.0, 1.0, kTRUE );
+ std::vector<LauAbsRValue*> dePars;
+ dePars.reserve( 2 );
+ dePars.push_back( de_sig_mean1_neg );
+ dePars.push_back( de_sig_sigma1_neg );
+ LauAbsPdf* sigNegDE1Pdf = new LauGaussPdf( "deltaEsig", dePars, deMin, deMax );
+ dePars.clear();
+ dePars.push_back( de_sig_mean2_neg );
+ dePars.push_back( de_sig_sigma2_neg );
+ LauAbsPdf* sigNegDE2Pdf = new LauGaussPdf( "deltaEsig", dePars, deMin, deMax );
+ LauAbsPdf* sigNegDEPdf = new LauSumPdf( sigNegDE1Pdf, sigNegDE2Pdf, de_sig_frac_neg );
+
+ dePars.clear();
+ LauParameter* de_sig_mean1_pos = de_sig_mean1_neg->createClone();
+ LauParameter* de_sig_sigma1_pos = de_sig_sigma1_neg->createClone();
+ LauParameter* de_sig_mean2_pos = de_sig_mean2_neg->createClone();
+ LauParameter* de_sig_sigma2_pos = de_sig_sigma2_neg->createClone();
+ LauParameter* de_sig_frac_pos = de_sig_frac_neg->createClone();
+ dePars.push_back( de_sig_mean1_pos );
+ dePars.push_back( de_sig_sigma1_pos );
+ LauAbsPdf* sigPosDE1Pdf = new LauGaussPdf( "deltaEsig", dePars, deMin, deMax );
+ dePars.clear();
+ dePars.push_back( de_sig_mean2_pos );
+ dePars.push_back( de_sig_sigma2_pos );
+ LauAbsPdf* sigPosDE2Pdf = new LauGaussPdf( "deltaEsig", dePars, deMin, deMax );
+ LauAbsPdf* sigPosDEPdf = new LauSumPdf( sigPosDE1Pdf, sigPosDE2Pdf, de_sig_frac_pos );
+
+ fitModel->setSignalPdfs( sigNegDEPdf, sigPosDEPdf );
+
+ // Continuum PDF is a 1st order polynomial
+ dePars.clear();
+ LauParameter* de_qqbar_slope_neg =
+ new LauParameter( "de_qqbar_slope_neg", -0.00241, -0.01, 0.01, kFALSE );
+ dePars.push_back( de_qqbar_slope_neg );
+ LauAbsPdf* qqbarNegDEPdf = new LauLinearPdf( "deltaEsig", dePars, deMin, deMax );
+
+ dePars.clear();
+ LauParameter* de_qqbar_slope_pos = de_qqbar_slope_neg->createClone();
+ dePars.push_back( de_qqbar_slope_pos );
+ LauAbsPdf* qqbarPosDEPdf = new LauLinearPdf( "deltaEsig", dePars, deMin, deMax );
+
+ fitModel->setBkgndPdfs( "qqbar", qqbarNegDEPdf, qqbarPosDEPdf );
+
+ // BB background PDFs are 1D histograms
+ std::vector<TH1F*> negBBDE( nBBs );
+ std::vector<TH1F*> posBBDE( nBBs );
+ std::vector<LauAbsPdf*> negBBDEPdfs( nBBs );
+ std::vector<LauAbsPdf*> posBBDEPdfs( nBBs );
+ for ( Int_t i( 0 ); i < nBBs; ++i ) {
+ negBBFile->cd();
+ negBBDE[i] = dynamic_cast<TH1F*>( negBBFile->Get( BBDENames[i] ) );
+ if ( negBBDE[i] == 0 ) {
+ std::cerr << "Problem finding histogram \"" << BBDENames[i] << "\" in B- file."
+ << std::endl;
+ return EXIT_FAILURE;
+ }
+ negBBDEPdfs[i] =
+ new Lau1DHistPdf( "deltaEsig", negBBDE[i], deMin, deMax, useInterpolation, fluctuateBins );
+
+ posBBFile->cd();
+ posBBDE[i] = dynamic_cast<TH1F*>( posBBFile->Get( BBDENames[i] ) );
+ if ( posBBDE[i] == 0 ) {
+ std::cerr << "Problem finding histogram \"" << BBDENames[i] << "\" in B+ file."
+ << std::endl;
+ return EXIT_FAILURE;
+ }
+ posBBDEPdfs[i] =
+ new Lau1DHistPdf( "deltaEsig", posBBDE[i], deMin, deMax, useInterpolation, fluctuateBins );
+
+ fitModel->setBkgndPdfs( BBNames[i], negBBDEPdfs[i], posBBDEPdfs[i] );
+ }
+
+ // Configure various fit options
+
+ // Do not calculate asymmetric errors.
+ fitModel->useAsymmFitErrors( kFALSE );
+
+ // Randomise initial fit values for the signal isobar parameters
+ fitModel->useRandomInitFitPars( kTRUE );
+
+ // Switch on/off Poissonian smearing of total number of events
+ fitModel->doPoissonSmearing( kTRUE );
+
+ // Switch on/off Extended ML Fit option
+ fitModel->doEMLFit( kTRUE );
+
+ // Switch on/off two-stage fitting for CPV parameters
+ fitModel->twoStageFit( doTwoStageFit );
+
+ // Generate toy from the fitted parameters
+ //TString fitToyFileName("fitToyMC_Kpipi_");
+ //fitToyFileName += iFit;
+ //fitToyFileName += ".root";
+ //fitModel->compareFitData(100, fitToyFileName);
+
+ // Write out per-event likelihoods and sWeights
+ //TString splotFileName("splot_Kpipi_");
+ //splotFileName += iFit;
+ //splotFileName += ".root";
+ //fitModel->writeSPlotData(splotFileName, "splot", kFALSE);
+
+ // Set the names of the files to read/write
+ TString dataFile( "gen-Kpipi.root" );
+ TString treeName( "genResults" );
+ TString rootFileName( "" );
+ TString tableFileName( "" );
+ if ( command == "fit" ) {
+ rootFileName = "fitKpipi_";
+ rootFileName += iFit;
+ rootFileName += "_expts";
+ rootFileName += firstExpt;
+ rootFileName += "-";
+ rootFileName += firstExpt + nExpt - 1;
+ rootFileName += ".root";
+ tableFileName = "fitKpipiResults_";
+ tableFileName += iFit;
+ } else {
+ rootFileName = "dummy.root";
+ tableFileName = "genKpipiResults";
+ }
+
+ // Execute the generation/fit
+ fitModel->run( command, dataFile, treeName, rootFileName, tableFileName );
+
+ return EXIT_SUCCESS;
}
diff --git a/examples/GenFitNoDP.cc b/examples/GenFitNoDP.cc
index 83b4c4e..92ad1dc 100644
--- a/examples/GenFitNoDP.cc
+++ b/examples/GenFitNoDP.cc
@@ -1,249 +1,269 @@
/*
Copyright 2010 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
-#include <cstdlib>
-#include <iostream>
-#include <vector>
-
-#include "TFile.h"
-#include "TH2.h"
-#include "TString.h"
-
-#include "LauSimpleFitModel.hh"
#include "LauCrystalBallPdf.hh"
#include "LauDaughters.hh"
#include "LauEffModel.hh"
#include "LauExponentialPdf.hh"
#include "LauGaussPdf.hh"
#include "LauIsobarDynamics.hh"
#include "LauLinearPdf.hh"
#include "LauRealImagCoeffSet.hh"
+#include "LauSimpleFitModel.hh"
#include "LauSumPdf.hh"
#include "LauVetoes.hh"
+#include "TFile.h"
+#include "TH2.h"
+#include "TString.h"
+
+#include <cstdlib>
+#include <iostream>
+#include <vector>
+
void usage( std::ostream& out, const TString& progName )
{
- out<<"Usage:\n";
- out<<progName<<" gen [nExpt = 1] [firstExpt = 0]\n";
- out<<"or\n";
- out<<progName<<" fit <iFit> [nExpt = 1] [firstExpt = 0]"<<std::endl;
+ out << "Usage:\n";
+ out << progName << " gen [nExpt = 1] [firstExpt = 0]\n";
+ out << "or\n";
+ out << progName << " fit <iFit> [nExpt = 1] [firstExpt = 0]" << std::endl;
}
int main( int argc, char** argv )
{
- // Process command-line arguments
- // Usage:
- // ./GenFitNoDP gen [nExpt = 1] [firstExpt = 0]
- // or
- // ./GenFitNoDP fit <iFit> [nExpt = 1] [firstExpt = 0]
- if ( argc < 2 ) {
- usage( std::cerr, argv[0] );
- return EXIT_FAILURE;
- }
-
- TString command = argv[1];
- command.ToLower();
- Int_t iFit(0);
- Int_t nExpt(1);
- Int_t firstExpt(0);
- Bool_t isToy(kTRUE);
- if ( command == "gen" ) {
- if ( argc > 2 ) {
- nExpt = atoi( argv[2] );
- if ( argc > 3 ) {
- firstExpt = atoi( argv[3] );
- }
- }
- } else if ( command == "fit" ) {
- if ( argc < 3 ) {
- usage( std::cerr, argv[0] );
- return EXIT_FAILURE;
- }
- iFit = atoi( argv[2] );
- if ( argc > 3 ) {
- nExpt = atoi( argv[3] );
- if ( argc > 4 ) {
- firstExpt = atoi( argv[4] );
- }
- }
- } else {
- usage( std::cerr, argv[0] );
- return EXIT_FAILURE;
- }
-
- // Still need to define the DP, so just make one up!
- LauDaughters* daughters = new LauDaughters("B+", "K+", "pi+", "pi-");
-
- // Need a dummy vetoes object
- LauVetoes* vetoes = new LauVetoes();
-
- // Need a dummy efficiency object
- LauEffModel* effModel = new LauEffModel(daughters, vetoes);
-
- // Create the signal dynamics object and just give it a non-resonant component
- LauIsobarDynamics* sigModel = new LauIsobarDynamics(daughters, effModel);
- sigModel->setIntFileName("integ.dat");
- sigModel->addResonance("NonReson", 0, LauAbsResonance::FlatNR);
-
- // Create the fit model, passing it the signal dynamics model
- LauSimpleFitModel* fitModel = new LauSimpleFitModel(sigModel);
- fitModel->useDP(kFALSE);
-
- // Set isobar coefficients for the NR to be 1+0i (and fixed)
- LauAbsCoeffSet* coeffset = new LauRealImagCoeffSet("NonReson", 1.0, 0.0, kTRUE, kTRUE);
- fitModel->setAmpCoeffSet( coeffset );
-
- // Set up the additional background configuration
- const Int_t nBkgnds(2);
- std::vector<TString> bkgndNames(nBkgnds);
- bkgndNames[0] = "Combinatorial";
- bkgndNames[1] = "PartialReco";
- fitModel->setBkgndClassNames( bkgndNames );
-
- // Signal and background yields
- Double_t nSigEvents = 5000.0;
- Bool_t fixNSigEvents = kFALSE;
- Double_t nCombBgEvents = 7000.0;
- Bool_t fixNCombBgEvents = kFALSE;
- Double_t nPartRecoBgEvents = 3000.0;
- Bool_t fixNPartRecoBgEvents = kFALSE;
- Double_t nTotEvents = nSigEvents + nCombBgEvents + nPartRecoBgEvents;
-
- // Set the number of signal and background events and the number of experiments
- LauParameter* nSig = new LauParameter("signalEvents",nSigEvents,-1.0*nTotEvents,2.0*nTotEvents,fixNSigEvents);
- LauParameter* nCombBkg = new LauParameter("Combinatorial",nCombBgEvents,-1.0*nTotEvents,2.0*nTotEvents,fixNCombBgEvents);
- LauParameter* nPartBkg = new LauParameter("PartialReco",nPartRecoBgEvents,-1.0*nTotEvents,2.0*nTotEvents,fixNPartRecoBgEvents);
- // Optionally blind the yield parameters
- //nSig->blindParameter("something1",2000.0);
- //nCombBkg->blindParameter("something2",2000.0);
- //nPartBkg->blindParameter("something3",2000.0);
- fitModel->setNSigEvents(nSig);
- fitModel->setNBkgndEvents( nCombBkg );
- fitModel->setNBkgndEvents( nPartBkg );
- fitModel->setNExpts(nExpt, firstExpt, isToy);
-
- // Signal mB PDF parameter values
- Double_t sig_mb_mean1_value = 5.279;
- Double_t sig_mb_sigma1_value = 0.02;
- Double_t sig_mb_sigma2_value = 0.07;
- Double_t sig_mb_frac_value = 0.90;
-
- // m_B PDFs
- Double_t mbMin = 5.150;
- Double_t mbMax = 5.600;
- std::vector<LauAbsRValue*> mbPars; mbPars.reserve(2);
-
- // Signal PDF is a double Gaussian with the means constrained to be the same
- LauParameter* sig_mb_mean1 = new LauParameter("sig_mb_mean1", sig_mb_mean1_value, 5.2, 5.3, kTRUE);
- LauParameter* sig_mb_sigma1 = new LauParameter("sig_mb_sigma1", sig_mb_sigma1_value, 0.0, 0.1, kTRUE);
- LauParameter* sig_mb_mean2 = sig_mb_mean1->createClone();
- LauParameter* sig_mb_sigma2 = new LauParameter("sig_mb_sigma2", sig_mb_sigma2_value, 0.0, 0.2, kTRUE);
- LauParameter* sig_mb_frac = new LauParameter("sig_mb_frac", sig_mb_frac_value, 0.0, 1.0, kTRUE);
-
- mbPars.clear();
- mbPars.push_back(sig_mb_mean1);
- mbPars.push_back(sig_mb_sigma1);
- LauAbsPdf* sigMBPdf1 = new LauGaussPdf("mB", mbPars, mbMin, mbMax);
-
- mbPars.clear();
- mbPars.push_back(sig_mb_mean2);
- mbPars.push_back(sig_mb_sigma2);
- LauAbsPdf* sigMBPdf2 = new LauGaussPdf("mB", mbPars, mbMin, mbMax);
-
- LauAbsPdf* sigMBPdf = new LauSumPdf(sigMBPdf1, sigMBPdf2, sig_mb_frac);
- fitModel->setSignalPdf(sigMBPdf);
-
- // Combinatoric background PDF is linear function
- LauParameter* comb_mb_slope = new LauParameter("comb_mb_slope", -0.05, -1.0, 1.0, kTRUE);
-
- mbPars.clear();
- mbPars.push_back(comb_mb_slope);
- LauAbsPdf* combMBPdf = new LauLinearPdf("mB", mbPars, mbMin, mbMax);
-
- fitModel->setBkgndPdf( bkgndNames[0], combMBPdf );
-
- // Partially reconstructed background PDF is a crystal ball function
- LauParameter* pr_mb_mean = new LauParameter("pr_mb_mean", 5.200, 5.1, 5.3, kTRUE);
- LauParameter* pr_mb_sigma = new LauParameter("pr_mb_sigma", 0.050, 0.0, 0.2, kTRUE);
- LauParameter* pr_mb_alpha = new LauParameter("pr_mb_alpha", 0.100, -5.0, 5.0, kTRUE);
- LauParameter* pr_mb_order = new LauParameter("pr_mb_order", 4.000, 0.0, 5.0, kTRUE);
-
- mbPars.clear();
- mbPars.push_back(pr_mb_mean);
- mbPars.push_back(pr_mb_sigma);
- mbPars.push_back(pr_mb_alpha);
- mbPars.push_back(pr_mb_order);
- LauAbsPdf* prbgMBPdf = new LauCrystalBallPdf("mB", mbPars, mbMin, mbMax);
-
- fitModel->setBkgndPdf( bkgndNames[1], prbgMBPdf );
-
-
- // Configure various fit options
-
- // Do not calculate asymmetric errors.
- fitModel->useAsymmFitErrors(kTRUE);
-
- // Randomise initial fit values for the signal isobar parameters
- fitModel->useRandomInitFitPars(kTRUE);
-
- // Switch on/off Poissonian smearing of total number of events
- fitModel->doPoissonSmearing(kTRUE);
-
- // Switch on/off Extended ML Fit option
- fitModel->doEMLFit(kTRUE);
-
- // Switch on/off two-stage fitting for CPV parameters
- fitModel->twoStageFit(kFALSE);
-
- // Generate toy from the fitted parameters
- //TString fitToyFileName("fitToyMC_NoDP_");
- //fitToyFileName += iFit;
- //fitToyFileName += ".root";
- //fitModel->compareFitData(100, fitToyFileName);
-
- // Write out per-event likelihoods and sWeights
- //TString splotFileName("splot_NoDP_");
- //splotFileName += iFit;
- //splotFileName += ".root";
- //fitModel->writeSPlotData(splotFileName, "splot", kFALSE);
-
- TString dataFile("gen-NoDP.root");
- TString treeName("genResults");
- TString rootFileName("");
- TString tableFileName("");
- if (command == "fit") {
- rootFileName = "fitNoDP_"; rootFileName += iFit;
- rootFileName += "_expt_"; rootFileName += firstExpt; rootFileName += "-"; rootFileName += firstExpt+nExpt-1;
- rootFileName += ".root";
- tableFileName = "fitNoDPResults_"; tableFileName += iFit;
- } else {
- rootFileName = "dummy.root";
- tableFileName = "genNoDPResults";
- }
-
- // Execute the generation/fit
- fitModel->run(command, dataFile, treeName, rootFileName, tableFileName);
-
- return EXIT_SUCCESS;
+ // Process command-line arguments
+ // Usage:
+ // ./GenFitNoDP gen [nExpt = 1] [firstExpt = 0]
+ // or
+ // ./GenFitNoDP fit <iFit> [nExpt = 1] [firstExpt = 0]
+ if ( argc < 2 ) {
+ usage( std::cerr, argv[0] );
+ return EXIT_FAILURE;
+ }
+
+ TString command = argv[1];
+ command.ToLower();
+ Int_t iFit( 0 );
+ Int_t nExpt( 1 );
+ Int_t firstExpt( 0 );
+ Bool_t isToy( kTRUE );
+ if ( command == "gen" ) {
+ if ( argc > 2 ) {
+ nExpt = atoi( argv[2] );
+ if ( argc > 3 ) {
+ firstExpt = atoi( argv[3] );
+ }
+ }
+ } else if ( command == "fit" ) {
+ if ( argc < 3 ) {
+ usage( std::cerr, argv[0] );
+ return EXIT_FAILURE;
+ }
+ iFit = atoi( argv[2] );
+ if ( argc > 3 ) {
+ nExpt = atoi( argv[3] );
+ if ( argc > 4 ) {
+ firstExpt = atoi( argv[4] );
+ }
+ }
+ } else {
+ usage( std::cerr, argv[0] );
+ return EXIT_FAILURE;
+ }
+
+ // Still need to define the DP, so just make one up!
+ LauDaughters* daughters = new LauDaughters( "B+", "K+", "pi+", "pi-" );
+
+ // Need a dummy vetoes object
+ LauVetoes* vetoes = new LauVetoes();
+
+ // Need a dummy efficiency object
+ LauEffModel* effModel = new LauEffModel( daughters, vetoes );
+
+ // Create the signal dynamics object and just give it a non-resonant component
+ LauIsobarDynamics* sigModel = new LauIsobarDynamics( daughters, effModel );
+ sigModel->setIntFileName( "integ.dat" );
+ sigModel->addResonance( "NonReson", 0, LauAbsResonance::FlatNR );
+
+ // Create the fit model, passing it the signal dynamics model
+ LauSimpleFitModel* fitModel = new LauSimpleFitModel( sigModel );
+ fitModel->useDP( kFALSE );
+
+ // Set isobar coefficients for the NR to be 1+0i (and fixed)
+ LauAbsCoeffSet* coeffset = new LauRealImagCoeffSet( "NonReson", 1.0, 0.0, kTRUE, kTRUE );
+ fitModel->setAmpCoeffSet( coeffset );
+
+ // Set up the additional background configuration
+ const Int_t nBkgnds( 2 );
+ std::vector<TString> bkgndNames( nBkgnds );
+ bkgndNames[0] = "Combinatorial";
+ bkgndNames[1] = "PartialReco";
+ fitModel->setBkgndClassNames( bkgndNames );
+
+ // Signal and background yields
+ Double_t nSigEvents = 5000.0;
+ Bool_t fixNSigEvents = kFALSE;
+ Double_t nCombBgEvents = 7000.0;
+ Bool_t fixNCombBgEvents = kFALSE;
+ Double_t nPartRecoBgEvents = 3000.0;
+ Bool_t fixNPartRecoBgEvents = kFALSE;
+ Double_t nTotEvents = nSigEvents + nCombBgEvents + nPartRecoBgEvents;
+
+ // Set the number of signal and background events and the number of experiments
+ LauParameter* nSig = new LauParameter( "signalEvents",
+ nSigEvents,
+ -1.0 * nTotEvents,
+ 2.0 * nTotEvents,
+ fixNSigEvents );
+ LauParameter* nCombBkg = new LauParameter( "Combinatorial",
+ nCombBgEvents,
+ -1.0 * nTotEvents,
+ 2.0 * nTotEvents,
+ fixNCombBgEvents );
+ LauParameter* nPartBkg = new LauParameter( "PartialReco",
+ nPartRecoBgEvents,
+ -1.0 * nTotEvents,
+ 2.0 * nTotEvents,
+ fixNPartRecoBgEvents );
+ // Optionally blind the yield parameters
+ //nSig->blindParameter("something1",2000.0);
+ //nCombBkg->blindParameter("something2",2000.0);
+ //nPartBkg->blindParameter("something3",2000.0);
+ fitModel->setNSigEvents( nSig );
+ fitModel->setNBkgndEvents( nCombBkg );
+ fitModel->setNBkgndEvents( nPartBkg );
+ fitModel->setNExpts( nExpt, firstExpt, isToy );
+
+ // Signal mB PDF parameter values
+ Double_t sig_mb_mean1_value = 5.279;
+ Double_t sig_mb_sigma1_value = 0.02;
+ Double_t sig_mb_sigma2_value = 0.07;
+ Double_t sig_mb_frac_value = 0.90;
+
+ // m_B PDFs
+ Double_t mbMin = 5.150;
+ Double_t mbMax = 5.600;
+ std::vector<LauAbsRValue*> mbPars;
+ mbPars.reserve( 2 );
+
+ // Signal PDF is a double Gaussian with the means constrained to be the same
+ LauParameter* sig_mb_mean1 =
+ new LauParameter( "sig_mb_mean1", sig_mb_mean1_value, 5.2, 5.3, kTRUE );
+ LauParameter* sig_mb_sigma1 =
+ new LauParameter( "sig_mb_sigma1", sig_mb_sigma1_value, 0.0, 0.1, kTRUE );
+ LauParameter* sig_mb_mean2 = sig_mb_mean1->createClone();
+ LauParameter* sig_mb_sigma2 =
+ new LauParameter( "sig_mb_sigma2", sig_mb_sigma2_value, 0.0, 0.2, kTRUE );
+ LauParameter* sig_mb_frac = new LauParameter( "sig_mb_frac", sig_mb_frac_value, 0.0, 1.0, kTRUE );
+
+ mbPars.clear();
+ mbPars.push_back( sig_mb_mean1 );
+ mbPars.push_back( sig_mb_sigma1 );
+ LauAbsPdf* sigMBPdf1 = new LauGaussPdf( "mB", mbPars, mbMin, mbMax );
+
+ mbPars.clear();
+ mbPars.push_back( sig_mb_mean2 );
+ mbPars.push_back( sig_mb_sigma2 );
+ LauAbsPdf* sigMBPdf2 = new LauGaussPdf( "mB", mbPars, mbMin, mbMax );
+
+ LauAbsPdf* sigMBPdf = new LauSumPdf( sigMBPdf1, sigMBPdf2, sig_mb_frac );
+ fitModel->setSignalPdf( sigMBPdf );
+
+ // Combinatoric background PDF is linear function
+ LauParameter* comb_mb_slope = new LauParameter( "comb_mb_slope", -0.05, -1.0, 1.0, kTRUE );
+
+ mbPars.clear();
+ mbPars.push_back( comb_mb_slope );
+ LauAbsPdf* combMBPdf = new LauLinearPdf( "mB", mbPars, mbMin, mbMax );
+
+ fitModel->setBkgndPdf( bkgndNames[0], combMBPdf );
+
+ // Partially reconstructed background PDF is a crystal ball function
+ LauParameter* pr_mb_mean = new LauParameter( "pr_mb_mean", 5.200, 5.1, 5.3, kTRUE );
+ LauParameter* pr_mb_sigma = new LauParameter( "pr_mb_sigma", 0.050, 0.0, 0.2, kTRUE );
+ LauParameter* pr_mb_alpha = new LauParameter( "pr_mb_alpha", 0.100, -5.0, 5.0, kTRUE );
+ LauParameter* pr_mb_order = new LauParameter( "pr_mb_order", 4.000, 0.0, 5.0, kTRUE );
+
+ mbPars.clear();
+ mbPars.push_back( pr_mb_mean );
+ mbPars.push_back( pr_mb_sigma );
+ mbPars.push_back( pr_mb_alpha );
+ mbPars.push_back( pr_mb_order );
+ LauAbsPdf* prbgMBPdf = new LauCrystalBallPdf( "mB", mbPars, mbMin, mbMax );
+
+ fitModel->setBkgndPdf( bkgndNames[1], prbgMBPdf );
+
+ // Configure various fit options
+
+ // Do not calculate asymmetric errors.
+ fitModel->useAsymmFitErrors( kTRUE );
+
+ // Randomise initial fit values for the signal isobar parameters
+ fitModel->useRandomInitFitPars( kTRUE );
+
+ // Switch on/off Poissonian smearing of total number of events
+ fitModel->doPoissonSmearing( kTRUE );
+
+ // Switch on/off Extended ML Fit option
+ fitModel->doEMLFit( kTRUE );
+
+ // Switch on/off two-stage fitting for CPV parameters
+ fitModel->twoStageFit( kFALSE );
+
+ // Generate toy from the fitted parameters
+ //TString fitToyFileName("fitToyMC_NoDP_");
+ //fitToyFileName += iFit;
+ //fitToyFileName += ".root";
+ //fitModel->compareFitData(100, fitToyFileName);
+
+ // Write out per-event likelihoods and sWeights
+ //TString splotFileName("splot_NoDP_");
+ //splotFileName += iFit;
+ //splotFileName += ".root";
+ //fitModel->writeSPlotData(splotFileName, "splot", kFALSE);
+
+ TString dataFile( "gen-NoDP.root" );
+ TString treeName( "genResults" );
+ TString rootFileName( "" );
+ TString tableFileName( "" );
+ if ( command == "fit" ) {
+ rootFileName = "fitNoDP_";
+ rootFileName += iFit;
+ rootFileName += "_expt_";
+ rootFileName += firstExpt;
+ rootFileName += "-";
+ rootFileName += firstExpt + nExpt - 1;
+ rootFileName += ".root";
+ tableFileName = "fitNoDPResults_";
+ tableFileName += iFit;
+ } else {
+ rootFileName = "dummy.root";
+ tableFileName = "genNoDPResults";
+ }
+
+ // Execute the generation/fit
+ fitModel->run( command, dataFile, treeName, rootFileName, tableFileName );
+
+ return EXIT_SUCCESS;
}
diff --git a/examples/GenFitNoDPMultiDim.cc b/examples/GenFitNoDPMultiDim.cc
index d9d150a..67dad6d 100644
--- a/examples/GenFitNoDPMultiDim.cc
+++ b/examples/GenFitNoDPMultiDim.cc
@@ -1,267 +1,286 @@
/*
Copyright 2010 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
-#include <cstdlib>
-#include <iostream>
-#include <vector>
-
-#include "TFile.h"
-#include "TH2.h"
-#include "TString.h"
-
-#include "LauSimpleFitModel.hh"
#include "LauArgusPdf.hh"
#include "LauDaughters.hh"
#include "LauEffModel.hh"
#include "LauGaussPdf.hh"
#include "LauIsobarDynamics.hh"
#include "LauLinearPdf.hh"
#include "LauRealImagCoeffSet.hh"
+#include "LauSimpleFitModel.hh"
#include "LauSumPdf.hh"
#include "LauVetoes.hh"
+#include "TFile.h"
+#include "TH2.h"
+#include "TString.h"
+
+#include <cstdlib>
+#include <iostream>
+#include <vector>
+
void usage( std::ostream& out, const TString& progName )
{
- out<<"Usage:\n";
- out<<progName<<" gen [nExpt = 1] [firstExpt = 0]\n";
- out<<"or\n";
- out<<progName<<" fit <iFit> [nExpt = 1] [firstExpt = 0]"<<std::endl;
+ out << "Usage:\n";
+ out << progName << " gen [nExpt = 1] [firstExpt = 0]\n";
+ out << "or\n";
+ out << progName << " fit <iFit> [nExpt = 1] [firstExpt = 0]" << std::endl;
}
int main( int argc, char** argv )
{
- // Process command-line arguments
- // Usage:
- // ./GenFitNoDPMultiDim gen [nExpt = 1] [firstExpt = 0]
- // or
- // ./GenFitNoDPMultiDim fit <iFit> [nExpt = 1] [firstExpt = 0]
- if ( argc < 2 ) {
- usage( std::cerr, argv[0] );
- return EXIT_FAILURE;
- }
-
- TString command = argv[1];
- command.ToLower();
- Int_t iFit(0);
- Int_t nExpt(1);
- Int_t firstExpt(0);
- Bool_t isToy(kTRUE);
- if ( command == "gen" ) {
- if ( argc > 2 ) {
- nExpt = atoi( argv[2] );
- if ( argc > 3 ) {
- firstExpt = atoi( argv[3] );
- }
- }
- } else if ( command == "fit" ) {
- if ( argc < 3 ) {
- usage( std::cerr, argv[0] );
- return EXIT_FAILURE;
- }
- iFit = atoi( argv[2] );
- if ( argc > 3 ) {
- nExpt = atoi( argv[3] );
- if ( argc > 4 ) {
- firstExpt = atoi( argv[4] );
- }
- }
- } else {
- usage( std::cerr, argv[0] );
- return EXIT_FAILURE;
- }
-
- // Still need to define the DP, so just make one up!
- LauDaughters* daughters = new LauDaughters("B+", "K+", "pi+", "pi-");
-
- // Need a dummy vetoes object
- LauVetoes* vetoes = new LauVetoes();
-
- // Need a dummy efficiency object
- LauEffModel* effModel = new LauEffModel(daughters, vetoes);
-
- // Create the signal dynamics object and just give it a non-resonant component
- LauIsobarDynamics* sigModel = new LauIsobarDynamics(daughters, effModel);
- sigModel->setIntFileName("integ.dat");
- sigModel->addResonance("NonReson", 0, LauAbsResonance::FlatNR);
-
- // Create the fit model, passing it the signal dynamics model
- LauSimpleFitModel* fitModel = new LauSimpleFitModel(sigModel);
- fitModel->useDP(kFALSE);
-
- // Set isobar coefficients for the NR to be 1+0i (and fixed)
- LauAbsCoeffSet* coeffset = new LauRealImagCoeffSet("NonReson", 1.0, 0.0, kTRUE, kTRUE);
- fitModel->setAmpCoeffSet( coeffset );
-
- // Define the background categories
- std::vector<TString> bkgndClasses(1);
- bkgndClasses[0] = "qqbar";
- fitModel->setBkgndClassNames( bkgndClasses );
-
- // Signal and background yields
- const Double_t nSigEvents = 5000.0;
- const Bool_t fixNSigEvents = kFALSE;
- const Double_t nCombBgEvents = 7000.0;
- const Bool_t fixNCombBgEvents = kFALSE;
-
- // Set the number of signal and background events and the number of experiments
- LauParameter* nSig = new LauParameter("signalEvents",nSigEvents,-1.0*nSigEvents,2.0*nSigEvents,fixNSigEvents);
- LauParameter* nBkg = new LauParameter("qqbar",nCombBgEvents,-1.0*nCombBgEvents,2.0*nCombBgEvents,fixNCombBgEvents);
-
- fitModel->setNSigEvents(nSig);
- fitModel->setNBkgndEvents(nBkg);
- fitModel->setNExpts(nExpt, firstExpt, isToy);
-
-
- // Signal mES PDF parameter values
- Double_t sig_mes_mean1_value = 5.279;
- Double_t sig_mes_sigma1_value = 0.002;
- Double_t sig_mes_sigma2_value = 0.007;
- Double_t sig_mes_frac_value = 0.90;
-
- // mES PDFs
- Double_t mesMin = 5.260;
- Double_t mesMax = 5.286;
- std::vector<LauAbsRValue*> mesPars; mesPars.reserve(2);
-
- // Signal PDF is a double Gaussian with the means constrained to be the same
- LauParameter* sig_mes_mean1 = new LauParameter("sig_mes_mean1", sig_mes_mean1_value, 5.2, 5.3, kTRUE);
- LauParameter* sig_mes_sigma1 = new LauParameter("sig_mes_sigma1", sig_mes_sigma1_value, 0.0, 0.1, kTRUE);
- LauParameter* sig_mes_mean2 = sig_mes_mean1->createClone();
- LauParameter* sig_mes_sigma2 = new LauParameter("sig_mes_sigma2", sig_mes_sigma2_value, 0.0, 0.2, kTRUE);
- LauParameter* sig_mes_frac = new LauParameter("sig_mes_frac", sig_mes_frac_value, 0.0, 1.0, kTRUE);
-
- mesPars.clear();
- mesPars.push_back(sig_mes_mean1);
- mesPars.push_back(sig_mes_sigma1);
- LauAbsPdf* sigMESPdf1 = new LauGaussPdf("mES", mesPars, mesMin, mesMax);
-
- mesPars.clear();
- mesPars.push_back(sig_mes_mean2);
- mesPars.push_back(sig_mes_sigma2);
- LauAbsPdf* sigMESPdf2 = new LauGaussPdf("mES", mesPars, mesMin, mesMax);
-
- LauAbsPdf* sigMESPdf = new LauSumPdf(sigMESPdf1, sigMESPdf2, sig_mes_frac);
- fitModel->setSignalPdf(sigMESPdf);
-
- // Combinatoric background PDF is an ARGUS function
- LauParameter* comb_mes_m0 = new LauParameter("comb_mes_m0", 5.289);
- LauParameter* comb_mes_xi = new LauParameter("comb_mes_xi", 20.0, 0.0, 50.0, kTRUE);
-
- mesPars.clear();
- mesPars.push_back(comb_mes_m0);
- mesPars.push_back(comb_mes_xi);
- LauAbsPdf* combMESPdf = new LauArgusPdf("mES", mesPars, mesMin, mesMax);
-
- fitModel->setBkgndPdf( "qqbar", combMESPdf );
-
-
- // Signal DeltaE PDF parameter values
- Double_t sig_de_mean1_value = -0.005;
- Double_t sig_de_sigma1_value = 0.020;
- Double_t sig_de_sigma2_value = 0.050;
- Double_t sig_de_frac_value = 0.90;
-
- // DeltaE PDFs
- Double_t deMin = -0.2;
- Double_t deMax = 0.2;
- std::vector<LauAbsRValue*> dePars; dePars.reserve(2);
-
- // Signal PDF is a double Gaussian with the means constrained to be the same
- LauParameter* sig_de_mean1 = new LauParameter("sig_de_mean1", sig_de_mean1_value, -0.1, 0.1, kTRUE);
- LauParameter* sig_de_sigma1 = new LauParameter("sig_de_sigma1", sig_de_sigma1_value, 0.0, 0.2, kTRUE);
- LauParameter* sig_de_mean2 = sig_de_mean1->createClone();
- LauParameter* sig_de_sigma2 = new LauParameter("sig_de_sigma2", sig_de_sigma2_value, 0.0, 0.2, kTRUE);
- LauParameter* sig_de_frac = new LauParameter("sig_de_frac", sig_de_frac_value, 0.0, 1.0, kTRUE);
-
- dePars.clear();
- dePars.push_back(sig_de_mean1);
- dePars.push_back(sig_de_sigma1);
- LauAbsPdf* sigDEPdf1 = new LauGaussPdf("DeltaE", dePars, deMin, deMax);
-
- dePars.clear();
- dePars.push_back(sig_de_mean2);
- dePars.push_back(sig_de_sigma2);
- LauAbsPdf* sigDEPdf2 = new LauGaussPdf("DeltaE", dePars, deMin, deMax);
-
- LauAbsPdf* sigDEPdf = new LauSumPdf(sigDEPdf1, sigDEPdf2, sig_de_frac);
- fitModel->setSignalPdf(sigDEPdf);
-
- // Combinatoric background PDF is a linear function
- LauParameter* comb_de_slope = new LauParameter("comb_de_slope", -5.0, -10.0, 10.0, kTRUE);
-
- dePars.clear();
- dePars.push_back(comb_de_slope);
- LauAbsPdf* combDEPdf = new LauLinearPdf("DeltaE", dePars, deMin, deMax);
-
- fitModel->setBkgndPdf( "qqbar", combDEPdf );
-
-
- // Configure various fit options
-
- // Do not calculate asymmetric errors.
- fitModel->useAsymmFitErrors(kFALSE);
-
- // Randomise initial fit values for the signal isobar parameters
- fitModel->useRandomInitFitPars(kTRUE);
-
- // Switch on/off Poissonian smearing of total number of events
- fitModel->doPoissonSmearing(kTRUE);
-
- // Switch on/off Extended ML Fit option
- fitModel->doEMLFit(kTRUE);
-
- // Switch on/off two-stage fitting for CPV parameters
- fitModel->twoStageFit(kFALSE);
-
- // Generate toy from the fitted parameters
- //TString fitToyFileName("fitToyMC_NoDPMultiDim_");
- //fitToyFileName += iFit;
- //fitToyFileName += ".root";
- //fitModel->compareFitData(100, fitToyFileName);
-
- // Write out per-event likelihoods and sWeights
- //TString splotFileName("splot_NoDPMultiDim_");
- //splotFileName += iFit;
- //splotFileName += ".root";
- //fitModel->writeSPlotData(splotFileName, "splot", kFALSE);
-
- TString dataFile("gen-NoDPMultiDim.root");
- TString treeName("genResults");
- TString rootFileName("");
- TString tableFileName("");
- if (command == "fit") {
- rootFileName = "fitNoDPMultiDim_"; rootFileName += iFit;
- rootFileName += "_expt_"; rootFileName += firstExpt; rootFileName += "-"; rootFileName += firstExpt+nExpt-1;
- rootFileName += ".root";
- tableFileName = "fitNoDPMultiDimResults_"; tableFileName += iFit;
- } else {
- rootFileName = "dummy.root";
- tableFileName = "genNoDPMultiDimResults";
- }
-
- // Execute the generation/fit
- fitModel->run(command, dataFile, treeName, rootFileName, tableFileName);
-
- return EXIT_SUCCESS;
+ // Process command-line arguments
+ // Usage:
+ // ./GenFitNoDPMultiDim gen [nExpt = 1] [firstExpt = 0]
+ // or
+ // ./GenFitNoDPMultiDim fit <iFit> [nExpt = 1] [firstExpt = 0]
+ if ( argc < 2 ) {
+ usage( std::cerr, argv[0] );
+ return EXIT_FAILURE;
+ }
+
+ TString command = argv[1];
+ command.ToLower();
+ Int_t iFit( 0 );
+ Int_t nExpt( 1 );
+ Int_t firstExpt( 0 );
+ Bool_t isToy( kTRUE );
+ if ( command == "gen" ) {
+ if ( argc > 2 ) {
+ nExpt = atoi( argv[2] );
+ if ( argc > 3 ) {
+ firstExpt = atoi( argv[3] );
+ }
+ }
+ } else if ( command == "fit" ) {
+ if ( argc < 3 ) {
+ usage( std::cerr, argv[0] );
+ return EXIT_FAILURE;
+ }
+ iFit = atoi( argv[2] );
+ if ( argc > 3 ) {
+ nExpt = atoi( argv[3] );
+ if ( argc > 4 ) {
+ firstExpt = atoi( argv[4] );
+ }
+ }
+ } else {
+ usage( std::cerr, argv[0] );
+ return EXIT_FAILURE;
+ }
+
+ // Still need to define the DP, so just make one up!
+ LauDaughters* daughters = new LauDaughters( "B+", "K+", "pi+", "pi-" );
+
+ // Need a dummy vetoes object
+ LauVetoes* vetoes = new LauVetoes();
+
+ // Need a dummy efficiency object
+ LauEffModel* effModel = new LauEffModel( daughters, vetoes );
+
+ // Create the signal dynamics object and just give it a non-resonant component
+ LauIsobarDynamics* sigModel = new LauIsobarDynamics( daughters, effModel );
+ sigModel->setIntFileName( "integ.dat" );
+ sigModel->addResonance( "NonReson", 0, LauAbsResonance::FlatNR );
+
+ // Create the fit model, passing it the signal dynamics model
+ LauSimpleFitModel* fitModel = new LauSimpleFitModel( sigModel );
+ fitModel->useDP( kFALSE );
+
+ // Set isobar coefficients for the NR to be 1+0i (and fixed)
+ LauAbsCoeffSet* coeffset = new LauRealImagCoeffSet( "NonReson", 1.0, 0.0, kTRUE, kTRUE );
+ fitModel->setAmpCoeffSet( coeffset );
+
+ // Define the background categories
+ std::vector<TString> bkgndClasses( 1 );
+ bkgndClasses[0] = "qqbar";
+ fitModel->setBkgndClassNames( bkgndClasses );
+
+ // Signal and background yields
+ const Double_t nSigEvents = 5000.0;
+ const Bool_t fixNSigEvents = kFALSE;
+ const Double_t nCombBgEvents = 7000.0;
+ const Bool_t fixNCombBgEvents = kFALSE;
+
+ // Set the number of signal and background events and the number of experiments
+ LauParameter* nSig = new LauParameter( "signalEvents",
+ nSigEvents,
+ -1.0 * nSigEvents,
+ 2.0 * nSigEvents,
+ fixNSigEvents );
+ LauParameter* nBkg = new LauParameter( "qqbar",
+ nCombBgEvents,
+ -1.0 * nCombBgEvents,
+ 2.0 * nCombBgEvents,
+ fixNCombBgEvents );
+
+ fitModel->setNSigEvents( nSig );
+ fitModel->setNBkgndEvents( nBkg );
+ fitModel->setNExpts( nExpt, firstExpt, isToy );
+
+ // Signal mES PDF parameter values
+ Double_t sig_mes_mean1_value = 5.279;
+ Double_t sig_mes_sigma1_value = 0.002;
+ Double_t sig_mes_sigma2_value = 0.007;
+ Double_t sig_mes_frac_value = 0.90;
+
+ // mES PDFs
+ Double_t mesMin = 5.260;
+ Double_t mesMax = 5.286;
+ std::vector<LauAbsRValue*> mesPars;
+ mesPars.reserve( 2 );
+
+ // Signal PDF is a double Gaussian with the means constrained to be the same
+ LauParameter* sig_mes_mean1 =
+ new LauParameter( "sig_mes_mean1", sig_mes_mean1_value, 5.2, 5.3, kTRUE );
+ LauParameter* sig_mes_sigma1 =
+ new LauParameter( "sig_mes_sigma1", sig_mes_sigma1_value, 0.0, 0.1, kTRUE );
+ LauParameter* sig_mes_mean2 = sig_mes_mean1->createClone();
+ LauParameter* sig_mes_sigma2 =
+ new LauParameter( "sig_mes_sigma2", sig_mes_sigma2_value, 0.0, 0.2, kTRUE );
+ LauParameter* sig_mes_frac =
+ new LauParameter( "sig_mes_frac", sig_mes_frac_value, 0.0, 1.0, kTRUE );
+
+ mesPars.clear();
+ mesPars.push_back( sig_mes_mean1 );
+ mesPars.push_back( sig_mes_sigma1 );
+ LauAbsPdf* sigMESPdf1 = new LauGaussPdf( "mES", mesPars, mesMin, mesMax );
+
+ mesPars.clear();
+ mesPars.push_back( sig_mes_mean2 );
+ mesPars.push_back( sig_mes_sigma2 );
+ LauAbsPdf* sigMESPdf2 = new LauGaussPdf( "mES", mesPars, mesMin, mesMax );
+
+ LauAbsPdf* sigMESPdf = new LauSumPdf( sigMESPdf1, sigMESPdf2, sig_mes_frac );
+ fitModel->setSignalPdf( sigMESPdf );
+
+ // Combinatoric background PDF is an ARGUS function
+ LauParameter* comb_mes_m0 = new LauParameter( "comb_mes_m0", 5.289 );
+ LauParameter* comb_mes_xi = new LauParameter( "comb_mes_xi", 20.0, 0.0, 50.0, kTRUE );
+
+ mesPars.clear();
+ mesPars.push_back( comb_mes_m0 );
+ mesPars.push_back( comb_mes_xi );
+ LauAbsPdf* combMESPdf = new LauArgusPdf( "mES", mesPars, mesMin, mesMax );
+
+ fitModel->setBkgndPdf( "qqbar", combMESPdf );
+
+ // Signal DeltaE PDF parameter values
+ Double_t sig_de_mean1_value = -0.005;
+ Double_t sig_de_sigma1_value = 0.020;
+ Double_t sig_de_sigma2_value = 0.050;
+ Double_t sig_de_frac_value = 0.90;
+
+ // DeltaE PDFs
+ Double_t deMin = -0.2;
+ Double_t deMax = 0.2;
+ std::vector<LauAbsRValue*> dePars;
+ dePars.reserve( 2 );
+
+ // Signal PDF is a double Gaussian with the means constrained to be the same
+ LauParameter* sig_de_mean1 =
+ new LauParameter( "sig_de_mean1", sig_de_mean1_value, -0.1, 0.1, kTRUE );
+ LauParameter* sig_de_sigma1 =
+ new LauParameter( "sig_de_sigma1", sig_de_sigma1_value, 0.0, 0.2, kTRUE );
+ LauParameter* sig_de_mean2 = sig_de_mean1->createClone();
+ LauParameter* sig_de_sigma2 =
+ new LauParameter( "sig_de_sigma2", sig_de_sigma2_value, 0.0, 0.2, kTRUE );
+ LauParameter* sig_de_frac = new LauParameter( "sig_de_frac", sig_de_frac_value, 0.0, 1.0, kTRUE );
+
+ dePars.clear();
+ dePars.push_back( sig_de_mean1 );
+ dePars.push_back( sig_de_sigma1 );
+ LauAbsPdf* sigDEPdf1 = new LauGaussPdf( "DeltaE", dePars, deMin, deMax );
+
+ dePars.clear();
+ dePars.push_back( sig_de_mean2 );
+ dePars.push_back( sig_de_sigma2 );
+ LauAbsPdf* sigDEPdf2 = new LauGaussPdf( "DeltaE", dePars, deMin, deMax );
+
+ LauAbsPdf* sigDEPdf = new LauSumPdf( sigDEPdf1, sigDEPdf2, sig_de_frac );
+ fitModel->setSignalPdf( sigDEPdf );
+
+ // Combinatoric background PDF is a linear function
+ LauParameter* comb_de_slope = new LauParameter( "comb_de_slope", -5.0, -10.0, 10.0, kTRUE );
+
+ dePars.clear();
+ dePars.push_back( comb_de_slope );
+ LauAbsPdf* combDEPdf = new LauLinearPdf( "DeltaE", dePars, deMin, deMax );
+
+ fitModel->setBkgndPdf( "qqbar", combDEPdf );
+
+ // Configure various fit options
+
+ // Do not calculate asymmetric errors.
+ fitModel->useAsymmFitErrors( kFALSE );
+
+ // Randomise initial fit values for the signal isobar parameters
+ fitModel->useRandomInitFitPars( kTRUE );
+
+ // Switch on/off Poissonian smearing of total number of events
+ fitModel->doPoissonSmearing( kTRUE );
+
+ // Switch on/off Extended ML Fit option
+ fitModel->doEMLFit( kTRUE );
+
+ // Switch on/off two-stage fitting for CPV parameters
+ fitModel->twoStageFit( kFALSE );
+
+ // Generate toy from the fitted parameters
+ //TString fitToyFileName("fitToyMC_NoDPMultiDim_");
+ //fitToyFileName += iFit;
+ //fitToyFileName += ".root";
+ //fitModel->compareFitData(100, fitToyFileName);
+
+ // Write out per-event likelihoods and sWeights
+ //TString splotFileName("splot_NoDPMultiDim_");
+ //splotFileName += iFit;
+ //splotFileName += ".root";
+ //fitModel->writeSPlotData(splotFileName, "splot", kFALSE);
+
+ TString dataFile( "gen-NoDPMultiDim.root" );
+ TString treeName( "genResults" );
+ TString rootFileName( "" );
+ TString tableFileName( "" );
+ if ( command == "fit" ) {
+ rootFileName = "fitNoDPMultiDim_";
+ rootFileName += iFit;
+ rootFileName += "_expt_";
+ rootFileName += firstExpt;
+ rootFileName += "-";
+ rootFileName += firstExpt + nExpt - 1;
+ rootFileName += ".root";
+ tableFileName = "fitNoDPMultiDimResults_";
+ tableFileName += iFit;
+ } else {
+ rootFileName = "dummy.root";
+ tableFileName = "genNoDPMultiDimResults";
+ }
+
+ // Execute the generation/fit
+ fitModel->run( command, dataFile, treeName, rootFileName, tableFileName );
+
+ return EXIT_SUCCESS;
}
diff --git a/examples/KMatrixDto3pi.cc b/examples/KMatrixDto3pi.cc
index 0c5b0cc..00a59ba 100644
--- a/examples/KMatrixDto3pi.cc
+++ b/examples/KMatrixDto3pi.cc
@@ -1,184 +1,206 @@
/*
Copyright 2008 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
#include <iostream>
-using std::cout;
using std::cerr;
+using std::cout;
using std::endl;
-#include <vector>
-#include <map>
-
-#include "LauDaughters.hh"
-#include "LauVetoes.hh"
-#include "LauIsobarDynamics.hh"
-#include "LauSimpleFitModel.hh"
#include "LauAbsCoeffSet.hh"
#include "LauCartesianCPCoeffSet.hh"
+#include "LauDaughters.hh"
#include "LauEffModel.hh"
+#include "LauIsobarDynamics.hh"
+#include "LauSimpleFitModel.hh"
+#include "LauVetoes.hh"
#include "TString.h"
+#include <map>
+#include <vector>
+
void usage( std::ostream& out, const TString& progName )
{
- out<<"Usage:\n";
- out<<progName<<" gen [nExpt = 1] [firstExpt = 0]\n";
- out<<"or\n";
- out<<progName<<" fit <iFit> [nExpt = 1] [firstExpt = 0]"<<std::endl;
+ out << "Usage:\n";
+ out << progName << " gen [nExpt = 1] [firstExpt = 0]\n";
+ out << "or\n";
+ out << progName << " fit <iFit> [nExpt = 1] [firstExpt = 0]" << std::endl;
}
-int main(const int argc, const char ** argv) {
-
- // Process command-line arguments
- // Usage:
- // ./KMatrixDto3pi gen [nExpt = 1] [firstExpt = 0]
- // or
- // ./KMatrixDto3pi fit <iFit> [nExpt = 1] [firstExpt = 0]
- if ( argc < 2 ) {
- usage( std::cerr, argv[0] );
- return EXIT_FAILURE;
- }
-
- TString command = argv[1];
- command.ToLower();
- Int_t iFit(0);
- Int_t nExpt(1);
- Int_t firstExpt(0);
- Bool_t isToy(kTRUE);
- if ( command == "gen" ) {
- if ( argc > 2 ) {
- nExpt = atoi( argv[2] );
- if ( argc > 3 ) {
- firstExpt = atoi( argv[3] );
- }
- }
- } else if ( command == "fit" ) {
- if ( argc < 3 ) {
- usage( std::cerr, argv[0] );
- return EXIT_FAILURE;
- }
- iFit = atoi( argv[2] );
- if ( argc > 3 ) {
- nExpt = atoi( argv[3] );
- if ( argc > 4 ) {
- firstExpt = atoi( argv[4] );
- }
- }
- } else {
- usage( std::cerr, argv[0] );
- return EXIT_FAILURE;
- }
-
- // Generate K-matrix amplitude distribution across the DP
- LauDaughters* daughters = new LauDaughters("D+", "pi+", "pi+", "pi-", kFALSE);
- LauVetoes* vetoes = new LauVetoes();
- LauEffModel* effModel = new LauEffModel(daughters, vetoes);
-
- LauIsobarDynamics* sigModel = new LauIsobarDynamics(daughters, effModel);
-
- // Define the "S-wave" K-matrix propagator
- Int_t nChannels = 5;
- Int_t nPoles = 5;
- Int_t resPairInt = 1;
- Int_t KMatrixIndex = 1; // for S-wave
- sigModel->defineKMatrixPropagator("KMSWave", "FOCUSD3pi.dat", resPairInt, nChannels, nPoles, KMatrixIndex);
- // Now define the pole and "slowly-varying part" (SVP) amplitudes for the K-matrix.
- // Each part will have their own complex coefficients which can (should) be fitted.
- sigModel->addKMatrixProdPole("KMPole1", "KMSWave", 1);
- sigModel->addKMatrixProdPole("KMPole2", "KMSWave", 2);
- sigModel->addKMatrixProdPole("KMPole3", "KMSWave", 3);
- //sigModel->addKMatrixProdPole("KMPole4", "KMSWave", 4);
- //sigModel->addKMatrixProdPole("KMPole5", "KMSWave", 5);
-
- sigModel->addKMatrixProdSVP("KMSVP1", "KMSWave", 1);
- sigModel->addKMatrixProdSVP("KMSVP2", "KMSWave", 2);
- //sigModel->addKMatrixProdSVP("KMSVP3", "KMSWave", 3);
- //sigModel->addKMatrixProdSVP("KMSVP4", "KMSWave", 4);
- //sigModel->addKMatrixProdSVP("KMSVP5", "KMSWave", 5);
-
- sigModel->addResonance("rho0(770)", 1, LauAbsResonance::RelBW);
- sigModel->addResonance("f_2(1270)", 1, LauAbsResonance::RelBW);
-
- sigModel->setASqMaxValue(2.1);
-
- LauSimpleFitModel* fitModel = new LauSimpleFitModel(sigModel);
-
- std::vector<LauAbsCoeffSet*> coeffset;
-
- coeffset.push_back(new LauCartesianCPCoeffSet("KMPole1", 0.85, -0.55, 0.0, 0.0, kFALSE, kFALSE, kTRUE, kTRUE));
- coeffset.push_back(new LauCartesianCPCoeffSet("KMPole2", -1.10, -0.30, 0.0, 0.0, kFALSE, kFALSE, kTRUE, kTRUE));
- coeffset.push_back(new LauCartesianCPCoeffSet("KMPole3", -0.84, 0.35, 0.0, 0.0, kFALSE, kFALSE, kTRUE, kTRUE));
- //coeffset.push_back(new LauCartesianCPCoeffSet("KMPole4", -0.004, .46, 0.0, 0.0, kFALSE, kFALSE, kTRUE, kTRUE));
- //coeffset.push_back(new LauCartesianCPCoeffSet("KMPole5", 0.00, 0.00, 0.0, 0.0, kFALSE, kFALSE, kTRUE, kTRUE));
-
- coeffset.push_back(new LauCartesianCPCoeffSet("KMSVP1", 0.230, 0.352, 0.0, 0.0, kFALSE, kFALSE, kTRUE, kTRUE));
- coeffset.push_back(new LauCartesianCPCoeffSet("KMSVP2", 0.330, 0.42, 0.0, 0.0, kFALSE, kFALSE, kTRUE, kTRUE));
- //coeffset.push_back(new LauCartesianCPCoeffSet("KMSVP3", -0.48, 1.25, 0.0, 0.0, kFALSE, kFALSE, kTRUE, kTRUE));
- //coeffset.push_back(new LauCartesianCPCoeffSet("KMSVP4", 0.30, 1.32, 0.0, 0.0, kFALSE, kFALSE, kTRUE, kTRUE));
- //coeffset.push_back(new LauCartesianCPCoeffSet("KMSVP5", 0.00, 0.00, 0.0, 0.0, kFALSE, kFALSE, kTRUE, kTRUE));
-
- coeffset.push_back(new LauCartesianCPCoeffSet("rho0(770)", 1.0, 0.00, 0.0, 0.0, kTRUE, kTRUE, kTRUE, kTRUE));
- coeffset.push_back(new LauCartesianCPCoeffSet("f_2(1270)", 0.45, 0.35, 0.0, 0.0, kFALSE, kFALSE, kTRUE, kTRUE));
-
- for (std::vector<LauAbsCoeffSet*>::iterator iter=coeffset.begin(); iter!=coeffset.end(); ++iter) {
- fitModel->setAmpCoeffSet(*iter);
- }
-
- Double_t nSigEvents = 20000;
- Bool_t fixSigEvents = kTRUE;
- LauParameter * nSig = new LauParameter("signalEvents",nSigEvents,-2.0*nSigEvents,2.0*nSigEvents,fixSigEvents);
- fitModel->setNSigEvents(nSig);
- fitModel->setNExpts(nExpt, firstExpt, isToy);
-
- // Do not calculate asymmetric errors
- fitModel->useAsymmFitErrors(kFALSE);
-
- // Randomise initial fit values for the signal mode
- fitModel->useRandomInitFitPars(kTRUE);
-
- // Switch off Poissonian smearing of total number of events
- fitModel->doPoissonSmearing(kFALSE);
-
- // Switch on Extended ML Fit option - only really use if Poisson smearing is also enabled
- fitModel->doEMLFit(kFALSE);
-
- // Set the names of the files to read/write
- TString dataFile("gen-KMatrixDto3pi.root");
- TString treeName("genResults");
- TString rootFileName("");
- TString tableFileName("");
- if (command == "fit") {
- rootFileName = "fitKMatrixDto3pi_"; rootFileName += iFit;
- rootFileName += "_expt_"; rootFileName += firstExpt;
- rootFileName += "-"; rootFileName += (firstExpt+nExpt-1);
- rootFileName += ".root";
- tableFileName = "fitKMatrixDto3piResults_"; tableFileName += iFit;
- } else {
- rootFileName = "dummy.root";
- tableFileName = "genKMatrixDto3piResults";
- }
-
- // Execute the generation/fit
- fitModel->run( command, dataFile, treeName, rootFileName, tableFileName );
+int main( const int argc, const char** argv )
+{
+
+ // Process command-line arguments
+ // Usage:
+ // ./KMatrixDto3pi gen [nExpt = 1] [firstExpt = 0]
+ // or
+ // ./KMatrixDto3pi fit <iFit> [nExpt = 1] [firstExpt = 0]
+ if ( argc < 2 ) {
+ usage( std::cerr, argv[0] );
+ return EXIT_FAILURE;
+ }
+
+ TString command = argv[1];
+ command.ToLower();
+ Int_t iFit( 0 );
+ Int_t nExpt( 1 );
+ Int_t firstExpt( 0 );
+ Bool_t isToy( kTRUE );
+ if ( command == "gen" ) {
+ if ( argc > 2 ) {
+ nExpt = atoi( argv[2] );
+ if ( argc > 3 ) {
+ firstExpt = atoi( argv[3] );
+ }
+ }
+ } else if ( command == "fit" ) {
+ if ( argc < 3 ) {
+ usage( std::cerr, argv[0] );
+ return EXIT_FAILURE;
+ }
+ iFit = atoi( argv[2] );
+ if ( argc > 3 ) {
+ nExpt = atoi( argv[3] );
+ if ( argc > 4 ) {
+ firstExpt = atoi( argv[4] );
+ }
+ }
+ } else {
+ usage( std::cerr, argv[0] );
+ return EXIT_FAILURE;
+ }
+
+ // Generate K-matrix amplitude distribution across the DP
+ LauDaughters* daughters = new LauDaughters( "D+", "pi+", "pi+", "pi-", kFALSE );
+ LauVetoes* vetoes = new LauVetoes();
+ LauEffModel* effModel = new LauEffModel( daughters, vetoes );
+
+ LauIsobarDynamics* sigModel = new LauIsobarDynamics( daughters, effModel );
+
+ // Define the "S-wave" K-matrix propagator
+ Int_t nChannels = 5;
+ Int_t nPoles = 5;
+ Int_t resPairInt = 1;
+ Int_t KMatrixIndex = 1; // for S-wave
+ sigModel->defineKMatrixPropagator( "KMSWave",
+ "FOCUSD3pi.dat",
+ resPairInt,
+ nChannels,
+ nPoles,
+ KMatrixIndex );
+ // Now define the pole and "slowly-varying part" (SVP) amplitudes for the K-matrix.
+ // Each part will have their own complex coefficients which can (should) be fitted.
+ sigModel->addKMatrixProdPole( "KMPole1", "KMSWave", 1 );
+ sigModel->addKMatrixProdPole( "KMPole2", "KMSWave", 2 );
+ sigModel->addKMatrixProdPole( "KMPole3", "KMSWave", 3 );
+ //sigModel->addKMatrixProdPole("KMPole4", "KMSWave", 4);
+ //sigModel->addKMatrixProdPole("KMPole5", "KMSWave", 5);
+
+ sigModel->addKMatrixProdSVP( "KMSVP1", "KMSWave", 1 );
+ sigModel->addKMatrixProdSVP( "KMSVP2", "KMSWave", 2 );
+ //sigModel->addKMatrixProdSVP("KMSVP3", "KMSWave", 3);
+ //sigModel->addKMatrixProdSVP("KMSVP4", "KMSWave", 4);
+ //sigModel->addKMatrixProdSVP("KMSVP5", "KMSWave", 5);
+
+ sigModel->addResonance( "rho0(770)", 1, LauAbsResonance::RelBW );
+ sigModel->addResonance( "f_2(1270)", 1, LauAbsResonance::RelBW );
+
+ sigModel->setASqMaxValue( 2.1 );
+
+ LauSimpleFitModel* fitModel = new LauSimpleFitModel( sigModel );
+
+ std::vector<LauAbsCoeffSet*> coeffset;
+
+ coeffset.push_back(
+ new LauCartesianCPCoeffSet( "KMPole1", 0.85, -0.55, 0.0, 0.0, kFALSE, kFALSE, kTRUE, kTRUE ) );
+ coeffset.push_back(
+ new LauCartesianCPCoeffSet( "KMPole2", -1.10, -0.30, 0.0, 0.0, kFALSE, kFALSE, kTRUE, kTRUE ) );
+ coeffset.push_back(
+ new LauCartesianCPCoeffSet( "KMPole3", -0.84, 0.35, 0.0, 0.0, kFALSE, kFALSE, kTRUE, kTRUE ) );
+ //coeffset.push_back(new LauCartesianCPCoeffSet("KMPole4", -0.004, .46, 0.0, 0.0, kFALSE, kFALSE, kTRUE, kTRUE));
+ //coeffset.push_back(new LauCartesianCPCoeffSet("KMPole5", 0.00, 0.00, 0.0, 0.0, kFALSE, kFALSE, kTRUE, kTRUE));
+
+ coeffset.push_back(
+ new LauCartesianCPCoeffSet( "KMSVP1", 0.230, 0.352, 0.0, 0.0, kFALSE, kFALSE, kTRUE, kTRUE ) );
+ coeffset.push_back(
+ new LauCartesianCPCoeffSet( "KMSVP2", 0.330, 0.42, 0.0, 0.0, kFALSE, kFALSE, kTRUE, kTRUE ) );
+ //coeffset.push_back(new LauCartesianCPCoeffSet("KMSVP3", -0.48, 1.25, 0.0, 0.0, kFALSE, kFALSE, kTRUE, kTRUE));
+ //coeffset.push_back(new LauCartesianCPCoeffSet("KMSVP4", 0.30, 1.32, 0.0, 0.0, kFALSE, kFALSE, kTRUE, kTRUE));
+ //coeffset.push_back(new LauCartesianCPCoeffSet("KMSVP5", 0.00, 0.00, 0.0, 0.0, kFALSE, kFALSE, kTRUE, kTRUE));
+
+ coeffset.push_back(
+ new LauCartesianCPCoeffSet( "rho0(770)", 1.0, 0.00, 0.0, 0.0, kTRUE, kTRUE, kTRUE, kTRUE ) );
+ coeffset.push_back(
+ new LauCartesianCPCoeffSet( "f_2(1270)", 0.45, 0.35, 0.0, 0.0, kFALSE, kFALSE, kTRUE, kTRUE ) );
+
+ for ( std::vector<LauAbsCoeffSet*>::iterator iter = coeffset.begin(); iter != coeffset.end();
+ ++iter ) {
+ fitModel->setAmpCoeffSet( *iter );
+ }
+
+ Double_t nSigEvents = 20000;
+ Bool_t fixSigEvents = kTRUE;
+ LauParameter* nSig = new LauParameter( "signalEvents",
+ nSigEvents,
+ -2.0 * nSigEvents,
+ 2.0 * nSigEvents,
+ fixSigEvents );
+ fitModel->setNSigEvents( nSig );
+ fitModel->setNExpts( nExpt, firstExpt, isToy );
+
+ // Do not calculate asymmetric errors
+ fitModel->useAsymmFitErrors( kFALSE );
+
+ // Randomise initial fit values for the signal mode
+ fitModel->useRandomInitFitPars( kTRUE );
+
+ // Switch off Poissonian smearing of total number of events
+ fitModel->doPoissonSmearing( kFALSE );
+
+ // Switch on Extended ML Fit option - only really use if Poisson smearing is also enabled
+ fitModel->doEMLFit( kFALSE );
+
+ // Set the names of the files to read/write
+ TString dataFile( "gen-KMatrixDto3pi.root" );
+ TString treeName( "genResults" );
+ TString rootFileName( "" );
+ TString tableFileName( "" );
+ if ( command == "fit" ) {
+ rootFileName = "fitKMatrixDto3pi_";
+ rootFileName += iFit;
+ rootFileName += "_expt_";
+ rootFileName += firstExpt;
+ rootFileName += "-";
+ rootFileName += ( firstExpt + nExpt - 1 );
+ rootFileName += ".root";
+ tableFileName = "fitKMatrixDto3piResults_";
+ tableFileName += iFit;
+ } else {
+ rootFileName = "dummy.root";
+ tableFileName = "genKMatrixDto3piResults";
+ }
+
+ // Execute the generation/fit
+ fitModel->run( command, dataFile, treeName, rootFileName, tableFileName );
}
diff --git a/examples/KMatrixExample.cc b/examples/KMatrixExample.cc
index 434edb7..e8e40f3 100644
--- a/examples/KMatrixExample.cc
+++ b/examples/KMatrixExample.cc
@@ -1,220 +1,233 @@
/*
Copyright 2008 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
#include <iostream>
-using std::cout;
using std::cerr;
+using std::cout;
using std::endl;
-#include <vector>
-#include <map>
-
+#include "LauAbsCoeffSet.hh"
#include "LauDaughters.hh"
-#include "LauVetoes.hh"
#include "LauEffModel.hh"
#include "LauIsobarDynamics.hh"
-#include "LauSimpleFitModel.hh"
-#include "LauAbsCoeffSet.hh"
#include "LauRealImagCoeffSet.hh"
+#include "LauSimpleFitModel.hh"
+#include "LauVetoes.hh"
#include "TString.h"
+#include <map>
+#include <vector>
+
void usage( std::ostream& out, const TString& progName )
{
- out<<"Usage:\n";
- out<<progName<<" gen [nExpt = 1] [firstExpt = 0]\n";
- out<<"or\n";
- out<<progName<<" fit <iFit> [nExpt = 1] [firstExpt = 0]"<<std::endl;
+ out << "Usage:\n";
+ out << progName << " gen [nExpt = 1] [firstExpt = 0]\n";
+ out << "or\n";
+ out << progName << " fit <iFit> [nExpt = 1] [firstExpt = 0]" << std::endl;
}
int main( int argc, char** argv )
{
- // Process command-line arguments
- // Usage:
- // ./KMatrixExample gen [nExpt = 1] [firstExpt = 0]
- // or
- // ./KMatrixExample fit <iFit> [nExpt = 1] [firstExpt = 0]
- if ( argc < 2 ) {
- usage( std::cerr, argv[0] );
- return EXIT_FAILURE;
- }
-
- TString command = argv[1];
- command.ToLower();
- Int_t iFit(0);
- Int_t nExpt(1);
- Int_t firstExpt(0);
- Bool_t isToy(kTRUE);
- if ( command == "gen" ) {
- if ( argc > 2 ) {
- nExpt = atoi( argv[2] );
- if ( argc > 3 ) {
- firstExpt = atoi( argv[3] );
- }
- }
- } else if ( command == "fit" ) {
- if ( argc < 3 ) {
- usage( std::cerr, argv[0] );
- return EXIT_FAILURE;
- }
- iFit = atoi( argv[2] );
- if ( argc > 3 ) {
- nExpt = atoi( argv[3] );
- if ( argc > 4 ) {
- firstExpt = atoi( argv[4] );
- }
- }
- } else {
- usage( std::cerr, argv[0] );
- return EXIT_FAILURE;
- }
-
- // If you want to use square DP histograms for efficiency,
- // backgrounds or you just want the square DP co-ordinates
- // stored in the toy MC ntuple then set this to kTRUE
- Bool_t squareDP = kFALSE;
-
- // This defines the DP => decay is B0 -> pi+ pi- K_S0
- // Particle 1 = pi+
- // Particle 2 = pi-
- // Particle 3 = K_S0
- // The DP is defined in terms of m13Sq and m23Sq
- LauDaughters* daughters = new LauDaughters("B0", "pi+", "pi-", "K_S0", squareDP);
-
- LauVetoes* vetoes = new LauVetoes();
- LauEffModel* effModel = new LauEffModel(daughters, vetoes);
-
- LauIsobarDynamics* sigModel = new LauIsobarDynamics(daughters, effModel);
-
- // Add relativistic BWs for the rho and K* resonances
- sigModel->addResonance("rho0(770)", 3, LauAbsResonance::RelBW);
- sigModel->addResonance("K*+(892)", 2, LauAbsResonance::RelBW);
- sigModel->addResonance("K*+_2(1430)", 2, LauAbsResonance::RelBW);
-
- // Define the pi+ pi- "S-wave" K-matrix propagator
- // The defineKMatrixPropagator requires four arguments
- // name of propagator, parameter file, mass pair index (1,2,3) for "s" variable, number of channels, number of
- // mass poles and the row index defining the K-matrix state (e.g. index = 1 for the first row -> S-wave).
- Int_t resPairInt = 3;
- Int_t nChannels = 5;
- Int_t nPoles = 5;
- Int_t KMatrixIndex = 1;
- sigModel->defineKMatrixPropagator("KM_pipi", "LauKMatrixCoeff.dat", resPairInt, nChannels, nPoles, KMatrixIndex);
-
- // Now define the pole and "slowly-varying part" (SVP) amplitudes for this K-matrix.
- // Each part will have their own complex coefficients which can (should) be fitted.
- // The addKMatrixProd functions need: name of pole/SVP, name of propagator and the index
- // number of the amplitude (from 1 to nPoles or nChannels)
- sigModel->addKMatrixProdPole("KM_pipi_Pole1", "KM_pipi", 1);
- sigModel->addKMatrixProdPole("KM_pipi_Pole2", "KM_pipi", 2);
- sigModel->addKMatrixProdPole("KM_pipi_Pole3", "KM_pipi", 3);
- sigModel->addKMatrixProdPole("KM_pipi_Pole4", "KM_pipi", 4);
- sigModel->addKMatrixProdPole("KM_pipi_Pole5", "KM_pipi", 5);
-
- sigModel->addKMatrixProdSVP("KM_pipi_SVP1", "KM_pipi", 1);
- sigModel->addKMatrixProdSVP("KM_pipi_SVP2", "KM_pipi", 2);
- sigModel->addKMatrixProdSVP("KM_pipi_SVP3", "KM_pipi", 3);
-
- sigModel->setASqMaxValue(3.1);
-
- LauSimpleFitModel* fitModel = new LauSimpleFitModel(sigModel);
-
- std::vector<LauAbsCoeffSet*> coeffset;
-
- // Define the coefficients for the P-wave rho and K* resonances
- coeffset.push_back(new LauRealImagCoeffSet("rho0(770)", 1.00, 0.00, kTRUE, kTRUE));
- coeffset.push_back(new LauRealImagCoeffSet("K*+(892)", 0.97, -1.10, kFALSE, kFALSE));
- coeffset.push_back(new LauRealImagCoeffSet("K*+_2(1430)", 0.38, -0.54, kFALSE, kFALSE));
-
- // Define the coefficients for the K-matrix amplitudes defined above ("beta" and "f" production coeffs)
- coeffset.push_back(new LauRealImagCoeffSet("KM_pipi_Pole1", -0.18, -0.91, kFALSE, kFALSE));
- coeffset.push_back(new LauRealImagCoeffSet("KM_pipi_Pole2", -1.02, -0.38, kFALSE, kFALSE));
- coeffset.push_back(new LauRealImagCoeffSet("KM_pipi_Pole3", -0.37, 0.50, kFALSE, kFALSE));
- coeffset.push_back(new LauRealImagCoeffSet("KM_pipi_Pole4", -0.01, 0.92, kFALSE, kFALSE));
- coeffset.push_back(new LauRealImagCoeffSet("KM_pipi_Pole5", 0.01, -0.05, kFALSE, kFALSE));
-
- coeffset.push_back(new LauRealImagCoeffSet("KM_pipi_SVP1", 0.22, 0.76, kFALSE, kFALSE));
- coeffset.push_back(new LauRealImagCoeffSet("KM_pipi_SVP2", 0.89, -0.31, kFALSE, kFALSE));
- coeffset.push_back(new LauRealImagCoeffSet("KM_pipi_SVP3", -0.97, 0.93, kFALSE, kFALSE));
-
- for (std::vector<LauAbsCoeffSet*>::iterator iter=coeffset.begin(); iter!=coeffset.end(); ++iter) {
- fitModel->setAmpCoeffSet(*iter);
- }
-
- Double_t nSigEvents = 5000;
- Bool_t fixSigEvents = kTRUE;
- LauParameter* nSig = new LauParameter("signalEvents",nSigEvents,-1.0*nSigEvents,2.0*nSigEvents,fixSigEvents);
- fitModel->setNSigEvents(nSig);
- fitModel->setNExpts(nExpt, firstExpt, isToy);
-
-
- // Configure various fit options
-
- // Switch on/off calculation of asymmetric errors.
- fitModel->useAsymmFitErrors(kFALSE);
-
- // Randomise initial fit values for the signal mode
- fitModel->useRandomInitFitPars(kTRUE);
-
- const Bool_t haveBkgnds = ( fitModel->nBkgndClasses() > 0 );
-
- // Switch on/off Poissonian smearing of total number of events
- fitModel->doPoissonSmearing(haveBkgnds);
-
- // Switch on/off Extended ML Fit option
- fitModel->doEMLFit(haveBkgnds);
-
- // Generate toy from the fitted parameters
- //TString fitToyFileName("fitToyMC_KMatrixExample_");
- //fitToyFileName += iFit;
- //fitToyFileName += ".root";
- //fitModel->compareFitData(100, fitToyFileName);
-
- // Write out per-event likelihoods and sWeights
- //TString splotFileName("splot_KMatrixExample_");
- //splotFileName += iFit;
- //splotFileName += ".root";
- //fitModel->writeSPlotData(splotFileName, "splot", kFALSE);
-
- // Set the names of the files to read/write
- TString dataFile("gen-KMatrixExample.root");
- TString treeName("genResults");
- TString rootFileName("");
- TString tableFileName("");
- if (command == "fit") {
- rootFileName = "fitKMatrixExample_"; rootFileName += iFit;
- rootFileName += "_expt_"; rootFileName += firstExpt;
- rootFileName += "-"; rootFileName += (firstExpt+nExpt-1);
- rootFileName += ".root";
- tableFileName = "fitKMatrixExampleResults_"; tableFileName += iFit;
- } else {
- rootFileName = "dummy.root";
- tableFileName = "genKMatrixExampleResults";
- }
-
- // Execute the generation/fit
- fitModel->run( command, dataFile, treeName, rootFileName, tableFileName );
-
- return EXIT_SUCCESS;
+ // Process command-line arguments
+ // Usage:
+ // ./KMatrixExample gen [nExpt = 1] [firstExpt = 0]
+ // or
+ // ./KMatrixExample fit <iFit> [nExpt = 1] [firstExpt = 0]
+ if ( argc < 2 ) {
+ usage( std::cerr, argv[0] );
+ return EXIT_FAILURE;
+ }
+
+ TString command = argv[1];
+ command.ToLower();
+ Int_t iFit( 0 );
+ Int_t nExpt( 1 );
+ Int_t firstExpt( 0 );
+ Bool_t isToy( kTRUE );
+ if ( command == "gen" ) {
+ if ( argc > 2 ) {
+ nExpt = atoi( argv[2] );
+ if ( argc > 3 ) {
+ firstExpt = atoi( argv[3] );
+ }
+ }
+ } else if ( command == "fit" ) {
+ if ( argc < 3 ) {
+ usage( std::cerr, argv[0] );
+ return EXIT_FAILURE;
+ }
+ iFit = atoi( argv[2] );
+ if ( argc > 3 ) {
+ nExpt = atoi( argv[3] );
+ if ( argc > 4 ) {
+ firstExpt = atoi( argv[4] );
+ }
+ }
+ } else {
+ usage( std::cerr, argv[0] );
+ return EXIT_FAILURE;
+ }
+
+ // If you want to use square DP histograms for efficiency,
+ // backgrounds or you just want the square DP co-ordinates
+ // stored in the toy MC ntuple then set this to kTRUE
+ Bool_t squareDP = kFALSE;
+
+ // This defines the DP => decay is B0 -> pi+ pi- K_S0
+ // Particle 1 = pi+
+ // Particle 2 = pi-
+ // Particle 3 = K_S0
+ // The DP is defined in terms of m13Sq and m23Sq
+ LauDaughters* daughters = new LauDaughters( "B0", "pi+", "pi-", "K_S0", squareDP );
+
+ LauVetoes* vetoes = new LauVetoes();
+ LauEffModel* effModel = new LauEffModel( daughters, vetoes );
+
+ LauIsobarDynamics* sigModel = new LauIsobarDynamics( daughters, effModel );
+
+ // Add relativistic BWs for the rho and K* resonances
+ sigModel->addResonance( "rho0(770)", 3, LauAbsResonance::RelBW );
+ sigModel->addResonance( "K*+(892)", 2, LauAbsResonance::RelBW );
+ sigModel->addResonance( "K*+_2(1430)", 2, LauAbsResonance::RelBW );
+
+ // Define the pi+ pi- "S-wave" K-matrix propagator
+ // The defineKMatrixPropagator requires four arguments
+ // name of propagator, parameter file, mass pair index (1,2,3) for "s" variable, number of channels, number of
+ // mass poles and the row index defining the K-matrix state (e.g. index = 1 for the first row -> S-wave).
+ Int_t resPairInt = 3;
+ Int_t nChannels = 5;
+ Int_t nPoles = 5;
+ Int_t KMatrixIndex = 1;
+ sigModel->defineKMatrixPropagator( "KM_pipi",
+ "LauKMatrixCoeff.dat",
+ resPairInt,
+ nChannels,
+ nPoles,
+ KMatrixIndex );
+
+ // Now define the pole and "slowly-varying part" (SVP) amplitudes for this K-matrix.
+ // Each part will have their own complex coefficients which can (should) be fitted.
+ // The addKMatrixProd functions need: name of pole/SVP, name of propagator and the index
+ // number of the amplitude (from 1 to nPoles or nChannels)
+ sigModel->addKMatrixProdPole( "KM_pipi_Pole1", "KM_pipi", 1 );
+ sigModel->addKMatrixProdPole( "KM_pipi_Pole2", "KM_pipi", 2 );
+ sigModel->addKMatrixProdPole( "KM_pipi_Pole3", "KM_pipi", 3 );
+ sigModel->addKMatrixProdPole( "KM_pipi_Pole4", "KM_pipi", 4 );
+ sigModel->addKMatrixProdPole( "KM_pipi_Pole5", "KM_pipi", 5 );
+
+ sigModel->addKMatrixProdSVP( "KM_pipi_SVP1", "KM_pipi", 1 );
+ sigModel->addKMatrixProdSVP( "KM_pipi_SVP2", "KM_pipi", 2 );
+ sigModel->addKMatrixProdSVP( "KM_pipi_SVP3", "KM_pipi", 3 );
+
+ sigModel->setASqMaxValue( 3.1 );
+
+ LauSimpleFitModel* fitModel = new LauSimpleFitModel( sigModel );
+
+ std::vector<LauAbsCoeffSet*> coeffset;
+
+ // Define the coefficients for the P-wave rho and K* resonances
+ coeffset.push_back( new LauRealImagCoeffSet( "rho0(770)", 1.00, 0.00, kTRUE, kTRUE ) );
+ coeffset.push_back( new LauRealImagCoeffSet( "K*+(892)", 0.97, -1.10, kFALSE, kFALSE ) );
+ coeffset.push_back( new LauRealImagCoeffSet( "K*+_2(1430)", 0.38, -0.54, kFALSE, kFALSE ) );
+
+ // Define the coefficients for the K-matrix amplitudes defined above ("beta" and "f" production coeffs)
+ coeffset.push_back( new LauRealImagCoeffSet( "KM_pipi_Pole1", -0.18, -0.91, kFALSE, kFALSE ) );
+ coeffset.push_back( new LauRealImagCoeffSet( "KM_pipi_Pole2", -1.02, -0.38, kFALSE, kFALSE ) );
+ coeffset.push_back( new LauRealImagCoeffSet( "KM_pipi_Pole3", -0.37, 0.50, kFALSE, kFALSE ) );
+ coeffset.push_back( new LauRealImagCoeffSet( "KM_pipi_Pole4", -0.01, 0.92, kFALSE, kFALSE ) );
+ coeffset.push_back( new LauRealImagCoeffSet( "KM_pipi_Pole5", 0.01, -0.05, kFALSE, kFALSE ) );
+
+ coeffset.push_back( new LauRealImagCoeffSet( "KM_pipi_SVP1", 0.22, 0.76, kFALSE, kFALSE ) );
+ coeffset.push_back( new LauRealImagCoeffSet( "KM_pipi_SVP2", 0.89, -0.31, kFALSE, kFALSE ) );
+ coeffset.push_back( new LauRealImagCoeffSet( "KM_pipi_SVP3", -0.97, 0.93, kFALSE, kFALSE ) );
+
+ for ( std::vector<LauAbsCoeffSet*>::iterator iter = coeffset.begin(); iter != coeffset.end();
+ ++iter ) {
+ fitModel->setAmpCoeffSet( *iter );
+ }
+
+ Double_t nSigEvents = 5000;
+ Bool_t fixSigEvents = kTRUE;
+ LauParameter* nSig = new LauParameter( "signalEvents",
+ nSigEvents,
+ -1.0 * nSigEvents,
+ 2.0 * nSigEvents,
+ fixSigEvents );
+ fitModel->setNSigEvents( nSig );
+ fitModel->setNExpts( nExpt, firstExpt, isToy );
+
+ // Configure various fit options
+
+ // Switch on/off calculation of asymmetric errors.
+ fitModel->useAsymmFitErrors( kFALSE );
+
+ // Randomise initial fit values for the signal mode
+ fitModel->useRandomInitFitPars( kTRUE );
+
+ const Bool_t haveBkgnds = ( fitModel->nBkgndClasses() > 0 );
+
+ // Switch on/off Poissonian smearing of total number of events
+ fitModel->doPoissonSmearing( haveBkgnds );
+
+ // Switch on/off Extended ML Fit option
+ fitModel->doEMLFit( haveBkgnds );
+
+ // Generate toy from the fitted parameters
+ //TString fitToyFileName("fitToyMC_KMatrixExample_");
+ //fitToyFileName += iFit;
+ //fitToyFileName += ".root";
+ //fitModel->compareFitData(100, fitToyFileName);
+
+ // Write out per-event likelihoods and sWeights
+ //TString splotFileName("splot_KMatrixExample_");
+ //splotFileName += iFit;
+ //splotFileName += ".root";
+ //fitModel->writeSPlotData(splotFileName, "splot", kFALSE);
+
+ // Set the names of the files to read/write
+ TString dataFile( "gen-KMatrixExample.root" );
+ TString treeName( "genResults" );
+ TString rootFileName( "" );
+ TString tableFileName( "" );
+ if ( command == "fit" ) {
+ rootFileName = "fitKMatrixExample_";
+ rootFileName += iFit;
+ rootFileName += "_expt_";
+ rootFileName += firstExpt;
+ rootFileName += "-";
+ rootFileName += ( firstExpt + nExpt - 1 );
+ rootFileName += ".root";
+ tableFileName = "fitKMatrixExampleResults_";
+ tableFileName += iFit;
+ } else {
+ rootFileName = "dummy.root";
+ tableFileName = "genKMatrixExampleResults";
+ }
+
+ // Execute the generation/fit
+ fitModel->run( command, dataFile, treeName, rootFileName, tableFileName );
+
+ return EXIT_SUCCESS;
}
diff --git a/examples/MergeDataFiles.cc b/examples/MergeDataFiles.cc
index c8da4eb..6d444a0 100644
--- a/examples/MergeDataFiles.cc
+++ b/examples/MergeDataFiles.cc
@@ -1,55 +1,55 @@
/*
Copyright 2013 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
-#include <iostream>
+#include "LauMergeDataFiles.hh"
#include "TString.h"
-#include "LauMergeDataFiles.hh"
+#include <iostream>
-int main(const int argc, const char** argv)
+int main( const int argc, const char** argv )
{
- if (argc < 3) {
- std::cerr<<"Usage: "<<argv[0]<<" <inputFileName1> <inputFileName2> [treeName] [outputFileName]"<<std::endl;
- return EXIT_FAILURE;
- }
-
- TString inputFileName1(argv[1]);
- TString inputFileName2(argv[2]);
-
- TString treeName("fitTree");
- if (argc > 3) {
- treeName = argv[3];
- }
- TString outputFileName("test.root");
- if (argc > 4) {
- outputFileName = argv[4];
- }
-
- LauMergeDataFiles myMerger(inputFileName1,inputFileName2,treeName);
- myMerger.process(outputFileName);
-
- return EXIT_SUCCESS;
+ if ( argc < 3 ) {
+ std::cerr << "Usage: " << argv[0]
+ << " <inputFileName1> <inputFileName2> [treeName] [outputFileName]" << std::endl;
+ return EXIT_FAILURE;
+ }
+
+ TString inputFileName1( argv[1] );
+ TString inputFileName2( argv[2] );
+
+ TString treeName( "fitTree" );
+ if ( argc > 3 ) {
+ treeName = argv[3];
+ }
+ TString outputFileName( "test.root" );
+ if ( argc > 4 ) {
+ outputFileName = argv[4];
+ }
+
+ LauMergeDataFiles myMerger( inputFileName1, inputFileName2, treeName );
+ myMerger.process( outputFileName );
+
+ return EXIT_SUCCESS;
}
-
diff --git a/examples/PlotKMatrixTAmp.cc b/examples/PlotKMatrixTAmp.cc
index 2128ab3..f20f720 100644
--- a/examples/PlotKMatrixTAmp.cc
+++ b/examples/PlotKMatrixTAmp.cc
@@ -1,229 +1,235 @@
/*
Copyright 2014 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
// Code to plot the transition amplitude T for the K-matrix pi pi S-wave
#include <iostream>
using std::cout;
using std::endl;
-#include "LauKMatrixPropagator.hh"
#include "LauComplex.hh"
+#include "LauKMatrixPropagator.hh"
-#include "TGraph.h"
-#include "TCanvas.h"
-#include "TStyle.h"
-#include "TROOT.h"
-#include "TSystem.h"
+#include "TArrow.h"
#include "TAxis.h"
+#include "TCanvas.h"
+#include "TGraph.h"
+#include "TLatex.h"
#include "TLine.h"
#include "TMath.h"
-#include "TLatex.h"
-#include "TArrow.h"
-
-int main(const int /*argc*/, const char** /*argv*/) {
-
- // Define the "S-wave" K-matrix propagator
- Int_t nChannels = 5;
- Int_t nPoles = 5;
- Int_t resPairInt = 1;
- Int_t KMatrixIndex = 1; // for S-wave
- LauKMatrixPropagator* propagator = new LauKMatrixPropagator("KMSWave", "DToKspipiKMatrixCoeff.dat",
- resPairInt, nChannels,
- nPoles, KMatrixIndex);
-
- // Find the transition amplitude T for the pi pi mode for
- // invariant mass squared s between (2*mpi)^2 and 4.0 GeV^2
- Double_t mMin(0.28);
- Double_t mMax(2.0);
- Int_t nS = 2000;
- Double_t dm = (mMax - mMin)/(nS*1.0);
-
- // Argand plot
- TGraph* TxyGraph = new TGraph(nS);
- // Intensity
- TGraph* TSqGraph = new TGraph(nS);
- // Phase
- TGraph* TDeltaGraph = new TGraph(nS);
- // Inelasticity eta
- TGraph* TEtaGraph = new TGraph(nS);
-
- Double_t radToDeg = 180.0/TMath::Pi();
- // Keep track of the real value of T to know when it
- // changes sign from -ve to +ve => 180 phase shift
- Double_t oldReT(0.0);
- int n180Shift(0);
-
- for (Int_t i = 0; i < nS; i++) {
-
- Double_t m = dm*i + mMin;
- Double_t s = m*m;
-
- LauComplex TAmp = propagator->getTransitionAmp(s, KMatrixIndex);
-
- Double_t realT = TAmp.re();
- Double_t imagT = TAmp.im();
-
- // Argand diagram showing the transition amplitude phase motion
- TxyGraph->SetPoint(i, realT, imagT);
- // Transition amplitude squared
- TSqGraph->SetPoint(i, m, TAmp.abs2());
-
- // T - E = 0.5*i, where E = inelasticity vector, pointing to T from (0,i/2)
- Double_t ReE = realT;
- Double_t ImE = imagT - 0.5;
-
- LauComplex EVect(ReE, ImE);
- // Inelasticity
- Double_t EMag = EVect.abs();
- Double_t eta = 2.0*EMag;
- TEtaGraph->SetPoint(i, m, eta);
-
- // Find the phase shift angle, delta
- Double_t delta = 0.5*TMath::ATan2(ImE, fabs(ReE))*radToDeg + 45.0;
- if (realT < 0.0) {delta = 180.0 - delta;}
-
- // Have we gone through 180 deg (or 2*delta through 360 deg)?
- if (oldReT < 0.0 && realT > 0.0) {n180Shift += 1;}
- // Add 180 if required
- delta += 180.0*n180Shift;
-
- TDeltaGraph->SetPoint(i, m, delta);
-
- // Keep track of the real value of T to see if it changes sign
- oldReT = realT;
-
- }
-
- TCanvas* theCanvas = new TCanvas("theCanvas", "", 1400, 1000);
- gROOT->SetStyle("Plain");
- gStyle->SetOptStat(0);
- theCanvas->Clear();
- theCanvas->UseCurrentStyle();
-
- theCanvas->Divide(2,2);
- // Argand plot
- theCanvas->cd(1);
- TxyGraph->SetTitle("Transition amplitude T#; S #equiv I + 2iT");
- TxyGraph->GetXaxis()->SetTitle("Re(T)");
- TxyGraph->GetYaxis()->SetTitle("Im(T)");
- TxyGraph->GetXaxis()->CenterTitle(kTRUE);
- TxyGraph->GetYaxis()->CenterTitle(kTRUE);
- TxyGraph->SetLineWidth(1);
- TxyGraph->Draw("apl");
-
- // Overlay the elastic boundaries
- TLine lineA1(-0.5, 0.0, -0.5, 1.0);
- lineA1.SetLineStyle(kDotted);
- lineA1.SetLineWidth(1);
- lineA1.Draw();
- TLine lineA2(0.5, 0.0, 0.5, 1.0);
- lineA2.SetLineStyle(kDotted);
- lineA2.SetLineWidth(1);
- lineA2.Draw();
- TLine lineA3(-0.5, 1.0, 0.5, 1.0);
- lineA3.SetLineStyle(kDotted);
- lineA3.SetLineWidth(1);
- lineA3.Draw();
-
- // Intensity
- theCanvas->cd(2);
- TSqGraph->SetTitle("Transition amplitude intensity");
- TSqGraph->GetXaxis()->SetTitle("m(#pi^{+}#pi^{-}) (GeV/c^{2})");
- TSqGraph->GetYaxis()->SetTitle("|T|^{2}");
- TSqGraph->SetLineWidth(1);
- TSqGraph->GetXaxis()->CenterTitle(kTRUE);
- TSqGraph->GetYaxis()->CenterTitle(kTRUE);
- TSqGraph->Draw("apl");
- // Overlay the unitarity limit
- TAxis* xAxis = TSqGraph->GetXaxis();
- TLine lineB1(xAxis->GetXmin(), 1.0, xAxis->GetXmax(), 1.0);
- lineB1.SetLineStyle(kDotted);
- lineB1.SetLineWidth(1);
- lineB1.Draw();
-
- // Also overlay "interesting regions"
- TLatex text;
- text.SetTextSize(0.045);
-
- // sigma
- text.DrawLatex(0.65, 0.6, "f_{0}(500)");
- text.DrawLatex(0.68, 0.525, "or #sigma");
-
- // f0(980)
- text.SetTextSize(0.045);
- text.DrawLatex(0.9, 1.02, "f_{0}(980)");
- TArrow arrow1(0.98, 1.0, 0.98, 0.8, 0.01);
- arrow1.SetLineWidth(1);
- arrow1.Draw();
-
- // f0(1370)
- text.DrawLatex(1.25, 0.91, "f_{0}(1370)");
- TArrow arrow2(1.37, 0.9, 1.37, 0.7, 0.01);
- arrow2.SetLineWidth(1);
- arrow2.Draw();
-
- // f0(1500)
- text.DrawLatex(1.45, 0.76, "f_{0}(1500)");
- TArrow arrow3(1.50, 0.72, 1.50, 0.52, 0.01);
- arrow3.SetLineWidth(1);
- arrow3.Draw();
-
- // f0(1710)
- text.DrawLatex(1.60, 0.61, "f_{0}(1710)");
- TArrow arrow4(1.71, 0.6, 1.71, 0.45, 0.01);
- arrow4.SetLineWidth(1);
- arrow4.Draw();
-
- // Phase
- theCanvas->cd(3);
- TDeltaGraph->SetTitle("Phase shift");
- TDeltaGraph->GetXaxis()->SetTitle("m(#pi^{+}#pi^{-}) (GeV/c^{2})");
- TDeltaGraph->GetYaxis()->SetTitle("#delta (degrees)");
- TDeltaGraph->GetXaxis()->CenterTitle(kTRUE);
- TDeltaGraph->GetYaxis()->CenterTitle(kTRUE);
- TDeltaGraph->SetLineWidth(1);
- TDeltaGraph->Draw("apl");
-
- // Inelasticity
- theCanvas->cd(4);
- TEtaGraph->SetTitle("Inelasticity, #eta #equiv |2T - iI| = |S|");
- TEtaGraph->GetXaxis()->SetTitle("m(#pi^{+}#pi^{-}) (GeV/c^{2})");
- TEtaGraph->GetYaxis()->SetTitle("#eta");
- TEtaGraph->GetXaxis()->CenterTitle(kTRUE);
- TEtaGraph->GetYaxis()->CenterTitle(kTRUE);
- TEtaGraph->SetLineWidth(1);
- TEtaGraph->Draw("apl");
-
- // Overlay the elastic limit
- xAxis = TEtaGraph->GetXaxis();
- TLine lineD1(xAxis->GetXmin(), 1.0, xAxis->GetXmax(), 1.0);
- lineD1.SetLineStyle(kDotted);
- lineD1.SetLineWidth(1);
- lineD1.Draw();
-
- theCanvas->Print("KMatrixTAmpPlots.png");
- theCanvas->Print("KMatrixTAmpPlots.eps");
+#include "TROOT.h"
+#include "TStyle.h"
+#include "TSystem.h"
+int main( const int /*argc*/, const char** /*argv*/ )
+{
+
+ // Define the "S-wave" K-matrix propagator
+ Int_t nChannels = 5;
+ Int_t nPoles = 5;
+ Int_t resPairInt = 1;
+ Int_t KMatrixIndex = 1; // for S-wave
+ LauKMatrixPropagator* propagator = new LauKMatrixPropagator( "KMSWave",
+ "DToKspipiKMatrixCoeff.dat",
+ resPairInt,
+ nChannels,
+ nPoles,
+ KMatrixIndex );
+
+ // Find the transition amplitude T for the pi pi mode for
+ // invariant mass squared s between (2*mpi)^2 and 4.0 GeV^2
+ Double_t mMin( 0.28 );
+ Double_t mMax( 2.0 );
+ Int_t nS = 2000;
+ Double_t dm = ( mMax - mMin ) / ( nS * 1.0 );
+
+ // Argand plot
+ TGraph* TxyGraph = new TGraph( nS );
+ // Intensity
+ TGraph* TSqGraph = new TGraph( nS );
+ // Phase
+ TGraph* TDeltaGraph = new TGraph( nS );
+ // Inelasticity eta
+ TGraph* TEtaGraph = new TGraph( nS );
+
+ Double_t radToDeg = 180.0 / TMath::Pi();
+ // Keep track of the real value of T to know when it
+ // changes sign from -ve to +ve => 180 phase shift
+ Double_t oldReT( 0.0 );
+ int n180Shift( 0 );
+
+ for ( Int_t i = 0; i < nS; i++ ) {
+
+ Double_t m = dm * i + mMin;
+ Double_t s = m * m;
+
+ LauComplex TAmp = propagator->getTransitionAmp( s, KMatrixIndex );
+
+ Double_t realT = TAmp.re();
+ Double_t imagT = TAmp.im();
+
+ // Argand diagram showing the transition amplitude phase motion
+ TxyGraph->SetPoint( i, realT, imagT );
+ // Transition amplitude squared
+ TSqGraph->SetPoint( i, m, TAmp.abs2() );
+
+ // T - E = 0.5*i, where E = inelasticity vector, pointing to T from (0,i/2)
+ Double_t ReE = realT;
+ Double_t ImE = imagT - 0.5;
+
+ LauComplex EVect( ReE, ImE );
+ // Inelasticity
+ Double_t EMag = EVect.abs();
+ Double_t eta = 2.0 * EMag;
+ TEtaGraph->SetPoint( i, m, eta );
+
+ // Find the phase shift angle, delta
+ Double_t delta = 0.5 * TMath::ATan2( ImE, fabs( ReE ) ) * radToDeg + 45.0;
+ if ( realT < 0.0 ) {
+ delta = 180.0 - delta;
+ }
+
+ // Have we gone through 180 deg (or 2*delta through 360 deg)?
+ if ( oldReT < 0.0 && realT > 0.0 ) {
+ n180Shift += 1;
+ }
+ // Add 180 if required
+ delta += 180.0 * n180Shift;
+
+ TDeltaGraph->SetPoint( i, m, delta );
+
+ // Keep track of the real value of T to see if it changes sign
+ oldReT = realT;
+ }
+
+ TCanvas* theCanvas = new TCanvas( "theCanvas", "", 1400, 1000 );
+ gROOT->SetStyle( "Plain" );
+ gStyle->SetOptStat( 0 );
+ theCanvas->Clear();
+ theCanvas->UseCurrentStyle();
+
+ theCanvas->Divide( 2, 2 );
+ // Argand plot
+ theCanvas->cd( 1 );
+ TxyGraph->SetTitle( "Transition amplitude T#; S #equiv I + 2iT" );
+ TxyGraph->GetXaxis()->SetTitle( "Re(T)" );
+ TxyGraph->GetYaxis()->SetTitle( "Im(T)" );
+ TxyGraph->GetXaxis()->CenterTitle( kTRUE );
+ TxyGraph->GetYaxis()->CenterTitle( kTRUE );
+ TxyGraph->SetLineWidth( 1 );
+ TxyGraph->Draw( "apl" );
+
+ // Overlay the elastic boundaries
+ TLine lineA1( -0.5, 0.0, -0.5, 1.0 );
+ lineA1.SetLineStyle( kDotted );
+ lineA1.SetLineWidth( 1 );
+ lineA1.Draw();
+ TLine lineA2( 0.5, 0.0, 0.5, 1.0 );
+ lineA2.SetLineStyle( kDotted );
+ lineA2.SetLineWidth( 1 );
+ lineA2.Draw();
+ TLine lineA3( -0.5, 1.0, 0.5, 1.0 );
+ lineA3.SetLineStyle( kDotted );
+ lineA3.SetLineWidth( 1 );
+ lineA3.Draw();
+
+ // Intensity
+ theCanvas->cd( 2 );
+ TSqGraph->SetTitle( "Transition amplitude intensity" );
+ TSqGraph->GetXaxis()->SetTitle( "m(#pi^{+}#pi^{-}) (GeV/c^{2})" );
+ TSqGraph->GetYaxis()->SetTitle( "|T|^{2}" );
+ TSqGraph->SetLineWidth( 1 );
+ TSqGraph->GetXaxis()->CenterTitle( kTRUE );
+ TSqGraph->GetYaxis()->CenterTitle( kTRUE );
+ TSqGraph->Draw( "apl" );
+ // Overlay the unitarity limit
+ TAxis* xAxis = TSqGraph->GetXaxis();
+ TLine lineB1( xAxis->GetXmin(), 1.0, xAxis->GetXmax(), 1.0 );
+ lineB1.SetLineStyle( kDotted );
+ lineB1.SetLineWidth( 1 );
+ lineB1.Draw();
+
+ // Also overlay "interesting regions"
+ TLatex text;
+ text.SetTextSize( 0.045 );
+
+ // sigma
+ text.DrawLatex( 0.65, 0.6, "f_{0}(500)" );
+ text.DrawLatex( 0.68, 0.525, "or #sigma" );
+
+ // f0(980)
+ text.SetTextSize( 0.045 );
+ text.DrawLatex( 0.9, 1.02, "f_{0}(980)" );
+ TArrow arrow1( 0.98, 1.0, 0.98, 0.8, 0.01 );
+ arrow1.SetLineWidth( 1 );
+ arrow1.Draw();
+
+ // f0(1370)
+ text.DrawLatex( 1.25, 0.91, "f_{0}(1370)" );
+ TArrow arrow2( 1.37, 0.9, 1.37, 0.7, 0.01 );
+ arrow2.SetLineWidth( 1 );
+ arrow2.Draw();
+
+ // f0(1500)
+ text.DrawLatex( 1.45, 0.76, "f_{0}(1500)" );
+ TArrow arrow3( 1.50, 0.72, 1.50, 0.52, 0.01 );
+ arrow3.SetLineWidth( 1 );
+ arrow3.Draw();
+
+ // f0(1710)
+ text.DrawLatex( 1.60, 0.61, "f_{0}(1710)" );
+ TArrow arrow4( 1.71, 0.6, 1.71, 0.45, 0.01 );
+ arrow4.SetLineWidth( 1 );
+ arrow4.Draw();
+
+ // Phase
+ theCanvas->cd( 3 );
+ TDeltaGraph->SetTitle( "Phase shift" );
+ TDeltaGraph->GetXaxis()->SetTitle( "m(#pi^{+}#pi^{-}) (GeV/c^{2})" );
+ TDeltaGraph->GetYaxis()->SetTitle( "#delta (degrees)" );
+ TDeltaGraph->GetXaxis()->CenterTitle( kTRUE );
+ TDeltaGraph->GetYaxis()->CenterTitle( kTRUE );
+ TDeltaGraph->SetLineWidth( 1 );
+ TDeltaGraph->Draw( "apl" );
+
+ // Inelasticity
+ theCanvas->cd( 4 );
+ TEtaGraph->SetTitle( "Inelasticity, #eta #equiv |2T - iI| = |S|" );
+ TEtaGraph->GetXaxis()->SetTitle( "m(#pi^{+}#pi^{-}) (GeV/c^{2})" );
+ TEtaGraph->GetYaxis()->SetTitle( "#eta" );
+ TEtaGraph->GetXaxis()->CenterTitle( kTRUE );
+ TEtaGraph->GetYaxis()->CenterTitle( kTRUE );
+ TEtaGraph->SetLineWidth( 1 );
+ TEtaGraph->Draw( "apl" );
+
+ // Overlay the elastic limit
+ xAxis = TEtaGraph->GetXaxis();
+ TLine lineD1( xAxis->GetXmin(), 1.0, xAxis->GetXmax(), 1.0 );
+ lineD1.SetLineStyle( kDotted );
+ lineD1.SetLineWidth( 1 );
+ lineD1.Draw();
+
+ theCanvas->Print( "KMatrixTAmpPlots.png" );
+ theCanvas->Print( "KMatrixTAmpPlots.eps" );
}
diff --git a/examples/PlotLikelihood.cc b/examples/PlotLikelihood.cc
index fcc163a..ef55bd7 100644
--- a/examples/PlotLikelihood.cc
+++ b/examples/PlotLikelihood.cc
@@ -1,194 +1,198 @@
/*
Copyright 2023 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
-#include <cstdlib>
-#include <iostream>
-#include <memory>
-#include <vector>
-
-#include "TFile.h"
-#include "TH2.h"
-#include "TString.h"
-#include "TTree.h"
-
-#include "LauSimpleFitModel.hh"
#include "LauBkgndDPModel.hh"
#include "LauDaughters.hh"
#include "LauEffModel.hh"
#include "LauIsobarDynamics.hh"
#include "LauMagPhaseCoeffSet.hh"
#include "LauResonanceMaker.hh"
+#include "LauSimpleFitModel.hh"
#include "LauVetoes.hh"
+#include "TFile.h"
+#include "TH2.h"
+#include "TString.h"
+#include "TTree.h"
+
+#include <cstdlib>
+#include <iostream>
+#include <memory>
+#include <vector>
+
int main( /*int argc, char** argv*/ )
{
- // If you want to use square DP histograms for efficiency,
- // backgrounds or you just want the square DP co-ordinates
- // stored in the toy MC ntuple then set this to kTRUE
- Bool_t squareDP = kFALSE;
-
- // This defines the DP => decay is B+ -> pi+ pi+ pi-
- // Particle 1 = pi+
- // Particle 2 = pi+
- // Particle 3 = pi-
- // The DP is defined in terms of m13Sq and m23Sq
- LauDaughters* daughters = new LauDaughters("B+", "pi+", "pi+", "pi-", squareDP);
-
- // Optionally apply some vetoes to the DP
- // (example syntax given but commented-out)
- LauVetoes* vetoes = new LauVetoes();
- //Double_t DMin = 1.70;
- //Double_t DMax = 1.925;
- //Double_t JpsiMin = 3.051;
- //Double_t JpsiMax = 3.222;
- //Double_t psi2SMin = 3.676;
- //Double_t psi2SMax = 3.866;
- //vetoes->addMassVeto(1, DMin, DMax); // D0 veto, m23 (and automatically m13)
- //vetoes->addMassVeto(1, JpsiMin, JpsiMax); // J/psi veto, m23 (and automatically m13)
- //vetoes->addMassVeto(1, psi2SMin, psi2SMax); // psi(2S) veto, m23 (and automatically m13)
-
- // Define the efficiency model (defaults to unity everywhere)
- LauEffModel* effModel = new LauEffModel(daughters, vetoes);
-
- // Can optionally provide a histogram to model variation over DP
- // (example syntax given but commented-out)
- //TFile *effHistFile = TFile::Open("histoFiles/B3piNRDPEff.root", "read");
- //TH2* effHist = dynamic_cast<TH2*>(effHistFile->Get("effHist"));
- //Bool_t useInterpolation = kTRUE;
- //Bool_t fluctuateBins = kFALSE;
- //Bool_t useUpperHalf = kTRUE;
- //effModel->setEffHisto(effHist, useInterpolation, fluctuateBins, 0.0, 0.0, useUpperHalf, squareDP);
-
- // Create the isobar model
-
- // Set the values of the Blatt-Weisskopf barrier radii and whether they are fixed or floating
- LauResonanceMaker& resMaker = LauResonanceMaker::get();
- resMaker.setDefaultBWRadius( LauBlattWeisskopfFactor::Parent, 5.0 );
- resMaker.setDefaultBWRadius( LauBlattWeisskopfFactor::Light, 4.0 );
- resMaker.fixBWRadius( LauBlattWeisskopfFactor::Parent, kTRUE );
- resMaker.fixBWRadius( LauBlattWeisskopfFactor::Light, kTRUE );
-
- LauIsobarDynamics* sigModel = new LauIsobarDynamics(daughters, effModel);
- // Add various components to the isobar model,
- // modifying some resonance parameters
- LauAbsResonance* reson(0);
- // addResonance arguments: resName, resPairAmpInt, resType
- reson = sigModel->addResonance("rho0(770)", 1, LauAbsResonance::GS); // resPairAmpInt = 1 => resonance mass is m23.
- reson = sigModel->addResonance("rho0(1450)", 1, LauAbsResonance::RelBW);
- reson = sigModel->addResonance("f_0(980)", 1, LauAbsResonance::Flatte);
- reson->setResonanceParameter("g1",0.2);
- reson->setResonanceParameter("g2",1.0);
- reson = sigModel->addResonance("f_2(1270)", 1, LauAbsResonance::RelBW);
- const TString nrName = "BelleNR_Swave";
- reson = sigModel->addResonance(nrName, 0, LauAbsResonance::BelleSymNRNoInter);
- reson->setResonanceParameter("alpha", 0.2);
-
- // Set the maximum signal DP ASq value
- // If you do not provide a value, one will be determined automatically,
- // which should be close to the true maximum but is not guaranteed to
- // be optimal.
- // Any value, whether manually provided or automatically determined,
- // will be automatically adjusted to avoid bias or extreme inefficiency
- // but it is best to set this by hand once you've found the right value
- // through some trial and error.
- sigModel->setASqMaxValue(0.35);
-
- // Create the fit model
- LauSimpleFitModel* fitModel = new LauSimpleFitModel(sigModel);
-
- // Create the complex coefficients for the isobar model
- // Here we're using the magnitude and phase form:
- // c_j = a_j exp(i*delta_j)
- std::vector<LauAbsCoeffSet*> coeffset;
- coeffset.push_back( new LauMagPhaseCoeffSet("rho0(770)", 1.00, 0.00, kTRUE, kTRUE) );
- coeffset.push_back( new LauMagPhaseCoeffSet("rho0(1450)", 0.37, 1.99, kFALSE, kFALSE) );
- coeffset.push_back( new LauMagPhaseCoeffSet("f_0(980)", 0.27, -1.59, kFALSE, kFALSE) );
- coeffset.push_back( new LauMagPhaseCoeffSet("f_2(1270)", 0.53, 1.39, kFALSE, kFALSE) );
- coeffset.push_back( new LauMagPhaseCoeffSet(nrName, 0.54, -0.84, kFALSE, kFALSE) );
- for (std::vector<LauAbsCoeffSet*>::iterator iter=coeffset.begin(); iter!=coeffset.end(); ++iter) {
- fitModel->setAmpCoeffSet(*iter);
- }
-
- // Set the signal yield and define whether it is fixed or floated
- const Double_t nSigEvents = 1500.0;
- LauParameter * signalEvents = new LauParameter("signalEvents",nSigEvents,-1.0*nSigEvents,2.0*nSigEvents,kFALSE);
- fitModel->setNSigEvents(signalEvents);
-
- // Set up a background model
-
- // First declare the names of the background class(es)
- std::vector<TString> bkgndNames(1);
- bkgndNames[0] = "qqbar";
- fitModel->setBkgndClassNames( bkgndNames );
-
- // Define and set the yield parameter for the background
- const Double_t nBkg = 1250.0;
- LauParameter* nBkgndEvents = new LauParameter("qqbar",nBkg,-2.0*nBkg,2.0*nBkg,kFALSE);
- fitModel->setNBkgndEvents( nBkgndEvents );
-
- // Create the background DP model
- LauBkgndDPModel* qqbarModel = new LauBkgndDPModel(daughters, vetoes);
-
- // Load in background DP model histogram
- // (example syntax given but commented-out - the background will be treated as being uniform in the DP in the absence of a histogram)
- //TString qqFileName("histoFiles/offResDP.root");
- //TFile* qqFile = TFile::Open(qqFileName.Data(), "read");
- //TH2* qqDP = dynamic_cast<TH2*>(qqFile->Get("AllmTheta")); // m', theta'
- //qqbarModel->setBkgndHisto(qqDP, useInterpolation, fluctuateBins, useUpperHalf, squareDP);
-
- // Add the background DP model into the fit model
- fitModel->setBkgndDPModel( "qqbar", qqbarModel );
-
-
- // Set the names of the files to read/write
- const TString histFileName("plot-3pi.root");
- std::unique_ptr<TFile> histFile { TFile::Open( histFileName, "recreate" ) };
-
- const Int_t nBins{100};
- const Double_t xMin{0.0};
- const Double_t xMax{28.0};
- const Double_t yMin{0.0};
- const Double_t yMax{28.0};
- TH2* signalLike = new TH2D( "signalLike", "Signal Likelihood", nBins, xMin, xMax, nBins, yMin, yMax );
- TH2* qqbarLike = new TH2D( "qqbarLike", "qqbar Likelihood", nBins, xMin, xMax, nBins, yMin, yMax );
-
- for ( Int_t iX{1}; iX < nBins; ++iX ) {
-
- const Double_t m13Sq { signalLike->GetXaxis()->GetBinCenter( iX ) };
-
- for ( Int_t iY{1}; iY < nBins; ++iY ) {
- const Double_t m23Sq { signalLike->GetYaxis()->GetBinCenter( iY ) };
-
- const auto likelihoods { fitModel->getDPLikelihoods( m13Sq, m23Sq ) };
-
- signalLike->SetBinContent( iX, iY, likelihoods.at("signal") );
- qqbarLike ->SetBinContent( iX, iY, likelihoods.at("qqbar") );
- }
- }
-
- histFile->Write();
- histFile->Close();
-
- return EXIT_SUCCESS;
+ // If you want to use square DP histograms for efficiency,
+ // backgrounds or you just want the square DP co-ordinates
+ // stored in the toy MC ntuple then set this to kTRUE
+ Bool_t squareDP = kFALSE;
+
+ // This defines the DP => decay is B+ -> pi+ pi+ pi-
+ // Particle 1 = pi+
+ // Particle 2 = pi+
+ // Particle 3 = pi-
+ // The DP is defined in terms of m13Sq and m23Sq
+ LauDaughters* daughters = new LauDaughters( "B+", "pi+", "pi+", "pi-", squareDP );
+
+ // Optionally apply some vetoes to the DP
+ // (example syntax given but commented-out)
+ LauVetoes* vetoes = new LauVetoes();
+ //Double_t DMin = 1.70;
+ //Double_t DMax = 1.925;
+ //Double_t JpsiMin = 3.051;
+ //Double_t JpsiMax = 3.222;
+ //Double_t psi2SMin = 3.676;
+ //Double_t psi2SMax = 3.866;
+ //vetoes->addMassVeto(1, DMin, DMax); // D0 veto, m23 (and automatically m13)
+ //vetoes->addMassVeto(1, JpsiMin, JpsiMax); // J/psi veto, m23 (and automatically m13)
+ //vetoes->addMassVeto(1, psi2SMin, psi2SMax); // psi(2S) veto, m23 (and automatically m13)
+
+ // Define the efficiency model (defaults to unity everywhere)
+ LauEffModel* effModel = new LauEffModel( daughters, vetoes );
+
+ // Can optionally provide a histogram to model variation over DP
+ // (example syntax given but commented-out)
+ //TFile *effHistFile = TFile::Open("histoFiles/B3piNRDPEff.root", "read");
+ //TH2* effHist = dynamic_cast<TH2*>(effHistFile->Get("effHist"));
+ //Bool_t useInterpolation = kTRUE;
+ //Bool_t fluctuateBins = kFALSE;
+ //Bool_t useUpperHalf = kTRUE;
+ //effModel->setEffHisto(effHist, useInterpolation, fluctuateBins, 0.0, 0.0, useUpperHalf, squareDP);
+
+ // Create the isobar model
+
+ // Set the values of the Blatt-Weisskopf barrier radii and whether they are fixed or floating
+ LauResonanceMaker& resMaker = LauResonanceMaker::get();
+ resMaker.setDefaultBWRadius( LauBlattWeisskopfFactor::Parent, 5.0 );
+ resMaker.setDefaultBWRadius( LauBlattWeisskopfFactor::Light, 4.0 );
+ resMaker.fixBWRadius( LauBlattWeisskopfFactor::Parent, kTRUE );
+ resMaker.fixBWRadius( LauBlattWeisskopfFactor::Light, kTRUE );
+
+ LauIsobarDynamics* sigModel = new LauIsobarDynamics( daughters, effModel );
+ // Add various components to the isobar model,
+ // modifying some resonance parameters
+ LauAbsResonance* reson( 0 );
+ // addResonance arguments: resName, resPairAmpInt, resType
+ reson = sigModel->addResonance( "rho0(770)",
+ 1,
+ LauAbsResonance::GS ); // resPairAmpInt = 1 => resonance mass is m23.
+ reson = sigModel->addResonance( "rho0(1450)", 1, LauAbsResonance::RelBW );
+ reson = sigModel->addResonance( "f_0(980)", 1, LauAbsResonance::Flatte );
+ reson->setResonanceParameter( "g1", 0.2 );
+ reson->setResonanceParameter( "g2", 1.0 );
+ reson = sigModel->addResonance( "f_2(1270)", 1, LauAbsResonance::RelBW );
+ const TString nrName = "BelleNR_Swave";
+ reson = sigModel->addResonance( nrName, 0, LauAbsResonance::BelleSymNRNoInter );
+ reson->setResonanceParameter( "alpha", 0.2 );
+
+ // Set the maximum signal DP ASq value
+ // If you do not provide a value, one will be determined automatically,
+ // which should be close to the true maximum but is not guaranteed to
+ // be optimal.
+ // Any value, whether manually provided or automatically determined,
+ // will be automatically adjusted to avoid bias or extreme inefficiency
+ // but it is best to set this by hand once you've found the right value
+ // through some trial and error.
+ sigModel->setASqMaxValue( 0.35 );
+
+ // Create the fit model
+ LauSimpleFitModel* fitModel = new LauSimpleFitModel( sigModel );
+
+ // Create the complex coefficients for the isobar model
+ // Here we're using the magnitude and phase form:
+ // c_j = a_j exp(i*delta_j)
+ std::vector<LauAbsCoeffSet*> coeffset;
+ coeffset.push_back( new LauMagPhaseCoeffSet( "rho0(770)", 1.00, 0.00, kTRUE, kTRUE ) );
+ coeffset.push_back( new LauMagPhaseCoeffSet( "rho0(1450)", 0.37, 1.99, kFALSE, kFALSE ) );
+ coeffset.push_back( new LauMagPhaseCoeffSet( "f_0(980)", 0.27, -1.59, kFALSE, kFALSE ) );
+ coeffset.push_back( new LauMagPhaseCoeffSet( "f_2(1270)", 0.53, 1.39, kFALSE, kFALSE ) );
+ coeffset.push_back( new LauMagPhaseCoeffSet( nrName, 0.54, -0.84, kFALSE, kFALSE ) );
+ for ( std::vector<LauAbsCoeffSet*>::iterator iter = coeffset.begin(); iter != coeffset.end();
+ ++iter ) {
+ fitModel->setAmpCoeffSet( *iter );
+ }
+
+ // Set the signal yield and define whether it is fixed or floated
+ const Double_t nSigEvents = 1500.0;
+ LauParameter* signalEvents =
+ new LauParameter( "signalEvents", nSigEvents, -1.0 * nSigEvents, 2.0 * nSigEvents, kFALSE );
+ fitModel->setNSigEvents( signalEvents );
+
+ // Set up a background model
+
+ // First declare the names of the background class(es)
+ std::vector<TString> bkgndNames( 1 );
+ bkgndNames[0] = "qqbar";
+ fitModel->setBkgndClassNames( bkgndNames );
+
+ // Define and set the yield parameter for the background
+ const Double_t nBkg = 1250.0;
+ LauParameter* nBkgndEvents = new LauParameter( "qqbar", nBkg, -2.0 * nBkg, 2.0 * nBkg, kFALSE );
+ fitModel->setNBkgndEvents( nBkgndEvents );
+
+ // Create the background DP model
+ LauBkgndDPModel* qqbarModel = new LauBkgndDPModel( daughters, vetoes );
+
+ // Load in background DP model histogram
+ // (example syntax given but commented-out - the background will be treated as being uniform in the DP in the absence of a histogram)
+ //TString qqFileName("histoFiles/offResDP.root");
+ //TFile* qqFile = TFile::Open(qqFileName.Data(), "read");
+ //TH2* qqDP = dynamic_cast<TH2*>(qqFile->Get("AllmTheta")); // m', theta'
+ //qqbarModel->setBkgndHisto(qqDP, useInterpolation, fluctuateBins, useUpperHalf, squareDP);
+
+ // Add the background DP model into the fit model
+ fitModel->setBkgndDPModel( "qqbar", qqbarModel );
+
+ // Set the names of the files to read/write
+ const TString histFileName( "plot-3pi.root" );
+ std::unique_ptr<TFile> histFile { TFile::Open( histFileName, "recreate" ) };
+
+ const Int_t nBins { 100 };
+ const Double_t xMin { 0.0 };
+ const Double_t xMax { 28.0 };
+ const Double_t yMin { 0.0 };
+ const Double_t yMax { 28.0 };
+ TH2* signalLike =
+ new TH2D( "signalLike", "Signal Likelihood", nBins, xMin, xMax, nBins, yMin, yMax );
+ TH2* qqbarLike = new TH2D( "qqbarLike", "qqbar Likelihood", nBins, xMin, xMax, nBins, yMin, yMax );
+
+ for ( Int_t iX { 1 }; iX < nBins; ++iX ) {
+
+ const Double_t m13Sq { signalLike->GetXaxis()->GetBinCenter( iX ) };
+
+ for ( Int_t iY { 1 }; iY < nBins; ++iY ) {
+ const Double_t m23Sq { signalLike->GetYaxis()->GetBinCenter( iY ) };
+
+ const auto likelihoods { fitModel->getDPLikelihoods( m13Sq, m23Sq ) };
+
+ signalLike->SetBinContent( iX, iY, likelihoods.at( "signal" ) );
+ qqbarLike->SetBinContent( iX, iY, likelihoods.at( "qqbar" ) );
+ }
+ }
+
+ histFile->Write();
+ histFile->Close();
+
+ return EXIT_SUCCESS;
}
diff --git a/examples/PlotResults.cc b/examples/PlotResults.cc
index d5054be..0b41956 100644
--- a/examples/PlotResults.cc
+++ b/examples/PlotResults.cc
@@ -1,632 +1,658 @@
/*
Copyright 2009 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
-#include <iostream>
-#include <fstream>
-#include <cstdlib>
-
#include "TArrow.h"
#include "TCanvas.h"
#include "TF1.h"
#include "TFile.h"
#include "TH1.h"
#include "TLeaf.h"
#include "TROOT.h"
#include "TString.h"
#include "TStyle.h"
#include "TTree.h"
-using std::cout;
+#include <cstdlib>
+#include <fstream>
+#include <iostream>
+
using std::cerr;
+using std::cout;
using std::endl;
-void plotDists(const TString& fileName, const TString& treeName, Int_t numExpts);
-void plotErrors(const TString& fileName, const TString& treeName, Int_t numExpts);
-void plotPulls(const TString& fileName, const TString& treeName, Int_t numExpts);
-void plotCorrelations(const TString& fileName, const TString& treeName, Int_t numExpts, Bool_t onlyYieldCorrs = kTRUE);
+void plotDists( const TString& fileName, const TString& treeName, Int_t numExpts );
+void plotErrors( const TString& fileName, const TString& treeName, Int_t numExpts );
+void plotPulls( const TString& fileName, const TString& treeName, Int_t numExpts );
+void plotCorrelations( const TString& fileName,
+ const TString& treeName,
+ Int_t numExpts,
+ Bool_t onlyYieldCorrs = kTRUE );
-int main(const int argc, const char** argv)
+int main( const int argc, const char** argv )
{
- if ( argc < 2 ) {
- std::cerr << "Usage: " << argv[0] << " <command = plotpulls, ploterrors, plotdists, plotcorrs, plotcorrsall> [nExpts] [inputFileName] [treeName]" << std::endl;
- }
-
- gROOT->SetStyle("Plain");
- gStyle->SetOptStat(1000000);
- gStyle->SetOptFit(0111);
-
- Int_t nExpt(1);
-
- TString inputFileName("output.root");
- TString treeName("fitResults");
-
- Bool_t doPlotPulls(kFALSE);
- Bool_t doPlotErrors(kFALSE);
- Bool_t doPlotDists(kFALSE);
- Bool_t doPlotCorrs(kFALSE);
-
- Bool_t onlyYieldCorrs(kTRUE);
-
- if (argc > 1) {
- TString command(argv[1]);
- if (command.Contains("plotpulls",TString::kIgnoreCase)) {
- doPlotPulls = kTRUE;
- doPlotErrors = kFALSE;
- doPlotDists = kFALSE;
- doPlotCorrs = kFALSE;
- } else if (command.Contains("ploterrors",TString::kIgnoreCase)) {
- doPlotPulls = kFALSE;
- doPlotErrors = kTRUE;
- doPlotDists = kFALSE;
- doPlotCorrs = kFALSE;
- } else if (command.Contains("plotdists",TString::kIgnoreCase)) {
- doPlotPulls = kFALSE;
- doPlotErrors = kFALSE;
- doPlotDists = kTRUE;
- doPlotCorrs = kFALSE;
- } else if (command.Contains("plotcorrs",TString::kIgnoreCase)) {
- doPlotPulls = kFALSE;
- doPlotErrors = kFALSE;
- doPlotDists = kFALSE;
- doPlotCorrs = kTRUE;
- if ( command.Contains("plotcorrsall",TString::kIgnoreCase) ) {
- onlyYieldCorrs = kFALSE;
- }
- } else {
- cerr << "Unknown command: \"" << command << "\", exiting..." << endl;
- return EXIT_FAILURE;
- }
- }
- if (argc > 2) {
- nExpt = atoi(argv[2]);
- }
- if (argc > 3) {
- inputFileName = argv[3];
- }
- if (argc > 4) {
- treeName = argv[4];
- }
-
- if (doPlotPulls) {
- plotPulls(inputFileName, treeName, nExpt);
- }
- if (doPlotErrors) {
- plotErrors(inputFileName, treeName, nExpt);
- }
- if (doPlotDists) {
- plotDists(inputFileName, treeName, nExpt);
- }
- if (doPlotCorrs) {
- plotCorrelations(inputFileName, treeName, nExpt, onlyYieldCorrs);
- }
-
- return EXIT_SUCCESS;
+ if ( argc < 2 ) {
+ std::cerr << "Usage: " << argv[0]
+ << " <command = plotpulls, ploterrors, plotdists, plotcorrs, plotcorrsall> [nExpts] [inputFileName] [treeName]"
+ << std::endl;
+ }
+
+ gROOT->SetStyle( "Plain" );
+ gStyle->SetOptStat( 1000000 );
+ gStyle->SetOptFit( 0111 );
+
+ Int_t nExpt( 1 );
+
+ TString inputFileName( "output.root" );
+ TString treeName( "fitResults" );
+
+ Bool_t doPlotPulls( kFALSE );
+ Bool_t doPlotErrors( kFALSE );
+ Bool_t doPlotDists( kFALSE );
+ Bool_t doPlotCorrs( kFALSE );
+
+ Bool_t onlyYieldCorrs( kTRUE );
+
+ if ( argc > 1 ) {
+ TString command( argv[1] );
+ if ( command.Contains( "plotpulls", TString::kIgnoreCase ) ) {
+ doPlotPulls = kTRUE;
+ doPlotErrors = kFALSE;
+ doPlotDists = kFALSE;
+ doPlotCorrs = kFALSE;
+ } else if ( command.Contains( "ploterrors", TString::kIgnoreCase ) ) {
+ doPlotPulls = kFALSE;
+ doPlotErrors = kTRUE;
+ doPlotDists = kFALSE;
+ doPlotCorrs = kFALSE;
+ } else if ( command.Contains( "plotdists", TString::kIgnoreCase ) ) {
+ doPlotPulls = kFALSE;
+ doPlotErrors = kFALSE;
+ doPlotDists = kTRUE;
+ doPlotCorrs = kFALSE;
+ } else if ( command.Contains( "plotcorrs", TString::kIgnoreCase ) ) {
+ doPlotPulls = kFALSE;
+ doPlotErrors = kFALSE;
+ doPlotDists = kFALSE;
+ doPlotCorrs = kTRUE;
+ if ( command.Contains( "plotcorrsall", TString::kIgnoreCase ) ) {
+ onlyYieldCorrs = kFALSE;
+ }
+ } else {
+ cerr << "Unknown command: \"" << command << "\", exiting..." << endl;
+ return EXIT_FAILURE;
+ }
+ }
+ if ( argc > 2 ) {
+ nExpt = atoi( argv[2] );
+ }
+ if ( argc > 3 ) {
+ inputFileName = argv[3];
+ }
+ if ( argc > 4 ) {
+ treeName = argv[4];
+ }
+
+ if ( doPlotPulls ) {
+ plotPulls( inputFileName, treeName, nExpt );
+ }
+ if ( doPlotErrors ) {
+ plotErrors( inputFileName, treeName, nExpt );
+ }
+ if ( doPlotDists ) {
+ plotDists( inputFileName, treeName, nExpt );
+ }
+ if ( doPlotCorrs ) {
+ plotCorrelations( inputFileName, treeName, nExpt, onlyYieldCorrs );
+ }
+
+ return EXIT_SUCCESS;
}
-
-void plotPulls(const TString& fileName, const TString& treeName, Int_t numExpts)
+void plotPulls( const TString& fileName, const TString& treeName, Int_t numExpts )
{
- TString texName("pulls.tex");
- cout<<"Opening file \""<<texName<<"\" for writing table."<<endl;
- std::ofstream fout(texName);
-
- // write the table heading
- fout<<"\\begin{tabular}{lccc}"<<endl;
- fout<<"\\hline"<<endl;
- fout<<"Fit Parameter & Entries & Pull Mean & Pull Width \\\\"<<endl;
- fout<<"\\hline"<<endl;
-
- // open the file and get the tree
- TFile * file = TFile::Open(fileName);
- if (!file) {
- cerr<<"Can't open file: "<<fileName<<endl;
- return;
- }
- TTree * tree = (TTree*) file->Get(treeName);
- if (!tree) {
- cerr<<"Can't find tree: "<<treeName<<endl;
- return;
- }
-
- // get the array of leaves from the tree
- TObjArray* pArray = tree->GetListOfLeaves();
- if (!pArray) {
- cerr<<"Can't get leaf array from tree."<<endl;
- return;
- }
- TObjArray& array = *pArray;
-
- // create a canvas, histogram and gaussian function
- TCanvas * c1 = new TCanvas("c1","c1");
- Int_t nBins = static_cast<Int_t>( numExpts/5.0 );
- TH1F* histo = new TH1F("histo","",nBins,-5.0,5.0);
- TF1 gaus("gaus","gaus(0)",-5.0,5.0);
- gaus.SetParName(0,"N");
- gaus.SetParName(1,"#mu");
- gaus.SetParName(2,"#sigma");
-
- Int_t arraySize(array.GetEntries());
- cout<<"Looping over array of size: "<<arraySize<<endl;
- for (Int_t i(0); i<arraySize; ++i) {
-
- // reset the starting values of the Gaussian parameters
- gaus.SetParameter(0,5.0);
- gaus.SetParameter(1,0.0);
- gaus.SetParameter(2,1.0);
-
- // grab the leaf from the array
- // check that it's valid
- TLeaf* leaf = (TLeaf*) array.At(i);
- if (!leaf) {
- break;
- }
-
- // get the leaf name
- // check that it contains "Pull"
- TString name = leaf->GetName();
- if (!name.Contains("Pull")) {
- continue;
- }
-
- // create the plotting command from the leaf name
- TString plotCmd(name); plotCmd += ">>histo";
-
- // set the histogram axis title
- histo->SetXTitle(name);
-
- // draw the data into the histogram
- tree->Draw(plotCmd);
-
- // draw the histogram and fit it
- histo->Draw("E1P");
- histo->Fit("gaus","EQ");
- histo->Draw("E1P");
-
- // save the plot to an eps file
- TString plotName(name);
- plotName += ".eps";
- c1->SaveAs(plotName);
-
- // write the pull data to the text file
- TString compName(name);
- compName.ReplaceAll("_","\\_");
- fout << compName << " & " << histo->Integral() << " & " << "$" << gaus.GetParameter(1) << " \\pm " << gaus.GetParError(1) << "$" << " & " << "$" << gaus.GetParameter(2) << " \\pm " << gaus.GetParError(2) << "$" << " \\\\" << endl;
- }
-
- // write the table footer
- fout<<"\\hline"<<endl;
- fout<<"\\end{tabular}"<<endl;
- fout.close();
-
- delete histo;
- delete c1;
- delete tree;
- file->Close();
- delete file;
+ TString texName( "pulls.tex" );
+ cout << "Opening file \"" << texName << "\" for writing table." << endl;
+ std::ofstream fout( texName );
+
+ // write the table heading
+ fout << "\\begin{tabular}{lccc}" << endl;
+ fout << "\\hline" << endl;
+ fout << "Fit Parameter & Entries & Pull Mean & Pull Width \\\\" << endl;
+ fout << "\\hline" << endl;
+
+ // open the file and get the tree
+ TFile* file = TFile::Open( fileName );
+ if ( ! file ) {
+ cerr << "Can't open file: " << fileName << endl;
+ return;
+ }
+ TTree* tree = (TTree*)file->Get( treeName );
+ if ( ! tree ) {
+ cerr << "Can't find tree: " << treeName << endl;
+ return;
+ }
+
+ // get the array of leaves from the tree
+ TObjArray* pArray = tree->GetListOfLeaves();
+ if ( ! pArray ) {
+ cerr << "Can't get leaf array from tree." << endl;
+ return;
+ }
+ TObjArray& array = *pArray;
+
+ // create a canvas, histogram and gaussian function
+ TCanvas* c1 = new TCanvas( "c1", "c1" );
+ Int_t nBins = static_cast<Int_t>( numExpts / 5.0 );
+ TH1F* histo = new TH1F( "histo", "", nBins, -5.0, 5.0 );
+ TF1 gaus( "gaus", "gaus(0)", -5.0, 5.0 );
+ gaus.SetParName( 0, "N" );
+ gaus.SetParName( 1, "#mu" );
+ gaus.SetParName( 2, "#sigma" );
+
+ Int_t arraySize( array.GetEntries() );
+ cout << "Looping over array of size: " << arraySize << endl;
+ for ( Int_t i( 0 ); i < arraySize; ++i ) {
+
+ // reset the starting values of the Gaussian parameters
+ gaus.SetParameter( 0, 5.0 );
+ gaus.SetParameter( 1, 0.0 );
+ gaus.SetParameter( 2, 1.0 );
+
+ // grab the leaf from the array
+ // check that it's valid
+ TLeaf* leaf = (TLeaf*)array.At( i );
+ if ( ! leaf ) {
+ break;
+ }
+
+ // get the leaf name
+ // check that it contains "Pull"
+ TString name = leaf->GetName();
+ if ( ! name.Contains( "Pull" ) ) {
+ continue;
+ }
+
+ // create the plotting command from the leaf name
+ TString plotCmd( name );
+ plotCmd += ">>histo";
+
+ // set the histogram axis title
+ histo->SetXTitle( name );
+
+ // draw the data into the histogram
+ tree->Draw( plotCmd );
+
+ // draw the histogram and fit it
+ histo->Draw( "E1P" );
+ histo->Fit( "gaus", "EQ" );
+ histo->Draw( "E1P" );
+
+ // save the plot to an eps file
+ TString plotName( name );
+ plotName += ".eps";
+ c1->SaveAs( plotName );
+
+ // write the pull data to the text file
+ TString compName( name );
+ compName.ReplaceAll( "_", "\\_" );
+ fout << compName << " & " << histo->Integral() << " & "
+ << "$" << gaus.GetParameter( 1 ) << " \\pm " << gaus.GetParError( 1 ) << "$"
+ << " & "
+ << "$" << gaus.GetParameter( 2 ) << " \\pm " << gaus.GetParError( 2 ) << "$"
+ << " \\\\" << endl;
+ }
+
+ // write the table footer
+ fout << "\\hline" << endl;
+ fout << "\\end{tabular}" << endl;
+ fout.close();
+
+ delete histo;
+ delete c1;
+ delete tree;
+ file->Close();
+ delete file;
}
-void plotErrors(const TString& fileName, const TString& treeName, Int_t numExpts)
+void plotErrors( const TString& fileName, const TString& treeName, Int_t numExpts )
{
- // open the file and get the tree
- TFile * file = TFile::Open(fileName);
- if (!file) {
- cerr<<"Can't open file: "<<fileName<<endl;
- return;
- }
- TTree * tree = (TTree*) file->Get(treeName);
- if (!tree) {
- cerr<<"Can't find tree: "<<treeName<<endl;
- return;
- }
-
- // get the array of leaves from the tree
- TObjArray* pArray = tree->GetListOfLeaves();
- if (!pArray) {
- cerr<<"Can't get leaf array from tree."<<endl;
- return;
- }
- TObjArray& array = *pArray;
-
- // create a canvas, histogram pointer and gaussian function
- TCanvas * c1 = new TCanvas("c1","c1");
- Int_t nBins = static_cast<Int_t>( numExpts/5.0 );
- TH1F* histo(0);
- TF1 gaus("gaus","gaus(0)",-5.0,5.0);
- gaus.SetParName(0,"N");
- gaus.SetParName(1,"#mu");
- gaus.SetParName(2,"#sigma");
-
- Int_t arraySize(array.GetEntries());
- cout<<"Looping over array of size: "<<arraySize<<endl;
- for (Int_t i(0); i<arraySize; ++i) {
-
- // grab the leaf from the array
- // check that it's valid
- TLeaf* leaf = (TLeaf*) array.At(i);
- if (!leaf) {
- break;
- }
-
- // get the leaf name
- // check that it contains "Error"
- TString name = leaf->GetName();
- if (!name.Contains("Error")) {
- continue;
- }
-
- // create the plotting command from the leaf name
- TString plotCmd(name); plotCmd += ">>histo";
-
- // create the histogram from the minimum and maximum values of the leaf
- Double_t min = tree->GetMinimum(name);
- Double_t max = tree->GetMaximum(name);
- histo = new TH1F("histo", "", 50, min, max);
- tree->Draw(plotCmd);
-
- // now find the mean and RMS of the leaf
- Double_t mean = histo->GetMean();
- Double_t rms = histo->GetRMS();
-
- // delete and recreate the histo as mean+/-5sigma
- min = mean-5.0*rms;
- max = mean+5.0*rms;
- delete histo;
- histo = new TH1F("histo", "", nBins, min, max);
- tree->Draw(plotCmd);
-
- // set the histogram axis title
- histo->SetXTitle(name);
-
- // draw the data into the histogram
- tree->Draw(plotCmd);
-
- // reset the starting values of the Gaussian parameters
- gaus.SetRange(min, max);
- gaus.SetParameter(0,histo->GetMaximum()*50.0/nBins);
- gaus.SetParameter(1,histo->GetMean());
- gaus.SetParameter(2,histo->GetRMS());
-
- // draw the histogram and fit it
- histo->Draw("E1P");
- histo->Fit("gaus","EQ");
- histo->Draw("E1P");
-
- // save the plot to an eps file
- TString plotName(name);
- plotName += ".eps";
- c1->SaveAs(plotName);
-
- // delete the histogram
- delete histo;
- }
-
- delete c1;
- delete tree;
- file->Close();
- delete file;
+ // open the file and get the tree
+ TFile* file = TFile::Open( fileName );
+ if ( ! file ) {
+ cerr << "Can't open file: " << fileName << endl;
+ return;
+ }
+ TTree* tree = (TTree*)file->Get( treeName );
+ if ( ! tree ) {
+ cerr << "Can't find tree: " << treeName << endl;
+ return;
+ }
+
+ // get the array of leaves from the tree
+ TObjArray* pArray = tree->GetListOfLeaves();
+ if ( ! pArray ) {
+ cerr << "Can't get leaf array from tree." << endl;
+ return;
+ }
+ TObjArray& array = *pArray;
+
+ // create a canvas, histogram pointer and gaussian function
+ TCanvas* c1 = new TCanvas( "c1", "c1" );
+ Int_t nBins = static_cast<Int_t>( numExpts / 5.0 );
+ TH1F* histo( 0 );
+ TF1 gaus( "gaus", "gaus(0)", -5.0, 5.0 );
+ gaus.SetParName( 0, "N" );
+ gaus.SetParName( 1, "#mu" );
+ gaus.SetParName( 2, "#sigma" );
+
+ Int_t arraySize( array.GetEntries() );
+ cout << "Looping over array of size: " << arraySize << endl;
+ for ( Int_t i( 0 ); i < arraySize; ++i ) {
+
+ // grab the leaf from the array
+ // check that it's valid
+ TLeaf* leaf = (TLeaf*)array.At( i );
+ if ( ! leaf ) {
+ break;
+ }
+
+ // get the leaf name
+ // check that it contains "Error"
+ TString name = leaf->GetName();
+ if ( ! name.Contains( "Error" ) ) {
+ continue;
+ }
+
+ // create the plotting command from the leaf name
+ TString plotCmd( name );
+ plotCmd += ">>histo";
+
+ // create the histogram from the minimum and maximum values of the leaf
+ Double_t min = tree->GetMinimum( name );
+ Double_t max = tree->GetMaximum( name );
+ histo = new TH1F( "histo", "", 50, min, max );
+ tree->Draw( plotCmd );
+
+ // now find the mean and RMS of the leaf
+ Double_t mean = histo->GetMean();
+ Double_t rms = histo->GetRMS();
+
+ // delete and recreate the histo as mean+/-5sigma
+ min = mean - 5.0 * rms;
+ max = mean + 5.0 * rms;
+ delete histo;
+ histo = new TH1F( "histo", "", nBins, min, max );
+ tree->Draw( plotCmd );
+
+ // set the histogram axis title
+ histo->SetXTitle( name );
+
+ // draw the data into the histogram
+ tree->Draw( plotCmd );
+
+ // reset the starting values of the Gaussian parameters
+ gaus.SetRange( min, max );
+ gaus.SetParameter( 0, histo->GetMaximum() * 50.0 / nBins );
+ gaus.SetParameter( 1, histo->GetMean() );
+ gaus.SetParameter( 2, histo->GetRMS() );
+
+ // draw the histogram and fit it
+ histo->Draw( "E1P" );
+ histo->Fit( "gaus", "EQ" );
+ histo->Draw( "E1P" );
+
+ // save the plot to an eps file
+ TString plotName( name );
+ plotName += ".eps";
+ c1->SaveAs( plotName );
+
+ // delete the histogram
+ delete histo;
+ }
+
+ delete c1;
+ delete tree;
+ file->Close();
+ delete file;
}
-void plotDists(const TString& fileName, const TString& treeName, Int_t numExpts)
+void plotDists( const TString& fileName, const TString& treeName, Int_t numExpts )
{
- TString texName("dists.tex");
- cout<<"Opening file \""<<texName<<"\" for writing table."<<endl;
- std::ofstream fout(texName);
-
- // write the table heading
- fout<<"\\begin{tabular}{lcccccc}"<<endl;
- fout<<"\\hline"<<endl;
- fout<<"Fit Parameter & Entries & True Value & Distribution Mean & Distribution Width & Residual Mean & Residual Width \\\\"<<endl;
- fout<<"\\hline"<<endl;
-
- TFile * file = TFile::Open(fileName);
- if (!file) {
- cerr<<"Can't open file: "<<fileName<<endl;
- return;
- }
- TTree * tree = (TTree*) file->Get(treeName);
- if (!tree) {
- cerr<<"Can't find tree: "<<treeName<<endl;
- return;
- }
-
- // get the array of leaves from the tree
- TObjArray* pArray = tree->GetListOfLeaves();
- if (!pArray) {
- cerr<<"Can't get leaf array from tree."<<endl;
- return;
- }
- TObjArray& array = *pArray;
-
- // create a canvas and gaussian function
- TCanvas * c1 = new TCanvas("c1","c1");
- TF1 gaus("gaus","gaus(0)",-5,5);
- gaus.SetParName(0,"N");
- gaus.SetParName(1,"#mu");
- gaus.SetParName(2,"#sigma");
-
- Int_t nBins = static_cast<Int_t>( numExpts/5.0 );
-
- Int_t arraySize(array.GetEntries());
- cout<<"Looping over array of size: "<<arraySize<<endl;
- for (Int_t i(0); i<arraySize; ++i) {
-
- // grab the leaf from the array
- // check that it's valid
- TLeaf* leaf = (TLeaf*) array.At(i);
- if (!leaf) {
- break;
- }
-
- // get the leaf name
- // check that it is not a pull, error, truth value or correlation
- // also check that it isn't "iExpt" or "fitStatus"
- TString name = leaf->GetName();
- if (name.EndsWith("_Pull") || name.EndsWith("_Error") ||
- name.EndsWith("_True") || name.BeginsWith("corr__") ||
- name.EndsWith("_GCC") || name=="iExpt" || name=="fitStatus") {
- continue;
- }
-
- // only plot variables that are varying in the fit and fit fractions
- TString namePull(name); namePull += "_Pull";
- if ( ( ! name.Contains("TotFF") ) && ( ! name.Contains("FitFrac") ) && ( ! tree->GetBranch(namePull) ) ) {
- continue;
- }
-
- // create the plotting command from the leaf name
- TString plotCmd(name); plotCmd += ">>histo";
-
- // create the histogram from the minimum and maximum values of the leaf
- Double_t min = tree->GetMinimum(name);
- Double_t max = tree->GetMaximum(name);
- TH1F* histo = new TH1F("histo","",50,min,max);
- tree->Draw(plotCmd);
-
- // now find the mean and RMS of the leaf
- // the recreate the histo as mean+/-5sigma
- Double_t mean = histo->GetMean();
- Double_t rms = histo->GetRMS();
- Double_t xMin = mean-5.0*rms;
- Double_t xMax = mean+5.0*rms;
- if ( ( name.Contains("TotFF") || ( name.Contains("FitFrac") && name.Contains("Sq") ) ) && xMin < 0.0 ) {
- xMin = 0.0;
- }
- delete histo;
- histo = new TH1F("histo","",nBins,xMin,xMax);
- tree->Draw(plotCmd);
-
- // set the Gaussian parameters to the mean and RMS
- gaus.SetParameter(0,5.0);
- gaus.SetParameter(1,histo->GetMean());
- gaus.SetParameter(2,histo->GetRMS());
-
- // set the histogram axis title
- histo->SetXTitle(name);
-
- // draw the histogram and fit it
- histo->Draw("E1P");
- histo->Fit("gaus","EQ");
- histo->Draw("E1P");
-
- // plot the true value as an arrow
- TString trueName(name); trueName += "_True";
-
- Double_t maxTrueVal = tree->GetMaximum(trueName);
- Double_t minTrueVal = tree->GetMinimum(trueName);
- Bool_t goodTrueVal = kTRUE;
- if ( TMath::Abs( maxTrueVal - minTrueVal ) > 1e-6 ) {
- goodTrueVal = kFALSE;
- }
- Double_t trueVal = maxTrueVal;
- Double_t arrowHeight = histo->GetMaximum() * 0.2;
- TArrow arrow( trueVal, 0.0, trueVal, arrowHeight , 0.05, "<" );
- arrow.SetLineColor( kRed );
- if ( goodTrueVal ) {
- arrow.Draw();
- }
-
- // save the plot to an eps file
- TString plotName(name);
- plotName += ".eps";
- c1->SaveAs(plotName);
-
- // grab the values
- Double_t entries = histo->Integral();
- Double_t distMean = gaus.GetParameter(1);
- Double_t distMeanErr = gaus.GetParError(1);
- Double_t distWidth = gaus.GetParameter(2);
- Double_t distWidthErr = gaus.GetParError(2);
-
- // plot the residual
- delete histo;
- histo = new TH1F("histo","",nBins,xMin-trueVal,xMax-trueVal);
- plotCmd = name; plotCmd += "-"; plotCmd += trueName; plotCmd += ">>histo";
- tree->Draw(plotCmd);
-
- TString xTitle = name;
- xTitle += "_Residual";
- histo->SetXTitle( xTitle );
-
- Double_t trueValue(0.0);
- Double_t residualMean(0.0);
- Double_t residualMeanErr(0.0);
- Double_t residualWidth(0.0);
- Double_t residualWidthErr(0.0);
-
- // set the Gaussian parameters to the mean and RMS
- gaus.SetParameter(0,5.0);
- gaus.SetParameter(1,histo->GetMean());
- gaus.SetParameter(2,histo->GetRMS());
-
- // draw the histogram and fit it
- histo->Draw("E1P");
- histo->Fit("gaus","EQ");
- histo->Draw("E1P");
-
- plotName = name;
- plotName += "_Residual.eps";
- c1->SaveAs(plotName);
-
- // grab the values
- trueValue = tree->GetMinimum(trueName);
- residualMean = gaus.GetParameter(1);
- residualMeanErr = gaus.GetParError(1);
- residualWidth = gaus.GetParameter(2);
- residualWidthErr = gaus.GetParError(2);
-
- // write the distribution data to the text file
- TString compName(name);
- compName.ReplaceAll("_","\\_");
- fout << compName << " & " << entries << " & " << trueValue << " & ";
- fout << "$" << distMean << " \\pm " << distMeanErr << "$" << " & ";
- fout << "$" << distWidth << " \\pm " << distWidthErr << "$" << " & ";
- fout << "$" << residualMean << " \\pm " << residualMeanErr << "$" << " & ";
- fout << "$" << residualWidth << " \\pm " << residualWidthErr << "$" << " & ";
- fout << " \\\\" << endl;
-
- // delete the histogram
- delete histo;
- }
-
- // write the table footer
- fout<<"\\hline"<<endl;
- fout<<"\\end{tabular}"<<endl;
- fout.close();
-
- delete c1;
- delete tree;
- file->Close();
- delete file;
+ TString texName( "dists.tex" );
+ cout << "Opening file \"" << texName << "\" for writing table." << endl;
+ std::ofstream fout( texName );
+
+ // write the table heading
+ fout << "\\begin{tabular}{lcccccc}" << endl;
+ fout << "\\hline" << endl;
+ fout << "Fit Parameter & Entries & True Value & Distribution Mean & Distribution Width & Residual Mean & Residual Width \\\\"
+ << endl;
+ fout << "\\hline" << endl;
+
+ TFile* file = TFile::Open( fileName );
+ if ( ! file ) {
+ cerr << "Can't open file: " << fileName << endl;
+ return;
+ }
+ TTree* tree = (TTree*)file->Get( treeName );
+ if ( ! tree ) {
+ cerr << "Can't find tree: " << treeName << endl;
+ return;
+ }
+
+ // get the array of leaves from the tree
+ TObjArray* pArray = tree->GetListOfLeaves();
+ if ( ! pArray ) {
+ cerr << "Can't get leaf array from tree." << endl;
+ return;
+ }
+ TObjArray& array = *pArray;
+
+ // create a canvas and gaussian function
+ TCanvas* c1 = new TCanvas( "c1", "c1" );
+ TF1 gaus( "gaus", "gaus(0)", -5, 5 );
+ gaus.SetParName( 0, "N" );
+ gaus.SetParName( 1, "#mu" );
+ gaus.SetParName( 2, "#sigma" );
+
+ Int_t nBins = static_cast<Int_t>( numExpts / 5.0 );
+
+ Int_t arraySize( array.GetEntries() );
+ cout << "Looping over array of size: " << arraySize << endl;
+ for ( Int_t i( 0 ); i < arraySize; ++i ) {
+
+ // grab the leaf from the array
+ // check that it's valid
+ TLeaf* leaf = (TLeaf*)array.At( i );
+ if ( ! leaf ) {
+ break;
+ }
+
+ // get the leaf name
+ // check that it is not a pull, error, truth value or correlation
+ // also check that it isn't "iExpt" or "fitStatus"
+ TString name = leaf->GetName();
+ if ( name.EndsWith( "_Pull" ) || name.EndsWith( "_Error" ) || name.EndsWith( "_True" ) ||
+ name.BeginsWith( "corr__" ) || name.EndsWith( "_GCC" ) || name == "iExpt" ||
+ name == "fitStatus" ) {
+ continue;
+ }
+
+ // only plot variables that are varying in the fit and fit fractions
+ TString namePull( name );
+ namePull += "_Pull";
+ if ( ( ! name.Contains( "TotFF" ) ) && ( ! name.Contains( "FitFrac" ) ) &&
+ ( ! tree->GetBranch( namePull ) ) ) {
+ continue;
+ }
+
+ // create the plotting command from the leaf name
+ TString plotCmd( name );
+ plotCmd += ">>histo";
+
+ // create the histogram from the minimum and maximum values of the leaf
+ Double_t min = tree->GetMinimum( name );
+ Double_t max = tree->GetMaximum( name );
+ TH1F* histo = new TH1F( "histo", "", 50, min, max );
+ tree->Draw( plotCmd );
+
+ // now find the mean and RMS of the leaf
+ // the recreate the histo as mean+/-5sigma
+ Double_t mean = histo->GetMean();
+ Double_t rms = histo->GetRMS();
+ Double_t xMin = mean - 5.0 * rms;
+ Double_t xMax = mean + 5.0 * rms;
+ if ( ( name.Contains( "TotFF" ) || ( name.Contains( "FitFrac" ) && name.Contains( "Sq" ) ) ) &&
+ xMin < 0.0 ) {
+ xMin = 0.0;
+ }
+ delete histo;
+ histo = new TH1F( "histo", "", nBins, xMin, xMax );
+ tree->Draw( plotCmd );
+
+ // set the Gaussian parameters to the mean and RMS
+ gaus.SetParameter( 0, 5.0 );
+ gaus.SetParameter( 1, histo->GetMean() );
+ gaus.SetParameter( 2, histo->GetRMS() );
+
+ // set the histogram axis title
+ histo->SetXTitle( name );
+
+ // draw the histogram and fit it
+ histo->Draw( "E1P" );
+ histo->Fit( "gaus", "EQ" );
+ histo->Draw( "E1P" );
+
+ // plot the true value as an arrow
+ TString trueName( name );
+ trueName += "_True";
+
+ Double_t maxTrueVal = tree->GetMaximum( trueName );
+ Double_t minTrueVal = tree->GetMinimum( trueName );
+ Bool_t goodTrueVal = kTRUE;
+ if ( TMath::Abs( maxTrueVal - minTrueVal ) > 1e-6 ) {
+ goodTrueVal = kFALSE;
+ }
+ Double_t trueVal = maxTrueVal;
+ Double_t arrowHeight = histo->GetMaximum() * 0.2;
+ TArrow arrow( trueVal, 0.0, trueVal, arrowHeight, 0.05, "<" );
+ arrow.SetLineColor( kRed );
+ if ( goodTrueVal ) {
+ arrow.Draw();
+ }
+
+ // save the plot to an eps file
+ TString plotName( name );
+ plotName += ".eps";
+ c1->SaveAs( plotName );
+
+ // grab the values
+ Double_t entries = histo->Integral();
+ Double_t distMean = gaus.GetParameter( 1 );
+ Double_t distMeanErr = gaus.GetParError( 1 );
+ Double_t distWidth = gaus.GetParameter( 2 );
+ Double_t distWidthErr = gaus.GetParError( 2 );
+
+ // plot the residual
+ delete histo;
+ histo = new TH1F( "histo", "", nBins, xMin - trueVal, xMax - trueVal );
+ plotCmd = name;
+ plotCmd += "-";
+ plotCmd += trueName;
+ plotCmd += ">>histo";
+ tree->Draw( plotCmd );
+
+ TString xTitle = name;
+ xTitle += "_Residual";
+ histo->SetXTitle( xTitle );
+
+ Double_t trueValue( 0.0 );
+ Double_t residualMean( 0.0 );
+ Double_t residualMeanErr( 0.0 );
+ Double_t residualWidth( 0.0 );
+ Double_t residualWidthErr( 0.0 );
+
+ // set the Gaussian parameters to the mean and RMS
+ gaus.SetParameter( 0, 5.0 );
+ gaus.SetParameter( 1, histo->GetMean() );
+ gaus.SetParameter( 2, histo->GetRMS() );
+
+ // draw the histogram and fit it
+ histo->Draw( "E1P" );
+ histo->Fit( "gaus", "EQ" );
+ histo->Draw( "E1P" );
+
+ plotName = name;
+ plotName += "_Residual.eps";
+ c1->SaveAs( plotName );
+
+ // grab the values
+ trueValue = tree->GetMinimum( trueName );
+ residualMean = gaus.GetParameter( 1 );
+ residualMeanErr = gaus.GetParError( 1 );
+ residualWidth = gaus.GetParameter( 2 );
+ residualWidthErr = gaus.GetParError( 2 );
+
+ // write the distribution data to the text file
+ TString compName( name );
+ compName.ReplaceAll( "_", "\\_" );
+ fout << compName << " & " << entries << " & " << trueValue << " & ";
+ fout << "$" << distMean << " \\pm " << distMeanErr << "$"
+ << " & ";
+ fout << "$" << distWidth << " \\pm " << distWidthErr << "$"
+ << " & ";
+ fout << "$" << residualMean << " \\pm " << residualMeanErr << "$"
+ << " & ";
+ fout << "$" << residualWidth << " \\pm " << residualWidthErr << "$"
+ << " & ";
+ fout << " \\\\" << endl;
+
+ // delete the histogram
+ delete histo;
+ }
+
+ // write the table footer
+ fout << "\\hline" << endl;
+ fout << "\\end{tabular}" << endl;
+ fout.close();
+
+ delete c1;
+ delete tree;
+ file->Close();
+ delete file;
}
-void plotCorrelations(const TString& fileName, const TString& treeName, Int_t numExpts, Bool_t onlyYieldCorrs)
+void plotCorrelations( const TString& fileName,
+ const TString& treeName,
+ Int_t numExpts,
+ Bool_t onlyYieldCorrs )
{
- TFile * file = TFile::Open(fileName);
- if (!file) {
- cerr<<"Can't open file: "<<fileName<<endl;
- return;
- }
- TTree * tree = (TTree*) file->Get(treeName);
- if (!tree) {
- cerr<<"Can't find tree: "<<treeName<<endl;
- return;
- }
-
- // get the array of leaves from the tree
- TObjArray* pArray = tree->GetListOfLeaves();
- if (!pArray) {
- cerr<<"Can't get leaf array from tree."<<endl;
- return;
- }
- TObjArray& array = *pArray;
-
- // create a canvas and gaussian function
- TCanvas * c1 = new TCanvas("c1","c1");
- TF1 gaus("gaus","gaus(0)",-1,1);
- gaus.SetParName(0,"N");
- gaus.SetParName(1,"#mu");
- gaus.SetParName(2,"#sigma");
-
- Int_t nBins = static_cast<Int_t>( numExpts/5.0 );
-
- Int_t arraySize(array.GetEntries());
- cout<<"Looping over array of size: "<<arraySize<<endl;
- for (Int_t i(0); i<arraySize; ++i) {
-
- // grab the leaf from the array
- // check that it's valid
- TLeaf* leaf = (TLeaf*) array.At(i);
- if (!leaf) {
- break;
- }
-
- // get the leaf name and check that it is a correlation
- TString name = leaf->GetName();
- if ( ! name.BeginsWith("corr__") && ! name.EndsWith("GCC") ) {
- continue;
- }
-
- // check that if it is not a global correlation coeff then
- // it is a correlation between two yield parameters (if requested)
- if ( onlyYieldCorrs && ! name.EndsWith("GCC") ) {
- TString namePart("");
- Ssiz_t a(0);
- name.Tokenize( namePart, a, "_" );
- name.Tokenize( namePart, a, "_" );
- if ( ! namePart.Contains("Events") ) {
- continue;
- }
- name.Tokenize( namePart, a, "_" );
- if ( ! namePart.Contains("Events") ) {
- continue;
- }
- }
-
- // create the plotting command from the leaf name
- TString plotCmd(name); plotCmd += ">>histo";
-
- // create the histogram from the minimum and maximum values of the leaf
- Double_t min = tree->GetMinimum(name);
- Double_t max = tree->GetMaximum(name);
- TH1F* histo = new TH1F("histo","",50,min,max);
- tree->Draw(plotCmd);
-
- // now find the mean and RMS of the leaf
- // the recreate the histo as mean+/-5sigma
- Double_t mean = histo->GetMean();
- Double_t rms = histo->GetRMS();
- delete histo;
- histo = new TH1F("histo","",nBins,mean-5.0*rms,mean+5.0*rms);
- tree->Draw(plotCmd);
-
- // set the Gaussian parameters to the mean and RMS
- gaus.SetParameter(0,5.0);
- gaus.SetParameter(1,histo->GetMean());
- gaus.SetParameter(2,histo->GetRMS());
-
- // set the histogram axis title
- histo->SetXTitle(name);
-
- // draw the histogram and fit it
- histo->Draw("E1P");
- histo->Fit("gaus","EQ");
- histo->Draw("E1P");
-
- // save the plot to an eps file
- TString plotName(name);
- plotName += ".eps";
- c1->SaveAs(plotName);
-
- // delete the histogram
- delete histo;
- }
-
- delete c1;
- delete tree;
- file->Close();
- delete file;
+ TFile* file = TFile::Open( fileName );
+ if ( ! file ) {
+ cerr << "Can't open file: " << fileName << endl;
+ return;
+ }
+ TTree* tree = (TTree*)file->Get( treeName );
+ if ( ! tree ) {
+ cerr << "Can't find tree: " << treeName << endl;
+ return;
+ }
+
+ // get the array of leaves from the tree
+ TObjArray* pArray = tree->GetListOfLeaves();
+ if ( ! pArray ) {
+ cerr << "Can't get leaf array from tree." << endl;
+ return;
+ }
+ TObjArray& array = *pArray;
+
+ // create a canvas and gaussian function
+ TCanvas* c1 = new TCanvas( "c1", "c1" );
+ TF1 gaus( "gaus", "gaus(0)", -1, 1 );
+ gaus.SetParName( 0, "N" );
+ gaus.SetParName( 1, "#mu" );
+ gaus.SetParName( 2, "#sigma" );
+
+ Int_t nBins = static_cast<Int_t>( numExpts / 5.0 );
+
+ Int_t arraySize( array.GetEntries() );
+ cout << "Looping over array of size: " << arraySize << endl;
+ for ( Int_t i( 0 ); i < arraySize; ++i ) {
+
+ // grab the leaf from the array
+ // check that it's valid
+ TLeaf* leaf = (TLeaf*)array.At( i );
+ if ( ! leaf ) {
+ break;
+ }
+
+ // get the leaf name and check that it is a correlation
+ TString name = leaf->GetName();
+ if ( ! name.BeginsWith( "corr__" ) && ! name.EndsWith( "GCC" ) ) {
+ continue;
+ }
+
+ // check that if it is not a global correlation coeff then
+ // it is a correlation between two yield parameters (if requested)
+ if ( onlyYieldCorrs && ! name.EndsWith( "GCC" ) ) {
+ TString namePart( "" );
+ Ssiz_t a( 0 );
+ name.Tokenize( namePart, a, "_" );
+ name.Tokenize( namePart, a, "_" );
+ if ( ! namePart.Contains( "Events" ) ) {
+ continue;
+ }
+ name.Tokenize( namePart, a, "_" );
+ if ( ! namePart.Contains( "Events" ) ) {
+ continue;
+ }
+ }
+
+ // create the plotting command from the leaf name
+ TString plotCmd( name );
+ plotCmd += ">>histo";
+
+ // create the histogram from the minimum and maximum values of the leaf
+ Double_t min = tree->GetMinimum( name );
+ Double_t max = tree->GetMaximum( name );
+ TH1F* histo = new TH1F( "histo", "", 50, min, max );
+ tree->Draw( plotCmd );
+
+ // now find the mean and RMS of the leaf
+ // the recreate the histo as mean+/-5sigma
+ Double_t mean = histo->GetMean();
+ Double_t rms = histo->GetRMS();
+ delete histo;
+ histo = new TH1F( "histo", "", nBins, mean - 5.0 * rms, mean + 5.0 * rms );
+ tree->Draw( plotCmd );
+
+ // set the Gaussian parameters to the mean and RMS
+ gaus.SetParameter( 0, 5.0 );
+ gaus.SetParameter( 1, histo->GetMean() );
+ gaus.SetParameter( 2, histo->GetRMS() );
+
+ // set the histogram axis title
+ histo->SetXTitle( name );
+
+ // draw the histogram and fit it
+ histo->Draw( "E1P" );
+ histo->Fit( "gaus", "EQ" );
+ histo->Draw( "E1P" );
+
+ // save the plot to an eps file
+ TString plotName( name );
+ plotName += ".eps";
+ c1->SaveAs( plotName );
+
+ // delete the histogram
+ delete histo;
+ }
+
+ delete c1;
+ delete tree;
+ file->Close();
+ delete file;
}
-
diff --git a/examples/QuasiFlatSqDalitz-CustomMasses.cc b/examples/QuasiFlatSqDalitz-CustomMasses.cc
index f5d2667..de9a1bd 100644
--- a/examples/QuasiFlatSqDalitz-CustomMasses.cc
+++ b/examples/QuasiFlatSqDalitz-CustomMasses.cc
@@ -1,119 +1,121 @@
/*
Copyright 2018 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
-#include <cstdlib>
-#include <iostream>
-#include <string>
-#include <vector>
+#include "LauKinematics.hh"
+#include "LauRandom.hh"
#include "TFile.h"
#include "TRandom.h"
#include "TTree.h"
-#include "LauKinematics.hh"
-#include "LauRandom.hh"
+#include <cstdlib>
+#include <iostream>
+#include <string>
+#include <vector>
/*
* Generates toy MC according to EvtGen's FLATSQDALITZ model
*
* In LHCb simulation versions Sim08 and Sim09, and also in the global EvtGen
* version 2.0.0 the FLATSQDALITZ model does not generate perfectly uniformly
* in the square Dalitz plot.
*
* This issue was fixed in EvtGen 2.1.0 onwards, and hence in LHCb Sim10 since
* that uses a later tag of the global EvtGen repository.
*
* Usage: QuasiFlatSqDalitz-CustomMasses <parent mass> <child_1 mass> <child_2 mass> <child_3 mass> <nevents> <output file name>
*/
int main( int argc, char** argv )
{
- // Convert the command-line arguments into a useful format
- const std::vector<std::string> cmdLineArgs{ argv, argv+argc };
-
- if ( cmdLineArgs.size() != 7 ) {
- std::cout << "Usage: " << cmdLineArgs[0] << " <parent mass> <child_1 mass> <child_2 mass> <child_3 mass> <nevents> <output file name>" << std::endl;
- return 0;
- }
-
- const Double_t parent_mass { std::stod( cmdLineArgs[1] ) };
- const Double_t child_1_mass { std::stod( cmdLineArgs[2] ) };
- const Double_t child_2_mass { std::stod( cmdLineArgs[3] ) };
- const Double_t child_3_mass { std::stod( cmdLineArgs[4] ) };
- const ULong_t nEvents { std::stoul( cmdLineArgs[5] ) };
- const TString outputFileName { cmdLineArgs[6] };
-
- // Do not change this!
- const Bool_t squareDP { kTRUE };
-
- LauKinematics kinematics { child_1_mass, child_2_mass, child_3_mass, parent_mass, squareDP };
-
- Double_t m12Sq{0.0}, m13Sq{0.0}, m23Sq{0.0}, mPrime{0.0}, thPrime{0.0}, jacobian{0.0}, invJacobian{0.0}, randomNum{0.0};
-
- TFile * file { TFile::Open(outputFileName,"recreate") };
- TTree * tree { new TTree("genResults","genResults") };
-
- tree->Branch("m12Sq",&m12Sq,"m12Sq/D");
- tree->Branch("m13Sq",&m13Sq,"m13Sq/D");
- tree->Branch("m23Sq",&m23Sq,"m23Sq/D");
- tree->Branch("mPrime",&mPrime,"mPrime/D");
- tree->Branch("thPrime",&thPrime,"thPrime/D");
- tree->Branch("jacobian",&jacobian,"jacobian/D");
- tree->Branch("invJacobian",&invJacobian,"invJacobian/D");
- tree->Branch("randomNum",&randomNum,"randomNum/D");
-
- Bool_t evtAccepted{kFALSE};
- for ( ULong_t i{0}; i < nEvents; ++i ) {
-
- if ( nEvents > 1000 && i%(nEvents/1000)==0 ) {
- std::cout << "Generating event " << i << std::endl;
- }
-
- evtAccepted = kFALSE;
-
- while ( !evtAccepted ) {
- kinematics.genFlatPhaseSpace( m13Sq, m23Sq );
- kinematics.updateKinematics( m13Sq, m23Sq );
- jacobian = kinematics.calcSqDPJacobian();
- invJacobian = (jacobian<1.0) ? 1.0 : 1.0/jacobian;
-
- randomNum = LauRandom::randomFun()->Rndm();
- if ( randomNum < invJacobian ) {
- evtAccepted = kTRUE;
- m12Sq = kinematics.getm12Sq();
- mPrime = kinematics.getmPrime();
- thPrime = kinematics.getThetaPrime();
-
- tree->Fill();
- }
- }
- }
-
- file->Write();
- file->Close();
- delete file;
-
- return EXIT_SUCCESS;
+ // Convert the command-line arguments into a useful format
+ const std::vector<std::string> cmdLineArgs { argv, argv + argc };
+
+ if ( cmdLineArgs.size() != 7 ) {
+ std::cout << "Usage: " << cmdLineArgs[0]
+ << " <parent mass> <child_1 mass> <child_2 mass> <child_3 mass> <nevents> <output file name>"
+ << std::endl;
+ return 0;
+ }
+
+ const Double_t parent_mass { std::stod( cmdLineArgs[1] ) };
+ const Double_t child_1_mass { std::stod( cmdLineArgs[2] ) };
+ const Double_t child_2_mass { std::stod( cmdLineArgs[3] ) };
+ const Double_t child_3_mass { std::stod( cmdLineArgs[4] ) };
+ const ULong_t nEvents { std::stoul( cmdLineArgs[5] ) };
+ const TString outputFileName { cmdLineArgs[6] };
+
+ // Do not change this!
+ const Bool_t squareDP { kTRUE };
+
+ LauKinematics kinematics { child_1_mass, child_2_mass, child_3_mass, parent_mass, squareDP };
+
+ Double_t m12Sq { 0.0 }, m13Sq { 0.0 }, m23Sq { 0.0 }, mPrime { 0.0 }, thPrime { 0.0 },
+ jacobian { 0.0 }, invJacobian { 0.0 }, randomNum { 0.0 };
+
+ TFile* file { TFile::Open( outputFileName, "recreate" ) };
+ TTree* tree { new TTree( "genResults", "genResults" ) };
+
+ tree->Branch( "m12Sq", &m12Sq, "m12Sq/D" );
+ tree->Branch( "m13Sq", &m13Sq, "m13Sq/D" );
+ tree->Branch( "m23Sq", &m23Sq, "m23Sq/D" );
+ tree->Branch( "mPrime", &mPrime, "mPrime/D" );
+ tree->Branch( "thPrime", &thPrime, "thPrime/D" );
+ tree->Branch( "jacobian", &jacobian, "jacobian/D" );
+ tree->Branch( "invJacobian", &invJacobian, "invJacobian/D" );
+ tree->Branch( "randomNum", &randomNum, "randomNum/D" );
+
+ Bool_t evtAccepted { kFALSE };
+ for ( ULong_t i { 0 }; i < nEvents; ++i ) {
+
+ if ( nEvents > 1000 && i % ( nEvents / 1000 ) == 0 ) {
+ std::cout << "Generating event " << i << std::endl;
+ }
+
+ evtAccepted = kFALSE;
+
+ while ( ! evtAccepted ) {
+ kinematics.genFlatPhaseSpace( m13Sq, m23Sq );
+ kinematics.updateKinematics( m13Sq, m23Sq );
+ jacobian = kinematics.calcSqDPJacobian();
+ invJacobian = ( jacobian < 1.0 ) ? 1.0 : 1.0 / jacobian;
+
+ randomNum = LauRandom::randomFun()->Rndm();
+ if ( randomNum < invJacobian ) {
+ evtAccepted = kTRUE;
+ m12Sq = kinematics.getm12Sq();
+ mPrime = kinematics.getmPrime();
+ thPrime = kinematics.getThetaPrime();
+
+ tree->Fill();
+ }
+ }
+ }
+
+ file->Write();
+ file->Close();
+ delete file;
+
+ return EXIT_SUCCESS;
}
-
diff --git a/examples/QuasiFlatSqDalitz.cc b/examples/QuasiFlatSqDalitz.cc
index fe50222..44e3b07 100644
--- a/examples/QuasiFlatSqDalitz.cc
+++ b/examples/QuasiFlatSqDalitz.cc
@@ -1,121 +1,126 @@
/*
Copyright 2018 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
-#include <cstdlib>
-#include <iostream>
-#include <string>
-#include <vector>
+#include "LauDaughters.hh"
+#include "LauKinematics.hh"
+#include "LauRandom.hh"
#include "TFile.h"
#include "TRandom.h"
#include "TTree.h"
-#include "LauDaughters.hh"
-#include "LauKinematics.hh"
-#include "LauRandom.hh"
+#include <cstdlib>
+#include <iostream>
+#include <string>
+#include <vector>
/*
* Generates toy MC according to EvtGen's FLATSQDALITZ model
*
* In LHCb simulation versions Sim08 and Sim09, and also in the global EvtGen
* version 2.0.0 the FLATSQDALITZ model does not generate perfectly uniformly
* in the square Dalitz plot.
*
* This issue was fixed in EvtGen 2.1.0 onwards, and hence in LHCb Sim10 since
* that uses a later tag of the global EvtGen repository.
*
* Usage: QuasiFlatSqDalitz <parent> <child_1> <child_2> <child_3> <nevents>
*/
int main( int argc, char** argv )
{
- // Convert the command-line arguments into a useful format
- const std::vector<TString> cmdLineArgs{ argv, argv+argc };
-
- if ( cmdLineArgs.size() != 6 ) {
- std::cout << "Usage: " << cmdLineArgs[0] << " <parent> <child_1> <child_2> <child_3> <nevents>" << std::endl;
- return 0;
- }
-
- const TString& parent { cmdLineArgs[1] };
- const TString& child_1 { cmdLineArgs[2] };
- const TString& child_2 { cmdLineArgs[3] };
- const TString& child_3 { cmdLineArgs[4] };
- const ULong_t nEvents { std::stoul( cmdLineArgs[5].Data() ) };
-
- // Do not change this!
- const Bool_t squareDP { kTRUE };
-
- LauDaughters* daughters { new LauDaughters(parent, child_1, child_2, child_3, squareDP) };
- LauKinematics* kinematics { daughters->getKinematics() };
-
- Double_t m12Sq{0.0}, m13Sq{0.0}, m23Sq{0.0}, mPrime{0.0}, thPrime{0.0}, jacobian{0.0}, invJacobian{0.0}, randomNum{0.0};
-
- const TString outputFileName { TString::Format( "%s_%s_%s_%s.root", daughters->getSanitisedNameParent().Data(), daughters->getSanitisedNameDaug1().Data(), daughters->getSanitisedNameDaug2().Data(), daughters->getSanitisedNameDaug3().Data() ) };
- TFile * file { TFile::Open(outputFileName,"recreate") };
- TTree * tree { new TTree("genResults","genResults") };
-
- tree->Branch("m12Sq",&m12Sq,"m12Sq/D");
- tree->Branch("m13Sq",&m13Sq,"m13Sq/D");
- tree->Branch("m23Sq",&m23Sq,"m23Sq/D");
- tree->Branch("mPrime",&mPrime,"mPrime/D");
- tree->Branch("thPrime",&thPrime,"thPrime/D");
- tree->Branch("jacobian",&jacobian,"jacobian/D");
- tree->Branch("invJacobian",&invJacobian,"invJacobian/D");
- tree->Branch("randomNum",&randomNum,"randomNum/D");
-
- Bool_t evtAccepted{kFALSE};
- for ( ULong_t i{0}; i < nEvents; ++i ) {
-
- if ( nEvents > 1000 && i%(nEvents/1000)==0 ) {
- std::cout << "Generating event " << i << std::endl;
- }
-
- evtAccepted = kFALSE;
-
- while ( !evtAccepted ) {
- kinematics->genFlatPhaseSpace( m13Sq, m23Sq );
- kinematics->updateKinematics( m13Sq, m23Sq );
- jacobian = kinematics->calcSqDPJacobian();
- invJacobian = (jacobian<1.0) ? 1.0 : 1.0/jacobian;
-
- randomNum = LauRandom::randomFun()->Rndm();
- if ( randomNum < invJacobian ) {
- evtAccepted = kTRUE;
- m12Sq = kinematics->getm12Sq();
- mPrime = kinematics->getmPrime();
- thPrime = kinematics->getThetaPrime();
-
- tree->Fill();
- }
- }
- }
-
- file->Write();
- file->Close();
- delete file;
-
- return EXIT_SUCCESS;
+ // Convert the command-line arguments into a useful format
+ const std::vector<TString> cmdLineArgs { argv, argv + argc };
+
+ if ( cmdLineArgs.size() != 6 ) {
+ std::cout << "Usage: " << cmdLineArgs[0]
+ << " <parent> <child_1> <child_2> <child_3> <nevents>" << std::endl;
+ return 0;
+ }
+
+ const TString& parent { cmdLineArgs[1] };
+ const TString& child_1 { cmdLineArgs[2] };
+ const TString& child_2 { cmdLineArgs[3] };
+ const TString& child_3 { cmdLineArgs[4] };
+ const ULong_t nEvents { std::stoul( cmdLineArgs[5].Data() ) };
+
+ // Do not change this!
+ const Bool_t squareDP { kTRUE };
+
+ LauDaughters* daughters { new LauDaughters( parent, child_1, child_2, child_3, squareDP ) };
+ LauKinematics* kinematics { daughters->getKinematics() };
+
+ Double_t m12Sq { 0.0 }, m13Sq { 0.0 }, m23Sq { 0.0 }, mPrime { 0.0 }, thPrime { 0.0 },
+ jacobian { 0.0 }, invJacobian { 0.0 }, randomNum { 0.0 };
+
+ const TString outputFileName { TString::Format( "%s_%s_%s_%s.root",
+ daughters->getSanitisedNameParent().Data(),
+ daughters->getSanitisedNameDaug1().Data(),
+ daughters->getSanitisedNameDaug2().Data(),
+ daughters->getSanitisedNameDaug3().Data() ) };
+ TFile* file { TFile::Open( outputFileName, "recreate" ) };
+ TTree* tree { new TTree( "genResults", "genResults" ) };
+
+ tree->Branch( "m12Sq", &m12Sq, "m12Sq/D" );
+ tree->Branch( "m13Sq", &m13Sq, "m13Sq/D" );
+ tree->Branch( "m23Sq", &m23Sq, "m23Sq/D" );
+ tree->Branch( "mPrime", &mPrime, "mPrime/D" );
+ tree->Branch( "thPrime", &thPrime, "thPrime/D" );
+ tree->Branch( "jacobian", &jacobian, "jacobian/D" );
+ tree->Branch( "invJacobian", &invJacobian, "invJacobian/D" );
+ tree->Branch( "randomNum", &randomNum, "randomNum/D" );
+
+ Bool_t evtAccepted { kFALSE };
+ for ( ULong_t i { 0 }; i < nEvents; ++i ) {
+
+ if ( nEvents > 1000 && i % ( nEvents / 1000 ) == 0 ) {
+ std::cout << "Generating event " << i << std::endl;
+ }
+
+ evtAccepted = kFALSE;
+
+ while ( ! evtAccepted ) {
+ kinematics->genFlatPhaseSpace( m13Sq, m23Sq );
+ kinematics->updateKinematics( m13Sq, m23Sq );
+ jacobian = kinematics->calcSqDPJacobian();
+ invJacobian = ( jacobian < 1.0 ) ? 1.0 : 1.0 / jacobian;
+
+ randomNum = LauRandom::randomFun()->Rndm();
+ if ( randomNum < invJacobian ) {
+ evtAccepted = kTRUE;
+ m12Sq = kinematics->getm12Sq();
+ mPrime = kinematics->getmPrime();
+ thPrime = kinematics->getThetaPrime();
+
+ tree->Fill();
+ }
+ }
+ }
+
+ file->Write();
+ file->Close();
+ delete file;
+
+ return EXIT_SUCCESS;
}
-
diff --git a/examples/ResultsExtractor.cc b/examples/ResultsExtractor.cc
index a305398..6901c14 100644
--- a/examples/ResultsExtractor.cc
+++ b/examples/ResultsExtractor.cc
@@ -1,55 +1,55 @@
/*
Copyright 2013 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
-#include <cstdlib>
+#include "LauResultsExtractor.hh"
#include "TString.h"
-#include "LauResultsExtractor.hh"
+#include <cstdlib>
-int main(const int argc, const char** argv)
+int main( const int argc, const char** argv )
{
- Int_t nExpt(1);
- TString inputFileName("input-list.txt");
- TString outputFileName("output.root");
- TString treeName("fitResults");
-
- if (argc > 1) {
- nExpt = atoi(argv[1]);
- }
- if (argc > 2) {
- inputFileName = argv[2];
- }
- if (argc > 3) {
- outputFileName = argv[3];
- }
- if (argc > 4) {
- treeName = argv[4];
- }
-
- LauResultsExtractor myExtractor(inputFileName,outputFileName,treeName);
- myExtractor.process(nExpt);
-
- return EXIT_SUCCESS;
+ Int_t nExpt( 1 );
+ TString inputFileName( "input-list.txt" );
+ TString outputFileName( "output.root" );
+ TString treeName( "fitResults" );
+
+ if ( argc > 1 ) {
+ nExpt = atoi( argv[1] );
+ }
+ if ( argc > 2 ) {
+ inputFileName = argv[2];
+ }
+ if ( argc > 3 ) {
+ outputFileName = argv[3];
+ }
+ if ( argc > 4 ) {
+ treeName = argv[4];
+ }
+
+ LauResultsExtractor myExtractor( inputFileName, outputFileName, treeName );
+ myExtractor.process( nExpt );
+
+ return EXIT_SUCCESS;
}
diff --git a/examples/SimFitCoordinator.cc b/examples/SimFitCoordinator.cc
index 1bb9d7b..5be0570 100644
--- a/examples/SimFitCoordinator.cc
+++ b/examples/SimFitCoordinator.cc
@@ -1,81 +1,80 @@
/*
Copyright 2013 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
-#include <cstdlib>
-#include <iostream>
-
-#include <vector>
+#include "LauSimFitCoordinator.hh"
#include "TFile.h"
#include "TRandom.h"
#include "TString.h"
#include "TSystem.h"
-#include "LauSimFitCoordinator.hh"
+#include <cstdlib>
+#include <iostream>
+#include <vector>
void usage( std::ostream& out, const TString& progName )
{
- out<<"Usage:\n";
- out<<progName<<" <iFit> <isData> <nExpt> [firstExpt = 0] [numTasks = 2] [port = 0]\n";
+ out << "Usage:\n";
+ out << progName << " <iFit> <isData> <nExpt> [firstExpt = 0] [numTasks = 2] [port = 0]\n";
}
-int main(const int argc, const char ** argv)
+int main( const int argc, const char** argv )
{
- if ( argc < 4 ) {
- usage( std::cerr, argv[0] );
- return EXIT_FAILURE;
- }
-
- UInt_t iFit = atoi( argv[1] );
- Bool_t isToy = ! atoi( argv[2] );
- UInt_t nExpt = atoi( argv[3] );
- UInt_t firstExpt = 0;
- UInt_t nTasks = 2;
- UInt_t port = 0;
-
- Bool_t useAsymmErrors = kFALSE;
- Bool_t twoStageFit = kFALSE;
-
- if ( argc > 4 ) {
- firstExpt = atoi( argv[4] );
-
- if ( argc > 5 ) {
- nTasks = atoi( argv[5] );
-
- if ( argc > 6 ) {
- port = atoi( argv[6] );
- }
- }
- }
-
- TString ntupleName = "coordinator-ntuple-";
- ntupleName += iFit;
- ntupleName += ".root";
-
- LauSimFitCoordinator coordinator( nTasks, port );
- coordinator.setNExpts( nExpt, firstExpt, isToy );
- coordinator.runSimFit( ntupleName, useAsymmErrors, twoStageFit );
-
- return EXIT_SUCCESS;
+ if ( argc < 4 ) {
+ usage( std::cerr, argv[0] );
+ return EXIT_FAILURE;
+ }
+
+ UInt_t iFit = atoi( argv[1] );
+ Bool_t isToy = ! atoi( argv[2] );
+ UInt_t nExpt = atoi( argv[3] );
+ UInt_t firstExpt = 0;
+ UInt_t nTasks = 2;
+ UInt_t port = 0;
+
+ Bool_t useAsymmErrors = kFALSE;
+ Bool_t twoStageFit = kFALSE;
+
+ if ( argc > 4 ) {
+ firstExpt = atoi( argv[4] );
+
+ if ( argc > 5 ) {
+ nTasks = atoi( argv[5] );
+
+ if ( argc > 6 ) {
+ port = atoi( argv[6] );
+ }
+ }
+ }
+
+ TString ntupleName = "coordinator-ntuple-";
+ ntupleName += iFit;
+ ntupleName += ".root";
+
+ LauSimFitCoordinator coordinator( nTasks, port );
+ coordinator.setNExpts( nExpt, firstExpt, isToy );
+ coordinator.runSimFit( ntupleName, useAsymmErrors, twoStageFit );
+
+ return EXIT_SUCCESS;
}
diff --git a/examples/SimFitTask.cc b/examples/SimFitTask.cc
index 7e76ff3..4fbca9c 100644
--- a/examples/SimFitTask.cc
+++ b/examples/SimFitTask.cc
@@ -1,258 +1,274 @@
/*
Copyright 2013 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
-#include <cstdlib>
-#include <iostream>
-#include <vector>
-
-#include "TFile.h"
-#include "TH2.h"
-#include "TString.h"
-#include "TTree.h"
-
-#include "LauSimpleFitModel.hh"
#include "LauBkgndDPModel.hh"
#include "LauDaughters.hh"
#include "LauEffModel.hh"
#include "LauIsobarDynamics.hh"
#include "LauMagPhaseCoeffSet.hh"
#include "LauRandom.hh"
+#include "LauSimpleFitModel.hh"
#include "LauVetoes.hh"
+#include "TFile.h"
+#include "TH2.h"
+#include "TString.h"
+#include "TTree.h"
+
+#include <cstdlib>
+#include <iostream>
+#include <vector>
+
void usage( std::ostream& out, const TString& progName )
{
- out<<"Usage:\n";
- out<<progName<<" gen <category = DD or LL> [nExpt = 1] [firstExpt = 0]\n";
- out<<"or\n";
- out<<progName<<" fit <category = DD or LL> <iFit> <port> [hostname] [nExpt = 1] [firstExpt = 0]"<<std::endl;
+ out << "Usage:\n";
+ out << progName << " gen <category = DD or LL> [nExpt = 1] [firstExpt = 0]\n";
+ out << "or\n";
+ out << progName
+ << " fit <category = DD or LL> <iFit> <port> [hostname] [nExpt = 1] [firstExpt = 0]"
+ << std::endl;
}
int main( int argc, char** argv )
{
- // Process command-line arguments
- // Usage:
- // ./SimFitTask gen <category = DD or LL> [nExpt = 1] [firstExpt = 0]
- // or
- // ./SimFitTask fit <category = DD or LL> <iFit> <port> [nExpt = 1] [firstExpt = 0]
- if ( argc < 3 ) {
- usage( std::cerr, argv[0] );
- return EXIT_FAILURE;
- }
-
- TString command = argv[1];
- command.ToLower();
-
- TString category = argv[2];
- if ( category != "DD" && category != "LL" ) {
- usage( std::cerr, argv[0] );
- return EXIT_FAILURE;
- }
-
- Int_t iFit(0);
- UInt_t port(5000);
- TString hostname("localhost");
- Int_t nExpt(1);
- Int_t firstExpt(0);
- Bool_t isToy(kTRUE);
- if ( command == "gen" ) {
- if ( argc > 3 ) {
- nExpt = atoi( argv[3] );
- if ( argc > 4 ) {
- firstExpt = atoi( argv[4] );
- }
- }
- } else if ( command == "fit" ) {
- if ( argc < 5 ) {
- usage( std::cerr, argv[0] );
- return EXIT_FAILURE;
- }
- iFit = atoi( argv[3] );
- port = atoi( argv[4] );
- if ( argc > 5 ) {
- hostname = argv[5];
- if ( argc > 6 ) {
- nExpt = atoi( argv[6] );
- if ( argc > 7 ) {
- firstExpt = atoi( argv[7] );
- }
- }
- }
- } else {
- usage( std::cerr, argv[0] );
- return EXIT_FAILURE;
- }
-
- // If you want to use square DP histograms for efficiency,
- // backgrounds or you just want the square DP co-ordinates
- // stored in the toy MC ntuple then set this to kTRUE
- Bool_t squareDP = kFALSE;
-
- // This defines the DP => decay is B0 -> pi0 pi0 K_S0
- // Particle 1 = pi0
- // Particle 2 = pi0
- // Particle 3 = KS_0
- // The DP is defined in terms of m13Sq and m23Sq
- LauDaughters* daughters = new LauDaughters("B0", "pi0", "pi0", "K_S0", squareDP);
-
- // Optionally apply some vetoes to the DP
- LauVetoes* vetoes = new LauVetoes();
-
- // Define the efficiency model (defaults to unity everywhere)
- // Can optionally provide a histogram to model variation over DP
- // (example syntax given in commented-out section)
- LauEffModel* effModel = new LauEffModel(daughters, vetoes);
- //TFile *effHistFile = TFile::Open("histoFiles/efficiency.root", "read");
- //TH2* effHist = dynamic_cast<TH2*>(effHistFile->Get("effHist"));
- //Bool_t useInterpolation = kTRUE;
- //Bool_t fluctuateBins = kFALSE;
- //Bool_t useUpperHalf = kTRUE;
- //effModel->setEffHisto(effHist, useInterpolation, fluctuateBins, 0.0, 0.0, useUpperHalf, squareDP);
-
- // Create the isobar model
- LauIsobarDynamics* sigModel = new LauIsobarDynamics(daughters, effModel);
- LauAbsResonance* res(0);
- // resPairAmpInt = 1 => resonance mass is m23.
- // resPairAmpInt = 3 => resonance mass is m12.
- res = sigModel->addResonance("f_0(980)", 3, LauAbsResonance::Flatte);
- res = sigModel->addResonance("f_2(1270)", 3, LauAbsResonance::RelBW);
- res = sigModel->addResonance("K*0(892)", 1, LauAbsResonance::RelBW);
- res->fixMass(kFALSE);
- res = sigModel->addResonance("K*0_0(1430)", 1, LauAbsResonance::LASS);
-
- // Set the maximum signal DP ASq value
- // If you do not provide a value, one will be determined automatically,
- // which should be close to the true maximum but is not guaranteed to
- // be optimal.
- // Any value, whether manually provided or automatically determined,
- // will be automatically adjusted to avoid bias or extreme inefficiency
- // but it is best to set this by hand once you've found the right value
- // through some trial and error.
- sigModel->setASqMaxValue(1.25);
-
- TString integralsFileName("integ-");
- integralsFileName += category;
- integralsFileName += ".dat";
- sigModel->setIntFileName( integralsFileName );
-
- // Create the fit model
- LauSimpleFitModel* fitModel = new LauSimpleFitModel(sigModel);
-
- // Create the complex coefficients for the isobar model
- // Here we're using the magnitude and phase form:
- // c_j = a_j exp(i*delta_j)
- std::vector<LauAbsCoeffSet*> coeffset;
- coeffset.push_back( new LauMagPhaseCoeffSet("f_0(980)", 1.00, 0.00, kTRUE, kTRUE) );
- coeffset.push_back( new LauMagPhaseCoeffSet("f_2(1270)", 0.53, 1.39, kFALSE, kFALSE) );
- coeffset.push_back( new LauMagPhaseCoeffSet("K*0(892)", 0.87, 1.99, kFALSE, kFALSE) );
- coeffset.push_back( new LauMagPhaseCoeffSet("K*0_0(1430)", 1.17, -1.59, kFALSE, kFALSE) );
- for (std::vector<LauAbsCoeffSet*>::iterator iter=coeffset.begin(); iter!=coeffset.end(); ++iter) {
- fitModel->setAmpCoeffSet(*iter);
- }
-
- // Set the signal yield and define whether it is fixed or floated
- TString sigEventsName = "signalEvents" + category;
- Double_t nSig(500.0);
- if ( category == "DD" ) {
- nSig = 750.0;
- }
- LauParameter * nSigEvents = new LauParameter(sigEventsName,nSig,-2.0*nSig,2.0*nSig,kFALSE);
- fitModel->setNSigEvents(nSigEvents);
-
- // Set the number of experiments to generate or fit and which
- // experiment to start with
- fitModel->setNExpts( nExpt, firstExpt, isToy );
-
- // Optionally load in continuum background DP model histogram
- // (example syntax given in commented-out section)
- std::vector<TString> bkgndNames(1);
- bkgndNames[0] = "comb" + category;
- fitModel->setBkgndClassNames( bkgndNames );
- Double_t nBkgnd = 1200.0;
- if ( category == "DD" ) {
- nBkgnd = 2500.0;
- }
- LauParameter* nBkgndEvents = new LauParameter(bkgndNames[0],nBkgnd,-2.0*nBkgnd,2.0*nBkgnd,kFALSE);
- fitModel->setNBkgndEvents( nBkgndEvents );
- //TString bkgndFileName("histoFiles/bkgndDPs.root");
- //TFile* bkgndFile = TFile::Open(bkgndFileName.Data(), "read");
- //TH2* bkgndDP = dynamic_cast<TH2*>(bkgndFile->Get("AllmTheta")); // m', theta'
- LauBkgndDPModel* bkgndModel = new LauBkgndDPModel(daughters, vetoes);
- //bkgndModel->setBkgndHisto(bkgndDP, useInterpolation, fluctuateBins, useUpperHalf, squareDP);
- fitModel->setBkgndDPModel( bkgndNames[0], bkgndModel );
-
- // Randomise initial fit values for the signal mode
- fitModel->useRandomInitFitPars(kTRUE);
-
- const Bool_t haveBkgnds = ( fitModel->nBkgndClasses() > 0 );
-
- // Switch on/off Poissonian smearing of total number of events
- fitModel->doPoissonSmearing(haveBkgnds);
-
- // Switch on/off Extended ML Fit option
- fitModel->doEMLFit(haveBkgnds);
-
- // Activate two-stage fit
- fitModel->twoStageFit(kTRUE);
-
- // Generate toy from the fitted parameters
- //TString fitToyFileName("fitToyMC_");
- //fitToyFileName += category;
- //fitToyFileName += "-Task_";
- //fitToyFileName += iFit;
- //fitToyFileName += ".root";
- //fitModel->compareFitData(100, fitToyFileName);
-
- // Write out per-event likelihoods and sWeights
- //TString splotFileName("splot_");
- //splotFileName += category;
- //splotFileName += "-Task_";
- //splotFileName += iFit;
- //splotFileName += ".root";
- //fitModel->writeSPlotData(splotFileName, "splot", kFALSE);
-
- // Set the names of the files to read/write
- TString dataFile("gen-"); dataFile += category; dataFile += "-Task.root";
- TString treeName("genResults");
- TString rootFileName("");
- TString tableFileName("");
- if (command == "fit") {
- rootFileName = "fit"; rootFileName += category; rootFileName += "-Task_"; rootFileName += iFit;
- rootFileName += "_expt_"; rootFileName += firstExpt;
- rootFileName += "-"; rootFileName += (firstExpt+nExpt-1);
- rootFileName += ".root";
- tableFileName = "fit"; tableFileName += category; tableFileName += "TaskResults_"; tableFileName += iFit;
- } else {
- rootFileName = "dummy.root";
- tableFileName = "gen"; tableFileName += category; tableFileName += "TaskResults_";
- }
-
- // Execute the generation/fit
- if ( command == "fit" ) {
- fitModel->runTask( dataFile, treeName, rootFileName, tableFileName, hostname, port );
- } else {
- fitModel->run( command, dataFile, treeName, rootFileName, tableFileName );
- }
-
- return EXIT_SUCCESS;
+ // Process command-line arguments
+ // Usage:
+ // ./SimFitTask gen <category = DD or LL> [nExpt = 1] [firstExpt = 0]
+ // or
+ // ./SimFitTask fit <category = DD or LL> <iFit> <port> [nExpt = 1] [firstExpt = 0]
+ if ( argc < 3 ) {
+ usage( std::cerr, argv[0] );
+ return EXIT_FAILURE;
+ }
+
+ TString command = argv[1];
+ command.ToLower();
+
+ TString category = argv[2];
+ if ( category != "DD" && category != "LL" ) {
+ usage( std::cerr, argv[0] );
+ return EXIT_FAILURE;
+ }
+
+ Int_t iFit( 0 );
+ UInt_t port( 5000 );
+ TString hostname( "localhost" );
+ Int_t nExpt( 1 );
+ Int_t firstExpt( 0 );
+ Bool_t isToy( kTRUE );
+ if ( command == "gen" ) {
+ if ( argc > 3 ) {
+ nExpt = atoi( argv[3] );
+ if ( argc > 4 ) {
+ firstExpt = atoi( argv[4] );
+ }
+ }
+ } else if ( command == "fit" ) {
+ if ( argc < 5 ) {
+ usage( std::cerr, argv[0] );
+ return EXIT_FAILURE;
+ }
+ iFit = atoi( argv[3] );
+ port = atoi( argv[4] );
+ if ( argc > 5 ) {
+ hostname = argv[5];
+ if ( argc > 6 ) {
+ nExpt = atoi( argv[6] );
+ if ( argc > 7 ) {
+ firstExpt = atoi( argv[7] );
+ }
+ }
+ }
+ } else {
+ usage( std::cerr, argv[0] );
+ return EXIT_FAILURE;
+ }
+
+ // If you want to use square DP histograms for efficiency,
+ // backgrounds or you just want the square DP co-ordinates
+ // stored in the toy MC ntuple then set this to kTRUE
+ Bool_t squareDP = kFALSE;
+
+ // This defines the DP => decay is B0 -> pi0 pi0 K_S0
+ // Particle 1 = pi0
+ // Particle 2 = pi0
+ // Particle 3 = KS_0
+ // The DP is defined in terms of m13Sq and m23Sq
+ LauDaughters* daughters = new LauDaughters( "B0", "pi0", "pi0", "K_S0", squareDP );
+
+ // Optionally apply some vetoes to the DP
+ LauVetoes* vetoes = new LauVetoes();
+
+ // Define the efficiency model (defaults to unity everywhere)
+ // Can optionally provide a histogram to model variation over DP
+ // (example syntax given in commented-out section)
+ LauEffModel* effModel = new LauEffModel( daughters, vetoes );
+ //TFile *effHistFile = TFile::Open("histoFiles/efficiency.root", "read");
+ //TH2* effHist = dynamic_cast<TH2*>(effHistFile->Get("effHist"));
+ //Bool_t useInterpolation = kTRUE;
+ //Bool_t fluctuateBins = kFALSE;
+ //Bool_t useUpperHalf = kTRUE;
+ //effModel->setEffHisto(effHist, useInterpolation, fluctuateBins, 0.0, 0.0, useUpperHalf, squareDP);
+
+ // Create the isobar model
+ LauIsobarDynamics* sigModel = new LauIsobarDynamics( daughters, effModel );
+ LauAbsResonance* res( 0 );
+ // resPairAmpInt = 1 => resonance mass is m23.
+ // resPairAmpInt = 3 => resonance mass is m12.
+ res = sigModel->addResonance( "f_0(980)", 3, LauAbsResonance::Flatte );
+ res = sigModel->addResonance( "f_2(1270)", 3, LauAbsResonance::RelBW );
+ res = sigModel->addResonance( "K*0(892)", 1, LauAbsResonance::RelBW );
+ res->fixMass( kFALSE );
+ res = sigModel->addResonance( "K*0_0(1430)", 1, LauAbsResonance::LASS );
+
+ // Set the maximum signal DP ASq value
+ // If you do not provide a value, one will be determined automatically,
+ // which should be close to the true maximum but is not guaranteed to
+ // be optimal.
+ // Any value, whether manually provided or automatically determined,
+ // will be automatically adjusted to avoid bias or extreme inefficiency
+ // but it is best to set this by hand once you've found the right value
+ // through some trial and error.
+ sigModel->setASqMaxValue( 1.25 );
+
+ TString integralsFileName( "integ-" );
+ integralsFileName += category;
+ integralsFileName += ".dat";
+ sigModel->setIntFileName( integralsFileName );
+
+ // Create the fit model
+ LauSimpleFitModel* fitModel = new LauSimpleFitModel( sigModel );
+
+ // Create the complex coefficients for the isobar model
+ // Here we're using the magnitude and phase form:
+ // c_j = a_j exp(i*delta_j)
+ std::vector<LauAbsCoeffSet*> coeffset;
+ coeffset.push_back( new LauMagPhaseCoeffSet( "f_0(980)", 1.00, 0.00, kTRUE, kTRUE ) );
+ coeffset.push_back( new LauMagPhaseCoeffSet( "f_2(1270)", 0.53, 1.39, kFALSE, kFALSE ) );
+ coeffset.push_back( new LauMagPhaseCoeffSet( "K*0(892)", 0.87, 1.99, kFALSE, kFALSE ) );
+ coeffset.push_back( new LauMagPhaseCoeffSet( "K*0_0(1430)", 1.17, -1.59, kFALSE, kFALSE ) );
+ for ( std::vector<LauAbsCoeffSet*>::iterator iter = coeffset.begin(); iter != coeffset.end();
+ ++iter ) {
+ fitModel->setAmpCoeffSet( *iter );
+ }
+
+ // Set the signal yield and define whether it is fixed or floated
+ TString sigEventsName = "signalEvents" + category;
+ Double_t nSig( 500.0 );
+ if ( category == "DD" ) {
+ nSig = 750.0;
+ }
+ LauParameter* nSigEvents = new LauParameter( sigEventsName, nSig, -2.0 * nSig, 2.0 * nSig, kFALSE );
+ fitModel->setNSigEvents( nSigEvents );
+
+ // Set the number of experiments to generate or fit and which
+ // experiment to start with
+ fitModel->setNExpts( nExpt, firstExpt, isToy );
+
+ // Optionally load in continuum background DP model histogram
+ // (example syntax given in commented-out section)
+ std::vector<TString> bkgndNames( 1 );
+ bkgndNames[0] = "comb" + category;
+ fitModel->setBkgndClassNames( bkgndNames );
+ Double_t nBkgnd = 1200.0;
+ if ( category == "DD" ) {
+ nBkgnd = 2500.0;
+ }
+ LauParameter* nBkgndEvents =
+ new LauParameter( bkgndNames[0], nBkgnd, -2.0 * nBkgnd, 2.0 * nBkgnd, kFALSE );
+ fitModel->setNBkgndEvents( nBkgndEvents );
+ //TString bkgndFileName("histoFiles/bkgndDPs.root");
+ //TFile* bkgndFile = TFile::Open(bkgndFileName.Data(), "read");
+ //TH2* bkgndDP = dynamic_cast<TH2*>(bkgndFile->Get("AllmTheta")); // m', theta'
+ LauBkgndDPModel* bkgndModel = new LauBkgndDPModel( daughters, vetoes );
+ //bkgndModel->setBkgndHisto(bkgndDP, useInterpolation, fluctuateBins, useUpperHalf, squareDP);
+ fitModel->setBkgndDPModel( bkgndNames[0], bkgndModel );
+
+ // Randomise initial fit values for the signal mode
+ fitModel->useRandomInitFitPars( kTRUE );
+
+ const Bool_t haveBkgnds = ( fitModel->nBkgndClasses() > 0 );
+
+ // Switch on/off Poissonian smearing of total number of events
+ fitModel->doPoissonSmearing( haveBkgnds );
+
+ // Switch on/off Extended ML Fit option
+ fitModel->doEMLFit( haveBkgnds );
+
+ // Activate two-stage fit
+ fitModel->twoStageFit( kTRUE );
+
+ // Generate toy from the fitted parameters
+ //TString fitToyFileName("fitToyMC_");
+ //fitToyFileName += category;
+ //fitToyFileName += "-Task_";
+ //fitToyFileName += iFit;
+ //fitToyFileName += ".root";
+ //fitModel->compareFitData(100, fitToyFileName);
+
+ // Write out per-event likelihoods and sWeights
+ //TString splotFileName("splot_");
+ //splotFileName += category;
+ //splotFileName += "-Task_";
+ //splotFileName += iFit;
+ //splotFileName += ".root";
+ //fitModel->writeSPlotData(splotFileName, "splot", kFALSE);
+
+ // Set the names of the files to read/write
+ TString dataFile( "gen-" );
+ dataFile += category;
+ dataFile += "-Task.root";
+ TString treeName( "genResults" );
+ TString rootFileName( "" );
+ TString tableFileName( "" );
+ if ( command == "fit" ) {
+ rootFileName = "fit";
+ rootFileName += category;
+ rootFileName += "-Task_";
+ rootFileName += iFit;
+ rootFileName += "_expt_";
+ rootFileName += firstExpt;
+ rootFileName += "-";
+ rootFileName += ( firstExpt + nExpt - 1 );
+ rootFileName += ".root";
+ tableFileName = "fit";
+ tableFileName += category;
+ tableFileName += "TaskResults_";
+ tableFileName += iFit;
+ } else {
+ rootFileName = "dummy.root";
+ tableFileName = "gen";
+ tableFileName += category;
+ tableFileName += "TaskResults_";
+ }
+
+ // Execute the generation/fit
+ if ( command == "fit" ) {
+ fitModel->runTask( dataFile, treeName, rootFileName, tableFileName, hostname, port );
+ } else {
+ fitModel->run( command, dataFile, treeName, rootFileName, tableFileName );
+ }
+
+ return EXIT_SUCCESS;
}
diff --git a/examples/SimFitTaskRooFit.cc b/examples/SimFitTaskRooFit.cc
index 1df41e0..600fd6b 100644
--- a/examples/SimFitTaskRooFit.cc
+++ b/examples/SimFitTaskRooFit.cc
@@ -1,170 +1,177 @@
/*
Copyright 2017 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
-#include <cstdlib>
-#include <iostream>
-#include <vector>
+#include "LauRooFitTask.hh"
-#include "RooRealVar.h"
-#include "RooGaussian.h"
#include "RooAddPdf.h"
-#include "RooExponential.h"
-#include "RooDataSet.h"
#include "RooArgList.h"
#include "RooArgSet.h"
+#include "RooDataSet.h"
+#include "RooExponential.h"
+#include "RooGaussian.h"
+#include "RooRealVar.h"
#include "TFile.h"
#include "TString.h"
#include "TTree.h"
-#include "LauRooFitTask.hh"
+#include <cstdlib>
+#include <iostream>
+#include <vector>
void usage( std::ostream& out, const TString& progName )
{
- out<<"Usage:\n";
- out<<progName<<" gen <category = DD or LL> [nExpt = 1] [firstExpt = 0]\n";
- out<<"or\n";
- out<<progName<<" fit <category = DD or LL> <port> [nExpt = 1] [firstExpt = 0]"<<std::endl;
+ out << "Usage:\n";
+ out << progName << " gen <category = DD or LL> [nExpt = 1] [firstExpt = 0]\n";
+ out << "or\n";
+ out << progName << " fit <category = DD or LL> <port> [nExpt = 1] [firstExpt = 0]" << std::endl;
}
int main( int argc, char** argv )
{
- // Process command-line arguments
- // Usage:
- // ./SimFitTaskRooFit gen <category = DD or LL> [nExpt = 1] [firstExpt = 0]
- // or
- // ./SimFitTaskRooFit fit <category = DD or LL> <port> [nExpt = 1] [firstExpt = 0]
- if ( argc < 3 ) {
- usage( std::cerr, argv[0] );
- return EXIT_FAILURE;
- }
-
- TString command = argv[1];
- command.ToLower();
- TString category = argv[2];
- category.ToUpper();
- if ( category != "DD" && category != "LL" ) {
- usage( std::cerr, argv[0] );
- return EXIT_FAILURE;
- }
- UInt_t port(5000);
- Int_t nExpt(1);
- Int_t firstExpt(0);
- if ( command == "gen" ) {
- if ( argc > 3 ) {
- nExpt = atoi( argv[3] );
- if ( argc > 4 ) {
- firstExpt = atoi( argv[4] );
- }
- }
- } else if ( command == "fit" ) {
- if ( argc < 4 ) {
- usage( std::cerr, argv[0] );
- return EXIT_FAILURE;
- }
- port = atoi( argv[3] );
- if ( argc > 4 ) {
- nExpt = atoi( argv[4] );
- if ( argc > 5 ) {
- firstExpt = atoi( argv[5] );
- }
- }
- } else {
- usage( std::cerr, argv[0] );
- return EXIT_FAILURE;
- }
-
- // Set the names of the files to read/write
- TString dataFile = TString::Format("data-%s.root",category.Data());
- TString treeName("fitTree");
- TString rootFileName("");
- TString tableFileName("");
- if (command == "fit") {
- rootFileName = "fit"; rootFileName += category;
- rootFileName += "_expt_"; rootFileName += firstExpt;
- rootFileName += "-"; rootFileName += (firstExpt+nExpt-1);
- rootFileName += ".root";
- tableFileName = "fitResults";
- } else {
- rootFileName = "dummy.root";
- tableFileName = "genResults";
- }
-
- // Create the RooFit model
- std::cout << "Building the model..." << std::endl;
- RooRealVar mB("mB", "m_{B}", 5.150, 5.600, "GeV/c^{2}");
-
- Double_t sig_mb_mean1_value = 5.279;
- Double_t sig_mb_sigma1_value = 0.02;
- Double_t sig_mb_sigma2_value = 0.07;
- if ( category == "DD" ) {
- sig_mb_sigma1_value *= 1.05;
- sig_mb_sigma2_value *= 1.05;
- }
- Double_t sig_mb_frac_value = 0.90;
-
- RooRealVar sig_mb_mean1("sig_mb_mean1", "", sig_mb_mean1_value, 5.200, 5.300);
- RooRealVar sig_mb_sigma1("sig_mb_sigma1", "", sig_mb_sigma1_value, 0.000, 0.100);
- RooRealVar sig_mb_sigma2("sig_mb_sigma2", "", sig_mb_sigma2_value, 0.000, 0.200);
- RooRealVar sig_mb_frac("sig_mb_frac", "", sig_mb_frac_value, 0.000, 1.000);
- sig_mb_mean1.setConstant(kFALSE);
- sig_mb_sigma1.setConstant(kTRUE);
- sig_mb_sigma2.setConstant(kTRUE);
- sig_mb_frac.setConstant(kTRUE);
-
- RooGaussian gauss1( "gauss1", "", mB, sig_mb_mean1, sig_mb_sigma1 );
- RooGaussian gauss2( "gauss2", "", mB, sig_mb_mean1, sig_mb_sigma2 );
- RooAddPdf sigPDF( "sigPDF", "", gauss1, gauss2, sig_mb_frac );
-
- RooRealVar comb_mb_slope("comb_mb_slope", "", -1.5, -10.0, 2.0);
- comb_mb_slope.setConstant(kFALSE);
-
- RooExponential combPDF( "combPDF", "", mB, comb_mb_slope );
-
- Double_t nSigEvents = 5000.0;
- if ( category == "DD" ) {
- nSigEvents *= 1.5;
- }
- Double_t nCombBgEvents = 7000.0;
- if ( category == "DD" ) {
- nCombBgEvents *= 1.7;
- }
- Double_t nTotEvents = nSigEvents + nCombBgEvents;
-
- RooRealVar sigYield( "signalEvents"+category, "", nSigEvents, -2.0*nTotEvents, 2.0*nTotEvents );
- RooRealVar combYield( "CombinatorialEvents"+category, "", nCombBgEvents, -2.0*nTotEvents, 2.0*nTotEvents );
-
- RooAddPdf model( "model", "", RooArgList( sigPDF, combPDF ), RooArgList( sigYield, combYield ) );
-
- // Execute the generation/fit
- if ( command == "fit" ) {
- // Create the task instance
- LauRooFitTask fitModel(model, kTRUE, RooArgSet(mB));
- fitModel.runTask( dataFile, treeName, rootFileName, tableFileName, "localhost", port );
- } else {
- std::cerr << "Can't do this yet" << std::endl;
- //RooDataSet* data = model.generate( RooArgSet(mB), nTotEvents );
- }
-
- return EXIT_SUCCESS;
+ // Process command-line arguments
+ // Usage:
+ // ./SimFitTaskRooFit gen <category = DD or LL> [nExpt = 1] [firstExpt = 0]
+ // or
+ // ./SimFitTaskRooFit fit <category = DD or LL> <port> [nExpt = 1] [firstExpt = 0]
+ if ( argc < 3 ) {
+ usage( std::cerr, argv[0] );
+ return EXIT_FAILURE;
+ }
+
+ TString command = argv[1];
+ command.ToLower();
+ TString category = argv[2];
+ category.ToUpper();
+ if ( category != "DD" && category != "LL" ) {
+ usage( std::cerr, argv[0] );
+ return EXIT_FAILURE;
+ }
+ UInt_t port( 5000 );
+ Int_t nExpt( 1 );
+ Int_t firstExpt( 0 );
+ if ( command == "gen" ) {
+ if ( argc > 3 ) {
+ nExpt = atoi( argv[3] );
+ if ( argc > 4 ) {
+ firstExpt = atoi( argv[4] );
+ }
+ }
+ } else if ( command == "fit" ) {
+ if ( argc < 4 ) {
+ usage( std::cerr, argv[0] );
+ return EXIT_FAILURE;
+ }
+ port = atoi( argv[3] );
+ if ( argc > 4 ) {
+ nExpt = atoi( argv[4] );
+ if ( argc > 5 ) {
+ firstExpt = atoi( argv[5] );
+ }
+ }
+ } else {
+ usage( std::cerr, argv[0] );
+ return EXIT_FAILURE;
+ }
+
+ // Set the names of the files to read/write
+ TString dataFile = TString::Format( "data-%s.root", category.Data() );
+ TString treeName( "fitTree" );
+ TString rootFileName( "" );
+ TString tableFileName( "" );
+ if ( command == "fit" ) {
+ rootFileName = "fit";
+ rootFileName += category;
+ rootFileName += "_expt_";
+ rootFileName += firstExpt;
+ rootFileName += "-";
+ rootFileName += ( firstExpt + nExpt - 1 );
+ rootFileName += ".root";
+ tableFileName = "fitResults";
+ } else {
+ rootFileName = "dummy.root";
+ tableFileName = "genResults";
+ }
+
+ // Create the RooFit model
+ std::cout << "Building the model..." << std::endl;
+ RooRealVar mB( "mB", "m_{B}", 5.150, 5.600, "GeV/c^{2}" );
+
+ Double_t sig_mb_mean1_value = 5.279;
+ Double_t sig_mb_sigma1_value = 0.02;
+ Double_t sig_mb_sigma2_value = 0.07;
+ if ( category == "DD" ) {
+ sig_mb_sigma1_value *= 1.05;
+ sig_mb_sigma2_value *= 1.05;
+ }
+ Double_t sig_mb_frac_value = 0.90;
+
+ RooRealVar sig_mb_mean1( "sig_mb_mean1", "", sig_mb_mean1_value, 5.200, 5.300 );
+ RooRealVar sig_mb_sigma1( "sig_mb_sigma1", "", sig_mb_sigma1_value, 0.000, 0.100 );
+ RooRealVar sig_mb_sigma2( "sig_mb_sigma2", "", sig_mb_sigma2_value, 0.000, 0.200 );
+ RooRealVar sig_mb_frac( "sig_mb_frac", "", sig_mb_frac_value, 0.000, 1.000 );
+ sig_mb_mean1.setConstant( kFALSE );
+ sig_mb_sigma1.setConstant( kTRUE );
+ sig_mb_sigma2.setConstant( kTRUE );
+ sig_mb_frac.setConstant( kTRUE );
+
+ RooGaussian gauss1( "gauss1", "", mB, sig_mb_mean1, sig_mb_sigma1 );
+ RooGaussian gauss2( "gauss2", "", mB, sig_mb_mean1, sig_mb_sigma2 );
+ RooAddPdf sigPDF( "sigPDF", "", gauss1, gauss2, sig_mb_frac );
+
+ RooRealVar comb_mb_slope( "comb_mb_slope", "", -1.5, -10.0, 2.0 );
+ comb_mb_slope.setConstant( kFALSE );
+
+ RooExponential combPDF( "combPDF", "", mB, comb_mb_slope );
+
+ Double_t nSigEvents = 5000.0;
+ if ( category == "DD" ) {
+ nSigEvents *= 1.5;
+ }
+ Double_t nCombBgEvents = 7000.0;
+ if ( category == "DD" ) {
+ nCombBgEvents *= 1.7;
+ }
+ Double_t nTotEvents = nSigEvents + nCombBgEvents;
+
+ RooRealVar sigYield( "signalEvents" + category, "", nSigEvents, -2.0 * nTotEvents, 2.0 * nTotEvents );
+ RooRealVar combYield( "CombinatorialEvents" + category,
+ "",
+ nCombBgEvents,
+ -2.0 * nTotEvents,
+ 2.0 * nTotEvents );
+
+ RooAddPdf model( "model", "", RooArgList( sigPDF, combPDF ), RooArgList( sigYield, combYield ) );
+
+ // Execute the generation/fit
+ if ( command == "fit" ) {
+ // Create the task instance
+ LauRooFitTask fitModel( model, kTRUE, RooArgSet( mB ) );
+ fitModel.runTask( dataFile, treeName, rootFileName, tableFileName, "localhost", port );
+ } else {
+ std::cerr << "Can't do this yet" << std::endl;
+ //RooDataSet* data = model.generate( RooArgSet(mB), nTotEvents );
+ }
+
+ return EXIT_SUCCESS;
}
diff --git a/examples/mixedSampleTest.cc b/examples/mixedSampleTest.cc
index c5a6c7c..11e58d9 100644
--- a/examples/mixedSampleTest.cc
+++ b/examples/mixedSampleTest.cc
@@ -1,266 +1,285 @@
/*
Copyright 2015 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
// Code to perform the mixed sample unbinned goodness of fit test on the data and simulation provided.
//
// If the data and simulation are derived from the same underlying PDF then they will mix optimally.
// This is used to define the test statistic T = (1 / n_k (n_d + n_s) ) SUM_i^(n_d+n_s) SUM_k^(n_k) I(i,k)
// where I(i,k) is 1 if the ith event and its kth nearest neighbour are from the same sample and zero otherwise,
// n_d is the number of events in the data sample, n_s is the number of events in the simulation sample and
// n_k is the number of nearest neighbours to consider.
//
// For optimal mixing T should be Gaussian distributed with mean and width given by:
// mu_T = n_d(n_d - 1) + n_s(n_s - 1) / (n_d + n_s)(n_d + n_s - 1)
// sigma_T^2 = ( 1 / n_k(n_d+n_s) ) ( (n_d n_s)/(n_d + n_s)^2 + 4(n_d^2 n_s^2)/(n_d + n_s)^4 )
//
// This script uses 500 bootstrapped samples taken from the data and simulation provided,
// calculates T from each sample, performs a Gaussian fit to (T-mu_T)/sigma_T and reports the
// chi^2 of that fit.
-
-#include <map>
-#include <vector>
-#include <algorithm>
-#include <iostream>
-#include <cstdlib>
-
#include "TCanvas.h"
#include "TF1.h"
#include "TFile.h"
#include "TFitResult.h"
#include "TFitResultPtr.h"
#include "TH1D.h"
-#include "TMatrixD.h"
#include "TMath.h"
+#include "TMatrixD.h"
#include "TRandom3.h"
#include "TStyle.h"
#include "TTree.h"
-TRandom3* r(0);
+#include <algorithm>
+#include <cstdlib>
+#include <iostream>
+#include <map>
+#include <vector>
+
+TRandom3* r( 0 );
//Class to store a single event
class Entry {
- public:
- Entry(Bool_t mc, Double_t mPrime, Double_t thPrime)
- : _mc(mc), _mPrime(mPrime), _thPrime(thPrime) {}
-
- Bool_t isMC() { return _mc; }
-
- Double_t getDistSq(Entry* e) { return (this->_mPrime - e->_mPrime)*(this->_mPrime - e->_mPrime) + (this->_thPrime - e->_thPrime)*(this->_thPrime - e->_thPrime); }
-
- private:
- Bool_t _mc;
- Double_t _mPrime;
- Double_t _thPrime;
+ public:
+ Entry( Bool_t mc, Double_t mPrime, Double_t thPrime ) :
+ _mc( mc ),
+ _mPrime( mPrime ),
+ _thPrime( thPrime )
+ {
+ }
+
+ Bool_t isMC() { return _mc; }
+
+ Double_t getDistSq( Entry* e )
+ {
+ return ( this->_mPrime - e->_mPrime ) * ( this->_mPrime - e->_mPrime ) +
+ ( this->_thPrime - e->_thPrime ) * ( this->_thPrime - e->_thPrime );
+ }
+
+ private:
+ Bool_t _mc;
+ Double_t _mPrime;
+ Double_t _thPrime;
};
//Function to calculate the test statistic, T, for a single bootstrapped sample
-Double_t calcT(TString file0Name, TString tree0Name, TString file1Name, TString tree1Name, Int_t nd, Int_t nmc, Int_t nk) {
-
- //Open the data and simulation files
- TFile *f0(0), *f1(0);
-
- f0 = TFile::Open(file0Name);
- f1 = TFile::Open(file1Name);
-
- TTree* t0 = (TTree*)f0->Get(tree0Name);
- TTree* t1 = (TTree*)f1->Get(tree1Name);
-
- Double_t mprime(0.), thprime(0.);
-
- t0->SetBranchAddress("mPrime", &mprime);
- t0->SetBranchAddress("thPrime", &thprime);
- t1->SetBranchAddress("mPrime", &mprime);
- t1->SetBranchAddress("thPrime", &thprime);
-
- Int_t n0 = t0->GetEntries();
- Int_t n1 = t1->GetEntries();
-
- std::vector<Int_t> entries0;
- std::vector<Int_t> entries1;
-
- //Get randomised bootstrapped samples of data and simulation
- for(Int_t i=0; i<nmc; ++i) {
- entries0.push_back((Int_t)(r->Rndm()*n0));
- }
- for(Int_t i=0; i<nd; ++i) {
- entries1.push_back((Int_t)(r->Rndm()*n1));
- }
-
- //Sort entries to speed up extraction
- std::sort(entries0.begin(),entries0.end());
- std::sort(entries1.begin(),entries1.end());
-
- //Extract required entries from TTrees and store
- std::vector<Entry*> entries;
-
- for(Int_t i=0; i<nmc; ++i) {
- t0->GetEntry(entries0[i]);
- entries.push_back(new Entry(true,mprime,thprime));
- }
- for(Int_t i=0; i<nd; ++i) {
- t1->GetEntry(entries1[i]);
- entries.push_back(new Entry(false,mprime,thprime));
- }
-
- f0->Close();
- f1->Close();
-
- entries0.clear();
- entries1.clear();
-
- //Construct a matrix of the distances between all selected points
- TMatrixD distances(nmc+nd,nmc+nd);
-
- for(Int_t i=0; i<nmc+nd; ++i) {
- for(Int_t j=i; j<nmc+nd; ++j) {
- distances(i,j) = entries[i]->getDistSq(entries[j]);
- }
- }
-
- //Now calculate T
- Double_t T(0.);
-
- for(Int_t i=0; i<nmc+nd; ++i) {
- //For each entry, first sort all other entries by their distance
- std::multimap<Double_t,Int_t> distsSorted;
- for(Int_t j=0; j<i; ++j) {
- distsSorted.insert(std::pair<Double_t,Int_t>(distances(j,i),j));
- }
- for(Int_t j=i+1; j<nmc+nd; ++j) {
- distsSorted.insert(std::pair<Double_t,Int_t>(distances(i,j),j));
- }
- std::multimap<Double_t,Int_t>::iterator it = distsSorted.begin();
- //Use k nearest neighbours to calculate T
- for(Int_t k=0; k<nk; ++k) {
- if(entries[(*it).second]->isMC()==entries[i]->isMC()) ++T;
- ++it;
- }
- }
-
- //Apply the normalisation factor
- T/= nk*(nd+nmc);
-
- std::vector<Entry*>::iterator it = entries.begin();
- std::vector<Entry*>::iterator end = entries.end();
-
- //Clean up
- for( ; it!=end; ++it) {
- delete (*it);
- *it=0;
- }
- entries.clear();
-
- return T;
-
+Double_t calcT( TString file0Name,
+ TString tree0Name,
+ TString file1Name,
+ TString tree1Name,
+ Int_t nd,
+ Int_t nmc,
+ Int_t nk )
+{
+
+ //Open the data and simulation files
+ TFile *f0( 0 ), *f1( 0 );
+
+ f0 = TFile::Open( file0Name );
+ f1 = TFile::Open( file1Name );
+
+ TTree* t0 = (TTree*)f0->Get( tree0Name );
+ TTree* t1 = (TTree*)f1->Get( tree1Name );
+
+ Double_t mprime( 0. ), thprime( 0. );
+
+ t0->SetBranchAddress( "mPrime", &mprime );
+ t0->SetBranchAddress( "thPrime", &thprime );
+ t1->SetBranchAddress( "mPrime", &mprime );
+ t1->SetBranchAddress( "thPrime", &thprime );
+
+ Int_t n0 = t0->GetEntries();
+ Int_t n1 = t1->GetEntries();
+
+ std::vector<Int_t> entries0;
+ std::vector<Int_t> entries1;
+
+ //Get randomised bootstrapped samples of data and simulation
+ for ( Int_t i = 0; i < nmc; ++i ) {
+ entries0.push_back( (Int_t)( r->Rndm() * n0 ) );
+ }
+ for ( Int_t i = 0; i < nd; ++i ) {
+ entries1.push_back( (Int_t)( r->Rndm() * n1 ) );
+ }
+
+ //Sort entries to speed up extraction
+ std::sort( entries0.begin(), entries0.end() );
+ std::sort( entries1.begin(), entries1.end() );
+
+ //Extract required entries from TTrees and store
+ std::vector<Entry*> entries;
+
+ for ( Int_t i = 0; i < nmc; ++i ) {
+ t0->GetEntry( entries0[i] );
+ entries.push_back( new Entry( true, mprime, thprime ) );
+ }
+ for ( Int_t i = 0; i < nd; ++i ) {
+ t1->GetEntry( entries1[i] );
+ entries.push_back( new Entry( false, mprime, thprime ) );
+ }
+
+ f0->Close();
+ f1->Close();
+
+ entries0.clear();
+ entries1.clear();
+
+ //Construct a matrix of the distances between all selected points
+ TMatrixD distances( nmc + nd, nmc + nd );
+
+ for ( Int_t i = 0; i < nmc + nd; ++i ) {
+ for ( Int_t j = i; j < nmc + nd; ++j ) {
+ distances( i, j ) = entries[i]->getDistSq( entries[j] );
+ }
+ }
+
+ //Now calculate T
+ Double_t T( 0. );
+
+ for ( Int_t i = 0; i < nmc + nd; ++i ) {
+ //For each entry, first sort all other entries by their distance
+ std::multimap<Double_t, Int_t> distsSorted;
+ for ( Int_t j = 0; j < i; ++j ) {
+ distsSorted.insert( std::pair<Double_t, Int_t>( distances( j, i ), j ) );
+ }
+ for ( Int_t j = i + 1; j < nmc + nd; ++j ) {
+ distsSorted.insert( std::pair<Double_t, Int_t>( distances( i, j ), j ) );
+ }
+ std::multimap<Double_t, Int_t>::iterator it = distsSorted.begin();
+ //Use k nearest neighbours to calculate T
+ for ( Int_t k = 0; k < nk; ++k ) {
+ if ( entries[( *it ).second]->isMC() == entries[i]->isMC() )
+ ++T;
+ ++it;
+ }
+ }
+
+ //Apply the normalisation factor
+ T /= nk * ( nd + nmc );
+
+ std::vector<Entry*>::iterator it = entries.begin();
+ std::vector<Entry*>::iterator end = entries.end();
+
+ //Clean up
+ for ( ; it != end; ++it ) {
+ delete ( *it );
+ *it = 0;
+ }
+ entries.clear();
+
+ return T;
}
-int main(int argc, char** argv) {
-
- gStyle->SetOptStat(0);
-
- Int_t nd=100; // the number of data entries to use per sample
- Int_t nmcOvernd=10; // the number of simulation entries to use divided by the number of data entries
- Int_t nk=10; // the number of nearest neighbours to consider
- TString outFile("mixedSampleTest.pdf"); // the name of the output file for the histogram
- TString mcFile(""); // the file containing the simulation
- TString mcTree(""); // the tree containing the simulation
- TString dataFile(""); // the file containing the data
- TString dataTree(""); // the tree containing the data
- Int_t seed=0; // seed for the bootstrapping
- Int_t floatGaussianParams=0; // whether to float the mean and width of the Gaussian or not
-
- if(argc>4) {
- mcFile = argv[1];
- mcTree = argv[2];
- dataFile = argv[3];
- dataTree = argv[4];
- if(argc>5) {
- seed = atoi( argv[5] );
- if(argc>6) {
- nd = atoi( argv[6] );
- if(argc>7) {
- nmcOvernd = atoi( argv[7] );
- if(argc>8) {
- nk = atoi( argv[8] );
- if(argc>9) {
- floatGaussianParams = atoi( argv[9] );
- if(argc>10) {
- outFile = argv[10];
- }
- }
- }
+int main( int argc, char** argv )
+{
+
+ gStyle->SetOptStat( 0 );
+
+ Int_t nd = 100; // the number of data entries to use per sample
+ Int_t nmcOvernd =
+ 10; // the number of simulation entries to use divided by the number of data entries
+ Int_t nk = 10; // the number of nearest neighbours to consider
+ TString outFile( "mixedSampleTest.pdf" ); // the name of the output file for the histogram
+ TString mcFile( "" ); // the file containing the simulation
+ TString mcTree( "" ); // the tree containing the simulation
+ TString dataFile( "" ); // the file containing the data
+ TString dataTree( "" ); // the tree containing the data
+ Int_t seed = 0; // seed for the bootstrapping
+ Int_t floatGaussianParams = 0; // whether to float the mean and width of the Gaussian or not
+
+ if ( argc > 4 ) {
+ mcFile = argv[1];
+ mcTree = argv[2];
+ dataFile = argv[3];
+ dataTree = argv[4];
+ if ( argc > 5 ) {
+ seed = atoi( argv[5] );
+ if ( argc > 6 ) {
+ nd = atoi( argv[6] );
+ if ( argc > 7 ) {
+ nmcOvernd = atoi( argv[7] );
+ if ( argc > 8 ) {
+ nk = atoi( argv[8] );
+ if ( argc > 9 ) {
+ floatGaussianParams = atoi( argv[9] );
+ if ( argc > 10 ) {
+ outFile = argv[10];
+ }
+ }
+ }
+ }
}
- }
- }
- } else {
- std::cout << "Usage:\n";
- std::cout << argv[0] << " <mcFile> <mcTree> <dataFile> <dataTree> [seed = 0] [nd = 100] [nmcOvernd = 10] [nk = 10] [floatGaussianParams = 0] [outFile = \"mixedSampleTest.pdf\"]" << std::endl;
- return 0;
- }
-
-
- Int_t nmc=nmcOvernd*nd;
-
- //Calculate expected values of mu_T and sigma_T
- Double_t na(nd), nb(nmc), n(nd+nmc);
- Double_t muT = (na*(na-1) + nb*(nb-1))/(n*(n-1));
- Double_t sigT = TMath::Sqrt((na*nb/(n*n) + 4*na*na*nb*nb/(n*n*n*n))/((n)*nk));
-
- TH1D* h = new TH1D("h","",50,-5,5);
- r = new TRandom3(seed);
-
- //Calculate the test statistic for 500 bootstrapped samples and fill the histogram with (T-mu_T)/sigma_T
- for(Int_t i=0; i<500; ++i) {
- if(i%10==0) std::cout << "Processing sample " << i+1 << " of 500..." << std::endl;
- Double_t val = (calcT(mcFile,mcTree,dataFile,dataTree,nd,nmc,nk) - muT)/sigT;
- std::cout << val << std::endl;
- h->Fill(val);
- }
-
- //Perform a Gaussian fit to (T-mu_T)/sigma_T
- TCanvas can;
- TF1 gaus("gaus","gaus(0)",-5.0,5.0);
- gaus.SetParameter(0,100.);
- if(floatGaussianParams==1) {
- gaus.SetParameter(0,500.0);
- gaus.SetParameter(1,0.0);
- gaus.SetParameter(2,1.0);
- } else {
- gaus.SetParameter(0,500.0);
- gaus.FixParameter(1,0.0);
- gaus.FixParameter(2,1.0);
- }
- TFitResultPtr p = h->Fit("gaus","S");
- h->GetFunction("gaus")->SetLineColor(kRed);
- h->GetXaxis()->SetTitle("(T-#mu_{T})/#sigma_{T}");
- h->Draw("E");
- can.SaveAs(outFile);
-
- //Report the chi^2 of the Gaussian fit
- std::cout << "chi2/ndf=" << p->Chi2() << "/" << p->Ndf() << std::endl;
-
- delete r;
- delete h;
+ }
+ } else {
+ std::cout << "Usage:\n";
+ std::cout << argv[0]
+ << " <mcFile> <mcTree> <dataFile> <dataTree> [seed = 0] [nd = 100] [nmcOvernd = 10] [nk = 10] [floatGaussianParams = 0] [outFile = \"mixedSampleTest.pdf\"]"
+ << std::endl;
+ return 0;
+ }
+
+ Int_t nmc = nmcOvernd * nd;
+
+ //Calculate expected values of mu_T and sigma_T
+ Double_t na( nd ), nb( nmc ), n( nd + nmc );
+ Double_t muT = ( na * ( na - 1 ) + nb * ( nb - 1 ) ) / ( n * ( n - 1 ) );
+ Double_t sigT = TMath::Sqrt(
+ ( na * nb / ( n * n ) + 4 * na * na * nb * nb / ( n * n * n * n ) ) / ( (n)*nk ) );
+
+ TH1D* h = new TH1D( "h", "", 50, -5, 5 );
+ r = new TRandom3( seed );
+
+ //Calculate the test statistic for 500 bootstrapped samples and fill the histogram with (T-mu_T)/sigma_T
+ for ( Int_t i = 0; i < 500; ++i ) {
+ if ( i % 10 == 0 )
+ std::cout << "Processing sample " << i + 1 << " of 500..." << std::endl;
+ Double_t val = ( calcT( mcFile, mcTree, dataFile, dataTree, nd, nmc, nk ) - muT ) / sigT;
+ std::cout << val << std::endl;
+ h->Fill( val );
+ }
+
+ //Perform a Gaussian fit to (T-mu_T)/sigma_T
+ TCanvas can;
+ TF1 gaus( "gaus", "gaus(0)", -5.0, 5.0 );
+ gaus.SetParameter( 0, 100. );
+ if ( floatGaussianParams == 1 ) {
+ gaus.SetParameter( 0, 500.0 );
+ gaus.SetParameter( 1, 0.0 );
+ gaus.SetParameter( 2, 1.0 );
+ } else {
+ gaus.SetParameter( 0, 500.0 );
+ gaus.FixParameter( 1, 0.0 );
+ gaus.FixParameter( 2, 1.0 );
+ }
+ TFitResultPtr p = h->Fit( "gaus", "S" );
+ h->GetFunction( "gaus" )->SetLineColor( kRed );
+ h->GetXaxis()->SetTitle( "(T-#mu_{T})/#sigma_{T}" );
+ h->Draw( "E" );
+ can.SaveAs( outFile );
+
+ //Report the chi^2 of the Gaussian fit
+ std::cout << "chi2/ndf=" << p->Chi2() << "/" << p->Ndf() << std::endl;
+
+ delete r;
+ delete h;
}
diff --git a/examples/point2PointTestSample.cc b/examples/point2PointTestSample.cc
index ce50347..7ede5e5 100644
--- a/examples/point2PointTestSample.cc
+++ b/examples/point2PointTestSample.cc
@@ -1,255 +1,278 @@
/*
Copyright 2015 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
// Code to perform the point to point similarity unbinned goodness of fit test on a subsample of the data and simulation provided.
//
// A test statistic is constructed, T = (1/n_d^2) SUM_(i,j>i)^(n_d) psi(|x_i^d - x_j^d|) - 1/(n_d * n_s) SUM_(i,j)^(n_d,n_s) psi(|x_i^d - x_j^s|),
// where x_i^d is the position of the ith data entry in the phase space and x_i^s is the position of the ith simulated entry,
// n_d and n_s are the number of data and simulation entries, respectively,
// and psi is a function that drops off for larger distances. This script uses exp(-(m'^2+theat'^2)/(2sigma^2)) where sigma should be set to roughly the
// size of the narrowest structure in the square Dalitz plot.
//
// The distribution of this test statistic is unknown so the permutation test is used.
// The data and simulation samples are divided into n subsamples and a p-value is determined for subsample i.
// For a good match between data and simulation, the distribution of p-values for the n samples should be uniform between 0 and 1.
// For a bad match, the p-values will peak at zero.
-#include <algorithm>
-#include <cstdlib>
-#include <iostream>
-#include <map>
-#include <set>
-#include <vector>
-
#include "TCanvas.h"
#include "TF1.h"
#include "TFile.h"
#include "TFitResult.h"
#include "TFitResultPtr.h"
#include "TH1D.h"
-#include "TMatrixD.h"
#include "TMath.h"
+#include "TMatrixD.h"
#include "TRandom3.h"
#include "TStyle.h"
#include "TTree.h"
-TRandom3* r(0);
+#include <algorithm>
+#include <cstdlib>
+#include <iostream>
+#include <map>
+#include <set>
+#include <vector>
+
+TRandom3* r( 0 );
//object to store a single entry
class Entry {
- public:
- Entry(Bool_t data, Double_t mPrime, Double_t thPrime, Int_t nPerms)
- : _data(data), _permutedData(nPerms,0), _mPrime(mPrime), _thPrime(thPrime) {}
-
- Bool_t isData() { return _data; }
- Bool_t isPermutedData(Int_t i) { return _permutedData[i]; }
-
- void setPermutedData(Int_t i, Bool_t permutedData) { _permutedData[i] = permutedData; }
-
- //get squared distance from entry e
- Double_t getDistSq(Entry* e) { return (this->_mPrime - e->_mPrime)*(this->_mPrime - e->_mPrime) + (this->_thPrime - e->_thPrime)*(this->_thPrime - e->_thPrime); }
-
- private:
- Bool_t _data; //whether entry is data
- std::vector<Bool_t> _permutedData; //whether entry is considered data in each permuted dataset
- Double_t _mPrime; //SDP co-ordinate
- Double_t _thPrime;//SDP co-ordinate
+ public:
+ Entry( Bool_t data, Double_t mPrime, Double_t thPrime, Int_t nPerms ) :
+ _data( data ),
+ _permutedData( nPerms, 0 ),
+ _mPrime( mPrime ),
+ _thPrime( thPrime )
+ {
+ }
+
+ Bool_t isData() { return _data; }
+
+ Bool_t isPermutedData( Int_t i ) { return _permutedData[i]; }
+
+ void setPermutedData( Int_t i, Bool_t permutedData ) { _permutedData[i] = permutedData; }
+
+ //get squared distance from entry e
+ Double_t getDistSq( Entry* e )
+ {
+ return ( this->_mPrime - e->_mPrime ) * ( this->_mPrime - e->_mPrime ) +
+ ( this->_thPrime - e->_thPrime ) * ( this->_thPrime - e->_thPrime );
+ }
+
+ private:
+ Bool_t _data; //whether entry is data
+ std::vector<Bool_t> _permutedData; //whether entry is considered data in each permuted dataset
+ Double_t _mPrime; //SDP co-ordinate
+ Double_t _thPrime; //SDP co-ordinate
};
//function to load entries from data and MC files for sample i of n
-Int_t loadEntries(std::vector<Entry*>& entries, TString file0Name, TString tree0Name, TString file1Name, TString tree1Name, Int_t sample, Int_t nSamples, Int_t nPerms) {
-
- TFile *f0(0), *f1(0);
-
- f0 = TFile::Open(file0Name);
- f1 = TFile::Open(file1Name);
-
- TTree* t0 = (TTree*)f0->Get(tree0Name);
- TTree* t1 = (TTree*)f1->Get(tree1Name);
-
- Double_t mprime(0.), thprime(0.);
-
- t0->SetBranchAddress("mPrime", &mprime);
- t0->SetBranchAddress("thPrime", &thprime);
- t1->SetBranchAddress("mPrime", &mprime);
- t1->SetBranchAddress("thPrime", &thprime);
-
- Int_t n0 = t0->GetEntries()/nSamples;
- Int_t n1 = t1->GetEntries()/nSamples;
-
- entries.reserve(n0+n1);
-
- //load independent entries for each sample
- for(Int_t i=0; i<n0; ++i) {
- t0->GetEntry(i*nSamples+sample);
- entries.push_back(new Entry(false,mprime,thprime,nPerms));
- }
- for(Int_t i=0; i<n1; ++i) {
- t1->GetEntry(i*nSamples+sample);
- entries.push_back(new Entry(true,mprime,thprime,nPerms));
- }
-
- f0->Close();
- f1->Close();
-
- return n1;
+Int_t loadEntries( std::vector<Entry*>& entries,
+ TString file0Name,
+ TString tree0Name,
+ TString file1Name,
+ TString tree1Name,
+ Int_t sample,
+ Int_t nSamples,
+ Int_t nPerms )
+{
+
+ TFile *f0( 0 ), *f1( 0 );
+
+ f0 = TFile::Open( file0Name );
+ f1 = TFile::Open( file1Name );
+
+ TTree* t0 = (TTree*)f0->Get( tree0Name );
+ TTree* t1 = (TTree*)f1->Get( tree1Name );
+
+ Double_t mprime( 0. ), thprime( 0. );
+
+ t0->SetBranchAddress( "mPrime", &mprime );
+ t0->SetBranchAddress( "thPrime", &thprime );
+ t1->SetBranchAddress( "mPrime", &mprime );
+ t1->SetBranchAddress( "thPrime", &thprime );
+
+ Int_t n0 = t0->GetEntries() / nSamples;
+ Int_t n1 = t1->GetEntries() / nSamples;
+
+ entries.reserve( n0 + n1 );
+
+ //load independent entries for each sample
+ for ( Int_t i = 0; i < n0; ++i ) {
+ t0->GetEntry( i * nSamples + sample );
+ entries.push_back( new Entry( false, mprime, thprime, nPerms ) );
+ }
+ for ( Int_t i = 0; i < n1; ++i ) {
+ t1->GetEntry( i * nSamples + sample );
+ entries.push_back( new Entry( true, mprime, thprime, nPerms ) );
+ }
+
+ f0->Close();
+ f1->Close();
+
+ return n1;
}
//method to setup nPerms permuted datasets
-void makePermutations(std::vector<Entry*>& entries, Int_t nd, Int_t nPerms) {
- Int_t n = entries.size();
-
- for(Int_t i=0; i<nPerms; ++i) {
- std::set<Int_t> dataSet;
- Int_t entry(0);
- //pick nd random entries
- for(Int_t j=0; j<nd; ++j) {
- //throw random numbers until we find one that hasn't been inserted already
- do {
- entry = r->Integer(n);
- } while(!dataSet.insert(entry).second);
- }
-
- std::set<Int_t>::iterator it = dataSet.begin();
- std::set<Int_t>::iterator end = dataSet.end();
-
- //set the flags
- for( ; it!=end; ++it) {
- entries[(*it)]->setPermutedData(i,true);
- }
- }
+void makePermutations( std::vector<Entry*>& entries, Int_t nd, Int_t nPerms )
+{
+ Int_t n = entries.size();
+
+ for ( Int_t i = 0; i < nPerms; ++i ) {
+ std::set<Int_t> dataSet;
+ Int_t entry( 0 );
+ //pick nd random entries
+ for ( Int_t j = 0; j < nd; ++j ) {
+ //throw random numbers until we find one that hasn't been inserted already
+ do {
+ entry = r->Integer( n );
+ } while ( ! dataSet.insert( entry ).second );
+ }
+
+ std::set<Int_t>::iterator it = dataSet.begin();
+ std::set<Int_t>::iterator end = dataSet.end();
+
+ //set the flags
+ for ( ; it != end; ++it ) {
+ entries[( *it )]->setPermutedData( i, true );
+ }
+ }
}
//method to calculate the p-value for this sample
-Double_t calcPVal(std::vector<Entry*>& entries, Int_t nd, Int_t nPerms, Double_t sigma) {
-
- Int_t n = entries.size();
- Int_t nmc = n - nd;
-
- Double_t distSq(0.);
- Double_t psi(0.);
- Double_t twoSigSq(2*sigma*sigma);
-
- Double_t T1(0.), T2(0.);
- std::vector<Double_t> T1Perms(nPerms,0.);
- std::vector<Double_t> T2Perms(nPerms,0.);
-
- //loop over all pairs of entries
- for(Int_t i=0; i<n; ++i) {
- std:: cout << i << " of " << n << std::endl;
- for(Int_t j=i; j<n; ++j) {
- distSq = entries[i]->getDistSq(entries[j]);
- psi = TMath::Exp(-distSq/twoSigSq);
- //calculate contribution from this pair to the test statistic for data
- if(entries[i]->isData()) {
- if(entries[j]->isData()) {
- T1+=psi;
- } else {
- T2+=psi;
- }
- } else if(entries[j]->isData()) {
- T2+=psi;
- }
- //calculate contributions to test statistics for the permutations of the data
- for(Int_t k=0; k<nPerms; ++k) {
- if(entries[i]->isPermutedData(k)) {
- if(entries[j]->isPermutedData(k)) {
- T1Perms[k]+=psi;
- } else {
- T2Perms[k]+=psi;
- }
- } else if(entries[j]->isPermutedData(k)) {
- T2Perms[k]+=psi;
- }
- }
- }
- }
-
- Double_t T = T1/(nd*nd) - T2/(nd*nmc);
- Double_t pVal(0.);
- for(Int_t i=0; i<nPerms; ++i) {
- //count how many permutations give a worse test statistic than the data
- if(T1Perms[i]/(nd*nd) - T2Perms[i]/(nd*nmc) > T) ++pVal;
- }
- pVal/=nPerms;
-
- return pVal;
+Double_t calcPVal( std::vector<Entry*>& entries, Int_t nd, Int_t nPerms, Double_t sigma )
+{
+
+ Int_t n = entries.size();
+ Int_t nmc = n - nd;
+
+ Double_t distSq( 0. );
+ Double_t psi( 0. );
+ Double_t twoSigSq( 2 * sigma * sigma );
+
+ Double_t T1( 0. ), T2( 0. );
+ std::vector<Double_t> T1Perms( nPerms, 0. );
+ std::vector<Double_t> T2Perms( nPerms, 0. );
+
+ //loop over all pairs of entries
+ for ( Int_t i = 0; i < n; ++i ) {
+ std::cout << i << " of " << n << std::endl;
+ for ( Int_t j = i; j < n; ++j ) {
+ distSq = entries[i]->getDistSq( entries[j] );
+ psi = TMath::Exp( -distSq / twoSigSq );
+ //calculate contribution from this pair to the test statistic for data
+ if ( entries[i]->isData() ) {
+ if ( entries[j]->isData() ) {
+ T1 += psi;
+ } else {
+ T2 += psi;
+ }
+ } else if ( entries[j]->isData() ) {
+ T2 += psi;
+ }
+ //calculate contributions to test statistics for the permutations of the data
+ for ( Int_t k = 0; k < nPerms; ++k ) {
+ if ( entries[i]->isPermutedData( k ) ) {
+ if ( entries[j]->isPermutedData( k ) ) {
+ T1Perms[k] += psi;
+ } else {
+ T2Perms[k] += psi;
+ }
+ } else if ( entries[j]->isPermutedData( k ) ) {
+ T2Perms[k] += psi;
+ }
+ }
+ }
+ }
+
+ Double_t T = T1 / ( nd * nd ) - T2 / ( nd * nmc );
+ Double_t pVal( 0. );
+ for ( Int_t i = 0; i < nPerms; ++i ) {
+ //count how many permutations give a worse test statistic than the data
+ if ( T1Perms[i] / ( nd * nd ) - T2Perms[i] / ( nd * nmc ) > T )
+ ++pVal;
+ }
+ pVal /= nPerms;
+
+ return pVal;
}
-int main(int argc, char** argv) {
-
- gStyle->SetOptStat(0);
-
- TString mcFile(""); // the file to load simulated events from
- TString mcTree(""); // the tree containing the simulation
- TString dataFile(""); // the file to load data events from
- TString dataTree(""); // the tree containing the data
- Int_t seed=0; // seed the random number used to produce permutations
- Int_t iSample=0; // the index of this sample
- Int_t nSamples=1; // the number of samples to split the events into
- Int_t nPerms=100; // the number of permutations to test against
- Double_t sigma(0.01); // the width of the Gaussian decay used to weight events by distance
-
- if(argc>2) {
- mcFile = argv[1];
- mcTree = argv[2];
- dataFile = argv[3];
- dataTree = argv[4];
- if(argc>5) {
- seed = atoi( argv[5] );
- if(argc>6) {
- iSample = atoi( argv[6] );
- if(argc>7) {
- nSamples = atoi( argv[7] );
- if(argc>8) {
- nPerms = atoi( argv[8] );
- if(argc>9) {
- sigma = atof( argv[9] );
- }
- }
+int main( int argc, char** argv )
+{
+
+ gStyle->SetOptStat( 0 );
+
+ TString mcFile( "" ); // the file to load simulated events from
+ TString mcTree( "" ); // the tree containing the simulation
+ TString dataFile( "" ); // the file to load data events from
+ TString dataTree( "" ); // the tree containing the data
+ Int_t seed = 0; // seed the random number used to produce permutations
+ Int_t iSample = 0; // the index of this sample
+ Int_t nSamples = 1; // the number of samples to split the events into
+ Int_t nPerms = 100; // the number of permutations to test against
+ Double_t sigma( 0.01 ); // the width of the Gaussian decay used to weight events by distance
+
+ if ( argc > 2 ) {
+ mcFile = argv[1];
+ mcTree = argv[2];
+ dataFile = argv[3];
+ dataTree = argv[4];
+ if ( argc > 5 ) {
+ seed = atoi( argv[5] );
+ if ( argc > 6 ) {
+ iSample = atoi( argv[6] );
+ if ( argc > 7 ) {
+ nSamples = atoi( argv[7] );
+ if ( argc > 8 ) {
+ nPerms = atoi( argv[8] );
+ if ( argc > 9 ) {
+ sigma = atof( argv[9] );
+ }
+ }
+ }
}
- }
- }
- } else {
- std::cout << "Usage:\n";
- std::cout << argv[0] << "<mcFile> <mcTree> <dataFile> <dataTree> [seed = 0] [iSample = 0] [nSamples = 1] [nPerms = 100] [sigma = 0.01]" << std::endl;
- return 0;
- }
-
- r = new TRandom3(seed);
+ }
+ } else {
+ std::cout << "Usage:\n";
+ std::cout << argv[0]
+ << "<mcFile> <mcTree> <dataFile> <dataTree> [seed = 0] [iSample = 0] [nSamples = 1] [nPerms = 100] [sigma = 0.01]"
+ << std::endl;
+ return 0;
+ }
- std::vector<Entry*> entries;
+ r = new TRandom3( seed );
- //load entries from MC and from data
- Int_t nd = loadEntries(entries,mcFile,mcTree,dataFile,dataTree,iSample,nSamples,nPerms);
+ std::vector<Entry*> entries;
- //make the permuted-data sets
- makePermutations(entries,nd,nPerms);
+ //load entries from MC and from data
+ Int_t nd = loadEntries( entries, mcFile, mcTree, dataFile, dataTree, iSample, nSamples, nPerms );
- //calculate the p-value
- std::cout << calcPVal(entries,nd,nPerms,sigma);
+ //make the permuted-data sets
+ makePermutations( entries, nd, nPerms );
- delete r;
+ //calculate the p-value
+ std::cout << calcPVal( entries, nd, nPerms, sigma );
+ delete r;
}
diff --git a/inc/Lau1DCubicSpline.hh b/inc/Lau1DCubicSpline.hh
index 10e8893..3c6b76f 100644
--- a/inc/Lau1DCubicSpline.hh
+++ b/inc/Lau1DCubicSpline.hh
@@ -1,207 +1,209 @@
/*
Copyright 2015 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file Lau1DCubicSpline.hh
\brief File containing declaration of Lau1DCubicSpline class.
- */
+*/
/*! \class Lau1DCubicSpline
\brief Class for defining a 1D cubic spline based on a set of knots.
Class for defining a 1D cubic spline based on a set of knots.
- Interpolation between the knots is performed either by one of
+ Interpolation between the knots is performed either by one of
two types of cubic spline (standard or Akima) or by linear interpolation.
The splines are defined by a piecewise cubic function which, between knots i and i+1, has the form
f_i(x) = (1 - t)*y_i + t*y_i+1 + t*(1 - t)(a*(1 - t) + b*t)
where t = (x - x_i)/(x_i+1 - x_i),
a = k_i *(x_i+1 - x_i) - (y_i+1 - y_i),
b = -k_i+1*(x_i+1 - x_i) + (y_i+1 - y_i)
and k_i is (by construction) the first derivative at knot i.
f(x) and f'(x) are continuous at the internal knots by construction.
-
- For the standard splines, f''(x) is required to be continuous
+
+ For the standard splines, f''(x) is required to be continuous
at all internal knots placing n-2 constraints on the n parameters, k_i.
The final two constraints are set by the boundary conditions.
At each boundary, the function may be:
(i) Clamped : f'(x) = C at the last knot
(ii) Natural : f''(x) = 0 at the last knot
(iii) Not a knot : f'''(x) continuous at the second last knot
The algorithms used in these splines can be found on:
http://en.wikipedia.org/wiki/Spline_interpolation#Algorithm_to_find_the_interpolating_cubic_spline
http://en.wikipedia.org/wiki/Tridiagonal_matrix_algorithm
For the Akima splines, the values of k_i are determined from the slopes of the four nearest segments (a_i-1, a_i, a_i+1 and a_i+2) as
k_i = ( | a_i+2 - a_i+1 | a_i + | a_i - a_i-1 | a_i+1 ) / ( | a_i+2 - a_i+1 | + | a_i - a_i-1 | )
and as
k_i = ( a_i + a_i+1 ) / 2
in the special case a_i-1 == a_i != a_i+1 == a_i+2.
Boundary conditions are specified by the relations
- a_2 - a_1 = a_1 - a_0 = a_0 - a_-1 and
+ a_2 - a_1 = a_1 - a_0 = a_0 - a_-1 and
a_n-1 - a_n-2 = a_n - a_n-1 = a_n+1 - a_n
The algorithms used in these splines can be found in:
J.ACM vol. 17 no. 4 pp 589-602
- */
+*/
#ifndef LAU_1DCUBICSPLINE
#define LAU_1DCUBICSPLINE
-#include <vector>
-
#include "Rtypes.h"
+#include <vector>
+
class Lau1DCubicSpline {
- public:
- //! Define the allowed interpolation types
- enum LauSplineType {
- StandardSpline, /*!< standard cubic splines with f''(x) continuous at all internal knots */
- AkimaSpline, /*!< Akima cubic splines with f'(x) at each knot defined locally by the positions of only five knots */
- LinearInterpolation /*! Linear interpolation between each pair of knots */
- };
-
- //! Define the allowed boundary condition types
- /*!
- These are only supported by standard splines
- */
- enum LauSplineBoundaryType {
- Clamped, /*!< clamped boundary - f'(x) = C */
- Natural, /*!< natural boundary - f''(x) = 0 */
- NotAKnot /*!< 'not a knot' boundary - f'''(x) continuous at second last knot */
- };
-
- //! Constructor
- /*!
- /param [in] xs the x-values of the knots
- /param [in] ys the y-values of the knots
- /param [in] type the type of the spline (e.g. StandardSpline, AkimaSpline, LinearInterpolation)
- /param [in] leftBound the left-hand boundary condition
- /param [in] rightBound the right-hand boundary condition
- /param [in] dydx0 the gradient at the left-hand boundary of a clamped spline
- /param [in] dydxn the gradient at the right-hand boundary of a clamped spline
- */
- Lau1DCubicSpline(const std::vector<Double_t>& xs, const std::vector<Double_t>& ys,
- LauSplineType type = Lau1DCubicSpline::StandardSpline,
- LauSplineBoundaryType leftBound = Lau1DCubicSpline::NotAKnot,
- LauSplineBoundaryType rightBound = Lau1DCubicSpline::NotAKnot,
- Double_t dydx0 = 0.0, Double_t dydxn = 0.0);
-
- //! Destructor
- virtual ~Lau1DCubicSpline();
-
- //! Evaluate the function at given point
- /*!
- \param [in] x the x-coordinate
- \return the value of the spline at x
- */
- Double_t evaluate(Double_t x) const;
-
- //! Update the y-values of the knots
- /*!
- \param [in] ys the y-values of the knots
- */
- void updateYValues(const std::vector<Double_t>& ys);
-
- //! Update the type of interpolation to perform
- /*!
- \param [in] type the type of interpolation
- */
- void updateType(LauSplineType type);
-
- //! Update the boundary conditions for the spline
- /*!
- /param [in] leftBound the left-hand boundary condition
- /param [in] rightBound the right-hand boundary condition
- /param [in] dydx0 the gradient at the left-hand boundary of a clamped spline
- /param [in] dydxn the gradient at the right-hand boundary of a clamped spline
- */
- void updateBoundaryConditions(LauSplineBoundaryType leftBound,
- LauSplineBoundaryType rightBound,
- Double_t dydx0 = 0.0,
- Double_t dydxn = 0.0);
-
- private:
- //! Copy constructor - not implemented
- Lau1DCubicSpline( const Lau1DCubicSpline& rhs );
-
- //! Copy assignment operator - not implemented
- Lau1DCubicSpline& operator=(const Lau1DCubicSpline& rhs);
-
- //! Initialise the class
- void init();
-
- //! Calculate the first derivative at each knot
- void calcDerivatives();
-
- //! Calculate the first derivatives according to the standard method
- void calcDerivativesStandard();
- //! Calculate the first derivatives according to the Akima method
- void calcDerivativesAkima();
-
- //! The number of knots in the spline
- const UInt_t nKnots_;
-
- //! The x-value at each knot
- std::vector<Double_t> x_;
- //! The y-value at each knot
- std::vector<Double_t> y_;
- //! The first derivative at each knot
- std::vector<Double_t> dydx_;
-
- //! The 'a' coefficients used to determine the derivatives
- std::vector<Double_t> a_;
- //! The 'b' coefficients used to determine the derivatives
- std::vector<Double_t> b_;
- //! The 'c' coefficients used to determine the derivatives
- std::vector<Double_t> c_;
- //! The 'd' coefficients used to determine the derivatives
- std::vector<Double_t> d_;
-
- //! The type of interpolation to be performed
- LauSplineType type_;
-
- //! The left-hand boundary condition on the spline
- LauSplineBoundaryType leftBound_;
- //! The right-hand boundary condition on the spline
- LauSplineBoundaryType rightBound_;
-
- //! The gradient at the left boundary for a clamped spline
- Double_t dydx0_;
- //! The gradient at the right boundary for a clamped spline
- Double_t dydxn_;
-
- ClassDef(Lau1DCubicSpline, 0); // Class for defining a 1D cubic spline
+ public:
+ //! Define the allowed interpolation types
+ enum LauSplineType {
+ StandardSpline, /*!< standard cubic splines with f''(x) continuous at all internal knots */
+ AkimaSpline, /*!< Akima cubic splines with f'(x) at each knot defined locally by the positions of only five knots */
+ LinearInterpolation /*! Linear interpolation between each pair of knots */
+ };
+
+ //! Define the allowed boundary condition types
+ /*!
+ These are only supported by standard splines
+ */
+ enum LauSplineBoundaryType {
+ Clamped, /*!< clamped boundary - f'(x) = C */
+ Natural, /*!< natural boundary - f''(x) = 0 */
+ NotAKnot /*!< 'not a knot' boundary - f'''(x) continuous at second last knot */
+ };
+
+ //! Constructor
+ /*!
+ \param [in] xs the x-values of the knots
+ \param [in] ys the y-values of the knots
+ \param [in] type the type of the spline (e.g. StandardSpline, AkimaSpline, LinearInterpolation)
+ \param [in] leftBound the left-hand boundary condition
+ \param [in] rightBound the right-hand boundary condition
+ \param [in] dydx0 the gradient at the left-hand boundary of a clamped spline
+ \param [in] dydxn the gradient at the right-hand boundary of a clamped spline
+ */
+ Lau1DCubicSpline( const std::vector<Double_t>& xs,
+ const std::vector<Double_t>& ys,
+ LauSplineType type = Lau1DCubicSpline::StandardSpline,
+ LauSplineBoundaryType leftBound = Lau1DCubicSpline::NotAKnot,
+ LauSplineBoundaryType rightBound = Lau1DCubicSpline::NotAKnot,
+ Double_t dydx0 = 0.0,
+ Double_t dydxn = 0.0 );
+
+ //! Destructor
+ virtual ~Lau1DCubicSpline();
+
+ //! Evaluate the function at given point
+ /*!
+ \param [in] x the x-coordinate
+ \return the value of the spline at x
+ */
+ Double_t evaluate( Double_t x ) const;
+
+ //! Update the y-values of the knots
+ /*!
+ \param [in] ys the y-values of the knots
+ */
+ void updateYValues( const std::vector<Double_t>& ys );
+
+ //! Update the type of interpolation to perform
+ /*!
+ \param [in] type the type of interpolation
+ */
+ void updateType( LauSplineType type );
+
+ //! Update the boundary conditions for the spline
+ /*!
+ \param [in] leftBound the left-hand boundary condition
+ \param [in] rightBound the right-hand boundary condition
+ \param [in] dydx0 the gradient at the left-hand boundary of a clamped spline
+ \param [in] dydxn the gradient at the right-hand boundary of a clamped spline
+ */
+ void updateBoundaryConditions( LauSplineBoundaryType leftBound,
+ LauSplineBoundaryType rightBound,
+ Double_t dydx0 = 0.0,
+ Double_t dydxn = 0.0 );
+
+ private:
+ //! Copy constructor - not implemented
+ Lau1DCubicSpline( const Lau1DCubicSpline& rhs );
+
+ //! Copy assignment operator - not implemented
+ Lau1DCubicSpline& operator=( const Lau1DCubicSpline& rhs );
+
+ //! Initialise the class
+ void init();
+
+ //! Calculate the first derivative at each knot
+ void calcDerivatives();
+
+ //! Calculate the first derivatives according to the standard method
+ void calcDerivativesStandard();
+ //! Calculate the first derivatives according to the Akima method
+ void calcDerivativesAkima();
+
+ //! The number of knots in the spline
+ const UInt_t nKnots_;
+
+ //! The x-value at each knot
+ std::vector<Double_t> x_;
+ //! The y-value at each knot
+ std::vector<Double_t> y_;
+ //! The first derivative at each knot
+ std::vector<Double_t> dydx_;
+
+ //! The 'a' coefficients used to determine the derivatives
+ std::vector<Double_t> a_;
+ //! The 'b' coefficients used to determine the derivatives
+ std::vector<Double_t> b_;
+ //! The 'c' coefficients used to determine the derivatives
+ std::vector<Double_t> c_;
+ //! The 'd' coefficients used to determine the derivatives
+ std::vector<Double_t> d_;
+
+ //! The type of interpolation to be performed
+ LauSplineType type_;
+
+ //! The left-hand boundary condition on the spline
+ LauSplineBoundaryType leftBound_;
+ //! The right-hand boundary condition on the spline
+ LauSplineBoundaryType rightBound_;
+
+ //! The gradient at the left boundary for a clamped spline
+ Double_t dydx0_;
+ //! The gradient at the right boundary for a clamped spline
+ Double_t dydxn_;
+
+ ClassDef( Lau1DCubicSpline, 0 ); // Class for defining a 1D cubic spline
};
#endif
diff --git a/inc/Lau1DHistPdf.hh b/inc/Lau1DHistPdf.hh
index e075124..0cb0ab5 100644
--- a/inc/Lau1DHistPdf.hh
+++ b/inc/Lau1DHistPdf.hh
@@ -1,136 +1,140 @@
/*
Copyright 2006 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file Lau1DHistPdf.hh
\brief File containing declaration of Lau1DHistPdf class.
*/
/*! \class Lau1DHistPdf
\brief Class for defining a 1D histogram PDF.
Class for defining a 1D histogram PDF.
Employs linear interpolation to get the PDF value based on how far away a
point is from nearby bin centres. The returned values are normalised to
the total area.
*/
#ifndef LAU_1DHIST_PDF
#define LAU_1DHIST_PDF
#include "LauAbsPdf.hh"
class TH1;
class Lau1DHistPdf : public LauAbsPdf {
- public:
- //! Constructor
- /*!
- \param [in] theVarName the name of the abscissa variable
- \param [in] hist the 1D histogram from which the PDF should be constructed
- \param [in] minAbscissa the minimum value of the abscissa
- \param [in] maxAbscissa the maximum value of the abscissa
- \param [in] useInterpolation boolean flag to determine whether linear interpolation between bins should be used or simply the raw bin values
- \param [in] fluctuateBins boolean flag to determine whether the bin contents should be fluctuated in accordance with their errors.
- The seed for the random number generator used to fluctuate the bins should first be set using LauRandom::setSeed.
- */
- Lau1DHistPdf(const TString& theVarName, const TH1* hist, Double_t minAbscissa, Double_t maxAbscissa,
- Bool_t useInterpolation = kTRUE, Bool_t fluctuateBins = kFALSE);
-
- //! Destructor
- virtual ~Lau1DHistPdf();
-
- //! Calculate the likelihood (and intermediate info) for a given abscissa
- /*!
- \param [in] abscissas the values of the abscissa(s)
- */
- virtual void calcLikelihoodInfo(const LauAbscissas& abscissas);
-
- using LauAbsPdf::calcLikelihoodInfo;
-
- //! Calculate the normalisation
- virtual void calcNorm();
-
- //! Calculate the PDF height
- /*!
- \param [in] kinematics the current DP kinematics (not strictly required in this case since PDF has no DP dependence)
- */
- virtual void calcPDFHeight( const LauKinematics* kinematics );
-
- protected:
- //! Fluctuate the histogram bin contents in accorance with their errors
- void doBinFluctuation();
-
- //! Check the normalisation calculation
- void checkNormalisation();
-
- //! Get the bin content from the histogram
- /*!
- \param [in] bin the bin number
- \return the bin content
- */
- Double_t getBinHistValue(Int_t bin) const;
-
- //! Perform the interpolation (unnormalised)
- /*!
- \param [in] x the abscissa value
- \return the unnormalised PDF value
- */
- Double_t interpolate(Double_t x) const;
-
- //! Perform the interpolation and divide by the normalisation
- /*!
- \param [in] x the abscissa value
- \return the normalised PDF value
- */
- Double_t interpolateNorm(Double_t x) const;
-
- private:
- //! Copy constructor (not implemented)
- Lau1DHistPdf(const Lau1DHistPdf& rhs);
-
- //! Copy assignment operator (not implemented)
- Lau1DHistPdf& operator=(const Lau1DHistPdf& rhs);
-
- //! The underlying histogram
- TH1* hist_;
-
- //! Control boolean for using the linear interpolation
- Bool_t useInterpolation_;
- //! Control boolean for performing the fluctuation of the histogram bin contents
- Bool_t fluctuateBins_;
-
- //! The number of bins in the histogram
- Int_t nBins_;
- //! The histogram axis minimum
- Double_t axisMin_;
- //! The histogram axis maximum
- Double_t axisMax_;
- //! The histogram axis range
- Double_t axisRange_;
-
- ClassDef(Lau1DHistPdf,0) // 1D histogram pdf class
+ public:
+ //! Constructor
+ /*!
+ \param [in] theVarName the name of the abscissa variable
+ \param [in] hist the 1D histogram from which the PDF should be constructed
+ \param [in] minAbscissa the minimum value of the abscissa
+ \param [in] maxAbscissa the maximum value of the abscissa
+ \param [in] useInterpolation boolean flag to determine whether linear interpolation between bins should be used or simply the raw bin values
+ \param [in] fluctuateBins boolean flag to determine whether the bin contents should be fluctuated in accordance with their errors.
+ The seed for the random number generator used to fluctuate the bins should first be set using LauRandom::setSeed.
+ */
+ Lau1DHistPdf( const TString& theVarName,
+ const TH1* hist,
+ Double_t minAbscissa,
+ Double_t maxAbscissa,
+ Bool_t useInterpolation = kTRUE,
+ Bool_t fluctuateBins = kFALSE );
+
+ //! Destructor
+ virtual ~Lau1DHistPdf();
+
+ //! Calculate the likelihood (and intermediate info) for a given abscissa
+ /*!
+ \param [in] abscissas the values of the abscissa(s)
+ */
+ virtual void calcLikelihoodInfo( const LauAbscissas& abscissas );
+
+ using LauAbsPdf::calcLikelihoodInfo;
+
+ //! Calculate the normalisation
+ virtual void calcNorm();
+
+ //! Calculate the PDF height
+ /*!
+ \param [in] kinematics the current DP kinematics (not strictly required in this case since PDF has no DP dependence)
+ */
+ virtual void calcPDFHeight( const LauKinematics* kinematics );
+
+ protected:
+ //! Fluctuate the histogram bin contents in accorance with their errors
+ void doBinFluctuation();
+
+ //! Check the normalisation calculation
+ void checkNormalisation();
+
+ //! Get the bin content from the histogram
+ /*!
+ \param [in] bin the bin number
+ \return the bin content
+ */
+ Double_t getBinHistValue( Int_t bin ) const;
+
+ //! Perform the interpolation (unnormalised)
+ /*!
+ \param [in] x the abscissa value
+ \return the unnormalised PDF value
+ */
+ Double_t interpolate( Double_t x ) const;
+
+ //! Perform the interpolation and divide by the normalisation
+ /*!
+ \param [in] x the abscissa value
+ \return the normalised PDF value
+ */
+ Double_t interpolateNorm( Double_t x ) const;
+
+ private:
+ //! Copy constructor (not implemented)
+ Lau1DHistPdf( const Lau1DHistPdf& rhs );
+
+ //! Copy assignment operator (not implemented)
+ Lau1DHistPdf& operator=( const Lau1DHistPdf& rhs );
+
+ //! The underlying histogram
+ TH1* hist_;
+
+ //! Control boolean for using the linear interpolation
+ Bool_t useInterpolation_;
+ //! Control boolean for performing the fluctuation of the histogram bin contents
+ Bool_t fluctuateBins_;
+
+ //! The number of bins in the histogram
+ Int_t nBins_;
+ //! The histogram axis minimum
+ Double_t axisMin_;
+ //! The histogram axis maximum
+ Double_t axisMax_;
+ //! The histogram axis range
+ Double_t axisRange_;
+
+ ClassDef( Lau1DHistPdf, 0 ) // 1D histogram pdf class
};
#endif
diff --git a/inc/Lau2DAbsDP.hh b/inc/Lau2DAbsDP.hh
index 723f149..34eb5dd 100644
--- a/inc/Lau2DAbsDP.hh
+++ b/inc/Lau2DAbsDP.hh
@@ -1,74 +1,73 @@
/*
Copyright 2013 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file Lau2DAbsDP.hh
\brief File containing declaration of Lau2DAbsDP class.
*/
/*! \class Lau2DAbsDP
\brief Pure abstract base class for defining a variation across a 2D DP.
Pure abstract base class for defining an unnormalised variation across a 2D DP.
*/
#ifndef LAU_2DABS_DP
#define LAU_2DABS_DP
#include "Rtypes.h"
-
class Lau2DAbsDP {
- public:
- //!Constructor
- Lau2DAbsDP() {}
+ public:
+ //!Constructor
+ Lau2DAbsDP() {}
- //! Destructor
- virtual ~Lau2DAbsDP() {}
+ //! Destructor
+ virtual ~Lau2DAbsDP() {}
- //! Perform the interpolation
- /*!
- \param [in] x the x-axis value
- \param [in] y the y-aixs value
- \return the interpolated histogram value
- */
- virtual Double_t interpolateXY(Double_t x, Double_t y) const=0;
+ //! Perform the interpolation
+ /*!
+ \param [in] x the x-axis value
+ \param [in] y the y-aixs value
+ \return the interpolated histogram value
+ */
+ virtual Double_t interpolateXY( Double_t x, Double_t y ) const = 0;
- //! Determine whether the histogram is defined in the square DP
- /*
- \return kTRUE if the square DP is being used, kFALSE otherwise
- */
- virtual Bool_t usingSquareDP() const=0;
+ //! Determine whether the histogram is defined in the square DP
+ /*
+ \return kTRUE if the square DP is being used, kFALSE otherwise
+ */
+ virtual Bool_t usingSquareDP() const = 0;
- private:
- //! Copy constructor - not implemented
- Lau2DAbsDP( const Lau2DAbsDP& rhs );
+ private:
+ //! Copy constructor - not implemented
+ Lau2DAbsDP( const Lau2DAbsDP& rhs );
- //! Copy assignment operator - not implemented
- Lau2DAbsDP& operator=(const Lau2DAbsDP& rhs);
+ //! Copy assignment operator - not implemented
+ Lau2DAbsDP& operator=( const Lau2DAbsDP& rhs );
- ClassDef(Lau2DAbsDP,0) // Abstract base class for 2D DP variation
+ ClassDef( Lau2DAbsDP, 0 ) // Abstract base class for 2D DP variation
};
#endif
diff --git a/inc/Lau2DAbsDPPdf.hh b/inc/Lau2DAbsDPPdf.hh
index a8b5952..19a02aa 100644
--- a/inc/Lau2DAbsDPPdf.hh
+++ b/inc/Lau2DAbsDPPdf.hh
@@ -1,81 +1,81 @@
/*
Copyright 2014 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file Lau2DAbsDPPdf.hh
\brief File containing declaration of Lau2DAbsDPPdf class.
*/
/*! \class Lau2DAbsDPPdf
\brief Pure abstract base class for defining a variation across a 2D DP.
Pure abstract base class for defining a normalised variation across a 2D DP.
*/
#ifndef LAU_2DABS_DP_PDF
#define LAU_2DABS_DP_PDF
#include "Rtypes.h"
class Lau2DAbsDPPdf {
- public:
- //! Constructor
- Lau2DAbsDPPdf() {}
-
- //! Destructor
- virtual ~Lau2DAbsDPPdf() {}
-
- //! Retrieve maximum height
- virtual Double_t getMaxHeight() const=0;
-
- //! Retrieve PDF normalisation
- virtual Double_t getHistNorm() const=0;
-
- //! Perform the interpolation (unnormalised)
- /*!
- \param [in] x the x-axis value
- \param [in] y the y-aixs value
- \return the unnormalised PDF value
- */
- virtual Double_t interpolateXY(Double_t x, Double_t y) const=0;
-
- //! Perform the interpolation and divide by the normalisation
- /*!
- \param [in] x the x-axis abscissa value
- \param [in] y the y-axis abscissa value
- \return the normalised PDF value
- */
- virtual Double_t interpolateXYNorm(Double_t x, Double_t y) const=0;
-
- private:
- //! Copy constructor - not implemented
- Lau2DAbsDPPdf( const Lau2DAbsDPPdf& rhs );
-
- //! Copy assignment operator - not implemented
- Lau2DAbsDPPdf& operator=(const Lau2DAbsDPPdf& rhs);
-
- ClassDef(Lau2DAbsDPPdf,0) // Abstract base class for 2D DP variation
+ public:
+ //! Constructor
+ Lau2DAbsDPPdf() {}
+
+ //! Destructor
+ virtual ~Lau2DAbsDPPdf() {}
+
+ //! Retrieve maximum height
+ virtual Double_t getMaxHeight() const = 0;
+
+ //! Retrieve PDF normalisation
+ virtual Double_t getHistNorm() const = 0;
+
+ //! Perform the interpolation (unnormalised)
+ /*!
+ \param [in] x the x-axis value
+ \param [in] y the y-aixs value
+ \return the unnormalised PDF value
+ */
+ virtual Double_t interpolateXY( Double_t x, Double_t y ) const = 0;
+
+ //! Perform the interpolation and divide by the normalisation
+ /*!
+ \param [in] x the x-axis abscissa value
+ \param [in] y the y-axis abscissa value
+ \return the normalised PDF value
+ */
+ virtual Double_t interpolateXYNorm( Double_t x, Double_t y ) const = 0;
+
+ private:
+ //! Copy constructor - not implemented
+ Lau2DAbsDPPdf( const Lau2DAbsDPPdf& rhs );
+
+ //! Copy assignment operator - not implemented
+ Lau2DAbsDPPdf& operator=( const Lau2DAbsDPPdf& rhs );
+
+ ClassDef( Lau2DAbsDPPdf, 0 ) // Abstract base class for 2D DP variation
};
#endif
diff --git a/inc/Lau2DAbsHistDP.hh b/inc/Lau2DAbsHistDP.hh
index 3f6446e..6c82a46 100644
--- a/inc/Lau2DAbsHistDP.hh
+++ b/inc/Lau2DAbsHistDP.hh
@@ -1,146 +1,150 @@
/*
Copyright 2013 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file Lau2DAbsHistDP.hh
\brief File containing declaration of Lau2DAbsHistDP class.
*/
/*! \class Lau2DAbsHistDP
\brief Abstract base class for defining a variation across a 2D DP based on a histogram.
Abstract base class for defining an unnormalised variation across a 2D DP based on a histogram.
- Contains helper methods to vary bin contents in the input histogram within uncertainties and
+ Contains helper methods to vary bin contents in the input histogram within uncertainties and
scale the input histogram to match a given average value.
The histogram can be defined in the conventional DP (m13Sq vs m23Sq) or in the square DP and
one half can be used to describe symmetric DPs.
*/
#ifndef LAU_2DABSHIST_DP
#define LAU_2DABSHIST_DP
#include "Lau2DAbsDP.hh"
class TH2;
class LauDaughters;
class LauKinematics;
class Lau2DAbsHistDP : public Lau2DAbsDP {
- public:
- //! Constructor
- /*!
- \param [in] daughters the daughter particles
- \param [in] useUpperHalfOnly boolean flag to specify that the supplied histogram contains only the upper half of a symmetric DP (or lower half if using square DP coordinates)
- \param [in] squareDP boolean flag to specify whether the supplied histogram is in square DP coordinates
- */
- Lau2DAbsHistDP(const LauDaughters* daughters, Bool_t useUpperHalfOnly = kFALSE, Bool_t squareDP = kFALSE);
-
- //! Copy constructor
- //Lau2DAbsHistDP( const Lau2DAbsHistDP& rhs );
-
- //! Destructor
- virtual ~Lau2DAbsHistDP();
-
- //! Perform the interpolation
- /*!
- \param [in] x the x-axis value
- \param [in] y the y-axis value
- \return the interpolated histogram value
- */
- virtual Double_t interpolateXY(Double_t x, Double_t y) const=0;
-
- //! Determine whether the histogram is defined in the square DP
- /*
- \return kTRUE if the square DP is being used, kFALSE otherwise
- */
- virtual Bool_t usingSquareDP() const { return squareDP_; };
-
- protected:
- //! Fluctuate the contents of each histogram bin independently, in accordance with their errors
- /*!
- \param [in,out] hist the histogram
- */
- void doBinFluctuation(TH2* hist);
-
- //! Fluctuate the contents of each histogram bin independently, in accordance with their errors
- /*!
- \param [in,out] hist the histogram
- \param [in] errorHi the histogram containing the upper uncertainties on the bins
- \param [in] errorLo the histogram containing the lower uncertainties on the bins
- */
- void doBinFluctuation(TH2* hist, const TH2* errorHi, const TH2* errorLo);
-
- //! Rescale the histogram bin contents based on the desired average efficiency and its uncertainty
- /*!
- The new average is sampled from a Gaussian distribution G(x;avEff,avEffError).
- The histogram is then rescaled according to newAvg/oldAvg.
- \param [in,out] hist the histogram
- \param [in] avEff the desired average efficiency
- \param [in] avEffError the error on that efficiency
- */
- void raiseOrLowerBins(TH2* hist, const Double_t avEff, const Double_t avEffError);
-
- //! Compute the average bin content for bins within the kinematic boundary
- /*!
- This method just uses the raw bin contents with no interpolation
- \param [in] hist the histogram
- \return the average value over the DP
- */
- Double_t computeAverageContents(const TH2* hist) const;
-
- //! Check whether the given co-ordinates are within the kinematic boundary
- /*!
- \param [in] x the x co-ordinate
- \param [in] y the y co-ordinate
- \return true if the co-ordinates are within the kinematic boundary, otherwise false
- */
- Bool_t withinDPBoundaries(Double_t x, Double_t y) const;
-
- //! If only using the upper half of the (symmetric) DP then transform into the correct half
- /*!
- \param [in,out] x the x co-ordinate
- \param [in,out] y the y co-ordinate
- */
- void getUpperHalf(Double_t& x, Double_t& y) const;
-
- private:
- //! Copy constructor - not implemented
- Lau2DAbsHistDP( const Lau2DAbsHistDP& rhs );
-
- //! Copy assignment operator - not implemented
- Lau2DAbsHistDP& operator=(const Lau2DAbsHistDP& rhs);
-
- //! Kinematics used to check events are within DP boundary
- const LauKinematics* kinematics_;
-
- //! Boolean for using the upper half of DP
- Bool_t upperHalf_;
-
- //! Boolean for using square DP variables
- Bool_t squareDP_;
-
- ClassDef(Lau2DAbsHistDP,0) // Abstract base class for 2D DP variations based on a histogram
+ public:
+ //! Constructor
+ /*!
+ \param [in] daughters the daughter particles
+ \param [in] useUpperHalfOnly boolean flag to specify that the supplied histogram contains only the upper half of a symmetric DP (or lower half if using square DP coordinates)
+ \param [in] squareDP boolean flag to specify whether the supplied histogram is in square DP coordinates
+ */
+ Lau2DAbsHistDP( const LauDaughters* daughters,
+ Bool_t useUpperHalfOnly = kFALSE,
+ Bool_t squareDP = kFALSE );
+
+ //! Copy constructor
+ //Lau2DAbsHistDP( const Lau2DAbsHistDP& rhs );
+
+ //! Destructor
+ virtual ~Lau2DAbsHistDP();
+
+ //! Perform the interpolation
+ /*!
+ \param [in] x the x-axis value
+ \param [in] y the y-axis value
+ \return the interpolated histogram value
+ */
+ virtual Double_t interpolateXY( Double_t x, Double_t y ) const = 0;
+
+ //! Determine whether the histogram is defined in the square DP
+ /*
+ \return kTRUE if the square DP is being used, kFALSE otherwise
+ */
+ virtual Bool_t usingSquareDP() const { return squareDP_; };
+
+ protected:
+ //! Fluctuate the contents of each histogram bin independently, in accordance with their errors
+ /*!
+ \param [in,out] hist the histogram
+ */
+ void doBinFluctuation( TH2* hist );
+
+ //! Fluctuate the contents of each histogram bin independently, in accordance with their errors
+ /*!
+ \param [in,out] hist the histogram
+ \param [in] errorHi the histogram containing the upper uncertainties on the bins
+ \param [in] errorLo the histogram containing the lower uncertainties on the bins
+ */
+ void doBinFluctuation( TH2* hist, const TH2* errorHi, const TH2* errorLo );
+
+ //! Rescale the histogram bin contents based on the desired average efficiency and its uncertainty
+ /*!
+ The new average is sampled from a Gaussian distribution G(x;avEff,avEffError).
+ The histogram is then rescaled according to newAvg/oldAvg.
+
+ \param [in,out] hist the histogram
+ \param [in] avEff the desired average efficiency
+ \param [in] avEffError the error on that efficiency
+ */
+ void raiseOrLowerBins( TH2* hist, const Double_t avEff, const Double_t avEffError );
+
+ //! Compute the average bin content for bins within the kinematic boundary
+ /*!
+ This method just uses the raw bin contents with no interpolation
+
+ \param [in] hist the histogram
+ \return the average value over the DP
+ */
+ Double_t computeAverageContents( const TH2* hist ) const;
+
+ //! Check whether the given co-ordinates are within the kinematic boundary
+ /*!
+ \param [in] x the x co-ordinate
+ \param [in] y the y co-ordinate
+ \return true if the co-ordinates are within the kinematic boundary, otherwise false
+ */
+ Bool_t withinDPBoundaries( Double_t x, Double_t y ) const;
+
+ //! If only using the upper half of the (symmetric) DP then transform into the correct half
+ /*!
+ \param [in,out] x the x co-ordinate
+ \param [in,out] y the y co-ordinate
+ */
+ void getUpperHalf( Double_t& x, Double_t& y ) const;
+
+ private:
+ //! Copy constructor - not implemented
+ Lau2DAbsHistDP( const Lau2DAbsHistDP& rhs );
+
+ //! Copy assignment operator - not implemented
+ Lau2DAbsHistDP& operator=( const Lau2DAbsHistDP& rhs );
+
+ //! Kinematics used to check events are within DP boundary
+ const LauKinematics* kinematics_;
+
+ //! Boolean for using the upper half of DP
+ Bool_t upperHalf_;
+
+ //! Boolean for using square DP variables
+ Bool_t squareDP_;
+
+ ClassDef( Lau2DAbsHistDP, 0 ) // Abstract base class for 2D DP variations based on a histogram
};
#endif
diff --git a/inc/Lau2DAbsHistDPPdf.hh b/inc/Lau2DAbsHistDPPdf.hh
index badc37e..5e1f865 100644
--- a/inc/Lau2DAbsHistDPPdf.hh
+++ b/inc/Lau2DAbsHistDPPdf.hh
@@ -1,163 +1,164 @@
/*
Copyright 2014 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file Lau2DAbsHistDPPdf.hh
\brief File containing declaration of Lau2DAbsHistDPPdf class.
*/
/*! \class Lau2DAbsHistDPPdf
\brief Abstract base class for defining a variation across a 2D DP based on a histogram.
Abstract base class for defining a normalised variation across a 2D DP based on a histogram.
The returned values are normalised to the total area.
The histogram can be defined in the conventional DP (m13Sq vs m23Sq) or in the square DP and
one half can be used to describe symmetric DPs.
*/
#ifndef LAU_2DABSHIST_DP_PDF
#define LAU_2DABSHIST_DP_PDF
#include "Lau2DAbsDPPdf.hh"
class TH2;
class LauKinematics;
class LauVetoes;
class Lau2DAbsHistDPPdf : public Lau2DAbsDPPdf {
- public:
- //! Constructor
- /*!
- \param [in] kinematics the current DP kinematics
- \param [in] vetoes the vetoes within the DP
- \param [in] useUpperHalfOnly boolean flag to specify that the supplied histogram contains only the upper half of a symmetric DP (or lower half if using square DP coordinates)
- \param [in] squareDP boolean flag to specify whether the supplied histogram is in square DP coordinates
- */
- Lau2DAbsHistDPPdf(LauKinematics* kinematics, const LauVetoes* vetoes,
- Bool_t useUpperHalfOnly = kFALSE, Bool_t squareDP = kFALSE);
-
- //! Destructor
- virtual ~Lau2DAbsHistDPPdf();
-
- //! Retrieve maximum height of the PDF
- /*!
- \return the maximum height
- */
- Double_t getMaxHeight() const {return maxHeight_;}
-
- //! Retrieve PDF normalisation
- /*!
- \return the normalisation factor
- */
- virtual Double_t getHistNorm() const=0;
-
- //! Perform the interpolation (unnormalised)
- /*!
- \param [in] x the x-axis value
- \param [in] y the y-aixs value
- \return the unnormalised PDF value
- */
- virtual Double_t interpolateXY(Double_t x, Double_t y) const=0;
-
- //! Perform the interpolation and divide by the normalisation
- /*!
- \param [in] x the x-axis abscissa value
- \param [in] y the y-axis abscissa value
- \return the normalised PDF value
- */
- virtual Double_t interpolateXYNorm(Double_t x, Double_t y) const=0;
-
- protected:
- //! Get the kinematics object
- /*!
- \return the kinematics
- */
- const LauKinematics * getKinematics() const {return kinematics_;}
-
- //! Get the vetoes object
- /*!
- \return the vetoes
- */
- const LauVetoes * getVetoes() const {return vetoes_;}
-
- //! Calculate maximum height
- /*!
- \param [in,out] hist the histogram
- */
- void calcMaxHeight(TH2* hist);
-
- //! Fluctuate the histogram bin contents in accordance with their errors
- /*!
- \param [in,out] hist the histogram
- */
- void doBinFluctuation(TH2* hist);
-
- //! Check whether the given co-ordinates are within the kinematic boundary
- /*!
- \param [in] x the x co-ordinate
- \param [in] y the y co-ordinate
- \return true if the co-ordinates are within the kinematic boundary, otherwise false
- */
- Bool_t withinDPBoundaries(Double_t x, Double_t y) const;
-
- //! Update the current co-ordinates in the kinematic space
- /*!
- \param [in] x the x co-ordinate
- \param [in] y the y co-ordinate
- */
- void updateKinematics(Double_t x, Double_t y) const;
-
- //! If only using the upper half of the (symmetric) DP then transform into the correct half
- /*!
- \param [in,out] x the x co-ordinate
- \param [in,out] y the y co-ordinate
- */
- void getUpperHalf(Double_t& x, Double_t& y) const;
-
-
- private:
- //! Copy constructor - not implemented
- Lau2DAbsHistDPPdf( const Lau2DAbsHistDPPdf& rhs );
-
- //! Copy assignment operator - not implemented
- Lau2DAbsHistDPPdf& operator=(const Lau2DAbsHistDPPdf& rhs);
-
- //! DP kinematics
- LauKinematics* kinematics_;
-
- //! Vetos within DP
- const LauVetoes* vetoes_;
-
- //! The maximum height of 2D histogram
- Double_t maxHeight_;
-
- //! Boolean for using the upper half of DP
- Bool_t upperHalf_;
- //! Boolean for using square DP variables
- Bool_t squareDP_;
-
- ClassDef(Lau2DAbsHistDPPdf,0) // Abstract base class for 2D DP variations based on a histogram
+ public:
+ //! Constructor
+ /*!
+ \param [in] kinematics the current DP kinematics
+ \param [in] vetoes the vetoes within the DP
+ \param [in] useUpperHalfOnly boolean flag to specify that the supplied histogram contains only the upper half of a symmetric DP (or lower half if using square DP coordinates)
+ \param [in] squareDP boolean flag to specify whether the supplied histogram is in square DP coordinates
+ */
+ Lau2DAbsHistDPPdf( LauKinematics* kinematics,
+ const LauVetoes* vetoes,
+ Bool_t useUpperHalfOnly = kFALSE,
+ Bool_t squareDP = kFALSE );
+
+ //! Destructor
+ virtual ~Lau2DAbsHistDPPdf();
+
+ //! Retrieve maximum height of the PDF
+ /*!
+ \return the maximum height
+ */
+ Double_t getMaxHeight() const { return maxHeight_; }
+
+ //! Retrieve PDF normalisation
+ /*!
+ \return the normalisation factor
+ */
+ virtual Double_t getHistNorm() const = 0;
+
+ //! Perform the interpolation (unnormalised)
+ /*!
+ \param [in] x the x-axis value
+ \param [in] y the y-aixs value
+ \return the unnormalised PDF value
+ */
+ virtual Double_t interpolateXY( Double_t x, Double_t y ) const = 0;
+
+ //! Perform the interpolation and divide by the normalisation
+ /*!
+ \param [in] x the x-axis abscissa value
+ \param [in] y the y-axis abscissa value
+ \return the normalised PDF value
+ */
+ virtual Double_t interpolateXYNorm( Double_t x, Double_t y ) const = 0;
+
+ protected:
+ //! Get the kinematics object
+ /*!
+ \return the kinematics
+ */
+ const LauKinematics* getKinematics() const { return kinematics_; }
+
+ //! Get the vetoes object
+ /*!
+ \return the vetoes
+ */
+ const LauVetoes* getVetoes() const { return vetoes_; }
+
+ //! Calculate maximum height
+ /*!
+ \param [in,out] hist the histogram
+ */
+ void calcMaxHeight( TH2* hist );
+
+ //! Fluctuate the histogram bin contents in accordance with their errors
+ /*!
+ \param [in,out] hist the histogram
+ */
+ void doBinFluctuation( TH2* hist );
+
+ //! Check whether the given co-ordinates are within the kinematic boundary
+ /*!
+ \param [in] x the x co-ordinate
+ \param [in] y the y co-ordinate
+ \return true if the co-ordinates are within the kinematic boundary, otherwise false
+ */
+ Bool_t withinDPBoundaries( Double_t x, Double_t y ) const;
+
+ //! Update the current co-ordinates in the kinematic space
+ /*!
+ \param [in] x the x co-ordinate
+ \param [in] y the y co-ordinate
+ */
+ void updateKinematics( Double_t x, Double_t y ) const;
+
+ //! If only using the upper half of the (symmetric) DP then transform into the correct half
+ /*!
+ \param [in,out] x the x co-ordinate
+ \param [in,out] y the y co-ordinate
+ */
+ void getUpperHalf( Double_t& x, Double_t& y ) const;
+
+ private:
+ //! Copy constructor - not implemented
+ Lau2DAbsHistDPPdf( const Lau2DAbsHistDPPdf& rhs );
+
+ //! Copy assignment operator - not implemented
+ Lau2DAbsHistDPPdf& operator=( const Lau2DAbsHistDPPdf& rhs );
+
+ //! DP kinematics
+ LauKinematics* kinematics_;
+
+ //! Vetos within DP
+ const LauVetoes* vetoes_;
+
+ //! The maximum height of 2D histogram
+ Double_t maxHeight_;
+
+ //! Boolean for using the upper half of DP
+ Bool_t upperHalf_;
+ //! Boolean for using square DP variables
+ Bool_t squareDP_;
+
+ ClassDef( Lau2DAbsHistDPPdf, 0 ) // Abstract base class for 2D DP variations based on a histogram
};
#endif
diff --git a/inc/Lau2DCubicSpline.hh b/inc/Lau2DCubicSpline.hh
index deb64c6..773eb8b 100644
--- a/inc/Lau2DCubicSpline.hh
+++ b/inc/Lau2DCubicSpline.hh
@@ -1,222 +1,228 @@
/*
Copyright 2013 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file Lau2DCubicSpline.hh
\brief File containing declaration of Lau2DCubicSpline class.
*/
/*! \class Lau2DCubicSpline
\brief Class for defining a 2D cubic spline based on an input histogram
Class for defining a 2D cubic spline based on RooBinned2DBicubicBase by
Manuel Tobias Schiller <manuel.schiller@nikhef.nl> (2012-08-29).
Smoothly interpolate between bin midpoints of a 2D histogram with
equal-sized bins
-
+
The interpolation function coincides with the saved histogram values in bin
midpoints; a cubic interpolation polynomial is used. Bins must all have the
same size. The interpolation polynomial in a "cell" between four bin
midpoints is:
-
+
\f[ p(x, y) = \sum_{i=0}^3 \sum_{j=0}^3 a_{ij} x^i y^j \f]
-
+
The coefficients \f$a_{ij}\f$ are determined by the requirement that
function value, first derivatives and the mixed second derivative must agree
with that of the binned function at the four bin midpoints at the edges of
the cell. Symmetric finite differences are used to approximate these
derivatives.
-
+
For each cell, the coefficients are determined at constuction time. The
object also keeps a cache of 2D integrals over complete cells, such that 2D
integrations can be done analytically in a reasonably short amount of time.
*/
#ifndef LAU_2DCUBICSPLINE
#define LAU_2DCUBICSPLINE
#include "Rtypes.h"
#include <vector>
class TH2;
-class Lau2DCubicSpline
-{
- private:
- //! Length of coefficient record in array
- enum { NCoeff = 16, CoeffRecLen = 17 };
-
- public:
- //! Constructor from histogram
- /*!
- /param h the histogram
- */
- Lau2DCubicSpline(const TH2& h);
-
- //! Destructor
- virtual ~Lau2DCubicSpline();
-
- //! Evaluate the function at given point
- /*!
- \param [in] x the x co-ordinate
- \param [in] y the y co-ordinate
- */
- virtual Double_t evaluate(Double_t x, Double_t y) const;
-
- //! Evaluate analytical integral in x, y, or x and y
- /*!
- \param [in] x1 the lower x limit
- \param [in] x2 the upper x limit
- \param [in] y1 the lower y limit
- \param [in] y2 the upper y limit
- */
- virtual Double_t analyticalIntegral(Double_t x1, Double_t x2, Double_t y1, Double_t y2) const;
-
- //! Evaluate analytical integral across the whole function
- virtual Double_t analyticalIntegral() const;
-
-
- private:
- //! Copy constructor - not implemented
- Lau2DCubicSpline( const Lau2DCubicSpline& rhs );
-
- //! Copy assignment operator - not implemented
- Lau2DCubicSpline& operator=(const Lau2DCubicSpline& rhs);
-
- //! Number of bins in x axis
- Int_t nBinsX;
-
- //! Number of bins in y axis
- Int_t nBinsY;
-
- //! Bin size in x
- Double_t binSizeX;
-
- //! Bin size in y
- Double_t binSizeY;
-
- //! Minimum x value
- Double_t xmin;
-
- //! Maximum x value
- Double_t xmax;
-
- //! Minimum y value
- Double_t ymin;
-
- //! Maximum y value
- Double_t ymax;
-
- //! Coefficients of interpolation polynomials
- std::vector<Double_t> coeffs;
-
- //! Get contents of a given bin from a histogram
- /*!
- \param [in] h the histogram
- \param [in] xbin the x bin index
- \param [in] ybin the y bin index
- \return the bin contents
- */
- Double_t histcont(const TH2& h, Int_t xbin, Int_t ybin) const;
-
- //! Get d/dx finite difference in a given bin from a histogram
- /*!
- \param [in] h the histogram
- \param [in] xbin the x bin index
- \param [in] ybin the y bin index
- \return the d/dx finite difference
- */
- Double_t dhistdx(const TH2& h, Int_t xbin, Int_t ybin) const;
-
- //! Get d/dy finite difference in a given bin from a histogram
- /*!
- \param [in] h the histogram
- \param [in] xbin the x bin index
- \param [in] ybin the y bin index
- \return the d/dy finite difference
- */
- Double_t dhistdy(const TH2& h, Int_t xbin, Int_t ybin) const;
-
- //! Get d^2/dydx finite difference in a given bin from a histogram
- /*!
- \param [in] h the histogram
- \param [in] xbin the x bin index
- \param [in] ybin the y bin index
- \return the d^2/dydx finite difference
- */
- Double_t d2histdxdy(const TH2& h, Int_t xbin, Int_t ybin) const;
-
- //! Const access to coefficients
- /*!
- \param [in] binx the x bin index
- \param [in] biny the y bin index
- \param [in] theCoeff the coefficient index
- \return the coefficient
- */
- inline const Double_t& coeff(Int_t binx, Int_t biny, Int_t theCoeff) const
- { return coeffs[theCoeff + CoeffRecLen * (binx + nBinsX * biny)]; }
-
- //! Access to coefficients
- /*!
- \param [in] binx the x bin index
- \param [in] biny the y bin index
- \param [in] theCoeff the coefficient index
- \return the coefficient
- */
- inline Double_t& coeff(Int_t binx, Int_t biny, Int_t theCoeff)
- { return coeffs[theCoeff + CoeffRecLen * (binx + nBinsX * biny)]; }
-
- //! Evaluate integral over x at a given y from (x1, y) to (x2, y)
- /*!
- \param [in] x1 lower x limit
- \param [in] x2 upper x limit
- \param [in] y y value
- \return integral over x
- */
- Double_t evalX(Double_t x1, Double_t x2, Double_t y) const;
-
- //! Evaluate integral over y at a given x from (x, y1) to (x, y2)
- /*!
- \param [in] x x value
- \param [in] y1 lower y limit
- \param [in] y2 upper y limit
- \return integral over y
- */
- Double_t evalY(Double_t x, Double_t y1, Double_t y2) const;
-
- //! Evaluate integral over x and y from (x1, y1) to (x2, y2)
- /*!
- \param [in] x1 lower x limit
- \param [in] x2 upper x limit
- \param [in] y1 lower y limit
- \param [in] y2 upper y limit
- \return integral over x and y
- */
- Double_t evalXY(Double_t x1, Double_t x2, Double_t y1, Double_t y2) const;
-
- ClassDef(Lau2DCubicSpline, 0); // Class for defining a 2D cubic spline based on an input histogram
+class Lau2DCubicSpline {
+ private:
+ //! Length of coefficient record in array
+ enum {
+ NCoeff = 16,
+ CoeffRecLen = 17
+ };
+
+ public:
+ //! Constructor from histogram
+ /*!
+ \param h the histogram
+ */
+ Lau2DCubicSpline( const TH2& h );
+
+ //! Destructor
+ virtual ~Lau2DCubicSpline();
+
+ //! Evaluate the function at given point
+ /*!
+ \param [in] x the x co-ordinate
+ \param [in] y the y co-ordinate
+ */
+ virtual Double_t evaluate( Double_t x, Double_t y ) const;
+
+ //! Evaluate analytical integral in x, y, or x and y
+ /*!
+ \param [in] x1 the lower x limit
+ \param [in] x2 the upper x limit
+ \param [in] y1 the lower y limit
+ \param [in] y2 the upper y limit
+ */
+ virtual Double_t analyticalIntegral( Double_t x1, Double_t x2, Double_t y1, Double_t y2 ) const;
+
+ //! Evaluate analytical integral across the whole function
+ virtual Double_t analyticalIntegral() const;
+
+ private:
+ //! Copy constructor - not implemented
+ Lau2DCubicSpline( const Lau2DCubicSpline& rhs );
+
+ //! Copy assignment operator - not implemented
+ Lau2DCubicSpline& operator=( const Lau2DCubicSpline& rhs );
+
+ //! Number of bins in x axis
+ Int_t nBinsX;
+
+ //! Number of bins in y axis
+ Int_t nBinsY;
+
+ //! Bin size in x
+ Double_t binSizeX;
+
+ //! Bin size in y
+ Double_t binSizeY;
+
+ //! Minimum x value
+ Double_t xmin;
+
+ //! Maximum x value
+ Double_t xmax;
+
+ //! Minimum y value
+ Double_t ymin;
+
+ //! Maximum y value
+ Double_t ymax;
+
+ //! Coefficients of interpolation polynomials
+ std::vector<Double_t> coeffs;
+
+ //! Get contents of a given bin from a histogram
+ /*!
+ \param [in] h the histogram
+ \param [in] xbin the x bin index
+ \param [in] ybin the y bin index
+ \return the bin contents
+ */
+ Double_t histcont( const TH2& h, Int_t xbin, Int_t ybin ) const;
+
+ //! Get d/dx finite difference in a given bin from a histogram
+ /*!
+ \param [in] h the histogram
+ \param [in] xbin the x bin index
+ \param [in] ybin the y bin index
+ \return the d/dx finite difference
+ */
+ Double_t dhistdx( const TH2& h, Int_t xbin, Int_t ybin ) const;
+
+ //! Get d/dy finite difference in a given bin from a histogram
+ /*!
+ \param [in] h the histogram
+ \param [in] xbin the x bin index
+ \param [in] ybin the y bin index
+ \return the d/dy finite difference
+ */
+ Double_t dhistdy( const TH2& h, Int_t xbin, Int_t ybin ) const;
+
+ //! Get d^2/dydx finite difference in a given bin from a histogram
+ /*!
+ \param [in] h the histogram
+ \param [in] xbin the x bin index
+ \param [in] ybin the y bin index
+ \return the d^2/dydx finite difference
+ */
+ Double_t d2histdxdy( const TH2& h, Int_t xbin, Int_t ybin ) const;
+
+ //! Const access to coefficients
+ /*!
+ \param [in] binx the x bin index
+ \param [in] biny the y bin index
+ \param [in] theCoeff the coefficient index
+ \return the coefficient
+ */
+ inline const Double_t& coeff( Int_t binx, Int_t biny, Int_t theCoeff ) const
+ {
+ return coeffs[theCoeff + CoeffRecLen * ( binx + nBinsX * biny )];
+ }
+
+ //! Access to coefficients
+ /*!
+ \param [in] binx the x bin index
+ \param [in] biny the y bin index
+ \param [in] theCoeff the coefficient index
+ \return the coefficient
+ */
+ inline Double_t& coeff( Int_t binx, Int_t biny, Int_t theCoeff )
+ {
+ return coeffs[theCoeff + CoeffRecLen * ( binx + nBinsX * biny )];
+ }
+
+ //! Evaluate integral over x at a given y from (x1, y) to (x2, y)
+ /*!
+ \param [in] x1 lower x limit
+ \param [in] x2 upper x limit
+ \param [in] y y value
+ \return integral over x
+ */
+ Double_t evalX( Double_t x1, Double_t x2, Double_t y ) const;
+
+ //! Evaluate integral over y at a given x from (x, y1) to (x, y2)
+ /*!
+ \param [in] x x value
+ \param [in] y1 lower y limit
+ \param [in] y2 upper y limit
+ \return integral over y
+ */
+ Double_t evalY( Double_t x, Double_t y1, Double_t y2 ) const;
+
+ //! Evaluate integral over x and y from (x1, y1) to (x2, y2)
+ /*!
+ \param [in] x1 lower x limit
+ \param [in] x2 upper x limit
+ \param [in] y1 lower y limit
+ \param [in] y2 upper y limit
+ \return integral over x and y
+ */
+ Double_t evalXY( Double_t x1, Double_t x2, Double_t y1, Double_t y2 ) const;
+
+ ClassDef( Lau2DCubicSpline,
+ 0 ); // Class for defining a 2D cubic spline based on an input histogram
};
#endif
diff --git a/inc/Lau2DHistDP.hh b/inc/Lau2DHistDP.hh
index 0f125d3..7f5f9b4 100644
--- a/inc/Lau2DHistDP.hh
+++ b/inc/Lau2DHistDP.hh
@@ -1,150 +1,166 @@
/*
Copyright 2004 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file Lau2DHistDP.hh
\brief File containing declaration of Lau2DHistDP class.
*/
/*! \class Lau2DHistDP
\brief Class for defining a 2D DP histogram.
Class for defining a 2D DP histogram.
Employs linear interpolation to get the histogram value based on how far away a point in (x,y)
is to nearby bin centres. The returned values are not normalised to the total histogram area
(useful for efficiency histograms for example).
The histogram can be defined in the conventional DP (m13Sq vs m23Sq) or in the square DP.
*/
#ifndef LAU_2DHIST_DP
#define LAU_2DHIST_DP
#include "Lau2DAbsHistDP.hh"
class TH2;
class LauDaughters;
class LauKinematics;
class Lau2DHistDP : public Lau2DAbsHistDP {
- public:
- //! Constructor
- /*!
- \param [in] hist the 2D DP histogram
- \param [in] daughters the daughter particles
- \param [in] useInterpolation boolean flag to determine whether linear interpolation between bins should be used or simply the raw bin values
- \param [in] fluctuateBins boolean flag to determine whether the bin contents should be fluctuated in accordance with their errors (useful for systematic error evaluation).
- The seed for the random number generator used to fluctuate the bins should first be set using LauRandom::setSeed.
- \param [in] avEff the desired average efficiency - see Lau2DHistDP::raiseOrLowerBins.
- The seed for the random number generator used to raise or lower the bins should first be set using LauRandom::setSeed.
- \param [in] avEffError the error on that efficiency - see Lau2DHistDP::raiseOrLowerBins
- \param [in] useUpperHalfOnly boolean flag to specify that the supplied histogram contains only the upper half of a symmetric DP (or lower half if using square DP coordinates)
- \param [in] squareDP boolean flag to specify whether the supplied histogram is in square DP coordinates
- */
- Lau2DHistDP(const TH2* hist, const LauDaughters* daughters,
- Bool_t useInterpolation = kTRUE, Bool_t fluctuateBins = kFALSE,
- Double_t avEff = -1.0, Double_t avEffError = -1.0, Bool_t useUpperHalfOnly = kFALSE, Bool_t squareDP = kFALSE);
-
- //! Constructor
- /*!
- \param [in] hist the 2D DP histogram
- \param [in] errorHi the 2D DP histogram containing the upper uncertainty
- \param [in] errorLo the 2D DP histogram containing the lower uncertainty
- \param [in] daughters the daughter particles
- \param [in] useInterpolation boolean flag to determine whether linear interpolation between bins should be used or simply the raw bin values
- \param [in] fluctuateBins boolean flag to determine whether the bin contents should be fluctuated in accordance with their errors (useful for systematic error evaluation).
- The seed for the random number generator used to fluctuate the bins should first be set using LauRandom::setSeed.
- \param [in] avEff the desired average efficiency - see Lau2DHistDP::raiseOrLowerBins.
- The seed for the random number generator used to raise or lower the bins should first be set using LauRandom::setSeed.
- \param [in] avEffError the error on that efficiency - see Lau2DHistDP::raiseOrLowerBins
- \param [in] useUpperHalfOnly boolean flag to specify that the supplied histogram contains only the upper half of a symmetric DP (or lower half if using square DP coordinates)
- \param [in] squareDP boolean flag to specify whether the supplied histogram is in square DP coordinates
- */
- Lau2DHistDP(const TH2* hist, const TH2* errorHi, const TH2* errorLo, const LauDaughters* daughters,
- Bool_t useInterpolation = kTRUE, Bool_t fluctuateBins = kFALSE,
- Double_t avEff = -1.0, Double_t avEffError = -1.0, Bool_t useUpperHalfOnly = kFALSE, Bool_t squareDP = kFALSE);
-
- //! Destructor
- virtual ~Lau2DHistDP();
-
- //! Perform the interpolation
- /*!
- \param [in] x the x-axis value
- \param [in] y the y-aixs value
- \return the interpolated histogram value
- */
- Double_t interpolateXY(Double_t x, Double_t y) const;
-
- protected:
- //! Get the raw bin content from the histogram
- /*!
- \param [in] xBinNo the x-axis bin number
- \param [in] yBinNo the y-axis bin number
- \return the bin conent
- */
- Double_t getBinHistValue(Int_t xBinNo, Int_t yBinNo) const;
-
- private:
- //! Copy constructor - not implemented
- Lau2DHistDP( const Lau2DHistDP& rhs );
-
- //! Copy assignment operator - not implemented
- Lau2DHistDP& operator=(const Lau2DHistDP& rhs);
-
- //! The underlying histogram
- TH2* hist_;
- //! The histogram containing the upper errors
- TH2* errorHi_;
- //! The histogram containing the lower errors
- TH2* errorLo_;
-
- //! The histogram x-axis minimum
- Double_t minX_;
- //! The histogram x-axis maximum
- Double_t maxX_;
- //! The histogram y-axis minimum
- Double_t minY_;
- //! The histogram y-axis maximum
- Double_t maxY_;
- //! The histogram x-axis range
- Double_t rangeX_;
- //! The histogram y-axis range
- Double_t rangeY_;
-
- //! The histogram x-axis bin width
- Double_t binXWidth_;
- //! The histogram y-axis bin width
- Double_t binYWidth_;
-
- //! The number of bins on the x-axis of the histogram
- Int_t nBinsX_;
- //! The number of bins on the y-axis of the histogram
- Int_t nBinsY_;
-
- //! Control boolean for using the linear interpolation
- Bool_t useInterpolation_;
-
- ClassDef(Lau2DHistDP,0) // 2D Histogram utility class for DP analyses
+ public:
+ //! Constructor
+ /*!
+ \param [in] hist the 2D DP histogram
+ \param [in] daughters the daughter particles
+ \param [in] useInterpolation boolean flag to determine whether linear interpolation between bins should be used or simply the raw bin values
+ \param [in] fluctuateBins boolean flag to determine whether the bin contents should be fluctuated in accordance with their errors (useful for systematic error evaluation).
+ The seed for the random number generator used to fluctuate the bins should first be set using LauRandom::setSeed.
+
+ \param [in] avEff the desired average efficiency - see Lau2DHistDP::raiseOrLowerBins.
+ The seed for the random number generator used to raise or lower the bins should first be set using LauRandom::setSeed.
+
+ \param [in] avEffError the error on that efficiency - see Lau2DHistDP::raiseOrLowerBins
+ \param [in] useUpperHalfOnly boolean flag to specify that the supplied histogram contains only the upper half of a symmetric DP (or lower half if using square DP coordinates)
+ \param [in] squareDP boolean flag to specify whether the supplied histogram is in square DP coordinates
+ */
+ Lau2DHistDP( const TH2* hist,
+ const LauDaughters* daughters,
+ Bool_t useInterpolation = kTRUE,
+ Bool_t fluctuateBins = kFALSE,
+ Double_t avEff = -1.0,
+ Double_t avEffError = -1.0,
+ Bool_t useUpperHalfOnly = kFALSE,
+ Bool_t squareDP = kFALSE );
+
+ //! Constructor
+ /*!
+ \param [in] hist the 2D DP histogram
+ \param [in] errorHi the 2D DP histogram containing the upper uncertainty
+ \param [in] errorLo the 2D DP histogram containing the lower uncertainty
+ \param [in] daughters the daughter particles
+ \param [in] useInterpolation boolean flag to determine whether linear interpolation between bins should be used or simply the raw bin values
+ \param [in] fluctuateBins boolean flag to determine whether the bin contents should be fluctuated in accordance with their errors (useful for systematic error evaluation).
+ The seed for the random number generator used to fluctuate the bins should first be set using LauRandom::setSeed.
+
+ \param [in] avEff the desired average efficiency - see Lau2DHistDP::raiseOrLowerBins.
+ The seed for the random number generator used to raise or lower the bins should first be set using LauRandom::setSeed.
+
+ \param [in] avEffError the error on that efficiency - see Lau2DHistDP::raiseOrLowerBins
+ \param [in] useUpperHalfOnly boolean flag to specify that the supplied histogram contains only the upper half of a symmetric DP (or lower half if using square DP coordinates)
+ \param [in] squareDP boolean flag to specify whether the supplied histogram is in square DP coordinates
+ */
+ Lau2DHistDP( const TH2* hist,
+ const TH2* errorHi,
+ const TH2* errorLo,
+ const LauDaughters* daughters,
+ Bool_t useInterpolation = kTRUE,
+ Bool_t fluctuateBins = kFALSE,
+ Double_t avEff = -1.0,
+ Double_t avEffError = -1.0,
+ Bool_t useUpperHalfOnly = kFALSE,
+ Bool_t squareDP = kFALSE );
+
+ //! Destructor
+ virtual ~Lau2DHistDP();
+
+ //! Perform the interpolation
+ /*!
+ \param [in] x the x-axis value
+ \param [in] y the y-aixs value
+ \return the interpolated histogram value
+ */
+ Double_t interpolateXY( Double_t x, Double_t y ) const;
+
+ protected:
+ //! Get the raw bin content from the histogram
+ /*!
+ \param [in] xBinNo the x-axis bin number
+ \param [in] yBinNo the y-axis bin number
+ \return the bin conent
+ */
+ Double_t getBinHistValue( Int_t xBinNo, Int_t yBinNo ) const;
+
+ private:
+ //! Copy constructor - not implemented
+ Lau2DHistDP( const Lau2DHistDP& rhs );
+
+ //! Copy assignment operator - not implemented
+ Lau2DHistDP& operator=( const Lau2DHistDP& rhs );
+
+ //! The underlying histogram
+ TH2* hist_;
+ //! The histogram containing the upper errors
+ TH2* errorHi_;
+ //! The histogram containing the lower errors
+ TH2* errorLo_;
+
+ //! The histogram x-axis minimum
+ Double_t minX_;
+ //! The histogram x-axis maximum
+ Double_t maxX_;
+ //! The histogram y-axis minimum
+ Double_t minY_;
+ //! The histogram y-axis maximum
+ Double_t maxY_;
+ //! The histogram x-axis range
+ Double_t rangeX_;
+ //! The histogram y-axis range
+ Double_t rangeY_;
+
+ //! The histogram x-axis bin width
+ Double_t binXWidth_;
+ //! The histogram y-axis bin width
+ Double_t binYWidth_;
+
+ //! The number of bins on the x-axis of the histogram
+ Int_t nBinsX_;
+ //! The number of bins on the y-axis of the histogram
+ Int_t nBinsY_;
+
+ //! Control boolean for using the linear interpolation
+ Bool_t useInterpolation_;
+
+ ClassDef( Lau2DHistDP, 0 ) // 2D Histogram utility class for DP analyses
};
#endif
diff --git a/inc/Lau2DHistDPPdf.hh b/inc/Lau2DHistDPPdf.hh
index 2508c7b..1049f1d 100644
--- a/inc/Lau2DHistDPPdf.hh
+++ b/inc/Lau2DHistDPPdf.hh
@@ -1,154 +1,159 @@
/*
Copyright 2004 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file Lau2DHistDPPdf.hh
\brief File containing declaration of Lau2DHistDPPdf class.
*/
/*! \class Lau2DHistDPPdf
- \brief Class for defining a 2D DP histogram PDF.
+ \brief Class for defining a 2D DP histogram PDF.
- Class for defining a 2D DP histogram PDF.
+ Class for defining a 2D DP histogram PDF.
Employs linear interpolation to get the histogram value based on how far away a point in (x,y)
is to nearby bin centres. The returned values are normalised to the total area.
The histogram can be defined in the conventional DP (m13Sq vs m23Sq) or in the square DP.
*/
#ifndef LAU_2DHIST_DP_PDF
#define LAU_2DHIST_DP_PDF
#include "Lau2DAbsHistDPPdf.hh"
class TH2;
class LauKinematics;
class LauVetoes;
class Lau2DHistDPPdf : public Lau2DAbsHistDPPdf {
- public:
- //! Constructor
- /*!
- \param [in] hist the 2D DP histogram
- \param [in] kinematics the current DP kinematics
- \param [in] vetoes the vetoes within the DP
- \param [in] useInterpolation boolean flag to determine whether linear interpolation between bins should be used or simply the raw bin values
- \param [in] fluctuateBins boolean flag to determine whether the bin contents should be fluctuated in accordance with their errors (useful for systematic error evaluation).
- The seed for the random number generator used to fluctuate the bins should first be set using LauRandom::setSeed.
- \param [in] useUpperHalfOnly boolean flag to specify that the supplied histogram contains only the upper half of a symmetric DP (or lower half if using square DP coordinates)
- \param [in] squareDP boolean flag to specify whether the supplied histogram is in square DP coordinates
- */
- Lau2DHistDPPdf(const TH2* hist, LauKinematics* kinematics, const LauVetoes* vetoes,
- Bool_t useInterpolation = kTRUE, Bool_t fluctuateBins = kFALSE,
- Bool_t useUpperHalfOnly = kFALSE, Bool_t squareDP = kFALSE);
-
- //! Destructor
- virtual ~Lau2DHistDPPdf();
-
- //! Retrieve PDF normalisation
- /*!
- \return the normalisation factor
- */
- Double_t getHistNorm() const {return norm_;}
-
- //! Perform the interpolation (unnormalised)
- /*!
- \param [in] x the x-axis value
- \param [in] y the y-aixs value
- \return the unnormalised PDF value
- */
- Double_t interpolateXY(Double_t x, Double_t y) const;
-
- //! Perform the interpolation and divide by the normalisation
- /*!
- \param [in] x the x-axis abscissa value
- \param [in] y the y-axis abscissa value
- \return the normalised PDF value
- */
- Double_t interpolateXYNorm(Double_t x, Double_t y) const;
-
- protected:
- //! Get the bin content from the histogram
- /*!
- \param [in] xBinNo the x-axis bin number
- \param [in] yBinNo the y-axis bin number
- \return the bin conent
- */
- Double_t getBinHistValue(Int_t xBinNo, Int_t yBinNo) const;
-
- //! Calculate the PDF normalisation
- void calcHistNorm();
-
- //! Check the normalisation calculation
- void checkNormalisation();
-
- private:
- //! Copy constructor - not implemented
- Lau2DHistDPPdf( const Lau2DHistDPPdf& rhs );
-
- //! Copy assignment operator - not implemented
- Lau2DHistDPPdf& operator=(const Lau2DHistDPPdf& rhs);
-
- //! The underlying histogram
- TH2* hist_;
-
- //! The histogram x-axis minimum
- Double_t minX_;
- //! The histogram x-axis maximum
- Double_t maxX_;
- //! The histogram y-axis minimum
- Double_t minY_;
- //! The histogram y-axis maximum
- Double_t maxY_;
- //! The histogram x-axis range
- Double_t rangeX_;
- //! The histogram y-axis range
- Double_t rangeY_;
-
- //! The histogram x-axis bin width
- Double_t binXWidth_;
- //! The histogram y-axis bin width
- Double_t binYWidth_;
- //! The histogram x-axis inverse bin width
- Double_t invBinXWidth_;
- //! The histogram y-axis inverse bin width
- Double_t invBinYWidth_;
-
- //! The maximum height of 2D histogram
- Double_t maxHeight_;
-
- //! The number of bins on the x-axis of the histogram
- Int_t nBinsX_;
- //! The number of bins on the y-axis of the histogram
- Int_t nBinsY_;
-
- //! The histogram normalisation
- Double_t norm_;
-
- //! Control boolean for using the linear interpolation
- Bool_t useInterpolation_;
-
- ClassDef(Lau2DHistDPPdf,0) // 2D Histogram utility class for DP analyses
+ public:
+ //! Constructor
+ /*!
+ \param [in] hist the 2D DP histogram
+ \param [in] kinematics the current DP kinematics
+ \param [in] vetoes the vetoes within the DP
+ \param [in] useInterpolation boolean flag to determine whether linear interpolation between bins should be used or simply the raw bin values
+ \param [in] fluctuateBins boolean flag to determine whether the bin contents should be fluctuated in accordance with their errors (useful for systematic error evaluation).
+ The seed for the random number generator used to fluctuate the bins should first be set using LauRandom::setSeed.
+
+ \param [in] useUpperHalfOnly boolean flag to specify that the supplied histogram contains only the upper half of a symmetric DP (or lower half if using square DP coordinates)
+ \param [in] squareDP boolean flag to specify whether the supplied histogram is in square DP coordinates
+ */
+ Lau2DHistDPPdf( const TH2* hist,
+ LauKinematics* kinematics,
+ const LauVetoes* vetoes,
+ Bool_t useInterpolation = kTRUE,
+ Bool_t fluctuateBins = kFALSE,
+ Bool_t useUpperHalfOnly = kFALSE,
+ Bool_t squareDP = kFALSE );
+
+ //! Destructor
+ virtual ~Lau2DHistDPPdf();
+
+ //! Retrieve PDF normalisation
+ /*!
+ \return the normalisation factor
+ */
+ Double_t getHistNorm() const { return norm_; }
+
+ //! Perform the interpolation (unnormalised)
+ /*!
+ \param [in] x the x-axis value
+ \param [in] y the y-aixs value
+ \return the unnormalised PDF value
+ */
+ Double_t interpolateXY( Double_t x, Double_t y ) const;
+
+ //! Perform the interpolation and divide by the normalisation
+ /*!
+ \param [in] x the x-axis abscissa value
+ \param [in] y the y-axis abscissa value
+ \return the normalised PDF value
+ */
+ Double_t interpolateXYNorm( Double_t x, Double_t y ) const;
+
+ protected:
+ //! Get the bin content from the histogram
+ /*!
+ \param [in] xBinNo the x-axis bin number
+ \param [in] yBinNo the y-axis bin number
+ \return the bin conent
+ */
+ Double_t getBinHistValue( Int_t xBinNo, Int_t yBinNo ) const;
+
+ //! Calculate the PDF normalisation
+ void calcHistNorm();
+
+ //! Check the normalisation calculation
+ void checkNormalisation();
+
+ private:
+ //! Copy constructor - not implemented
+ Lau2DHistDPPdf( const Lau2DHistDPPdf& rhs );
+
+ //! Copy assignment operator - not implemented
+ Lau2DHistDPPdf& operator=( const Lau2DHistDPPdf& rhs );
+
+ //! The underlying histogram
+ TH2* hist_;
+
+ //! The histogram x-axis minimum
+ Double_t minX_;
+ //! The histogram x-axis maximum
+ Double_t maxX_;
+ //! The histogram y-axis minimum
+ Double_t minY_;
+ //! The histogram y-axis maximum
+ Double_t maxY_;
+ //! The histogram x-axis range
+ Double_t rangeX_;
+ //! The histogram y-axis range
+ Double_t rangeY_;
+
+ //! The histogram x-axis bin width
+ Double_t binXWidth_;
+ //! The histogram y-axis bin width
+ Double_t binYWidth_;
+ //! The histogram x-axis inverse bin width
+ Double_t invBinXWidth_;
+ //! The histogram y-axis inverse bin width
+ Double_t invBinYWidth_;
+
+ //! The maximum height of 2D histogram
+ Double_t maxHeight_;
+
+ //! The number of bins on the x-axis of the histogram
+ Int_t nBinsX_;
+ //! The number of bins on the y-axis of the histogram
+ Int_t nBinsY_;
+
+ //! The histogram normalisation
+ Double_t norm_;
+
+ //! Control boolean for using the linear interpolation
+ Bool_t useInterpolation_;
+
+ ClassDef( Lau2DHistDPPdf, 0 ) // 2D Histogram utility class for DP analyses
};
#endif
diff --git a/inc/Lau2DHistPdf.hh b/inc/Lau2DHistPdf.hh
index fd8a59a..b2f8c52 100644
--- a/inc/Lau2DHistPdf.hh
+++ b/inc/Lau2DHistPdf.hh
@@ -1,218 +1,220 @@
/*
Copyright 2008 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file Lau2DHistPdf.hh
\brief File containing declaration of Lau2DHistPdf class.
*/
/*! \class Lau2DHistPdf
\brief Class for defining a 2D histogram PDF.
Class for defining a 2D histogram PDF.
Employs linear interpolation to get the histogram value based on how far away a
point is to nearby bin centres. The returned values are normalised to
the total area.
*/
#ifndef LAU_2DHIST_PDF
#define LAU_2DHIST_PDF
#include "LauAbsPdf.hh"
class TH2;
class TH1;
class Lau1DHistPdf;
class Lau2DHistPdf : public LauAbsPdf {
- public:
- //! Constructor
- /*!
- \param [in] theVarNames the names of the abscissa variables
- \param [in] hist the 2D histogram from which the PDF should be constructed
- \param [in] minVals the minimum values of the abscissas
- \param [in] maxVals the maximum values of the abscissas
- \param [in] useInterpolation boolean flag to determine whether linear interpolation between bins should be used or simply the raw bin values
- \param [in] fluctuateBins boolean flag to determine whether the bin contents should be fluctuated in accordance with their errors.
- The seed for the random number generator used to fluctuate the bins should first be set using LauRandom::setSeed.
- */
- Lau2DHistPdf(const std::vector<TString>& theVarNames, const TH2* hist,
- const LauFitData& minVals, const LauFitData& maxVals,
- Bool_t useInterpolation = kTRUE, Bool_t fluctuateBins = kFALSE);
-
- //! Destructor
- virtual ~Lau2DHistPdf();
-
- //! Get the minimum value of x-axis abscissa
- Double_t getMinX() const {return minX_;}
-
- //! Get the maximum value of x-axis abscissa
- Double_t getMaxX() const {return maxX_;}
-
- //! Get the range of x-axis abscissa values
- Double_t getRangeX() const {return rangeX_;}
-
- //! Get the minimum value of y-axis abscissa
- Double_t getMinY() const {return minY_;}
-
- //! Get the maximum value of y-axis abscissa
- Double_t getMaxY() const {return maxY_;}
-
- //! Get the range of y-axis abscissa values
- Double_t getRangeY() const {return rangeY_;}
-
- //! Cache information from data
- /*!
- \param [in] inputData the input data
- */
- virtual void cacheInfo(const LauFitDataTree& inputData);
-
- //! Calculate the likelihood (and intermediate info) for a given value of the abscissas
- /*!
- \param [in] abscissas the abscissa values
- */
- virtual void calcLikelihoodInfo(const LauAbscissas& abscissas);
-
- //! Calculate the likelihood (and intermediate info) for a given event number
- /*!
- \param [in] iEvt event number
- */
- virtual void calcLikelihoodInfo(UInt_t iEvt);
-
-
- //! Get likelihood only for the given variable
- /*!
- \param [in] theVarName the variable name (must be one of the two dimensions of this histogram!)
- \return likelihood value
- */
- virtual Double_t getLikelihood( const TString& theVarName ) const;
- using LauAbsPdf::getLikelihood;
-
- //! Calculate the normalisation
- virtual void calcNorm();
-
- //! Calculate the PDF height
- /*!
- \param [in] kinematics the current DP kinematics (not strictly required in this case since PDF has no DP dependence)
- */
- virtual void calcPDFHeight( const LauKinematics* kinematics );
-
- //! Generate an event from the PDF
- /*!
- \param [in] kinematics the current DP kinematics (used to determine the DP position by some PDFs that have dependence on it)
- \return generated data
- */
- virtual LauFitData generate(const LauKinematics* kinematics);
-
- protected:
- //! Fluctuate the histogram bin contents in accordance with their errors
- void doBinFluctuation();
-
- //! Check the normalisation calculation
- void checkNormalisation();
-
- //! Get the bin content from the histogram
- /*!
- \param [in] i the x-axis bin number
- \param [in] j the y-axis bin number
- \return the bin conent
- */
- Double_t getBinHistValue(Int_t i, Int_t j) const;
-
- //! Perform the interpolation (unnormalised)
- /*!
- \param [in] x the x-axis abscissa value
- \param [in] y the y-aixs abscissa value
- \return the unnormalised PDF value
- */
- Double_t interpolateXY(Double_t x, Double_t y) const;
-
- //! Perform the interpolation and divide by the normalisation
- /*!
- \param [in] x the x-axis abscissa value
- \param [in] y the y-axis abscissa value
- \return the normalised PDF value
- */
- Double_t interpolateXYNorm(Double_t x, Double_t y) const;
-
- private:
- //! Copy constructor (not implemented)
- Lau2DHistPdf(const Lau2DHistPdf& other);
-
- //! Copy assignment operator (not implemented)
- Lau2DHistPdf& operator=(const Lau2DHistPdf& other);
-
- //! The underlying histogram
- TH2* hist_;
- //! Projection of histogram x-axis
- TH1* xProj_;
- //! Projection of histogram y-axis
- TH1* yProj_;
-
- //! 1D PDF for x variable
- Lau1DHistPdf* xVarPdf_;
- //! 1D PDF for y variable
- Lau1DHistPdf* yVarPdf_;
-
- //! x variable name
- TString xName_;
- //! y variable name
- TString yName_;
-
- //! The number of bins on the x-axis of the histogram
- Int_t nBinsX_;
- //! The number of bins on the y-axis of the histogram
- Int_t nBinsY_;
- //! The histogram x-axis minimum
- Double_t minX_;
- //! The histogram x-axis maximum
- Double_t maxX_;
- //! The histogram y-axis minimum
- Double_t minY_;
- //! The histogram y-axis maximum
- Double_t maxY_;
- //! The histogram x-axis range
- Double_t rangeX_;
- //! The histogram y-axis range
- Double_t rangeY_;
-
- //! The histogram x-axis bin width
- Double_t binXWidth_;
- //! The histogram y-axis bin width
- Double_t binYWidth_;
-
- //! The histogram x-axis inverse bin width
- Double_t invBinXWidth_;
- //! The histogram y-axis inverse bin width
- Double_t invBinYWidth_;
-
- //! Control boolean for using the linear interpolation
- Bool_t useInterpolation_;
- //! Control boolean for performing the fluctuation of the histogram bin contents
- Bool_t fluctuateBins_;
-
- ClassDef(Lau2DHistPdf,0) // 2D histogram pdf class
+ public:
+ //! Constructor
+ /*!
+ \param [in] theVarNames the names of the abscissa variables
+ \param [in] hist the 2D histogram from which the PDF should be constructed
+ \param [in] minVals the minimum values of the abscissas
+ \param [in] maxVals the maximum values of the abscissas
+ \param [in] useInterpolation boolean flag to determine whether linear interpolation between bins should be used or simply the raw bin values
+ \param [in] fluctuateBins boolean flag to determine whether the bin contents should be fluctuated in accordance with their errors.
+ The seed for the random number generator used to fluctuate the bins should first be set using LauRandom::setSeed.
+ */
+ Lau2DHistPdf( const std::vector<TString>& theVarNames,
+ const TH2* hist,
+ const LauFitData& minVals,
+ const LauFitData& maxVals,
+ Bool_t useInterpolation = kTRUE,
+ Bool_t fluctuateBins = kFALSE );
+
+ //! Destructor
+ virtual ~Lau2DHistPdf();
+
+ //! Get the minimum value of x-axis abscissa
+ Double_t getMinX() const { return minX_; }
+
+ //! Get the maximum value of x-axis abscissa
+ Double_t getMaxX() const { return maxX_; }
+
+ //! Get the range of x-axis abscissa values
+ Double_t getRangeX() const { return rangeX_; }
+
+ //! Get the minimum value of y-axis abscissa
+ Double_t getMinY() const { return minY_; }
+
+ //! Get the maximum value of y-axis abscissa
+ Double_t getMaxY() const { return maxY_; }
+
+ //! Get the range of y-axis abscissa values
+ Double_t getRangeY() const { return rangeY_; }
+
+ //! Cache information from data
+ /*!
+ \param [in] inputData the input data
+ */
+ virtual void cacheInfo( const LauFitDataTree& inputData );
+
+ //! Calculate the likelihood (and intermediate info) for a given value of the abscissas
+ /*!
+ \param [in] abscissas the abscissa values
+ */
+ virtual void calcLikelihoodInfo( const LauAbscissas& abscissas );
+
+ //! Calculate the likelihood (and intermediate info) for a given event number
+ /*!
+ \param [in] iEvt event number
+ */
+ virtual void calcLikelihoodInfo( UInt_t iEvt );
+
+ //! Get likelihood only for the given variable
+ /*!
+ \param [in] theVarName the variable name (must be one of the two dimensions of this histogram!)
+ \return likelihood value
+ */
+ virtual Double_t getLikelihood( const TString& theVarName ) const;
+ using LauAbsPdf::getLikelihood;
+
+ //! Calculate the normalisation
+ virtual void calcNorm();
+
+ //! Calculate the PDF height
+ /*!
+ \param [in] kinematics the current DP kinematics (not strictly required in this case since PDF has no DP dependence)
+ */
+ virtual void calcPDFHeight( const LauKinematics* kinematics );
+
+ //! Generate an event from the PDF
+ /*!
+ \param [in] kinematics the current DP kinematics (used to determine the DP position by some PDFs that have dependence on it)
+ \return generated data
+ */
+ virtual LauFitData generate( const LauKinematics* kinematics );
+
+ protected:
+ //! Fluctuate the histogram bin contents in accordance with their errors
+ void doBinFluctuation();
+
+ //! Check the normalisation calculation
+ void checkNormalisation();
+
+ //! Get the bin content from the histogram
+ /*!
+ \param [in] i the x-axis bin number
+ \param [in] j the y-axis bin number
+ \return the bin conent
+ */
+ Double_t getBinHistValue( Int_t i, Int_t j ) const;
+
+ //! Perform the interpolation (unnormalised)
+ /*!
+ \param [in] x the x-axis abscissa value
+ \param [in] y the y-aixs abscissa value
+ \return the unnormalised PDF value
+ */
+ Double_t interpolateXY( Double_t x, Double_t y ) const;
+
+ //! Perform the interpolation and divide by the normalisation
+ /*!
+ \param [in] x the x-axis abscissa value
+ \param [in] y the y-axis abscissa value
+ \return the normalised PDF value
+ */
+ Double_t interpolateXYNorm( Double_t x, Double_t y ) const;
+
+ private:
+ //! Copy constructor (not implemented)
+ Lau2DHistPdf( const Lau2DHistPdf& other );
+
+ //! Copy assignment operator (not implemented)
+ Lau2DHistPdf& operator=( const Lau2DHistPdf& other );
+
+ //! The underlying histogram
+ TH2* hist_;
+ //! Projection of histogram x-axis
+ TH1* xProj_;
+ //! Projection of histogram y-axis
+ TH1* yProj_;
+
+ //! 1D PDF for x variable
+ Lau1DHistPdf* xVarPdf_;
+ //! 1D PDF for y variable
+ Lau1DHistPdf* yVarPdf_;
+
+ //! x variable name
+ TString xName_;
+ //! y variable name
+ TString yName_;
+
+ //! The number of bins on the x-axis of the histogram
+ Int_t nBinsX_;
+ //! The number of bins on the y-axis of the histogram
+ Int_t nBinsY_;
+ //! The histogram x-axis minimum
+ Double_t minX_;
+ //! The histogram x-axis maximum
+ Double_t maxX_;
+ //! The histogram y-axis minimum
+ Double_t minY_;
+ //! The histogram y-axis maximum
+ Double_t maxY_;
+ //! The histogram x-axis range
+ Double_t rangeX_;
+ //! The histogram y-axis range
+ Double_t rangeY_;
+
+ //! The histogram x-axis bin width
+ Double_t binXWidth_;
+ //! The histogram y-axis bin width
+ Double_t binYWidth_;
+
+ //! The histogram x-axis inverse bin width
+ Double_t invBinXWidth_;
+ //! The histogram y-axis inverse bin width
+ Double_t invBinYWidth_;
+
+ //! Control boolean for using the linear interpolation
+ Bool_t useInterpolation_;
+ //! Control boolean for performing the fluctuation of the histogram bin contents
+ Bool_t fluctuateBins_;
+
+ ClassDef( Lau2DHistPdf, 0 ) // 2D histogram pdf class
};
#endif
diff --git a/inc/Lau2DSplineDP.hh b/inc/Lau2DSplineDP.hh
index a38cf91..13a875c 100644
--- a/inc/Lau2DSplineDP.hh
+++ b/inc/Lau2DSplineDP.hh
@@ -1,110 +1,124 @@
/*
Copyright 2013 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file Lau2DSplineDP.hh
\brief File containing declaration of Lau2DSplineDP class.
*/
/*! \class Lau2DSplineDP
\brief Class for defining variations across a 2D DP using a spline.
Class for defining variations across a 2D DP using a spline.
Employs a 2D cubic spline to get the histogram value based on an input histogram.
The returned values are not normalised to the total histogram area
(useful for efficiency histograms for example).
The histogram can be defined in the conventional DP (m13Sq vs m23Sq) or in the square DP.
*/
#ifndef LAU_2DSPLINE_DP
#define LAU_2DSPLINE_DP
#include "Lau2DAbsHistDP.hh"
class TH2;
class Lau2DCubicSpline;
class LauDaughters;
class LauKinematics;
class Lau2DSplineDP : public Lau2DAbsHistDP {
- public:
- //! Constructor
- /*!
- \param [in] hist the 2D DP histogram
- \param [in] daughters the daughter particles
- \param [in] fluctuateBins boolean flag to determine whether the bin contents should be fluctuated in accordance with their errors (useful for systematic error evaluation).
- The seed for the random number generator used to fluctuate the bins should first be set using LauRandom::setSeed.
- \param [in] avEff the desired average efficiency - see Lau2DSplineDP::raiseOrLowerBins.
- The seed for the random number generator used to raise or lower the bins should first be set using LauRandom::setSeed.
- \param [in] avEffError the error on that efficiency - see Lau2DSplineDP::raiseOrLowerBins
- \param [in] useUpperHalfOnly boolean flag to specify that the supplied histogram contains only the upper half of a symmetric DP (or lower half if using square DP coordinates)
- \param [in] squareDP boolean flag to specify whether the supplied histogram is in square DP coordinates
- */
- Lau2DSplineDP(const TH2* hist, const LauDaughters* daughters,
- Bool_t fluctuateBins = kFALSE, Double_t avEff = -1.0,
- Double_t avEffError = -1.0, Bool_t useUpperHalfOnly = kFALSE, Bool_t squareDP = kFALSE);
-
- //! Constructor
- /*!
- \param [in] hist the 2D DP histogram
- \param [in] errorHi the 2D DP histogram containing the upper uncertainty
- \param [in] errorLo the 2D DP histogram containing the lower uncertainty
- \param [in] daughters the daughter particles
- \param [in] fluctuateBins boolean flag to determine whether the bin contents should be fluctuated in accordance with their errors (useful for systematic error evaluation).
- The seed for the random number generator used to fluctuate the bins should first be set using LauRandom::setSeed.
- \param [in] avEff the desired average efficiency - see Lau2DSplineDP::raiseOrLowerBins.
- The seed for the random number generator used to raise or lower the bins should first be set using LauRandom::setSeed.
- \param [in] avEffError the error on that efficiency - see Lau2DSplineDP::raiseOrLowerBins
- \param [in] useUpperHalfOnly boolean flag to specify that the supplied histogram contains only the upper half of a symmetric DP (or lower half if using square DP coordinates)
- \param [in] squareDP boolean flag to specify whether the supplied histogram is in square DP coordinates
- */
- Lau2DSplineDP(const TH2* hist, const TH2* errorHi, const TH2* errorLo, const LauDaughters* daughters,
- Bool_t fluctuateBins = kFALSE, Double_t avEff = -1.0,
- Double_t avEffError = -1.0, Bool_t useUpperHalfOnly = kFALSE, Bool_t squareDP = kFALSE);
-
- //! Destructor
- virtual ~Lau2DSplineDP();
-
- //! Perform the interpolation
- /*!
- \param [in] x the x-axis value
- \param [in] y the y-aixs value
- \return the interpolated histogram value
- */
- Double_t interpolateXY(Double_t x, Double_t y) const;
-
- private:
- //! Copy constructor - not implemented
- Lau2DSplineDP( const Lau2DSplineDP& rhs );
-
- //! Copy assignment operator - not implemented
- Lau2DSplineDP& operator=(const Lau2DSplineDP& rhs);
-
- //! A 2D cubic spline generated from the histogram
- Lau2DCubicSpline* spline_;
-
- ClassDef(Lau2DSplineDP,0) // 2D Spline utility class for DP analyses
+ public:
+ //! Constructor
+ /*!
+ \param [in] hist the 2D DP histogram
+ \param [in] daughters the daughter particles
+ \param [in] fluctuateBins boolean flag to determine whether the bin contents should be fluctuated in accordance with their errors (useful for systematic error evaluation).
+ The seed for the random number generator used to fluctuate the bins should first be set using LauRandom::setSeed.
+
+ \param [in] avEff the desired average efficiency - see Lau2DSplineDP::raiseOrLowerBins.
+ The seed for the random number generator used to raise or lower the bins should first be set using LauRandom::setSeed.
+
+ \param [in] avEffError the error on that efficiency - see Lau2DSplineDP::raiseOrLowerBins
+ \param [in] useUpperHalfOnly boolean flag to specify that the supplied histogram contains only the upper half of a symmetric DP (or lower half if using square DP coordinates)
+ \param [in] squareDP boolean flag to specify whether the supplied histogram is in square DP coordinates
+ */
+ Lau2DSplineDP( const TH2* hist,
+ const LauDaughters* daughters,
+ Bool_t fluctuateBins = kFALSE,
+ Double_t avEff = -1.0,
+ Double_t avEffError = -1.0,
+ Bool_t useUpperHalfOnly = kFALSE,
+ Bool_t squareDP = kFALSE );
+
+ //! Constructor
+ /*!
+ \param [in] hist the 2D DP histogram
+ \param [in] errorHi the 2D DP histogram containing the upper uncertainty
+ \param [in] errorLo the 2D DP histogram containing the lower uncertainty
+ \param [in] daughters the daughter particles
+ \param [in] fluctuateBins boolean flag to determine whether the bin contents should be fluctuated in accordance with their errors (useful for systematic error evaluation).
+ The seed for the random number generator used to fluctuate the bins should first be set using LauRandom::setSeed.
+
+ \param [in] avEff the desired average efficiency - see Lau2DSplineDP::raiseOrLowerBins.
+ The seed for the random number generator used to raise or lower the bins should first be set using LauRandom::setSeed.
+
+ \param [in] avEffError the error on that efficiency - see Lau2DSplineDP::raiseOrLowerBins
+ \param [in] useUpperHalfOnly boolean flag to specify that the supplied histogram contains only the upper half of a symmetric DP (or lower half if using square DP coordinates)
+ \param [in] squareDP boolean flag to specify whether the supplied histogram is in square DP coordinates
+ */
+ Lau2DSplineDP( const TH2* hist,
+ const TH2* errorHi,
+ const TH2* errorLo,
+ const LauDaughters* daughters,
+ Bool_t fluctuateBins = kFALSE,
+ Double_t avEff = -1.0,
+ Double_t avEffError = -1.0,
+ Bool_t useUpperHalfOnly = kFALSE,
+ Bool_t squareDP = kFALSE );
+
+ //! Destructor
+ virtual ~Lau2DSplineDP();
+
+ //! Perform the interpolation
+ /*!
+ \param [in] x the x-axis value
+ \param [in] y the y-aixs value
+ \return the interpolated histogram value
+ */
+ Double_t interpolateXY( Double_t x, Double_t y ) const;
+
+ private:
+ //! Copy constructor - not implemented
+ Lau2DSplineDP( const Lau2DSplineDP& rhs );
+
+ //! Copy assignment operator - not implemented
+ Lau2DSplineDP& operator=( const Lau2DSplineDP& rhs );
+
+ //! A 2D cubic spline generated from the histogram
+ Lau2DCubicSpline* spline_;
+
+ ClassDef( Lau2DSplineDP, 0 ) // 2D Spline utility class for DP analyses
};
#endif
diff --git a/inc/Lau2DSplineDPPdf.hh b/inc/Lau2DSplineDPPdf.hh
index 83b0dfd..ad15eff 100644
--- a/inc/Lau2DSplineDPPdf.hh
+++ b/inc/Lau2DSplineDPPdf.hh
@@ -1,112 +1,117 @@
/*
Copyright 2014 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file Lau2DSplineDPPdf.hh
\brief File containing declaration of Lau2DSplineDPPdf class.
*/
/*! \class Lau2DSplineDPPdf
- \brief Class for defining a 2D DP spline PDF.
+ \brief Class for defining a 2D DP spline PDF.
- Class for defining a 2D DP spline PDF.
+ Class for defining a 2D DP spline PDF.
Employs a 2D cubic spline to get the histogram value based on an input histogram.
The returned values are normalised to the total area.
The histogram can be defined in the conventional DP (m13Sq vs m23Sq) or in the square DP.
*/
#ifndef LAU_2DSPLINE_DP_PDF
#define LAU_2DSPLINE_DP_PDF
#include "Lau2DAbsHistDPPdf.hh"
class TH2;
class Lau2DCubicSpline;
class LauKinematics;
class LauVetoes;
-class Lau2DSplineDPPdf: public Lau2DAbsHistDPPdf {
-
- public:
- //! Constructor
- /*!
- \param [in] hist the 2D DP histogram
- \param [in] kinematics the current DP kinematics
- \param [in] vetoes the vetoes within the DP
- \param [in] fluctuateBins boolean flag to determine whether the bin contents should be fluctuated in accordance with their errors (useful for systematic error evaluation).
- The seed for the random number generator used to fluctuate the bins should first be set using LauRandom::setSeed.
- \param [in] useUpperHalfOnly boolean flag to specify that the supplied histogram contains only the upper half of a symmetric DP (or lower half if using square DP coordinates)
- \param [in] squareDP boolean flag to specify whether the supplied histogram is in square DP coordinates
- */
- Lau2DSplineDPPdf(const TH2* hist, LauKinematics* kinematics, const LauVetoes* vetoes,
- Bool_t fluctuateBins = kFALSE, Bool_t useUpperHalfOnly = kFALSE, Bool_t squareDP = kFALSE);
-
- //! Destructor
- virtual ~Lau2DSplineDPPdf();
-
- //! Retrieve PDF normalisation
- /*!
- \return the normalisation factor
- */
- Double_t getHistNorm() const {return norm_;}
-
- //! Perform the interpolation (unnormalised)
- /*!
- \param [in] x the x-axis value
- \param [in] y the y-aixs value
- \return the unnormalised PDF value
- */
- Double_t interpolateXY(Double_t x, Double_t y) const;
-
- //! Perform the interpolation and divide by the normalisation
- /*!
- \param [in] x the x-axis abscissa value
- \param [in] y the y-axis abscissa value
- \return the normalised PDF value
- */
- Double_t interpolateXYNorm(Double_t x, Double_t y) const;
-
- protected:
- //! Calculate the PDF normalisation
- void calcHistNorm();
-
- private:
- //! Copy constructor - not implemented
- Lau2DSplineDPPdf( const Lau2DSplineDPPdf& rhs );
-
- //! Copy assignment operator - not implemented
- Lau2DSplineDPPdf& operator=(const Lau2DSplineDPPdf& rhs);
-
- //! The maximum height of 2D histogram
- Double_t maxHeight_;
-
- //! The histogram normalisation
- Double_t norm_;
-
- //! A 2D cubic spline generated from the histogram
- Lau2DCubicSpline* spline_;
-
- ClassDef(Lau2DSplineDPPdf,0) // 2D Spline utility class for DP analyses
+class Lau2DSplineDPPdf : public Lau2DAbsHistDPPdf {
+
+ public:
+ //! Constructor
+ /*!
+ \param [in] hist the 2D DP histogram
+ \param [in] kinematics the current DP kinematics
+ \param [in] vetoes the vetoes within the DP
+ \param [in] fluctuateBins boolean flag to determine whether the bin contents should be fluctuated in accordance with their errors (useful for systematic error evaluation).
+ The seed for the random number generator used to fluctuate the bins should first be set using LauRandom::setSeed.
+
+ \param [in] useUpperHalfOnly boolean flag to specify that the supplied histogram contains only the upper half of a symmetric DP (or lower half if using square DP coordinates)
+ \param [in] squareDP boolean flag to specify whether the supplied histogram is in square DP coordinates
+ */
+ Lau2DSplineDPPdf( const TH2* hist,
+ LauKinematics* kinematics,
+ const LauVetoes* vetoes,
+ Bool_t fluctuateBins = kFALSE,
+ Bool_t useUpperHalfOnly = kFALSE,
+ Bool_t squareDP = kFALSE );
+
+ //! Destructor
+ virtual ~Lau2DSplineDPPdf();
+
+ //! Retrieve PDF normalisation
+ /*!
+ \return the normalisation factor
+ */
+ Double_t getHistNorm() const { return norm_; }
+
+ //! Perform the interpolation (unnormalised)
+ /*!
+ \param [in] x the x-axis value
+ \param [in] y the y-aixs value
+ \return the unnormalised PDF value
+ */
+ Double_t interpolateXY( Double_t x, Double_t y ) const;
+
+ //! Perform the interpolation and divide by the normalisation
+ /*!
+ \param [in] x the x-axis abscissa value
+ \param [in] y the y-axis abscissa value
+ \return the normalised PDF value
+ */
+ Double_t interpolateXYNorm( Double_t x, Double_t y ) const;
+
+ protected:
+ //! Calculate the PDF normalisation
+ void calcHistNorm();
+
+ private:
+ //! Copy constructor - not implemented
+ Lau2DSplineDPPdf( const Lau2DSplineDPPdf& rhs );
+
+ //! Copy assignment operator - not implemented
+ Lau2DSplineDPPdf& operator=( const Lau2DSplineDPPdf& rhs );
+
+ //! The maximum height of 2D histogram
+ Double_t maxHeight_;
+
+ //! The histogram normalisation
+ Double_t norm_;
+
+ //! A 2D cubic spline generated from the histogram
+ Lau2DCubicSpline* spline_;
+
+ ClassDef( Lau2DSplineDPPdf, 0 ) // 2D Spline utility class for DP analyses
};
#endif
diff --git a/inc/LauASqMaxFinder.hh b/inc/LauASqMaxFinder.hh
index e2ccba5..45cbded 100644
--- a/inc/LauASqMaxFinder.hh
+++ b/inc/LauASqMaxFinder.hh
@@ -1,94 +1,94 @@
/*
Copyright 2022 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauASqMaxFinder.hh
\brief File containing declaration of LauASqMaxFinder class.
*/
#ifndef LAU_ASQ_MAX_FINDER
#define LAU_ASQ_MAX_FINDER
#include "LauFitObject.hh"
#include <memory>
#include <vector>
class LauIsobarDynamics;
class LauParameter;
/*! \class LauASqMaxFinder
\brief Class for locating the |A|^2 max for a given model
Currently supports finding the |A|^2 max for a LauIsobarDynamics object
*/
class LauASqMaxFinder : public LauFitObject {
- public:
- //! Constructor
- /*!
- \param [in] iso the isobar dynamics for which we need to find the maximum |A|^2 value
- */
- explicit LauASqMaxFinder(LauIsobarDynamics& iso);
-
- //! Run the minimisation to locate the maximum |A|^2 value
- /*!
- \return the maximum |A|^2 value
- */
- Double_t find();
-
- //! This function sets the parameter values from Minuit
- /*!
- This function has to be public since it is called from the global FCN.
- It should not be called otherwise!
-
- \param [in] par an array storing the various parameter values
- \param [in] npar the number of free parameters
- */
- void setParsFromMinuit(Double_t* par, Int_t npar) override;
-
- //! Calculate the new value of the negative log likelihood
- /*!
- This function has to be public since it is called from the global FCN.
- It should not be called otherwise!
- */
- Double_t getTotNegLogLikelihood() override;
-
- private:
- //! The isobar dynamics for which we need to find the maximum |A|^2 value
- LauIsobarDynamics& iso_;
-
- //! Flag to control printing of warnings if the fit wanders outside the DP
- Bool_t printMinimisationWarnings_{kTRUE};
-
- //! The fit parameters (owned by us)
- std::vector<std::unique_ptr<LauParameter>> ownedParams_;
-
- //! The fit parameters in a form to be passed to the minimiser
- std::vector<LauParameter*> params_;
-
- ClassDefOverride(LauASqMaxFinder,0)
+ public:
+ //! Constructor
+ /*!
+ \param [in] iso the isobar dynamics for which we need to find the maximum |A|^2 value
+ */
+ explicit LauASqMaxFinder( LauIsobarDynamics& iso );
+
+ //! Run the minimisation to locate the maximum |A|^2 value
+ /*!
+ \return the maximum |A|^2 value
+ */
+ Double_t find();
+
+ //! This function sets the parameter values from Minuit
+ /*!
+ This function has to be public since it is called from the global FCN.
+ It should not be called otherwise!
+
+ \param [in] par an array storing the various parameter values
+ \param [in] npar the number of free parameters
+ */
+ void setParsFromMinuit( Double_t* par, Int_t npar ) override;
+
+ //! Calculate the new value of the negative log likelihood
+ /*!
+ This function has to be public since it is called from the global FCN.
+ It should not be called otherwise!
+ */
+ Double_t getTotNegLogLikelihood() override;
+
+ private:
+ //! The isobar dynamics for which we need to find the maximum |A|^2 value
+ LauIsobarDynamics& iso_;
+
+ //! Flag to control printing of warnings if the fit wanders outside the DP
+ Bool_t printMinimisationWarnings_ { kTRUE };
+
+ //! The fit parameters (owned by us)
+ std::vector<std::unique_ptr<LauParameter>> ownedParams_;
+
+ //! The fit parameters in a form to be passed to the minimiser
+ std::vector<LauParameter*> params_;
+
+ ClassDefOverride( LauASqMaxFinder, 0 )
};
#endif
diff --git a/inc/LauAbsBkgndDPModel.hh b/inc/LauAbsBkgndDPModel.hh
index c5f7ca2..e628c03 100644
--- a/inc/LauAbsBkgndDPModel.hh
+++ b/inc/LauAbsBkgndDPModel.hh
@@ -1,173 +1,171 @@
/*
Copyright 2004 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauAbsBkgndDPModel.hh
\brief File containing declaration of LauAbsBkgndDPModel class.
*/
/*! \class LauAbsBkgndDPModel
\brief The abstract interface for a background Dalitz plot model
Class which defines the abstract interface for a background Dalitz plot model
*/
#ifndef LAU_ABS_BKGND_DP_MODEL
#define LAU_ABS_BKGND_DP_MODEL
#include "Rtypes.h"
class LauDaughters;
class LauKinematics;
class LauFitDataTree;
class LauVetoes;
class LauAbsBkgndDPModel {
- public:
- //! Destructor
- virtual ~LauAbsBkgndDPModel() {}
-
- //! Initialise the model
- virtual void initialise() = 0;
-
- //! Generate a toy MC event from the model
- /*!
- \return success/failure flag
- */
- virtual Bool_t generate() = 0;
-
- //! Get likelihood for a given DP position
- /*!
- \param [in] m13Sq the invariant mass squared of children 1 and 3
- \param [in] m23Sq the invariant mass squared of children 2 and 3
- \return the likelihood value
- */
- virtual Double_t getLikelihood( const Double_t m13Sq,
- const Double_t m23Sq ) = 0;
-
- //! Get unnormalised likelihood for a given DP position
- /*!
- \param [in] m13Sq the invariant mass squared of children 1 and 3
- \param [in] m23Sq the invariant mass squared of children 2 and 3
- \return the unnormalised likelihood value
- */
- virtual Double_t getUnNormValue( const Double_t m13Sq,
- const Double_t m23Sq ) = 0;
-
- //! Get likelihood for a given event
- /*!
- \param [in] iEvt the event number
- \return the likelihood value
- */
- virtual Double_t getLikelihood(UInt_t iEvt) = 0;
-
- //! Get unnormalised likelihood for a given event
- /*!
- \param [in] iEvt the event number
- \return the unnormalised likelihood value
- */
- virtual Double_t getUnNormValue(UInt_t iEvt) = 0;
-
- //! Get PDF normalisation constant
- /*!
- \return the PDF normalisation constant
- */
- virtual Double_t getPdfNorm() const = 0;
-
- //! Cache the input data and (if appropriate) the per-event likelihood values
- /*!
- \param [in] fitDataTree the input data
- */
- virtual void fillDataTree(const LauFitDataTree& fitDataTree) = 0;
-
- //! Get the daughter particles
- /*!
- \return the daughters
- */
- const LauDaughters* getDaughters() const {return daughters_;}
-
- //! Get the daughter particles
- /*!
- \return the daughters
- */
- LauDaughters* getDaughters() {return daughters_;}
-
- //! Get the Dalitz plot kinematics
- /*!
- \return the kinematics
- */
- const LauKinematics* getKinematics() const {return kinematics_;}
-
- //! Get the Dalitz plot kinematics
- /*!
- \return the kinematics
- */
- LauKinematics* getKinematics() {return kinematics_;}
-
- //! Get vetoes in the Dalitz plot
- /*!
- \return the vetoes
- */
- const LauVetoes* getVetoes() const {return vetoes_;}
-
- //! Get vetoes in the Dalitz plot
- /*!
- \return the vetoes
- */
- LauVetoes* getVetoes() {return vetoes_;}
-
- protected:
- //! Constructor
- /*!
- \param [in] daughters the daughter particles
- \param [in] vetoes the vetoes within the Dalitz plot
- */
- LauAbsBkgndDPModel(LauDaughters* daughters, LauVetoes* vetoes);
-
- //! Set data event number
- /*!
- \param [in] iEvt the event number
- */
- virtual void setDataEventNo(UInt_t iEvt) = 0;
-
- private:
- //! Copy constructor (not implemented)
- LauAbsBkgndDPModel(const LauAbsBkgndDPModel& rhs);
-
- //! Copy assignment operator (not implemented)
- LauAbsBkgndDPModel& operator=(const LauAbsBkgndDPModel& rhs);
-
- //! The daughter particles
- LauDaughters* daughters_;
-
- //! Dalitz plot kinematics
- LauKinematics* kinematics_;
-
- //! Vetoes within the Dalitz plot
- LauVetoes* vetoes_;
-
- ClassDef(LauAbsBkgndDPModel,0) // Abstract DP background model
+ public:
+ //! Destructor
+ virtual ~LauAbsBkgndDPModel() {}
+
+ //! Initialise the model
+ virtual void initialise() = 0;
+
+ //! Generate a toy MC event from the model
+ /*!
+ \return success/failure flag
+ */
+ virtual Bool_t generate() = 0;
+
+ //! Get likelihood for a given DP position
+ /*!
+ \param [in] m13Sq the invariant mass squared of children 1 and 3
+ \param [in] m23Sq the invariant mass squared of children 2 and 3
+ \return the likelihood value
+ */
+ virtual Double_t getLikelihood( const Double_t m13Sq, const Double_t m23Sq ) = 0;
+
+ //! Get unnormalised likelihood for a given DP position
+ /*!
+ \param [in] m13Sq the invariant mass squared of children 1 and 3
+ \param [in] m23Sq the invariant mass squared of children 2 and 3
+ \return the unnormalised likelihood value
+ */
+ virtual Double_t getUnNormValue( const Double_t m13Sq, const Double_t m23Sq ) = 0;
+
+ //! Get likelihood for a given event
+ /*!
+ \param [in] iEvt the event number
+ \return the likelihood value
+ */
+ virtual Double_t getLikelihood( UInt_t iEvt ) = 0;
+
+ //! Get unnormalised likelihood for a given event
+ /*!
+ \param [in] iEvt the event number
+ \return the unnormalised likelihood value
+ */
+ virtual Double_t getUnNormValue( UInt_t iEvt ) = 0;
+
+ //! Get PDF normalisation constant
+ /*!
+ \return the PDF normalisation constant
+ */
+ virtual Double_t getPdfNorm() const = 0;
+
+ //! Cache the input data and (if appropriate) the per-event likelihood values
+ /*!
+ \param [in] fitDataTree the input data
+ */
+ virtual void fillDataTree( const LauFitDataTree& fitDataTree ) = 0;
+
+ //! Get the daughter particles
+ /*!
+ \return the daughters
+ */
+ const LauDaughters* getDaughters() const { return daughters_; }
+
+ //! Get the daughter particles
+ /*!
+ \return the daughters
+ */
+ LauDaughters* getDaughters() { return daughters_; }
+
+ //! Get the Dalitz plot kinematics
+ /*!
+ \return the kinematics
+ */
+ const LauKinematics* getKinematics() const { return kinematics_; }
+
+ //! Get the Dalitz plot kinematics
+ /*!
+ \return the kinematics
+ */
+ LauKinematics* getKinematics() { return kinematics_; }
+
+ //! Get vetoes in the Dalitz plot
+ /*!
+ \return the vetoes
+ */
+ const LauVetoes* getVetoes() const { return vetoes_; }
+
+ //! Get vetoes in the Dalitz plot
+ /*!
+ \return the vetoes
+ */
+ LauVetoes* getVetoes() { return vetoes_; }
+
+ protected:
+ //! Constructor
+ /*!
+ \param [in] daughters the daughter particles
+ \param [in] vetoes the vetoes within the Dalitz plot
+ */
+ LauAbsBkgndDPModel( LauDaughters* daughters, LauVetoes* vetoes );
+
+ //! Set data event number
+ /*!
+ \param [in] iEvt the event number
+ */
+ virtual void setDataEventNo( UInt_t iEvt ) = 0;
+
+ private:
+ //! Copy constructor (not implemented)
+ LauAbsBkgndDPModel( const LauAbsBkgndDPModel& rhs );
+
+ //! Copy assignment operator (not implemented)
+ LauAbsBkgndDPModel& operator=( const LauAbsBkgndDPModel& rhs );
+
+ //! The daughter particles
+ LauDaughters* daughters_;
+
+ //! Dalitz plot kinematics
+ LauKinematics* kinematics_;
+
+ //! Vetoes within the Dalitz plot
+ LauVetoes* vetoes_;
+
+ ClassDef( LauAbsBkgndDPModel, 0 ) // Abstract DP background model
};
#endif
diff --git a/inc/LauAbsCoeffSet.hh b/inc/LauAbsCoeffSet.hh
index 51af166..4ecb79d 100644
--- a/inc/LauAbsCoeffSet.hh
+++ b/inc/LauAbsCoeffSet.hh
@@ -1,333 +1,358 @@
/*
Copyright 2006 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauAbsCoeffSet.hh
\brief File containing declaration of LauAbsCoeffSet class.
*/
/*! \class LauAbsCoeffSet
\brief Class for defining the abstract interface for complex coefficient classes.
Class for defining the abstract interface for complex coefficient classes.
Some common code is implemented but most methods are not.
*/
#ifndef LAU_ABS_COEFF_SET
#define LAU_ABS_COEFF_SET
+#include "TString.h"
+
#include <iosfwd>
#include <vector>
-#include "TString.h"
-
class TRandom;
class LauComplex;
class LauParameter;
-
class LauAbsCoeffSet {
- public:
- //! Options for cloning operation
- enum CloneOption {
- All, /*!< no special operation, all parameters cloned */
- TiePhase, /*!< phase cloned, magnitude free to vary */
- TieMagnitude, /*!< magnitude cloned, phase free to vary */
- TieRealPart, /*!< real part cloned, imaginary part free to vary */
- TieImagPart, /*!< imaginary part cloned, real part free to vary */
- TieCPPars /*!< CP-violating parameters cloned, CP-conserving ones free to vary */
- };
-
- //! Destructor
- virtual ~LauAbsCoeffSet(){}
-
- //! Retrieve the parameters of the coefficient so that they can be loaded into a fit
- /*!
- \return the parameters of the coefficient
- */
- virtual std::vector<LauParameter*> getParameters() = 0;
-
- //! Print the current values of the parameters
- virtual void printParValues() const = 0;
-
- //! Print the column headings for a results table
- /*!
- \param [out] stream the stream to print to
- */
- virtual void printTableHeading(std::ostream& stream) const = 0;
-
- //! Print the parameters of the complex coefficient as a row in the results table
- /*!
- \param [out] stream the stream to print to
- */
- virtual void printTableRow(std::ostream& stream) const = 0;
-
- //! Randomise the starting values of the parameters for a fit
- virtual void randomiseInitValues() = 0;
-
- //! Make sure values are in "standard" ranges, e.g. phases should be between -pi and pi
- virtual void finaliseValues() = 0;
-
- //! Retrieve the complex coefficient for a particle
- /*!
- \return the complex coefficient for a particle
- */
- virtual const LauComplex& particleCoeff() = 0;
-
- //! Retrieve the complex coefficient for an antiparticle
- /*!
- \return the complex coefficient for an antiparticle
- */
- virtual const LauComplex& antiparticleCoeff() = 0;
-
- //! Set the parameters based on the complex coefficients for particles and antiparticles
- /*!
- \param [in] coeff the complex coefficient for a particle
- \param [in] coeffBar the complex coefficient for an antiparticle
- \param [in] init whether or not the initial and generated values should also be adjusted
- */
- virtual void setCoeffValues( const LauComplex& coeff, const LauComplex& coeffBar, Bool_t init ) = 0;
-
- //! Calculate the CP asymmetry
- /*!
- \return the CP asymmetry
- */
- virtual LauParameter acp() = 0;
-
- //! Create a clone of the coefficient set
- /*!
- \param [in] newName the clone's name
- \param [in] cloneOption special option for the cloning operation
- \param [in] constFactor a constant factor by which to multiply the cloned parameters
- \return a clone of the coefficient set
- */
- virtual LauAbsCoeffSet* createClone(const TString& newName, CloneOption cloneOption = All, Double_t constFactor = 1.0) = 0;
-
- //! Retrieve the name of the coefficient set
- /*!
- The name should correspond to the name of the resonance in the model.
- \return the name of the coefficient set
- */
- virtual TString name() const {return name_;}
-
- //! Set the name of the coefficient set
- /*!
- The name should correspond to the name of the resonance in the model.
- \param [in] theName the name to set
- */
- virtual void name(const TString& theName) {name_ = theName;}
-
- //! Retrieve the base name of the coefficient set
- /*!
- The base name is generally of the form "Ai", where i is an integer.
- This is used in the fit results ntuple.
- \return the base name of the coefficient set
- */
- virtual const TString& baseName() const {return basename_;}
-
- //! Set the base name of the coefficient set
- /*!
- The base name is generally of the form "Ai", where i is an integer.
- This is used in the fit results ntuple.
- \param [in] theBasename the base name to set
- */
- virtual void baseName(const TString& theBasename) {basename_ = theBasename;}
-
- //! Retrieve the index number of the coefficient set
- /*!
- \return the index number of the coefficient set
- */
- virtual UInt_t index() const {return index_;}
-
- //! Set the index number of the coefficient set
- /*!
- \param [in] newIndex the new index
- */
- virtual void index(UInt_t newIndex);
-
- //! Set the value of the named parameter
- /*!
- \param [in] parName the name of the parameter to adjust
- \param [in] value the new value for the parameter to take
- \param [in] init whether or not the initial and generated values should also be adjusted
- */
- virtual void setParameterValue(const TString& parName, Double_t value, Bool_t init);
-
- //! Set the error of the named parameter
- /*!
- This is particularly useful for tuning the step size used by MINUIT
- \param [in] parName the name of the parameter to adjust
- \param [in] error the new error value for the parameter to take
- */
- virtual void setParameterError(const TString& parName, Double_t error);
-
- //! Set the named parameter to be fixed in the fit
- /*!
- \param [in] parName the name of the parameter to adjust
- */
- virtual void fixParameter(const TString& parName);
-
- //! Set the named parameter to float in the fit
- /*!
- \param [in] parName the name of the parameter to adjust
- */
- virtual void floatParameter(const TString& parName);
-
- //! Blind the named parameter
- /*!
- See LauBlind documentation for details of blinding procedure
-
- \param [in] parName the name of the parameter to adjust
- \param [in] blindingString the unique blinding string used to seed the random number generator
- \param [in] width the width of the Gaussian from which the offset should be sampled
- */
- virtual void blindParameter(const TString& parName, const TString& blindingString, const Double_t width);
-
- //! Add Gaussian constraint to the named parameter
- /*!
- \param [in] parName the name of the parameter to adjust
- \param [in] mean the mean of the Gaussian constraint
- \param [in] width the width of the Gaussian constraint
- */
- virtual void addGaussianConstraint(const TString& parName, const Double_t mean, const Double_t width);
-
- //! Add suffix to the name of the given parameter
- /*!
- \param [in] parName the name of the parameter to adjust
- \param [in] suffix the suffix to add to the parameter name
- */
- virtual void addSuffixToParameterName(const TString& parName, const TString& suffix);
-
- //! Set the allowed range for magnitude parameters
- /*!
- \param [in] minMag the lower edge of the range
- \param [in] maxMag the upper edge of the range
- */
- static void setMagnitudeRange(Double_t minMag, Double_t maxMag) { minMagnitude_ = minMag; maxMagnitude_ = maxMag; }
-
- //! Set the allowed range for phase parameters
- /*!
- \param [in] minPhase the lower edge of the range
- \param [in] maxPhase the upper edge of the range
- */
- static void setPhaseRange(Double_t minPhase, Double_t maxPhase) { minPhase_ = minPhase; maxPhase_ = maxPhase; }
-
- //! Set the allowed range for real/imaginary part parameters
- /*!
- \param [in] minPar the lower edge of the range
- \param [in] maxPar the upper edge of the range
- */
- static void setRealImagRange(Double_t minPar, Double_t maxPar) { minRealImagPart_ = minPar; maxRealImagPart_ = maxPar; }
-
- //! Set the allowed range for CP-violating parameters
- /*!
- \param [in] minPar the lower edge of the range
- \param [in] maxPar the upper edge of the range
- */
- static void setCPParRange(Double_t minPar, Double_t maxPar) { minDelta_ = minPar; maxDelta_ = maxPar; }
-
- //! Set the randomiser
- /*!
- Set the random number generator to use for randomising parameter starting values.
- Will default to LauRandom::zeroSeedRandom if not explicitly supplied via this function.
-
- \param [in] randomiser the random number generator to use for randomising parameter starting values
- */
- static void setRandomiser(TRandom* randomiser) { randomiser_ = randomiser; }
-
- //! Access the randomiser
- /*!
- \return the random number generator to use for randomising parameter starting values
- */
- static TRandom* getRandomiser();
-
- protected:
- //! Constructor
- /*!
- \param [in] theName the name of the coefficient set
- \param [in] theBaseName the single character base for the parameter names
- */
- LauAbsCoeffSet(const TString& theName, const TString& theBaseName = "A");
-
- //! Find the parameter with the given name
- /*!
- \param [in] parName the name of the parameter to be found
- return the retrieved parameter
- */
- LauParameter* findParameter(const TString& parName);
-
- //! Prepend the base name and index to the name of a parameter
- /*!
- \param [in,out] par pointer to the parameter
- \param [in] oldBaseName the old base name, which might need to be removed before adding the new one
- */
- virtual void adjustName(LauParameter* par, const TString& oldBaseName);
-
- //! Minimum allowed value of magnitude parameters
- static Double_t minMagnitude_;
- //! Maximum allowed value of magnitude parameters
- static Double_t maxMagnitude_;
- //! Minimum allowed value of phase parameters
- static Double_t minPhase_;
- //! Maximum allowed value of phase parameters
- static Double_t maxPhase_;
- //! Minimum allowed value of real/imaginary part parameters
- static Double_t minRealImagPart_;
- //! Maximum allowed value of real/imaginary part parameters
- static Double_t maxRealImagPart_;
- //! Minimum allowed value of CP-violating real/imaginary part parameters
- static Double_t minDelta_;
- //! Maximum allowed value of CP-violating real/imaginary part parameters
- static Double_t maxDelta_;
-
- //! Copy constructor
- /*!
- \param [in] rhs the coefficient to clone
- */
- LauAbsCoeffSet(const LauAbsCoeffSet& rhs);
-
- //! Copy assignment operator
- /*!
- \param [in] rhs the coefficient to clone
- */
- LauAbsCoeffSet& operator=(const LauAbsCoeffSet& rhs);
-
- private:
- //! Random number generator to use for randomising parameter starting values
- static TRandom* randomiser_;
-
- //! The name of the coefficient set
- TString name_;
-
- //! The base name of the coefficient set
- TString basename_;
-
- //! The index number of the coefficient set
- UInt_t index_;
-
- ClassDef(LauAbsCoeffSet, 0)
-
+ public:
+ //! Options for cloning operation
+ enum CloneOption {
+ All, /*!< no special operation, all parameters cloned */
+ TiePhase, /*!< phase cloned, magnitude free to vary */
+ TieMagnitude, /*!< magnitude cloned, phase free to vary */
+ TieRealPart, /*!< real part cloned, imaginary part free to vary */
+ TieImagPart, /*!< imaginary part cloned, real part free to vary */
+ TieCPPars /*!< CP-violating parameters cloned, CP-conserving ones free to vary */
+ };
+
+ //! Destructor
+ virtual ~LauAbsCoeffSet() {}
+
+ //! Retrieve the parameters of the coefficient so that they can be loaded into a fit
+ /*!
+ \return the parameters of the coefficient
+ */
+ virtual std::vector<LauParameter*> getParameters() = 0;
+
+ //! Print the current values of the parameters
+ virtual void printParValues() const = 0;
+
+ //! Print the column headings for a results table
+ /*!
+ \param [out] stream the stream to print to
+ */
+ virtual void printTableHeading( std::ostream& stream ) const = 0;
+
+ //! Print the parameters of the complex coefficient as a row in the results table
+ /*!
+ \param [out] stream the stream to print to
+ */
+ virtual void printTableRow( std::ostream& stream ) const = 0;
+
+ //! Randomise the starting values of the parameters for a fit
+ virtual void randomiseInitValues() = 0;
+
+ //! Make sure values are in "standard" ranges, e.g. phases should be between -pi and pi
+ virtual void finaliseValues() = 0;
+
+ //! Retrieve the complex coefficient for a particle
+ /*!
+ \return the complex coefficient for a particle
+ */
+ virtual const LauComplex& particleCoeff() = 0;
+
+ //! Retrieve the complex coefficient for an antiparticle
+ /*!
+ \return the complex coefficient for an antiparticle
+ */
+ virtual const LauComplex& antiparticleCoeff() = 0;
+
+ //! Set the parameters based on the complex coefficients for particles and antiparticles
+ /*!
+ \param [in] coeff the complex coefficient for a particle
+ \param [in] coeffBar the complex coefficient for an antiparticle
+ \param [in] init whether or not the initial and generated values should also be adjusted
+ */
+ virtual void setCoeffValues( const LauComplex& coeff, const LauComplex& coeffBar, Bool_t init ) = 0;
+
+ //! Calculate the CP asymmetry
+ /*!
+ \return the CP asymmetry
+ */
+ virtual LauParameter acp() = 0;
+
+ //! Create a clone of the coefficient set
+ /*!
+ \param [in] newName the clone's name
+ \param [in] cloneOption special option for the cloning operation
+ \param [in] constFactor a constant factor by which to multiply the cloned parameters
+ \return a clone of the coefficient set
+ */
+ virtual LauAbsCoeffSet* createClone( const TString& newName,
+ CloneOption cloneOption = All,
+ Double_t constFactor = 1.0 ) = 0;
+
+ //! Retrieve the name of the coefficient set
+ /*!
+ The name should correspond to the name of the resonance in the model.
+
+ \return the name of the coefficient set
+ */
+ virtual TString name() const { return name_; }
+
+ //! Set the name of the coefficient set
+ /*!
+ The name should correspond to the name of the resonance in the model.
+
+ \param [in] theName the name to set
+ */
+ virtual void name( const TString& theName ) { name_ = theName; }
+
+ //! Retrieve the base name of the coefficient set
+ /*!
+ The base name is generally of the form "Ai", where i is an integer.
+ This is used in the fit results ntuple.
+
+ \return the base name of the coefficient set
+ */
+ virtual const TString& baseName() const { return basename_; }
+
+ //! Set the base name of the coefficient set
+ /*!
+ The base name is generally of the form "Ai", where i is an integer.
+ This is used in the fit results ntuple.
+
+ \param [in] theBasename the base name to set
+ */
+ virtual void baseName( const TString& theBasename ) { basename_ = theBasename; }
+
+ //! Retrieve the index number of the coefficient set
+ /*!
+ \return the index number of the coefficient set
+ */
+ virtual UInt_t index() const { return index_; }
+
+ //! Set the index number of the coefficient set
+ /*!
+ \param [in] newIndex the new index
+ */
+ virtual void index( UInt_t newIndex );
+
+ //! Set the value of the named parameter
+ /*!
+ \param [in] parName the name of the parameter to adjust
+ \param [in] value the new value for the parameter to take
+ \param [in] init whether or not the initial and generated values should also be adjusted
+ */
+ virtual void setParameterValue( const TString& parName, Double_t value, Bool_t init );
+
+ //! Set the error of the named parameter
+ /*!
+ This is particularly useful for tuning the step size used by MINUIT
+
+ \param [in] parName the name of the parameter to adjust
+ \param [in] error the new error value for the parameter to take
+ */
+ virtual void setParameterError( const TString& parName, Double_t error );
+
+ //! Set the named parameter to be fixed in the fit
+ /*!
+ \param [in] parName the name of the parameter to adjust
+ */
+ virtual void fixParameter( const TString& parName );
+
+ //! Set the named parameter to float in the fit
+ /*!
+ \param [in] parName the name of the parameter to adjust
+ */
+ virtual void floatParameter( const TString& parName );
+
+ //! Blind the named parameter
+ /*!
+ See LauBlind documentation for details of blinding procedure
+
+ \param [in] parName the name of the parameter to adjust
+ \param [in] blindingString the unique blinding string used to seed the random number generator
+ \param [in] width the width of the Gaussian from which the offset should be sampled
+ */
+ virtual void blindParameter( const TString& parName,
+ const TString& blindingString,
+ const Double_t width );
+
+ //! Add Gaussian constraint to the named parameter
+ /*!
+ \param [in] parName the name of the parameter to adjust
+ \param [in] mean the mean of the Gaussian constraint
+ \param [in] width the width of the Gaussian constraint
+ */
+ virtual void addGaussianConstraint( const TString& parName,
+ const Double_t mean,
+ const Double_t width );
+
+ //! Add suffix to the name of the given parameter
+ /*!
+ \param [in] parName the name of the parameter to adjust
+ \param [in] suffix the suffix to add to the parameter name
+ */
+ virtual void addSuffixToParameterName( const TString& parName, const TString& suffix );
+
+ //! Set the allowed range for magnitude parameters
+ /*!
+ \param [in] minMag the lower edge of the range
+ \param [in] maxMag the upper edge of the range
+ */
+ static void setMagnitudeRange( Double_t minMag, Double_t maxMag )
+ {
+ minMagnitude_ = minMag;
+ maxMagnitude_ = maxMag;
+ }
+
+ //! Set the allowed range for phase parameters
+ /*!
+ \param [in] minPhase the lower edge of the range
+ \param [in] maxPhase the upper edge of the range
+ */
+ static void setPhaseRange( Double_t minPhase, Double_t maxPhase )
+ {
+ minPhase_ = minPhase;
+ maxPhase_ = maxPhase;
+ }
+
+ //! Set the allowed range for real/imaginary part parameters
+ /*!
+ \param [in] minPar the lower edge of the range
+ \param [in] maxPar the upper edge of the range
+ */
+ static void setRealImagRange( Double_t minPar, Double_t maxPar )
+ {
+ minRealImagPart_ = minPar;
+ maxRealImagPart_ = maxPar;
+ }
+
+ //! Set the allowed range for CP-violating parameters
+ /*!
+ \param [in] minPar the lower edge of the range
+ \param [in] maxPar the upper edge of the range
+ */
+ static void setCPParRange( Double_t minPar, Double_t maxPar )
+ {
+ minDelta_ = minPar;
+ maxDelta_ = maxPar;
+ }
+
+ //! Set the randomiser
+ /*!
+ Set the random number generator to use for randomising parameter starting values.
+ Will default to LauRandom::zeroSeedRandom if not explicitly supplied via this function.
+
+ \param [in] randomiser the random number generator to use for randomising parameter starting values
+ */
+ static void setRandomiser( TRandom* randomiser ) { randomiser_ = randomiser; }
+
+ //! Access the randomiser
+ /*!
+ \return the random number generator to use for randomising parameter starting values
+ */
+ static TRandom* getRandomiser();
+
+ protected:
+ //! Constructor
+ /*!
+ \param [in] theName the name of the coefficient set
+ \param [in] theBaseName the single character base for the parameter names
+ */
+ LauAbsCoeffSet( const TString& theName, const TString& theBaseName = "A" );
+
+ //! Find the parameter with the given name
+ /*!
+ \param [in] parName the name of the parameter to be found
+ return the retrieved parameter
+ */
+ LauParameter* findParameter( const TString& parName );
+
+ //! Prepend the base name and index to the name of a parameter
+ /*!
+ \param [in,out] par pointer to the parameter
+ \param [in] oldBaseName the old base name, which might need to be removed before adding the new one
+ */
+ virtual void adjustName( LauParameter* par, const TString& oldBaseName );
+
+ //! Minimum allowed value of magnitude parameters
+ static Double_t minMagnitude_;
+ //! Maximum allowed value of magnitude parameters
+ static Double_t maxMagnitude_;
+ //! Minimum allowed value of phase parameters
+ static Double_t minPhase_;
+ //! Maximum allowed value of phase parameters
+ static Double_t maxPhase_;
+ //! Minimum allowed value of real/imaginary part parameters
+ static Double_t minRealImagPart_;
+ //! Maximum allowed value of real/imaginary part parameters
+ static Double_t maxRealImagPart_;
+ //! Minimum allowed value of CP-violating real/imaginary part parameters
+ static Double_t minDelta_;
+ //! Maximum allowed value of CP-violating real/imaginary part parameters
+ static Double_t maxDelta_;
+
+ //! Copy constructor
+ /*!
+ \param [in] rhs the coefficient to clone
+ */
+ LauAbsCoeffSet( const LauAbsCoeffSet& rhs );
+
+ //! Copy assignment operator
+ /*!
+ \param [in] rhs the coefficient to clone
+ */
+ LauAbsCoeffSet& operator=( const LauAbsCoeffSet& rhs );
+
+ private:
+ //! Random number generator to use for randomising parameter starting values
+ static TRandom* randomiser_;
+
+ //! The name of the coefficient set
+ TString name_;
+
+ //! The base name of the coefficient set
+ TString basename_;
+
+ //! The index number of the coefficient set
+ UInt_t index_;
+
+ ClassDef( LauAbsCoeffSet, 0 )
};
#endif
diff --git a/inc/LauAbsEffModel.hh b/inc/LauAbsEffModel.hh
index aeaae13..634eab1 100644
--- a/inc/LauAbsEffModel.hh
+++ b/inc/LauAbsEffModel.hh
@@ -1,89 +1,87 @@
/*
Copyright 2014 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauAbsEffModel.hh
\brief File containing declaration of LauAbsEffModel class.
*/
/*! \class LauAbsEffModel
\brief Pure abstract base class for defining the efficiency description across the signal Dalitz plot.
Pure abstract base class for defining the efficiency description across the signal Dalitz plot.
- The efficiency variation is defined in terms of x = m_13^2, y = m_23^2 for the Dalitz plot (default)
+ The efficiency variation is defined in terms of x = m_13^2, y = m_23^2 for the Dalitz plot (default)
or x = m', y = theta' for the square Dalitz plot
*/
#ifndef LAUABSEFFMODEL
#define LAUABSEFFMODEL
#include "Rtypes.h"
class LauDaughters;
class LauKinematics;
-
class LauAbsEffModel {
- public:
- //! Constructor
- LauAbsEffModel() {}
-
- //! Destructor
- virtual ~LauAbsEffModel() {}
+ public:
+ //! Constructor
+ LauAbsEffModel() {}
- //! Determine the efficiency for a given point in the Dalitz plot.
- /*!
- \param [in] kinematics the object that defines the DP position
- \return the efficiency value at the given point in the DP
- */
- virtual Double_t calcEfficiency( const LauKinematics* kinematics ) const=0;
+ //! Destructor
+ virtual ~LauAbsEffModel() {}
- //! Determine whether the given DP position is outside the vetoes
- /*!
- \param [in] kinematics the object that defines the DP position
- \return kTRUE if the DP position is outside all veto regions, kFALSE otherwise
- */
- virtual Bool_t passVeto( const LauKinematics* kinematics ) const=0;
+ //! Determine the efficiency for a given point in the Dalitz plot.
+ /*!
+ \param [in] kinematics the object that defines the DP position
+ \return the efficiency value at the given point in the DP
+ */
+ virtual Double_t calcEfficiency( const LauKinematics* kinematics ) const = 0;
- //! Determine whether the efficiency histogram has had its bins fluctuated within their errors
- virtual Bool_t fluctuateEffHisto() const=0;
+ //! Determine whether the given DP position is outside the vetoes
+ /*!
+ \param [in] kinematics the object that defines the DP position
+ \return kTRUE if the DP position is outside all veto regions, kFALSE otherwise
+ */
+ virtual Bool_t passVeto( const LauKinematics* kinematics ) const = 0;
- //! Return the daughters object
- /*
- \return the LauDaughters object associated with the DP
- */
- virtual const LauDaughters* getDaughters() const=0;
+ //! Determine whether the efficiency histogram has had its bins fluctuated within their errors
+ virtual Bool_t fluctuateEffHisto() const = 0;
- private:
- //! Copy constructor - not implemented
- LauAbsEffModel( const LauAbsEffModel& rhs );
+ //! Return the daughters object
+ /*
+ \return the LauDaughters object associated with the DP
+ */
+ virtual const LauDaughters* getDaughters() const = 0;
- //! Copy assignment operator - not implemented
- LauAbsEffModel& operator=( const LauAbsEffModel& rhs );
+ private:
+ //! Copy constructor - not implemented
+ LauAbsEffModel( const LauAbsEffModel& rhs );
- ClassDef(LauAbsEffModel, 0) // pABC for the signal efficiency across the DP
+ //! Copy assignment operator - not implemented
+ LauAbsEffModel& operator=( const LauAbsEffModel& rhs );
+ ClassDef( LauAbsEffModel, 0 ) // pABC for the signal efficiency across the DP
};
#endif
diff --git a/inc/LauAbsFitModel.hh b/inc/LauAbsFitModel.hh
index 287608d..468dd5f 100644
--- a/inc/LauAbsFitModel.hh
+++ b/inc/LauAbsFitModel.hh
@@ -1,897 +1,926 @@
/*
Copyright 2004 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauAbsFitModel.hh
\brief File containing declaration of LauAbsFitModel class.
*/
/*! \class LauAbsFitModel
\brief Abstract interface to the fitting and toy MC model
Abstract interface to the fitting and toy MC model
Any class inheriting from this must implement the following functions:
- cacheInputFitVars()
- checkInitFitParams()
- finaliseFitResults()
- fixdSpeciesNames()
- freeSpeciesNames()
- genExpt()
- getEventSum()
- getTotEvtLikelihood()
- initialise()
- initialiseDPModels()
- propagateParUpdates()
- recalculateNormalisation()
- scfDPSmear()
- setAmpCoeffSet()
- setNBkgndEvents()
- setNSigEvents()
- setupBkgndVectors()
- setupGenNtupleBranches()
- setupSPlotNtupleBranches()
- splitSignal()
- storePerEvtLlhds()
- twodimPDFs()
- updateCoeffs()
- variableNames()
- weightEvents()
- writeOutTable()
*/
#ifndef LAU_ABS_FIT_MODEL
#define LAU_ABS_FIT_MODEL
+#include "LauComplex.hh"
+#include "LauFitObject.hh"
+#include "LauFormulaPar.hh"
+#include "LauSimFitTask.hh"
+
#include "TMatrixDfwd.h"
-#include "TString.h"
#include "TStopwatch.h"
+#include "TString.h"
#include <iosfwd>
#include <set>
#include <vector>
-
-#include "LauComplex.hh"
-#include "LauFitObject.hh"
-#include "LauFormulaPar.hh"
-#include "LauSimFitTask.hh"
// LauSPlot included to get LauSPlot::NameSet typedef
#include "LauSPlot.hh"
class LauAbsCoeffSet;
class LauAbsPdf;
class LauFitDataTree;
class LauGenNtuple;
class LauAbsRValue;
class LauParameter;
class LauAbsFitModel : public LauSimFitTask {
- public:
- //! Constructor
- LauAbsFitModel();
-
- //! Destructor
- virtual ~LauAbsFitModel();
-
- //! Is the Dalitz plot term in the likelihood
- Bool_t useDP() const { return usingDP_; }
-
- //! Switch on/off the Dalitz plot term in the Likelihood (allows fits to other quantities, e.g. B mass)
- /*!
- \param [in] usingDP the boolean flag
- */
- void useDP(Bool_t usingDP) { usingDP_ = usingDP; }
-
- //! Return the flag to store the status of using an sFit or not
- Bool_t doSFit() const { return doSFit_; }
-
- //! Do an sFit (use sWeights to isolate signal decays rather than using background histograms)
- /*!
- \param [in] sWeightBranchName name of the branch of the tree containing the sWeights
- \param [in] scaleFactor scaling factor to get the uncertainties correct
- */
- void doSFit( const TString& sWeightBranchName, Double_t scaleFactor = 1.0 );
+ public:
+ //! Constructor
+ LauAbsFitModel();
+
+ //! Destructor
+ virtual ~LauAbsFitModel();
+
+ //! Is the Dalitz plot term in the likelihood
+ Bool_t useDP() const { return usingDP_; }
+
+ //! Switch on/off the Dalitz plot term in the Likelihood (allows fits to other quantities, e.g. B mass)
+ /*!
+ \param [in] usingDP the boolean flag
+ */
+ void useDP( Bool_t usingDP ) { usingDP_ = usingDP; }
+
+ //! Return the flag to store the status of using an sFit or not
+ Bool_t doSFit() const { return doSFit_; }
+
+ //! Do an sFit (use sWeights to isolate signal decays rather than using background histograms)
+ /*!
+ \param [in] sWeightBranchName name of the branch of the tree containing the sWeights
+ \param [in] scaleFactor scaling factor to get the uncertainties correct
+ */
+ void doSFit( const TString& sWeightBranchName, Double_t scaleFactor = 1.0 );
+
+ //! Determine whether an extended maximum likelihood fit it being performed
+ Bool_t doEMLFit() const { return emlFit_; }
+
+ //! Choice to perform an extended maximum likelihood fit
+ /*!
+ \param [in] emlFit boolean specifying whether or not to perform the EML
+ */
+ void doEMLFit( Bool_t emlFit ) { emlFit_ = emlFit; }
+
+ //! Determine whether Poisson smearing is enabled for the toy MC generation
+ Bool_t doPoissonSmearing() const { return poissonSmear_; }
+
+ //! Turn Poisson smearing (for the toy MC generation) on or off
+ /*!
+ \param [in] poissonSmear boolean specifying whether or not to do Poisson smearing
+ */
+ void doPoissonSmearing( Bool_t poissonSmear ) { poissonSmear_ = poissonSmear; }
+
+ //! Determine whether embedding of events is enabled in the generation
+ Bool_t enableEmbedding() const { return enableEmbedding_; }
+
+ //! Turn on or off embedding of events in the generation
+ /*!
+ \param [in] enable boolean specifying whether to embed events
+ */
+ void enableEmbedding( Bool_t enable ) { enableEmbedding_ = enable; }
+
+ //! Determine whether writing out of the latex table is enabled
+ Bool_t writeLatexTable() const { return writeLatexTable_; }
+
+ //! Turn on or off the writing out of the latex table
+ /*!
+ \param [in] writeTable boolean specifying whether or not the latex table should be written out
+ */
+ void writeLatexTable( Bool_t writeTable ) { writeLatexTable_ = writeTable; }
+
+ //! save files containing graphs of the resonance's PDFs
+ Bool_t saveFilePDF() const { return savePDF_; }
+
+ //! Turn on or off the save of files containing graphs of the resonance's PDFs
+ /*!
+ \param [in] savePDF boolean specifying whether or not the save of files containing graphs of the resonance's PDFs
+ */
+ void saveFilePDF( Bool_t savePDF ) { savePDF_ = savePDF; }
+
+ //! Set up the sPlot ntuple
+ /*!
+ \param [in] fileName the sPlot file name
+ \param [in] treeName the sPlot tree name
+ \param [in] storeDPEfficiency whether or not to store the efficiency information too
+ \param [in] verbosity define the level of output
+ */
+ void writeSPlotData( const TString& fileName,
+ const TString& treeName,
+ Bool_t storeDPEfficiency,
+ const TString& verbosity = "q" );
+
+ //! Determine whether the sPlot data is to be written out
+ Bool_t writeSPlotData() const { return writeSPlotData_; }
+
+ //! Determine whether the efficiency information should be stored in the sPlot ntuple
+ Bool_t storeDPEff() const { return storeDPEff_; }
+
+ //! Determine whether the initial values of the fit parameters, in particular the isobar coefficient parameters, are to be randomised
+ Bool_t useRandomInitFitPars() const { return randomFit_; }
+
+ //! Randomise the initial values of the fit parameters, in particular the isobar coefficient parameters
+ void useRandomInitFitPars( Bool_t boolean ) { randomFit_ = boolean; }
+
+ //! Setup the background class names
+ /*!
+ \param [in] names a vector of all the background names
+ */
+ virtual void setBkgndClassNames( const std::vector<TString>& names );
+
+ //! Returns the number of background classes
+ inline UInt_t nBkgndClasses() const { return bkgndClassNames_.size(); }
+
+ //! Set the number of signal events
+ /*!
+ \param [in] nSigEvents contains the signal yield and option to fix it
+ */
+ virtual void setNSigEvents( LauParameter* nSigEvents ) = 0;
+
+ //! Set the number of background events
+ /*!
+ The name of the parameter must be that of the corresponding background category (so that it can be correctly assigned)
+
+ \param [in] nBkgndEvents contains the name, yield and option to fix the yield of the background
+
+ */
+ virtual void setNBkgndEvents( LauAbsRValue* nBkgndEvents ) = 0;
+
+ //! Set the DP amplitude coefficients
+ /*!
+ The name of the coeffSet must match the name of one of the resonances in the DP model.
+
+ The supplied order of coefficients will be rearranged to match the order in which the resonances are stored in the dynamics, see LauIsobarDynamics::addResonance.
+
+ \param [in] coeffSet the set of coefficients
+ */
+ virtual void setAmpCoeffSet( LauAbsCoeffSet* coeffSet ) = 0;
+
+ //! Specify that a toy MC sample should be created for a successful fit to an experiment
+ /*!
+ Generation uses the fitted parameters so that the user can compare the fit to the data
+
+ \param [in] toyMCScale the scale factor to get the number of events to generate
+ \param [in] mcFileName the file name where the toy sample will be stored
+ \param [in] tableFileName name of the output tex file
+ \param [in] poissonSmearing turn smearing on or off
+ */
+ void compareFitData( UInt_t toyMCScale = 10,
+ const TString& mcFileName = "fitToyMC.root",
+ const TString& tableFileName = "fitToyMCTable.tex",
+ Bool_t poissonSmearing = kTRUE );
+
+ //! Start the toy generation / fitting
+ /*!
+ \param [in] applicationCode specifies what to do, perform a fit ("fit") or generate toy MC ("gen")
+ \param [in] dataFileName the name of the input data file
+ \param [in] dataTreeName the name of the tree containing the data
+ \param [in] histFileName the file name for the output histograms
+ \param [in] tableFileName the file name for the latex output file
+ */
+ void run( const TString& applicationCode,
+ const TString& dataFileName,
+ const TString& dataTreeName,
+ const TString& histFileName,
+ const TString& tableFileName = "" );
+
+ //! This function sets the parameter values from Minuit
+ /*!
+ This function has to be public since it is called from the global FCN.
+ It should not be called otherwise!
+
+ \param [in] par an array storing the various parameter values
+ \param [in] npar the number of free parameters
+ */
+ virtual void setParsFromMinuit( Double_t* par, Int_t npar );
+
+ //! Calculates the total negative log-likelihood
+ /*!
+ This function has to be public since it is called from the global FCN.
+ It should not be called otherwise!
+ */
+ virtual Double_t getTotNegLogLikelihood();
+
+ //! Set model parameters from a file
+ /*!
+ \param [in] fileName the name of the file with parameters to set
+ \param [in] treeName the name of the tree in the file corresponding to the parameters to set
+ \param [in] fix whether to fix (set constant) the loaded parameters, or leave them floating
+ */
+ void setParametersFromFile( const TString& fileName, const TString& treeName, const Bool_t fix );
+
+ //! Set model parameters from a given std::map
+ /*!
+ Only parameters named in the map are imported, all others are set to their values specified
+ in the model configuration.
+
+ \param [in] parameters map from parameter name to imported value
+ \param [in] fix whether to fix (set constant) the loaded parameters, or leave them floating
+ */
+ void setParametersFromMap( const std::map<TString, Double_t>& parameters, const Bool_t fix );
+
+ //! Set named model parameters from a file
+ /*!
+ Identical to setParametersFromFile, but only import parameters named from parameters set.
+ All others are set to their values specified in the model configuration.
+
+ \param [in] fileName the name of the file with parameters to set
+ \param [in] treeName the name of the tree in the file corresponding to the parameters to set
+ \param [in] parameters the set of parameters to import from the file
+ \param [in] fix whether to fix (set constant) the loaded parameters, or leave them floating
+ */
+ void setNamedParameters( const TString& fileName,
+ const TString& treeName,
+ const std::set<TString>& parameters,
+ const Bool_t fix );
+
+ //! Set named model parameters from a given std::map, with fallback to those from a file
+ /*!
+ Parameters named in the map are imported with their specified values. All other parameters are set
+ to the values corresponding to the value in the given file.
+
+ \param [in] fileName the name of the file with parameters to set
+ \param [in] treeName the name of the tree in the file corresponding to the parameters to set
+ \param [in] parameters map from parameter name to imported value (override parameters form the file)
+ \param [in] fix whether to fix (set constant) the loaded parameters, or leave them floating
+ */
+ void setParametersFileFallback( const TString& fileName,
+ const TString& treeName,
+ const std::map<TString, Double_t>& parameters,
+ const Bool_t fix );
+
+ //! Calculate the DP amplitude(s) for a given DP position
+ /*!
+ If not already done, this function will initialise the DP models
+
+ \param [in] m13Sq the invariant mass squared of children 1 and 3
+ \param [in] m23Sq the invariant mass squared of children 2 and 3
+ \return a container of complex amplitudes, labelled to indicate to which component they belong
+ */
+ virtual std::map<TString, LauComplex> getDPAmps( const Double_t m13Sq, const Double_t m23Sq ) = 0;
+
+ //! Calculate the DP likelihood(s) for a given DP position
+ /*!
+ If not already done, this function will initialise the DP models
+
+ \param [in] m13Sq the invariant mass squared of children 1 and 3
+ \param [in] m23Sq the invariant mass squared of children 2 and 3
+ \return a container of likelihood values, labelled to indicate to which component they belong
+ */
+ virtual std::map<TString, Double_t> getDPLikelihoods( const Double_t m13Sq,
+ const Double_t m23Sq ) = 0;
+
+ protected:
+ // Some typedefs
+
+ //! List of Pdfs
+ typedef std::vector<LauAbsPdf*> LauPdfPList;
+ //! List of parameter pointers
+ typedef std::vector<LauParameter*> LauParameterPList;
+ //! List of parameter pointers
+ typedef std::vector<LauAbsRValue*> LauAbsRValuePList;
+ //! Set of parameter pointers
+ typedef std::set<LauParameter*> LauParameterPSet;
+ //! List of parameters
+ typedef std::vector<LauParameter> LauParameterList;
+ //! A type to store background classes
+ typedef std::map<UInt_t, TString> LauBkgndClassMap;
+
+ //! Clear the vectors containing fit parameters
+ void clearFitParVectors();
+
+ //! Clear the vectors containing extra ntuple variables
+ void clearExtraVarVectors();
+
+ //! Weighting - allows e.g. MC events to be weighted by the DP model
+ /*!
+ \param [in] dataFileName the name of the data file
+ \param [in] dataTreeName the name of the tree containing the data
+ */
+ virtual void weightEvents( const TString& dataFileName, const TString& dataTreeName ) = 0;
+
+ //! Generate toy MC
+ /*!
+ \param [in] dataFileName the name of the file where the generated events are stored
+ \param [in] dataTreeName the name of the tree used to store the variables
+ \param [in] histFileName the name of the histogram output file (currently not used)
+ \param [in] tableFileNameBase the name the latex output file
+ */
+ virtual void generate( const TString& dataFileName,
+ const TString& dataTreeName,
+ const TString& histFileName,
+ const TString& tableFileNameBase );
+
+ //! The method that actually generates the toy MC events for the given experiment
+ /*!
+ \return the success/failure flag of the generation procedure
+ */
+ virtual Bool_t genExpt() = 0;
+
+ //! Perform the total fit
+ /*!
+ \param [in] dataFileName the name of the data file
+ \param [in] dataTreeName the name of the tree containing the data
+ \param [in] histFileName the name of the histogram output file
+ \param [in] tableFileNameBase the name the of latex output file
+ */
+ void fit( const TString& dataFileName,
+ const TString& dataTreeName,
+ const TString& histFileName,
+ const TString& tableFileNameBase );
+
+ //! Routine to perform the actual fit for a given experiment
+ void fitExpt();
+
+ //! Routine to perform the minimisation
+ /*!
+ \return the success/failure flag of the fit
+ */
+ Bool_t runMinimisation();
+
+ //! Create a toy MC sample from the fitted parameters
+ /*!
+ \param [in] mcFileName the file name where the toy sample will be stored
+ \param [in] tableFileName name of the output tex file
+ */
+ void createFitToyMC( const TString& mcFileName, const TString& tableFileName );
+
+ //! Read in the data for the current experiment
+ /*!
+ \return the number of events read in
+ */
+ virtual UInt_t readExperimentData();
+
+ //! Open the input file and verify that all required variables are present
+ /*!
+ \param [in] dataFileName the name of the input file
+ \param [in] dataTreeName the name of the input tree
+ */
+ virtual Bool_t verifyFitData( const TString& dataFileName, const TString& dataTreeName );
+
+ //! Cache the input data values to calculate the likelihood during the fit
+ virtual void cacheInputFitVars() = 0;
+
+ //! Cache the value of the sWeights to be used in the sFit
+ virtual void cacheInputSWeights();
+
+ //! Initialise the fit par vectors
+ /*!
+ Each class that inherits from this one must implement
+ this sensibly for all vectors specified in
+ clearFitParVectors, i.e. specify parameter names,
+ initial, min, max and fixed values
+ */
+ virtual void initialise() = 0;
+
+ //! Recalculate normalisation the signal DP model(s)
+ virtual void recalculateNormalisation() = 0;
+
+ //! Initialise the DP models
+ virtual void initialiseDPModels() = 0;
+
+ /*!
+ For each amp in the fit this function takes its
+ particular parameters and from them calculates the
+ single complex number that is its coefficient.
+ The vector of these coeffs can then be passed to the
+ signal dynamics.
+ */
+ virtual void updateCoeffs() = 0;
+
+ //! This function (specific to each model) calculates anything that depends on the fit parameter values
+ virtual void propagateParUpdates() = 0;
+
+ //! Calculate the sum of the log-likelihood over the specified events
+ /*!
+ \param [in] iStart the event number of the first event to be considered
+ \param [in] iEnd the event number of the final event to be considered
+ */
+ Double_t getLogLikelihood( UInt_t iStart, UInt_t iEnd );
+
+ //! Calculate the penalty terms to the log likelihood from Gaussian constraints
+ Double_t getLogLikelihoodPenalty();
+
+ //! Calculates the likelihood for a given event
+ /*!
+ \param [in] iEvt the event number
+ */
+ virtual Double_t getTotEvtLikelihood( UInt_t iEvt ) = 0;
+
+ //! Returns the sum of the expected events over all hypotheses; used in the EML fit scenario
+ virtual Double_t getEventSum() const = 0;
+
+ //! Prints the values of all the fit variables for the specified event - useful for diagnostics
+ /*!
+ \param [in] iEvt the event number
+ */
+ virtual void printEventInfo( UInt_t iEvt ) const;
+
+ //! Same as printEventInfo, but printing out the values of the variables in the fit
+ virtual void printVarsInfo() const;
+
+ //! Update initial fit parameters if required
+ virtual void checkInitFitParams() = 0;
+
+ //! Setup saving of fit results to ntuple/LaTeX table etc.
+ /*!
+ \param [in] histFileName the file name for the output histograms
+ \param [in] tableFileName the file name for the latex output file
+ */
+ virtual void setupResultsOutputs( const TString& histFileName, const TString& tableFileName );
+
+ //! Package the initial fit parameters for transmission to the coordinator
+ /*!
+ \param [out] array the array to be filled with the LauParameter objects
+ */
+ virtual void prepareInitialParArray( TObjArray& array );
+
+ //! Perform all finalisation actions
+ /*!
+ - Receive the results of the fit from the coordinator
+ - Perform any finalisation routines
+ - Package the finalised fit parameters for transmission back to the coordinator
+
+ \param [in] fitStat the status of the fit, e.g. status code, EDM, NLL
+ \param [in] parsFromCoordinator the parameters at the fit minimum
+ \param [in] covMat the fit covariance matrix
+ \param [out] parsToCoordinator the array to be filled with the finalised LauParameter objects
+ */
+ virtual void finaliseExperiment( const LauAbsFitter::FitStatus& fitStat,
+ const TObjArray* parsFromCoordinator,
+ const TMatrixD* covMat,
+ TObjArray& parsToCoordinator );
+
+ //! Write the results of the fit into the ntuple
+ /*!
+ \param [in] tableFileName the structure containing the results of the fit
+ */
+ virtual void finaliseFitResults( const TString& tableFileName ) = 0;
+
+ //! Save the pdf Plots for all the resonances of experiment number fitExp
+ /*!
+ \param [in] label prefix for the file name to be saved
+ */
+ virtual void savePDFPlots( const TString& label ) = 0;
+
+ //! Save the pdf Plots for the sum of ressonances correspondint to "sin" of experiment number fitExp
+ /*!
+ \param [in] label prefix for the file name to be saved
+ \param [in] spin spin of the wave to be saved
+ */
+ virtual void savePDFPlotsWave( const TString& label, const Int_t& spin ) = 0;
+
+ //! Write the latex table
+ /*!
+ \param [in] outputFile the name of the output file
+ */
+ virtual void writeOutTable( const TString& outputFile ) = 0;
+
+ //! Store the per-event likelihood values
+ virtual void storePerEvtLlhds() = 0;
+
+ //! Calculate the sPlot data
+ virtual void calculateSPlotData();
+
+ //! Make sure all parameters hold their genValue as the current value
+ void setGenValues();
+
+ //! Method to set up the storage for background-related quantities called by setBkgndClassNames
+ virtual void setupBkgndVectors() = 0;
+
+ //! Check if the given background class is in the list
+ /*!
+ \param [in] className the name of the class to check
+ \return true or false
+ */
+ Bool_t validBkgndClass( const TString& className ) const;
+
+ //! The number assigned to a background class
+ /*!
+ \param [in] className the name of the class to check
+ \return the background class ID number
+ */
+ UInt_t bkgndClassID( const TString& className ) const;
+
+ //! Get the name of a background class from the number
+ /*!
+ \param [in] classID the ID number of the background class
+ \return the class name
+ */
+ const TString& bkgndClassName( UInt_t classID ) const;
+
+ //! Setup the generation ntuple branches
+ virtual void setupGenNtupleBranches() = 0;
+
+ //! Add a branch to the gen tree for storing an integer
+ /*!
+ \param [in] name the name of the branch
+ */
+ virtual void addGenNtupleIntegerBranch( const TString& name );
+
+ //! Add a branch to the gen tree for storing a double
+ /*!
+ \param [in] name the name of the branch
+ */
+ virtual void addGenNtupleDoubleBranch( const TString& name );
+
+ //! Set the value of an integer branch in the gen tree
+ /*!
+ \param [in] name the name of the branch
+ \param [in] value the value to be stored
+ */
+ virtual void setGenNtupleIntegerBranchValue( const TString& name, Int_t value );
+
+ //! Set the value of a double branch in the gen tree
+ /*!
+ \param [in] name the name of the branch
+ \param [in] value the value to be stored
+ */
+ virtual void setGenNtupleDoubleBranchValue( const TString& name, Double_t value );
+
+ //! Get the value of an integer branch in the gen tree
+ /*!
+ \param [in] name the name of the branch
+ \return the value of the parameter
+ */
+ virtual Int_t getGenNtupleIntegerBranchValue( const TString& name ) const;
+
+ //! Get the value of a double branch in the gen tree
+ /*!
+ \param [in] name the name of the branch
+ \return the value of the parameter
+ */
+ virtual Double_t getGenNtupleDoubleBranchValue( const TString& name ) const;
+
+ //! Fill the gen tuple branches
+ virtual void fillGenNtupleBranches();
+
+ //! Setup the branches of the sPlot tuple
+ virtual void setupSPlotNtupleBranches() = 0;
+
+ //! Add a branch to the sPlot tree for storing an integer
+ /*!
+ \param [in] name the name of the branch
+ */
+ virtual void addSPlotNtupleIntegerBranch( const TString& name );
+
+ //! Add a branch to the sPlot tree for storing a double
+ /*!
+ \param [in] name the name of the branch
+ */
+ virtual void addSPlotNtupleDoubleBranch( const TString& name );
+
+ //! Set the value of an integer branch in the sPlot tree
+ /*!
+ \param [in] name the name of the branch
+ \param [in] value the value to be stored
+ */
+ virtual void setSPlotNtupleIntegerBranchValue( const TString& name, Int_t value );
+
+ //! Set the value of a double branch in the sPlot tree
+ /*!
+ \param [in] name the name of the branch
+ \param [in] value the value to be stored
+ */
+ virtual void setSPlotNtupleDoubleBranchValue( const TString& name, Double_t value );
+
+ //! Fill the sPlot tuple
+ virtual void fillSPlotNtupleBranches();
+
+ //! Returns the names of all variables in the fit
+ virtual LauSPlot::NameSet variableNames() const = 0;
+
+ //! Returns the names and yields of species that are free in the fit
+ virtual LauSPlot::NumbMap freeSpeciesNames() const = 0;
+
+ //! Returns the names and yields of species that are fixed in the fit
+ virtual LauSPlot::NumbMap fixdSpeciesNames() const = 0;
+
+ //! Returns the species and variables for all 2D PDFs in the fit
+ virtual LauSPlot::TwoDMap twodimPDFs() const = 0;
+
+ //! Check if the signal is split into well-reconstructed and mis-reconstructed types
+ virtual Bool_t splitSignal() const = 0;
+
+ //! Check if the mis-reconstructed signal is to be smeared in the DP
+ virtual Bool_t scfDPSmear() const = 0;
+
+ //! Add the given parameter to the list of all fit parameters
+ /*!
+ \param [in] param the parameter
+ \param [in] addFixed if true add the parameter even if it is not floating
+ \return the number of parameters added
+ */
+ UInt_t addFitParameters( LauParameter* param, const Bool_t addFixed = kFALSE );
+
+ //! Add the given parameter(s) to the list of all fit parameters
+ /*!
+ \param [in] param the parameter (which may depend on other parameters)
+ \param [in] addFixed if true add the parameter even if it is not floating
+ \return the number of parameters added
+ */
+ UInt_t addFitParameters( LauAbsRValue* param, const Bool_t addFixed = kFALSE );
+
+ //! Add the given parameter(s) to the list of all fit parameters
+ /*!
+ \param [in] paramList a list of parameters
+ \param [in] addFixed if true add the parameter even if it is not floating
+ \return the number of parameters added
+ */
+ UInt_t addFitParameters( LauParameterPList& paramList, const Bool_t addFixed = kFALSE );
+
+ //! Add the given parameter(s) to the list of all fit parameters
+ /*!
+ \param [in] paramList a list of parameters
+ \param [in] addFixed if true add the parameter even if it is not floating
+ \return the number of parameters added
+ */
+ UInt_t addFitParameters( LauAbsRValuePList& paramList, const Bool_t addFixed = kFALSE );
+
+ //! Add parameters of the PDFs in the list to the list of all fit parameters
+ /*!
+ \param [in] pdfList a list of Pdfs
+ \param [in] addFixed if true add the parameter even if it is not floating
+ \return the number of parameters added
+ */
+ UInt_t addFitParameters( LauPdfPList& pdfList, const Bool_t addFixed = kFALSE );
+
+ //! Add the given parameter to the list of resonance parameters and the list of all fit parameters
+ /*!
+ \param [in] param a resonance parameter
+ \return the number of parameters added
+ */
+ UInt_t addResonanceParameters( LauParameter* param );
+
+ //! Add the given parameter(s) to the list of resonance parameters and the list of all fit parameters
+ /*!
+ \param [in] parList a list of resonance parameters
+ \return the number of parameters added
+ */
+ UInt_t addResonanceParameters( LauParameterPList& paramList );
+
+ //! Add parameters to the list of Gaussian constrained parameters
+ void addConParameters();
+
+ //! Print the fit parameters for all PDFs in the list
+ /*!
+ \param [in] pdfList a list of Pdfs
+ \param [in] fout the output stream to write to
+ */
+ void printFitParameters( const LauPdfPList& pdfList, std::ostream& fout ) const;
+
+ //! Update the fit parameters for all PDFs in the list
+ /*!
+ \param [in] pdfList a list of Pdfs
+ */
+ void updateFitParameters( LauPdfPList& pdfList );
+
+ //! Have all PDFs in the list cache the data
+ /*!
+ \param [in] pdfList the list of pdfs
+ \param [in] theData the data from the fit
+ */
+ void cacheInfo( LauPdfPList& pdfList, const LauFitDataTree& theData );
+
+ //! Calculate the product of the per-event likelihoods of the PDFs in the list
+ /*!
+ \param [in] pdfList the list of pdfs
+ \param [in] iEvt the event number
+ */
+ Double_t prodPdfValue( LauPdfPList& pdfList, UInt_t iEvt );
+
+ //! Do any of the PDFs have a dependence on the DP?
+ /*!
+ \return the flag to indicated if there is a DP dependence
+ */
+ Bool_t pdfsDependOnDP() const { return pdfsDependOnDP_; }
+
+ //! Do any of the PDFs have a dependence on the DP?
+ /*!
+ \param [in] dependOnDP the flag to indicated if there is a DP dependence
+ */
+ void pdfsDependOnDP( Bool_t dependOnDP ) { pdfsDependOnDP_ = dependOnDP; }
+
+ //! Const access to the fit variables
+ const LauParameterPList& fitPars() const { return fitVars_; }
+
+ //! Const access the fit variables which affect the DP normalisation
+ const LauParameterPSet& resPars() const { return resVars_; }
+
+ //! Const access the extra variables
+ const LauParameterList& extraPars() const { return extraVars_; }
+
+ //! Non-const access the extra variables
+ LauParameterList& extraPars() { return extraVars_; }
+
+ //! Const access the Gaussian constrained variables
+ const LauAbsRValuePList& conPars() const { return conVars_; }
+
+ //! Const access the gen ntuple
+ const LauGenNtuple* genNtuple() const { return genNtuple_; }
+
+ //! Access the gen ntuple
+ LauGenNtuple* genNtuple() { return genNtuple_; }
+
+ //! Const access the sPlot ntuple
+ const LauGenNtuple* sPlotNtuple() const { return sPlotNtuple_; }
+
+ //! Access the sPlot ntuple
+ LauGenNtuple* sPlotNtuple() { return sPlotNtuple_; }
+
+ //! Const access the data store
+ const LauFitDataTree* fitData() const { return inputFitData_; }
+
+ //! Access the data store
+ LauFitDataTree* fitData() { return inputFitData_; }
+
+ //! Imported parameters file name
+ TString fixParamFileName_;
+
+ //! Imported parameters tree name
+ TString fixParamTreeName_;
+
+ //! Map from imported parameter name to value
+ std::map<TString, Double_t> fixParamMap_;
+
+ //! Imported parameter names
+ std::set<TString> fixParamNames_;
+
+ //! Whether to fix the loaded parameters (kTRUE) or leave them floating (kFALSE)
+ Bool_t fixParams_;
+
+ //! The set of parameters that are imported (either from a file or by value) and not
+ // set to be fixed in the fit. In addition to those from fixParamNames_, these
+ // include those imported from a file.
+ std::set<LauParameter*> allImportedFreeParams_;
+
+ private:
+ //! Copy constructor (not implemented)
+ LauAbsFitModel( const LauAbsFitModel& rhs );
+
+ //! Copy assignment operator (not implemented)
+ LauAbsFitModel& operator=( const LauAbsFitModel& rhs );
+
+ // Various control booleans
+
+ //! Option to make toy from 1st successful experiment
+ Bool_t compareFitData_;
+ //! Option to output a .C file of PDF's
+ Bool_t savePDF_;
+ //! Option to output a Latex format table
+ Bool_t writeLatexTable_;
+ //! Option to write sPlot data
+ Bool_t writeSPlotData_;
+ //! Option to store DP efficiencies in the sPlot ntuple
+ Bool_t storeDPEff_;
+ //! Option to randomise the initial values of the fit parameters
+ Bool_t randomFit_;
+ //! Option to perform an extended ML fit
+ Bool_t emlFit_;
+ //! Option to perform Poisson smearing
+ Bool_t poissonSmear_;
+ //! Option to enable embedding
+ Bool_t enableEmbedding_;
+ //! Option to include the DP as part of the fit
+ Bool_t usingDP_;
+ //! Option to state if pdfs depend on DP position
+ Bool_t pdfsDependOnDP_;
+
+ // Info on number of experiments and number of events
+
+ //! Internal vector of fit parameters
+ LauParameterPList fitVars_;
+
+ //! Internal set of the same fit parameters (used to check uniqueness)
+ LauParameterPSet fitVarsSet_;
+
+ //! Internal set of fit parameters upon which the DP normalisation depends
+ LauParameterPSet resVars_;
+
+ //! Extra variables that aren't in the fit but are stored in the ntuple
+ LauParameterList extraVars_;
+
+ //! Internal vectors of Gaussian parameters
+ LauAbsRValuePList conVars_;
+
+ // Input data and output ntuple
+
+ //! The input data
+ LauFitDataTree* inputFitData_;
+ //! The generated ntuple
+ LauGenNtuple* genNtuple_;
+ //! The sPlot ntuple
+ LauGenNtuple* sPlotNtuple_;
+
+ // Background class names
+
+ //! The background class names
+ LauBkgndClassMap bkgndClassNames_;
+ //! An empty string
+ const TString nullString_;
- //! Determine whether an extended maximum likelihood fit it being performed
- Bool_t doEMLFit() const {return emlFit_;}
-
- //! Choice to perform an extended maximum likelihood fit
- /*!
- \param [in] emlFit boolean specifying whether or not to perform the EML
- */
- void doEMLFit(Bool_t emlFit) {emlFit_ = emlFit;}
-
- //! Determine whether Poisson smearing is enabled for the toy MC generation
- Bool_t doPoissonSmearing() const {return poissonSmear_;}
-
- //! Turn Poisson smearing (for the toy MC generation) on or off
- /*!
- \param [in] poissonSmear boolean specifying whether or not to do Poisson smearing
- */
- void doPoissonSmearing(Bool_t poissonSmear) {poissonSmear_ = poissonSmear;}
-
- //! Determine whether embedding of events is enabled in the generation
- Bool_t enableEmbedding() const {return enableEmbedding_;}
-
- //! Turn on or off embedding of events in the generation
- /*!
- \param [in] enable boolean specifying whether to embed events
- */
- void enableEmbedding(Bool_t enable) {enableEmbedding_ = enable;}
-
- //! Determine whether writing out of the latex table is enabled
- Bool_t writeLatexTable() const {return writeLatexTable_;}
-
- //! Turn on or off the writing out of the latex table
- /*!
- \param [in] writeTable boolean specifying whether or not the latex table should be written out
- */
- void writeLatexTable(Bool_t writeTable) {writeLatexTable_ = writeTable;}
-
- //! save files containing graphs of the resonance's PDFs
- Bool_t saveFilePDF() const {return savePDF_;}
-
- //! Turn on or off the save of files containing graphs of the resonance's PDFs
- /*!
- \param [in] savePDF boolean specifying whether or not the save of files containing graphs of the resonance's PDFs
- */
- void saveFilePDF(Bool_t savePDF) {savePDF_ = savePDF;}
-
- //! Set up the sPlot ntuple
- /*!
- \param [in] fileName the sPlot file name
- \param [in] treeName the sPlot tree name
- \param [in] storeDPEfficiency whether or not to store the efficiency information too
- \param [in] verbosity define the level of output
- */
- void writeSPlotData(const TString& fileName, const TString& treeName, Bool_t storeDPEfficiency, const TString& verbosity = "q");
-
- //! Determine whether the sPlot data is to be written out
- Bool_t writeSPlotData() const {return writeSPlotData_;}
-
- //! Determine whether the efficiency information should be stored in the sPlot ntuple
- Bool_t storeDPEff() const {return storeDPEff_;}
-
- //! Determine whether the initial values of the fit parameters, in particular the isobar coefficient parameters, are to be randomised
- Bool_t useRandomInitFitPars() const {return randomFit_;}
-
- //! Randomise the initial values of the fit parameters, in particular the isobar coefficient parameters
- void useRandomInitFitPars(Bool_t boolean) {randomFit_ = boolean;}
-
- //! Setup the background class names
- /*!
- \param [in] names a vector of all the background names
- */
- virtual void setBkgndClassNames( const std::vector<TString>& names );
-
- //! Returns the number of background classes
- inline UInt_t nBkgndClasses() const {return bkgndClassNames_.size();}
-
- //! Set the number of signal events
- /*!
- \param [in] nSigEvents contains the signal yield and option to fix it
- */
- virtual void setNSigEvents(LauParameter* nSigEvents) = 0;
-
- //! Set the number of background events
- /*!
- The name of the parameter must be that of the corresponding background category (so that it can be correctly assigned)
-
- \param [in] nBkgndEvents contains the name, yield and option to fix the yield of the background
-
- */
- virtual void setNBkgndEvents(LauAbsRValue* nBkgndEvents) = 0;
-
- //! Set the DP amplitude coefficients
- /*!
- The name of the coeffSet must match the name of one of the resonances in the DP model.
-
- The supplied order of coefficients will be rearranged to match the order in which the resonances are stored in the dynamics, see LauIsobarDynamics::addResonance.
-
- \param [in] coeffSet the set of coefficients
- */
- virtual void setAmpCoeffSet(LauAbsCoeffSet* coeffSet) = 0;
-
- //! Specify that a toy MC sample should be created for a successful fit to an experiment
- /*!
- Generation uses the fitted parameters so that the user can compare the fit to the data
-
- \param [in] toyMCScale the scale factor to get the number of events to generate
- \param [in] mcFileName the file name where the toy sample will be stored
- \param [in] tableFileName name of the output tex file
- \param [in] poissonSmearing turn smearing on or off
- */
- void compareFitData(UInt_t toyMCScale = 10, const TString& mcFileName = "fitToyMC.root",
- const TString& tableFileName = "fitToyMCTable.tex", Bool_t poissonSmearing = kTRUE);
-
- //! Start the toy generation / fitting
- /*!
- \param [in] applicationCode specifies what to do, perform a fit ("fit") or generate toy MC ("gen")
- \param [in] dataFileName the name of the input data file
- \param [in] dataTreeName the name of the tree containing the data
- \param [in] histFileName the file name for the output histograms
- \param [in] tableFileName the file name for the latex output file
- */
- void run(const TString& applicationCode, const TString& dataFileName, const TString& dataTreeName,
- const TString& histFileName, const TString& tableFileName = "");
-
- //! This function sets the parameter values from Minuit
- /*!
- This function has to be public since it is called from the global FCN.
- It should not be called otherwise!
-
- \param [in] par an array storing the various parameter values
- \param [in] npar the number of free parameters
- */
- virtual void setParsFromMinuit(Double_t* par, Int_t npar);
-
- //! Calculates the total negative log-likelihood
- /*!
- This function has to be public since it is called from the global FCN.
- It should not be called otherwise!
- */
- virtual Double_t getTotNegLogLikelihood();
-
- //! Set model parameters from a file
- /*!
- \param [in] fileName the name of the file with parameters to set
- \param [in] treeName the name of the tree in the file corresponding to the parameters to set
- \param [in] fix whether to fix (set constant) the loaded parameters, or leave them floating
- */
- void setParametersFromFile(const TString& fileName, const TString& treeName, const Bool_t fix);
-
- //! Set model parameters from a given std::map
- /*!
- Only parameters named in the map are imported, all others are set to their values specified
- in the model configuration.
-
- \param [in] parameters map from parameter name to imported value
- \param [in] fix whether to fix (set constant) the loaded parameters, or leave them floating
- */
- void setParametersFromMap(const std::map<TString, Double_t>& parameters, const Bool_t fix);
-
- //! Set named model parameters from a file
- /*!
- Identical to setParametersFromFile, but only import parameters named from parameters set.
- All others are set to their values specified in the model configuration.
-
- \param [in] fileName the name of the file with parameters to set
- \param [in] treeName the name of the tree in the file corresponding to the parameters to set
- \param [in] parameters the set of parameters to import from the file
- \param [in] fix whether to fix (set constant) the loaded parameters, or leave them floating
- */
- void setNamedParameters(const TString& fileName, const TString& treeName, const std::set<TString>& parameters, const Bool_t fix);
-
- //! Set named model parameters from a given std::map, with fallback to those from a file
- /*!
- Parameters named in the map are imported with their specified values. All other parameters are set
- to the values corresponding to the value in the given file.
-
- \param [in] fileName the name of the file with parameters to set
- \param [in] treeName the name of the tree in the file corresponding to the parameters to set
- \param [in] parameters map from parameter name to imported value (override parameters form the file)
- \param [in] fix whether to fix (set constant) the loaded parameters, or leave them floating
- */
- void setParametersFileFallback(const TString& fileName, const TString& treeName, const std::map<TString, Double_t>& parameters, const Bool_t fix);
-
- //! Calculate the DP amplitude(s) for a given DP position
- /*!
- If not already done, this function will initialise the DP models
- \param [in] m13Sq the invariant mass squared of children 1 and 3
- \param [in] m23Sq the invariant mass squared of children 2 and 3
- \return a container of complex amplitudes, labelled to indicate to which component they belong
- */
- virtual std::map<TString, LauComplex> getDPAmps( const Double_t m13Sq, const Double_t m23Sq ) = 0;
-
- //! Calculate the DP likelihood(s) for a given DP position
- /*!
- If not already done, this function will initialise the DP models
- \param [in] m13Sq the invariant mass squared of children 1 and 3
- \param [in] m23Sq the invariant mass squared of children 2 and 3
- \return a container of likelihood values, labelled to indicate to which component they belong
- */
- virtual std::map<TString, Double_t> getDPLikelihoods( const Double_t m13Sq, const Double_t m23Sq ) = 0;
-
- protected:
-
- // Some typedefs
-
- //! List of Pdfs
- typedef std::vector<LauAbsPdf*> LauPdfPList;
- //! List of parameter pointers
- typedef std::vector<LauParameter*> LauParameterPList;
- //! List of parameter pointers
- typedef std::vector<LauAbsRValue*> LauAbsRValuePList;
- //! Set of parameter pointers
- typedef std::set<LauParameter*> LauParameterPSet;
- //! List of parameters
- typedef std::vector<LauParameter> LauParameterList;
- //! A type to store background classes
- typedef std::map<UInt_t,TString> LauBkgndClassMap;
-
- //! Clear the vectors containing fit parameters
- void clearFitParVectors();
-
- //! Clear the vectors containing extra ntuple variables
- void clearExtraVarVectors();
-
- //! Weighting - allows e.g. MC events to be weighted by the DP model
- /*!
- \param [in] dataFileName the name of the data file
- \param [in] dataTreeName the name of the tree containing the data
- */
- virtual void weightEvents( const TString& dataFileName, const TString& dataTreeName ) = 0;
-
- //! Generate toy MC
- /*!
- \param [in] dataFileName the name of the file where the generated events are stored
- \param [in] dataTreeName the name of the tree used to store the variables
- \param [in] histFileName the name of the histogram output file (currently not used)
- \param [in] tableFileNameBase the name the latex output file
- */
- virtual void generate(const TString& dataFileName, const TString& dataTreeName, const TString& histFileName, const TString& tableFileNameBase);
-
- //! The method that actually generates the toy MC events for the given experiment
- /*!
- \return the success/failure flag of the generation procedure
- */
- virtual Bool_t genExpt() = 0;
-
- //! Perform the total fit
- /*!
- \param [in] dataFileName the name of the data file
- \param [in] dataTreeName the name of the tree containing the data
- \param [in] histFileName the name of the histogram output file
- \param [in] tableFileNameBase the name the of latex output file
- */
- void fit(const TString& dataFileName, const TString& dataTreeName, const TString& histFileName, const TString& tableFileNameBase);
-
- //! Routine to perform the actual fit for a given experiment
- void fitExpt();
-
- //! Routine to perform the minimisation
- /*!
- \return the success/failure flag of the fit
- */
- Bool_t runMinimisation();
-
- //! Create a toy MC sample from the fitted parameters
- /*!
- \param [in] mcFileName the file name where the toy sample will be stored
- \param [in] tableFileName name of the output tex file
- */
- void createFitToyMC(const TString& mcFileName, const TString& tableFileName);
-
- //! Read in the data for the current experiment
- /*!
- \return the number of events read in
- */
- virtual UInt_t readExperimentData();
-
- //! Open the input file and verify that all required variables are present
- /*!
- \param [in] dataFileName the name of the input file
- \param [in] dataTreeName the name of the input tree
- */
- virtual Bool_t verifyFitData(const TString& dataFileName, const TString& dataTreeName);
-
- //! Cache the input data values to calculate the likelihood during the fit
- virtual void cacheInputFitVars() = 0;
-
- //! Cache the value of the sWeights to be used in the sFit
- virtual void cacheInputSWeights();
-
- //! Initialise the fit par vectors
- /*!
- Each class that inherits from this one must implement
- this sensibly for all vectors specified in
- clearFitParVectors, i.e. specify parameter names,
- initial, min, max and fixed values
- */
- virtual void initialise() = 0;
-
- //! Recalculate normalisation the signal DP model(s)
- virtual void recalculateNormalisation() = 0;
-
- //! Initialise the DP models
- virtual void initialiseDPModels() = 0;
-
- /*!
- For each amp in the fit this function takes its
- particular parameters and from them calculates the
- single complex number that is its coefficient.
- The vector of these coeffs can then be passed to the
- signal dynamics.
- */
- virtual void updateCoeffs() = 0;
-
- //! This function (specific to each model) calculates anything that depends on the fit parameter values
- virtual void propagateParUpdates() = 0;
-
- //! Calculate the sum of the log-likelihood over the specified events
- /*!
- \param [in] iStart the event number of the first event to be considered
- \param [in] iEnd the event number of the final event to be considered
- */
- Double_t getLogLikelihood( UInt_t iStart, UInt_t iEnd );
-
- //! Calculate the penalty terms to the log likelihood from Gaussian constraints
- Double_t getLogLikelihoodPenalty();
-
- //! Calculates the likelihood for a given event
- /*!
- \param [in] iEvt the event number
- */
- virtual Double_t getTotEvtLikelihood(UInt_t iEvt) = 0;
-
- //! Returns the sum of the expected events over all hypotheses; used in the EML fit scenario
- virtual Double_t getEventSum() const = 0;
-
- //! Prints the values of all the fit variables for the specified event - useful for diagnostics
- /*!
- \param [in] iEvt the event number
- */
- virtual void printEventInfo(UInt_t iEvt) const;
-
- //! Same as printEventInfo, but printing out the values of the variables in the fit
- virtual void printVarsInfo() const;
-
- //! Update initial fit parameters if required
- virtual void checkInitFitParams() = 0;
-
- //! Setup saving of fit results to ntuple/LaTeX table etc.
- /*!
- \param [in] histFileName the file name for the output histograms
- \param [in] tableFileName the file name for the latex output file
- */
- virtual void setupResultsOutputs( const TString& histFileName, const TString& tableFileName );
-
- //! Package the initial fit parameters for transmission to the coordinator
- /*!
- \param [out] array the array to be filled with the LauParameter objects
- */
- virtual void prepareInitialParArray( TObjArray& array );
-
- //! Perform all finalisation actions
- /*!
- - Receive the results of the fit from the coordinator
- - Perform any finalisation routines
- - Package the finalised fit parameters for transmission back to the coordinator
-
- \param [in] fitStat the status of the fit, e.g. status code, EDM, NLL
- \param [in] parsFromCoordinator the parameters at the fit minimum
- \param [in] covMat the fit covariance matrix
- \param [out] parsToCoordinator the array to be filled with the finalised LauParameter objects
- */
- virtual void finaliseExperiment( const LauAbsFitter::FitStatus& fitStat, const TObjArray* parsFromCoordinator, const TMatrixD* covMat, TObjArray& parsToCoordinator );
-
- //! Write the results of the fit into the ntuple
- /*!
- \param [in] tableFileName the structure containing the results of the fit
- */
- virtual void finaliseFitResults(const TString& tableFileName) = 0;
-
- //! Save the pdf Plots for all the resonances of experiment number fitExp
- /*!
- \param [in] label prefix for the file name to be saved
- */
- virtual void savePDFPlots(const TString& label) = 0;
-
- //! Save the pdf Plots for the sum of ressonances correspondint to "sin" of experiment number fitExp
- /*!
- \param [in] label prefix for the file name to be saved
- \param [in] spin spin of the wave to be saved
- */
- virtual void savePDFPlotsWave(const TString& label, const Int_t& spin) = 0;
-
- //! Write the latex table
- /*!
- \param [in] outputFile the name of the output file
- */
- virtual void writeOutTable(const TString& outputFile) = 0;
-
- //! Store the per-event likelihood values
- virtual void storePerEvtLlhds() = 0;
-
- //! Calculate the sPlot data
- virtual void calculateSPlotData();
-
- //! Make sure all parameters hold their genValue as the current value
- void setGenValues();
-
- //! Method to set up the storage for background-related quantities called by setBkgndClassNames
- virtual void setupBkgndVectors() = 0;
-
- //! Check if the given background class is in the list
- /*!
- \param [in] className the name of the class to check
- \return true or false
- */
- Bool_t validBkgndClass( const TString& className ) const;
-
- //! The number assigned to a background class
- /*!
- \param [in] className the name of the class to check
- \return the background class ID number
- */
- UInt_t bkgndClassID( const TString& className ) const;
-
- //! Get the name of a background class from the number
- /*!
- \param [in] classID the ID number of the background class
- \return the class name
- */
- const TString& bkgndClassName( UInt_t classID ) const;
-
- //! Setup the generation ntuple branches
- virtual void setupGenNtupleBranches() = 0;
-
- //! Add a branch to the gen tree for storing an integer
- /*!
- \param [in] name the name of the branch
- */
- virtual void addGenNtupleIntegerBranch(const TString& name);
-
- //! Add a branch to the gen tree for storing a double
- /*!
- \param [in] name the name of the branch
- */
- virtual void addGenNtupleDoubleBranch(const TString& name);
-
- //! Set the value of an integer branch in the gen tree
- /*!
- \param [in] name the name of the branch
- \param [in] value the value to be stored
- */
- virtual void setGenNtupleIntegerBranchValue(const TString& name, Int_t value);
-
- //! Set the value of a double branch in the gen tree
- /*!
- \param [in] name the name of the branch
- \param [in] value the value to be stored
- */
- virtual void setGenNtupleDoubleBranchValue(const TString& name, Double_t value);
-
- //! Get the value of an integer branch in the gen tree
- /*!
- \param [in] name the name of the branch
- \return the value of the parameter
- */
- virtual Int_t getGenNtupleIntegerBranchValue(const TString& name) const;
-
- //! Get the value of a double branch in the gen tree
- /*!
- \param [in] name the name of the branch
- \return the value of the parameter
- */
- virtual Double_t getGenNtupleDoubleBranchValue(const TString& name) const;
-
- //! Fill the gen tuple branches
- virtual void fillGenNtupleBranches();
-
- //! Setup the branches of the sPlot tuple
- virtual void setupSPlotNtupleBranches() = 0;
-
- //! Add a branch to the sPlot tree for storing an integer
- /*!
- \param [in] name the name of the branch
- */
- virtual void addSPlotNtupleIntegerBranch(const TString& name);
-
- //! Add a branch to the sPlot tree for storing a double
- /*!
- \param [in] name the name of the branch
- */
- virtual void addSPlotNtupleDoubleBranch(const TString& name);
-
- //! Set the value of an integer branch in the sPlot tree
- /*!
- \param [in] name the name of the branch
- \param [in] value the value to be stored
- */
- virtual void setSPlotNtupleIntegerBranchValue(const TString& name, Int_t value);
-
- //! Set the value of a double branch in the sPlot tree
- /*!
- \param [in] name the name of the branch
- \param [in] value the value to be stored
- */
- virtual void setSPlotNtupleDoubleBranchValue(const TString& name, Double_t value);
-
- //! Fill the sPlot tuple
- virtual void fillSPlotNtupleBranches();
-
- //! Returns the names of all variables in the fit
- virtual LauSPlot::NameSet variableNames() const = 0;
-
- //! Returns the names and yields of species that are free in the fit
- virtual LauSPlot::NumbMap freeSpeciesNames() const = 0;
-
- //! Returns the names and yields of species that are fixed in the fit
- virtual LauSPlot::NumbMap fixdSpeciesNames() const = 0;
-
- //! Returns the species and variables for all 2D PDFs in the fit
- virtual LauSPlot::TwoDMap twodimPDFs() const = 0;
-
- //! Check if the signal is split into well-reconstructed and mis-reconstructed types
- virtual Bool_t splitSignal() const = 0;
-
- //! Check if the mis-reconstructed signal is to be smeared in the DP
- virtual Bool_t scfDPSmear() const = 0;
-
- //! Add the given parameter to the list of all fit parameters
- /*!
- \param [in] param the parameter
- \param [in] addFixed if true add the parameter even if it is not floating
- \return the number of parameters added
- */
- UInt_t addFitParameters(LauParameter* param, const Bool_t addFixed = kFALSE);
-
- //! Add the given parameter(s) to the list of all fit parameters
- /*!
- \param [in] param the parameter (which may depend on other parameters)
- \param [in] addFixed if true add the parameter even if it is not floating
- \return the number of parameters added
- */
- UInt_t addFitParameters(LauAbsRValue* param, const Bool_t addFixed = kFALSE);
-
- //! Add the given parameter(s) to the list of all fit parameters
- /*!
- \param [in] paramList a list of parameters
- \param [in] addFixed if true add the parameter even if it is not floating
- \return the number of parameters added
- */
- UInt_t addFitParameters(LauParameterPList& paramList, const Bool_t addFixed = kFALSE);
-
- //! Add the given parameter(s) to the list of all fit parameters
- /*!
- \param [in] paramList a list of parameters
- \param [in] addFixed if true add the parameter even if it is not floating
- \return the number of parameters added
- */
- UInt_t addFitParameters(LauAbsRValuePList& paramList, const Bool_t addFixed = kFALSE);
-
- //! Add parameters of the PDFs in the list to the list of all fit parameters
- /*!
- \param [in] pdfList a list of Pdfs
- \param [in] addFixed if true add the parameter even if it is not floating
- \return the number of parameters added
- */
- UInt_t addFitParameters(LauPdfPList& pdfList, const Bool_t addFixed = kFALSE);
-
- //! Add the given parameter to the list of resonance parameters and the list of all fit parameters
- /*!
- \param [in] param a resonance parameter
- \return the number of parameters added
- */
- UInt_t addResonanceParameters(LauParameter* param);
-
- //! Add the given parameter(s) to the list of resonance parameters and the list of all fit parameters
- /*!
- \param [in] parList a list of resonance parameters
- \return the number of parameters added
- */
- UInt_t addResonanceParameters(LauParameterPList& paramList);
-
- //! Add parameters to the list of Gaussian constrained parameters
- void addConParameters();
-
- //! Print the fit parameters for all PDFs in the list
- /*!
- \param [in] pdfList a list of Pdfs
- \param [in] fout the output stream to write to
- */
- void printFitParameters(const LauPdfPList& pdfList, std::ostream& fout) const;
-
- //! Update the fit parameters for all PDFs in the list
- /*!
- \param [in] pdfList a list of Pdfs
- */
- void updateFitParameters(LauPdfPList& pdfList);
-
- //! Have all PDFs in the list cache the data
- /*!
- \param [in] pdfList the list of pdfs
- \param [in] theData the data from the fit
- */
- void cacheInfo(LauPdfPList& pdfList, const LauFitDataTree& theData);
-
- //! Calculate the product of the per-event likelihoods of the PDFs in the list
- /*!
- \param [in] pdfList the list of pdfs
- \param [in] iEvt the event number
- */
- Double_t prodPdfValue(LauPdfPList& pdfList, UInt_t iEvt);
-
- //! Do any of the PDFs have a dependence on the DP?
- /*!
- \return the flag to indicated if there is a DP dependence
- */
- Bool_t pdfsDependOnDP() const {return pdfsDependOnDP_;}
-
- //! Do any of the PDFs have a dependence on the DP?
- /*!
- \param [in] dependOnDP the flag to indicated if there is a DP dependence
- */
- void pdfsDependOnDP(Bool_t dependOnDP) { pdfsDependOnDP_ = dependOnDP; }
-
- //! Const access to the fit variables
- const LauParameterPList& fitPars() const {return fitVars_;}
-
- //! Const access the fit variables which affect the DP normalisation
- const LauParameterPSet& resPars() const {return resVars_;}
-
- //! Const access the extra variables
- const LauParameterList& extraPars() const {return extraVars_;}
- //! Non-const access the extra variables
- LauParameterList& extraPars() {return extraVars_;}
-
- //! Const access the Gaussian constrained variables
- const LauAbsRValuePList& conPars() const {return conVars_;}
-
- //! Const access the gen ntuple
- const LauGenNtuple* genNtuple() const {return genNtuple_;}
- //! Access the gen ntuple
- LauGenNtuple* genNtuple() {return genNtuple_;}
-
- //! Const access the sPlot ntuple
- const LauGenNtuple* sPlotNtuple() const {return sPlotNtuple_;}
- //! Access the sPlot ntuple
- LauGenNtuple* sPlotNtuple() {return sPlotNtuple_;}
-
- //! Const access the data store
- const LauFitDataTree* fitData() const {return inputFitData_;}
- //! Access the data store
- LauFitDataTree* fitData() {return inputFitData_;}
-
- //! Imported parameters file name
- TString fixParamFileName_;
-
- //! Imported parameters tree name
- TString fixParamTreeName_;
-
- //! Map from imported parameter name to value
- std::map<TString, Double_t> fixParamMap_;
-
- //! Imported parameter names
- std::set<TString> fixParamNames_;
-
- //! Whether to fix the loaded parameters (kTRUE) or leave them floating (kFALSE)
- Bool_t fixParams_;
-
- //! The set of parameters that are imported (either from a file or by value) and not
- // set to be fixed in the fit. In addition to those from fixParamNames_, these
- // include those imported from a file.
- std::set<LauParameter*> allImportedFreeParams_;
-
- private:
- //! Copy constructor (not implemented)
- LauAbsFitModel(const LauAbsFitModel& rhs);
-
- //! Copy assignment operator (not implemented)
- LauAbsFitModel& operator=(const LauAbsFitModel& rhs);
-
- // Various control booleans
-
- //! Option to make toy from 1st successful experiment
- Bool_t compareFitData_;
- //! Option to output a .C file of PDF's
- Bool_t savePDF_;
- //! Option to output a Latex format table
- Bool_t writeLatexTable_;
- //! Option to write sPlot data
- Bool_t writeSPlotData_;
- //! Option to store DP efficiencies in the sPlot ntuple
- Bool_t storeDPEff_;
- //! Option to randomise the initial values of the fit parameters
- Bool_t randomFit_;
- //! Option to perform an extended ML fit
- Bool_t emlFit_;
- //! Option to perform Poisson smearing
- Bool_t poissonSmear_;
- //! Option to enable embedding
- Bool_t enableEmbedding_;
- //! Option to include the DP as part of the fit
- Bool_t usingDP_;
- //! Option to state if pdfs depend on DP position
- Bool_t pdfsDependOnDP_;
-
- // Info on number of experiments and number of events
-
- //! Internal vector of fit parameters
- LauParameterPList fitVars_;
-
- //! Internal set of the same fit parameters (used to check uniqueness)
- LauParameterPSet fitVarsSet_;
-
- //! Internal set of fit parameters upon which the DP normalisation depends
- LauParameterPSet resVars_;
-
- //! Extra variables that aren't in the fit but are stored in the ntuple
- LauParameterList extraVars_;
-
- //! Internal vectors of Gaussian parameters
- LauAbsRValuePList conVars_;
-
- // Input data and output ntuple
-
- //! The input data
- LauFitDataTree* inputFitData_;
- //! The generated ntuple
- LauGenNtuple* genNtuple_;
- //! The sPlot ntuple
- LauGenNtuple* sPlotNtuple_;
-
- // Background class names
-
- //! The background class names
- LauBkgndClassMap bkgndClassNames_;
- //! An empty string
- const TString nullString_;
-
- // sFit related variables
-
- //! Option to perfom the sFit
- Bool_t doSFit_;
- //! The name of the sWeight branch
- TString sWeightBranchName_;
- //! The vector of sWeights
- std::vector<Double_t> sWeights_;
- //! The sWeight scaling factor
- Double_t sWeightScaleFactor_;
-
- // Fit timers
-
- //! The fit timer
- TStopwatch timer_;
- //! The total fit timer
- TStopwatch cumulTimer_;
-
- //! The output table name
- TString outputTableName_;
-
- // Comparison toy MC related variables
-
- //! The output file name for Toy MC
- TString fitToyMCFileName_;
- //! The output table name for Toy MC
- TString fitToyMCTableName_;
- //! The scaling factor (toy vs data statistics)
- UInt_t fitToyMCScale_;
- //! Option to perform Poisson smearing
- Bool_t fitToyMCPoissonSmear_;
-
- // sPlot related variables
-
- //! The name of the sPlot file
- TString sPlotFileName_;
- //! The name of the sPlot tree
- TString sPlotTreeName_;
- //! Control the verbosity of the sFit
- TString sPlotVerbosity_;
-
- ClassDef(LauAbsFitModel,0) // Abstract interface to fit/toyMC model
+ // sFit related variables
+
+ //! Option to perfom the sFit
+ Bool_t doSFit_;
+ //! The name of the sWeight branch
+ TString sWeightBranchName_;
+ //! The vector of sWeights
+ std::vector<Double_t> sWeights_;
+ //! The sWeight scaling factor
+ Double_t sWeightScaleFactor_;
+
+ // Fit timers
+
+ //! The fit timer
+ TStopwatch timer_;
+ //! The total fit timer
+ TStopwatch cumulTimer_;
+
+ //! The output table name
+ TString outputTableName_;
+
+ // Comparison toy MC related variables
+
+ //! The output file name for Toy MC
+ TString fitToyMCFileName_;
+ //! The output table name for Toy MC
+ TString fitToyMCTableName_;
+ //! The scaling factor (toy vs data statistics)
+ UInt_t fitToyMCScale_;
+ //! Option to perform Poisson smearing
+ Bool_t fitToyMCPoissonSmear_;
+
+ // sPlot related variables
+
+ //! The name of the sPlot file
+ TString sPlotFileName_;
+ //! The name of the sPlot tree
+ TString sPlotTreeName_;
+ //! Control the verbosity of the sFit
+ TString sPlotVerbosity_;
+
+ ClassDef( LauAbsFitModel, 0 ) // Abstract interface to fit/toyMC model
};
#endif
diff --git a/inc/LauAbsFitter.hh b/inc/LauAbsFitter.hh
index 2846900..9de0c74 100644
--- a/inc/LauAbsFitter.hh
+++ b/inc/LauAbsFitter.hh
@@ -1,146 +1,145 @@
/*
Copyright 2013 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauAbsFitter.hh
\brief File containing declaration of LauAbsFitter class.
*/
/*! \class LauAbsFitter
\brief The abstract interface to the fitter.
The abstract interface to the fitter.
Concrete implementations provide the singleton interface with a particular fitter, e.g. Minuit.
*/
#ifndef LAU_ABS_FITTER
#define LAU_ABS_FITTER
#include "Rtypes.h"
#include "TMatrixDfwd.h"
#include <vector>
class LauFitObject;
class LauParameter;
-
class LauAbsFitter {
- public:
- /*!
- \struct FitStatus
- \brief Struct to store fit status information
- */
- struct FitStatus {
- //! The status code of the fit
- Int_t status;
- //! The negative log-likelihood
- Double_t NLL;
- //! The estimated distance to the minimum
- Double_t EDM;
- };
-
- //! Destructor
- virtual ~LauAbsFitter() = default;
-
- //! Initialise the fitter, setting the information on the parameters
- /*!
- \param [in] fitObj the object that controls the likelihood calculation
- \param [in] parameters the list of parameters of the fit
- */
- virtual void initialise( LauFitObject* fitObj, const std::vector<LauParameter*>& parameters ) = 0;
-
- //! Get the object that controls the calculation of the likelihood
- virtual LauFitObject* getFitObject() = 0;
-
- //! Get the total number of fit parameters
- virtual UInt_t nParameters() const = 0;
-
- //! Get the number of floating fit parameters
- virtual UInt_t nFreeParameters() const = 0;
-
- //! Determine whether the two-stage fit is enabled
- virtual Bool_t twoStageFit() const = 0;
-
- //! Turn on or off the two stage fit
- /*!
- The two-stage fit allows certain parameters to be fixed
- in one stage and floated in another stage of the fit.
- Can be used, for example, in a CP fit where the
- CP-parameters are fixed to zero in the first stage
- (while the CP-average parameters are determined), then
- floated in the second.
-
- \param [in] doTwoStageFit boolean specifying whether or not the two-stage fit should be enabled
- */
- virtual void twoStageFit(Bool_t doTwoStageFit) = 0;
-
- //! Determine whether calculation of asymmetric errors is enabled
- virtual Bool_t useAsymmFitErrors() const = 0;
-
- //! Turn on or off the computation of asymmetric errors (e.g. MINOS routine in Minuit)
- /*!
- \param [in] useAsymmErrors boolean specifying whether or not the computation of asymmetric errors is enabled
- */
- virtual void useAsymmFitErrors(Bool_t useAsymmErrors) = 0;
-
- //! Perform the minimisation of the fit function
- /*!
- \return the status code of the fit and the minimised value
- */
- virtual const FitStatus& minimise() = 0;
-
- //! Fix parameters marked as "second stage"
- virtual void fixSecondStageParameters() = 0;
-
- //! Release parameters marked as "second stage"
- virtual void releaseSecondStageParameters() = 0;
-
- //! Update the values and errors of the parameters based on the fit minimum
- virtual void updateParameters() = 0;
-
- //! Retrieve the fit covariance matrix
- virtual const TMatrixD& covarianceMatrix() const = 0;
-
- protected:
- //! Constructor
- LauAbsFitter() = default;
-
- private:
- //! Copy constructor - private and not implemented
- LauAbsFitter( const LauAbsFitter& ) = delete;
-
- //! Move constructor - private and not implemented
- LauAbsFitter( LauAbsFitter&& ) = delete;
-
- //! Copy assignment operator - private and not implemented
- LauAbsFitter& operator=( const LauAbsFitter& rhs ) = delete;
-
- //! Move assignment operator - private and not implemented
- LauAbsFitter& operator=( LauAbsFitter&& rhs ) = delete;
-
- ClassDef(LauAbsFitter,0);
+ public:
+ /*!
+ \struct FitStatus
+ \brief Struct to store fit status information
+ */
+ struct FitStatus {
+ //! The status code of the fit
+ Int_t status;
+ //! The negative log-likelihood
+ Double_t NLL;
+ //! The estimated distance to the minimum
+ Double_t EDM;
+ };
+
+ //! Destructor
+ virtual ~LauAbsFitter() = default;
+
+ //! Initialise the fitter, setting the information on the parameters
+ /*!
+ \param [in] fitObj the object that controls the likelihood calculation
+ \param [in] parameters the list of parameters of the fit
+ */
+ virtual void initialise( LauFitObject* fitObj, const std::vector<LauParameter*>& parameters ) = 0;
+
+ //! Get the object that controls the calculation of the likelihood
+ virtual LauFitObject* getFitObject() = 0;
+
+ //! Get the total number of fit parameters
+ virtual UInt_t nParameters() const = 0;
+
+ //! Get the number of floating fit parameters
+ virtual UInt_t nFreeParameters() const = 0;
+
+ //! Determine whether the two-stage fit is enabled
+ virtual Bool_t twoStageFit() const = 0;
+
+ //! Turn on or off the two stage fit
+ /*!
+ The two-stage fit allows certain parameters to be fixed
+ in one stage and floated in another stage of the fit.
+ Can be used, for example, in a CP fit where the
+ CP-parameters are fixed to zero in the first stage
+ (while the CP-average parameters are determined), then
+ floated in the second.
+
+ \param [in] doTwoStageFit boolean specifying whether or not the two-stage fit should be enabled
+ */
+ virtual void twoStageFit( Bool_t doTwoStageFit ) = 0;
+
+ //! Determine whether calculation of asymmetric errors is enabled
+ virtual Bool_t useAsymmFitErrors() const = 0;
+
+ //! Turn on or off the computation of asymmetric errors (e.g. MINOS routine in Minuit)
+ /*!
+ \param [in] useAsymmErrors boolean specifying whether or not the computation of asymmetric errors is enabled
+ */
+ virtual void useAsymmFitErrors( Bool_t useAsymmErrors ) = 0;
+
+ //! Perform the minimisation of the fit function
+ /*!
+ \return the status code of the fit and the minimised value
+ */
+ virtual const FitStatus& minimise() = 0;
+
+ //! Fix parameters marked as "second stage"
+ virtual void fixSecondStageParameters() = 0;
+
+ //! Release parameters marked as "second stage"
+ virtual void releaseSecondStageParameters() = 0;
+
+ //! Update the values and errors of the parameters based on the fit minimum
+ virtual void updateParameters() = 0;
+
+ //! Retrieve the fit covariance matrix
+ virtual const TMatrixD& covarianceMatrix() const = 0;
+
+ protected:
+ //! Constructor
+ LauAbsFitter() = default;
+
+ private:
+ //! Copy constructor - private and not implemented
+ LauAbsFitter( const LauAbsFitter& ) = delete;
+
+ //! Move constructor - private and not implemented
+ LauAbsFitter( LauAbsFitter&& ) = delete;
+
+ //! Copy assignment operator - private and not implemented
+ LauAbsFitter& operator=( const LauAbsFitter& rhs ) = delete;
+
+ //! Move assignment operator - private and not implemented
+ LauAbsFitter& operator=( LauAbsFitter&& rhs ) = delete;
+
+ ClassDef( LauAbsFitter, 0 );
};
#endif
diff --git a/inc/LauAbsIncohRes.hh b/inc/LauAbsIncohRes.hh
index 9fbc4d4..777a0bf 100644
--- a/inc/LauAbsIncohRes.hh
+++ b/inc/LauAbsIncohRes.hh
@@ -1,82 +1,83 @@
/*
Copyright 2014 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauAbsIncohRes.hh
\brief File containing declaration of LauAbsIncohRes class.
*/
/*! \class LauAbsIncohRes
\brief Abstract class for defining incoherent resonant amplitude models
*/
#ifndef LAU_ABS_INCOH_RES
#define LAU_ABS_INCOH_RES
-#include "TString.h"
-
#include "LauAbsResonance.hh"
-class LauKinematics;
+#include "TString.h"
+class LauKinematics;
class LauAbsIncohRes : public LauAbsResonance {
- public:
- //! Constructor
- /*!
- \param [in] resInfo the object containing information on the resonance name, mass, width, spin, charge, etc.
- \param [in] resPairAmpInt the number of the daughter not produced by the resonance
- \param [in] daughters the daughter particles
- */
- LauAbsIncohRes(LauResonanceInfo* resInfo, const Int_t resPairAmpInt, const LauDaughters* daughters);
-
- //! Destructor
- virtual ~LauAbsIncohRes();
-
- //! Get intensity factor
- /*!
- /param [in] kinematics kinematic parameters of the parent and daughter particles
- /return the intensity factor
- */
- virtual Double_t intensityFactor(const LauKinematics* kinematics)=0;
-
- protected:
- //! Complex resonant amplitude
- /*!
- \param [in] mass appropriate invariant mass for the resonance
- \param [in] spinTerm spin term
- */
- virtual LauComplex resAmp(Double_t mass, Double_t spinTerm);
-
- private:
- //! Copy constructor (not implemented)
- LauAbsIncohRes(const LauAbsIncohRes& rhs);
-
- //! Copy assignment operator (not implemented)
- LauAbsIncohRes& operator=(const LauAbsIncohRes& rhs);
-
- ClassDef(LauAbsIncohRes,0) // Abstract incoherent resonance class
+ public:
+ //! Constructor
+ /*!
+ \param [in] resInfo the object containing information on the resonance name, mass, width, spin, charge, etc.
+ \param [in] resPairAmpInt the number of the daughter not produced by the resonance
+ \param [in] daughters the daughter particles
+ */
+ LauAbsIncohRes( LauResonanceInfo* resInfo,
+ const Int_t resPairAmpInt,
+ const LauDaughters* daughters );
+
+ //! Destructor
+ virtual ~LauAbsIncohRes();
+
+ //! Get intensity factor
+ /*!
+ \param [in] kinematics kinematic parameters of the parent and daughter particles
+ \return the intensity factor
+ */
+ virtual Double_t intensityFactor( const LauKinematics* kinematics ) = 0;
+
+ protected:
+ //! Complex resonant amplitude
+ /*!
+ \param [in] mass appropriate invariant mass for the resonance
+ \param [in] spinTerm spin term
+ */
+ virtual LauComplex resAmp( Double_t mass, Double_t spinTerm );
+
+ private:
+ //! Copy constructor (not implemented)
+ LauAbsIncohRes( const LauAbsIncohRes& rhs );
+
+ //! Copy assignment operator (not implemented)
+ LauAbsIncohRes& operator=( const LauAbsIncohRes& rhs );
+
+ ClassDef( LauAbsIncohRes, 0 ) // Abstract incoherent resonance class
};
#endif
diff --git a/inc/LauAbsModIndPartWave.hh b/inc/LauAbsModIndPartWave.hh
index ead918f..9e5c724 100644
--- a/inc/LauAbsModIndPartWave.hh
+++ b/inc/LauAbsModIndPartWave.hh
@@ -1,249 +1,255 @@
/*
Copyright 2014 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauAbsModIndPartWave.hh
\brief File containing declaration of LauAbsModIndPartWave class.
- */
+*/
/*! \class LauAbsModIndPartWave
\brief Abstract base class for defining a model independent partial wave component
Abstract base class for defining a model independent partial wave component.
This model uses splines to produce a partial wave from two sets of real numbers that represent the amplitude at a series of points in the phase space.
These real numbers at each point can be floated in the fit.
Classes inheriting from this define whether these real numbers are e.g. the magnitude and phase or e.g. the real and imaginary part of the amplitude.
- */
+*/
#ifndef LAU_ABSMODINDPARTWAVE
#define LAU_ABSMODINDPARTWAVE
-#include <set>
-
-#include "LauComplex.hh"
-#include "LauAbsResonance.hh"
#include "Lau1DCubicSpline.hh"
+#include "LauAbsResonance.hh"
+#include "LauComplex.hh"
+#include <set>
class LauAbsModIndPartWave : public LauAbsResonance {
- public:
- //! Constructor
- /*!
- \param [in] resInfo the object containing information on the resonance name, mass, width, spin, charge, etc.
- \param [in] resPairAmpInt the number of the daughter not produced by the resonance
- \param [in] daughters the daughter particles
- */
- LauAbsModIndPartWave(LauResonanceInfo* resInfo, Int_t resPairAmpInt, const LauDaughters* daughters);
-
- //! Destructor
- virtual ~LauAbsModIndPartWave();
-
- //! Initialise the model
- virtual void initialise();
-
- //! Define the knot positions
- /*!
- If absent from the set provided, knots are added automatically at the upper and lower kinematic limits
-
- \param [in] masses the mass values at which the knots are placed
- */
- void defineKnots(const std::set<Double_t>& masses);
-
- //! Return the number of knots that have been defined (including those at the upper and lower kinematic limits)
- /*!
- \return the number of knots
- */
- UInt_t nKnots() const { return nKnots_; }
-
- //! Set the values of the two real parameters that define the amplitude at a given knot
- /*!
- \param [in] knot the knot to be updated
- \param [in] ampVal1 the value of first real parameter representing the amplitude at the knot
- \param [in] ampVal2 the value of second real parameter representing the amplitude at the knot
- \param [in] fixAmpVal1 whether the first real parameter should be fixed
- \param [in] fixAmpVal2 whether the second real parameter should be fixed
- */
- virtual void setKnotAmp(const UInt_t knot, const Double_t ampVal1, const Double_t ampVal2, const Bool_t fixAmpVal1, const Bool_t fixAmpVal2) = 0;
-
- //! Set whether the parameters should be floated only in the second-stage of a two-stage fit
- /*!
- By default, the parameters describing the amplitude at each
- knot will float from the outset of a fit.
- If, however, a good estimate of these is already known, it
- can be more efficient to initially fix them and then to
- float them only in a second stage (as is done for other
- resonance lineshape parameters).
- This function allows the toggling of this behaviour.
-
- \param secondStage whether the parameters should float only in the second stage
- */
- void floatKnotsSecondStage(const Bool_t secondStage);
-
- //! Retrieve the value of the second stage flag
- Bool_t floatKnotsSecondStage() const {return secondStage_;};
-
- //! Retrieve the resonance parameters, e.g. so that they can be loaded into a fit
- /*!
- \return floating parameters of the resonance
- */
- virtual const std::vector<LauParameter*>& getFloatingParameters();
-
- protected:
- //! Complex resonant amplitude
- /*!
- \param [in] mass appropriate invariant mass for the resonance
- \param [in] spinTerm spin term
- */
- virtual LauComplex resAmp(Double_t mass, Double_t spinTerm);
-
- //! Evaluate the amplitude at the given point from the splines
- /*!
- \param [in] mass appropriate invariant mass for the resonance
- */
- virtual void evaluateAmplitude(const Double_t mass) = 0;
-
- //! Method to check that the supplied knot positions are valid
- /*!
- \param [in] masses the mass values at which the knots are placed
- */
- virtual std::set<Double_t> checkKnots(const std::set<Double_t>& masses);
-
- //! Method to create the parameter objects for the given knot
- /*!
- \param [in] iKnot the index of the knot
- */
- virtual void createAmpParameters(const UInt_t iKnot) = 0;
-
- //! Method to set the type of interpolation used for the splines
- /*!
- \param [in] type1 the type of interpolation for the first spline
- \param [in] type2 the type of interpolation for the second spline
- */
- void setSplineType(Lau1DCubicSpline::LauSplineType type1, Lau1DCubicSpline::LauSplineType type2);
-
- //! Method to set the boundary conditions of the splines
- /*!
- \param [in] leftBound1 the type of boundary condition for the left edge of the first spline
- \param [in] rightBound1 the type of boundary condition for the right edge of the first spline
- \param [in] leftBound2 the type of boundary condition for the left edge of the second spline
- \param [in] rightBound2 the type of boundary condition for the right edge of the second spline
- \param [in] leftGrad1 the gradient at the left edge of the first spline if clamped
- \param [in] rightGrad1 the gradient at the right edge of the first spline if clamped
- \param [in] leftGrad2 the gradient at the left edge of the second spline if clamped
- \param [in] rightGrad2 the gradient at the right edge of the second spline if clamped
- */
- void setSplineBoundaryConditions(Lau1DCubicSpline::LauSplineBoundaryType leftBound1,
- Lau1DCubicSpline::LauSplineBoundaryType rightBound1,
- Lau1DCubicSpline::LauSplineBoundaryType leftBound2,
- Lau1DCubicSpline::LauSplineBoundaryType rightBound2,
- Double_t leftGrad1 = 0.0, Double_t rightGrad1 = 0.0,
- Double_t leftGrad2 = 0.0, Double_t rightGrad2 = 0.0);
-
- //! Helper function to set the current amplitude value
- /*!
- \param [in] realPart the real part of the amplitude
- \param [in] imagPart the imaginary part of the amplitude
- */
- void setAmp(const Double_t realPart, const Double_t imagPart)
- {
- amp_.setRealImagPart(realPart,imagPart);
- }
-
- //! Helper function to access the masses
- const std::vector<Double_t>& getMasses() {return masses_;}
-
- //! Helper function to access the 1st parameter set
- std::vector<Double_t>& getAmp1Vals() {return amp1Vals_;}
-
- //! Helper function to access the 2nd parameter set
- std::vector<Double_t>& getAmp2Vals() {return amp2Vals_;}
-
- //! Helper function to access the 1st parameter set
- std::vector<LauParameter*>& getAmp1Pars() {return amp1Pars_;}
-
- //! Helper function to access the 2nd parameter set
- std::vector<LauParameter*>& getAmp2Pars() {return amp2Pars_;}
-
- //! Helper function to access the 1st spline
- const Lau1DCubicSpline* getSpline1() const {return spline1_;}
-
- //! Helper function to access the 1st spline
- const Lau1DCubicSpline* getSpline2() const {return spline2_;}
-
- private:
- //! The number of knots
- UInt_t nKnots_;
-
- //! The masses at which knots are defined in the magnitude and phase splines
- std::vector<Double_t> masses_;
-
- //! The values of the first real parameter at each knot
- std::vector<Double_t> amp1Vals_;
- //! The values of the second real parameter at each knot
- std::vector<Double_t> amp2Vals_;
-
- //! The parameters for the first real value at the knots
- std::vector<LauParameter*> amp1Pars_;
- //! The parameters for the second real value at the knots
- std::vector<LauParameter*> amp2Pars_;
-
- //! The spline used to interpolate the values of the first real parameter
- Lau1DCubicSpline* spline1_;
- //! The spline used to interpolate the values of the second real parameter
- Lau1DCubicSpline* spline2_;
-
- //! The type of interpolation used for the first spline
- Lau1DCubicSpline::LauSplineType type1_;
- //! The type of interpolation used for the second spline
- Lau1DCubicSpline::LauSplineType type2_;
-
- //! The lower boundary condition type for the first spline
- Lau1DCubicSpline::LauSplineBoundaryType leftBound1_;
- //! The upper boundary condition type for the first spline
- Lau1DCubicSpline::LauSplineBoundaryType rightBound1_;
- //! The lower boundary condition type for the second spline
- Lau1DCubicSpline::LauSplineBoundaryType leftBound2_;
- //! The upper boundary condition type for the second spline
- Lau1DCubicSpline::LauSplineBoundaryType rightBound2_;
-
- //! The gradient at the left boundary for the first spline if clamped
- Double_t leftGrad1_;
- //! The gradient at the right boundary for the first spline if clamped
- Double_t rightGrad1_;
- //! The gradient at the left boundary for the second spline if clamped
- Double_t leftGrad2_;
- //! The gradient at the right boundary for the second spline if clamped
- Double_t rightGrad2_;
-
- //! Flag to determine if the parameters should be floated only in the second stage of the fit
- Bool_t secondStage_;
-
- //! The current value of the amplitude
- LauComplex amp_;
-
- ClassDef(LauAbsModIndPartWave,0) // model independent partial wave
-
+ public:
+ //! Constructor
+ /*!
+ \param [in] resInfo the object containing information on the resonance name, mass, width, spin, charge, etc.
+ \param [in] resPairAmpInt the number of the daughter not produced by the resonance
+ \param [in] daughters the daughter particles
+ */
+ LauAbsModIndPartWave( LauResonanceInfo* resInfo,
+ Int_t resPairAmpInt,
+ const LauDaughters* daughters );
+
+ //! Destructor
+ virtual ~LauAbsModIndPartWave();
+
+ //! Initialise the model
+ virtual void initialise();
+
+ //! Define the knot positions
+ /*!
+ If absent from the set provided, knots are added automatically at the upper and lower kinematic limits
+
+ \param [in] masses the mass values at which the knots are placed
+ */
+ void defineKnots( const std::set<Double_t>& masses );
+
+ //! Return the number of knots that have been defined (including those at the upper and lower kinematic limits)
+ /*!
+ \return the number of knots
+ */
+ UInt_t nKnots() const { return nKnots_; }
+
+ //! Set the values of the two real parameters that define the amplitude at a given knot
+ /*!
+ \param [in] knot the knot to be updated
+ \param [in] ampVal1 the value of first real parameter representing the amplitude at the knot
+ \param [in] ampVal2 the value of second real parameter representing the amplitude at the knot
+ \param [in] fixAmpVal1 whether the first real parameter should be fixed
+ \param [in] fixAmpVal2 whether the second real parameter should be fixed
+ */
+ virtual void setKnotAmp( const UInt_t knot,
+ const Double_t ampVal1,
+ const Double_t ampVal2,
+ const Bool_t fixAmpVal1,
+ const Bool_t fixAmpVal2 ) = 0;
+
+ //! Set whether the parameters should be floated only in the second-stage of a two-stage fit
+ /*!
+ By default, the parameters describing the amplitude at each
+ knot will float from the outset of a fit.
+ If, however, a good estimate of these is already known, it
+ can be more efficient to initially fix them and then to
+ float them only in a second stage (as is done for other
+ resonance lineshape parameters).
+ This function allows the toggling of this behaviour.
+
+ \param secondStage whether the parameters should float only in the second stage
+ */
+ void floatKnotsSecondStage( const Bool_t secondStage );
+
+ //! Retrieve the value of the second stage flag
+ Bool_t floatKnotsSecondStage() const { return secondStage_; };
+
+ //! Retrieve the resonance parameters, e.g. so that they can be loaded into a fit
+ /*!
+ \return floating parameters of the resonance
+ */
+ virtual const std::vector<LauParameter*>& getFloatingParameters();
+
+ protected:
+ //! Complex resonant amplitude
+ /*!
+ \param [in] mass appropriate invariant mass for the resonance
+ \param [in] spinTerm spin term
+ */
+ virtual LauComplex resAmp( Double_t mass, Double_t spinTerm );
+
+ //! Evaluate the amplitude at the given point from the splines
+ /*!
+ \param [in] mass appropriate invariant mass for the resonance
+ */
+ virtual void evaluateAmplitude( const Double_t mass ) = 0;
+
+ //! Method to check that the supplied knot positions are valid
+ /*!
+ \param [in] masses the mass values at which the knots are placed
+ */
+ virtual std::set<Double_t> checkKnots( const std::set<Double_t>& masses );
+
+ //! Method to create the parameter objects for the given knot
+ /*!
+ \param [in] iKnot the index of the knot
+ */
+ virtual void createAmpParameters( const UInt_t iKnot ) = 0;
+
+ //! Method to set the type of interpolation used for the splines
+ /*!
+ \param [in] type1 the type of interpolation for the first spline
+ \param [in] type2 the type of interpolation for the second spline
+ */
+ void setSplineType( Lau1DCubicSpline::LauSplineType type1, Lau1DCubicSpline::LauSplineType type2 );
+
+ //! Method to set the boundary conditions of the splines
+ /*!
+ \param [in] leftBound1 the type of boundary condition for the left edge of the first spline
+ \param [in] rightBound1 the type of boundary condition for the right edge of the first spline
+ \param [in] leftBound2 the type of boundary condition for the left edge of the second spline
+ \param [in] rightBound2 the type of boundary condition for the right edge of the second spline
+ \param [in] leftGrad1 the gradient at the left edge of the first spline if clamped
+ \param [in] rightGrad1 the gradient at the right edge of the first spline if clamped
+ \param [in] leftGrad2 the gradient at the left edge of the second spline if clamped
+ \param [in] rightGrad2 the gradient at the right edge of the second spline if clamped
+ */
+ void setSplineBoundaryConditions( Lau1DCubicSpline::LauSplineBoundaryType leftBound1,
+ Lau1DCubicSpline::LauSplineBoundaryType rightBound1,
+ Lau1DCubicSpline::LauSplineBoundaryType leftBound2,
+ Lau1DCubicSpline::LauSplineBoundaryType rightBound2,
+ Double_t leftGrad1 = 0.0,
+ Double_t rightGrad1 = 0.0,
+ Double_t leftGrad2 = 0.0,
+ Double_t rightGrad2 = 0.0 );
+
+ //! Helper function to set the current amplitude value
+ /*!
+ \param [in] realPart the real part of the amplitude
+ \param [in] imagPart the imaginary part of the amplitude
+ */
+ void setAmp( const Double_t realPart, const Double_t imagPart )
+ {
+ amp_.setRealImagPart( realPart, imagPart );
+ }
+
+ //! Helper function to access the masses
+ const std::vector<Double_t>& getMasses() { return masses_; }
+
+ //! Helper function to access the 1st parameter set
+ std::vector<Double_t>& getAmp1Vals() { return amp1Vals_; }
+
+ //! Helper function to access the 2nd parameter set
+ std::vector<Double_t>& getAmp2Vals() { return amp2Vals_; }
+
+ //! Helper function to access the 1st parameter set
+ std::vector<LauParameter*>& getAmp1Pars() { return amp1Pars_; }
+
+ //! Helper function to access the 2nd parameter set
+ std::vector<LauParameter*>& getAmp2Pars() { return amp2Pars_; }
+
+ //! Helper function to access the 1st spline
+ const Lau1DCubicSpline* getSpline1() const { return spline1_; }
+
+ //! Helper function to access the 1st spline
+ const Lau1DCubicSpline* getSpline2() const { return spline2_; }
+
+ private:
+ //! The number of knots
+ UInt_t nKnots_;
+
+ //! The masses at which knots are defined in the magnitude and phase splines
+ std::vector<Double_t> masses_;
+
+ //! The values of the first real parameter at each knot
+ std::vector<Double_t> amp1Vals_;
+ //! The values of the second real parameter at each knot
+ std::vector<Double_t> amp2Vals_;
+
+ //! The parameters for the first real value at the knots
+ std::vector<LauParameter*> amp1Pars_;
+ //! The parameters for the second real value at the knots
+ std::vector<LauParameter*> amp2Pars_;
+
+ //! The spline used to interpolate the values of the first real parameter
+ Lau1DCubicSpline* spline1_;
+ //! The spline used to interpolate the values of the second real parameter
+ Lau1DCubicSpline* spline2_;
+
+ //! The type of interpolation used for the first spline
+ Lau1DCubicSpline::LauSplineType type1_;
+ //! The type of interpolation used for the second spline
+ Lau1DCubicSpline::LauSplineType type2_;
+
+ //! The lower boundary condition type for the first spline
+ Lau1DCubicSpline::LauSplineBoundaryType leftBound1_;
+ //! The upper boundary condition type for the first spline
+ Lau1DCubicSpline::LauSplineBoundaryType rightBound1_;
+ //! The lower boundary condition type for the second spline
+ Lau1DCubicSpline::LauSplineBoundaryType leftBound2_;
+ //! The upper boundary condition type for the second spline
+ Lau1DCubicSpline::LauSplineBoundaryType rightBound2_;
+
+ //! The gradient at the left boundary for the first spline if clamped
+ Double_t leftGrad1_;
+ //! The gradient at the right boundary for the first spline if clamped
+ Double_t rightGrad1_;
+ //! The gradient at the left boundary for the second spline if clamped
+ Double_t leftGrad2_;
+ //! The gradient at the right boundary for the second spline if clamped
+ Double_t rightGrad2_;
+
+ //! Flag to determine if the parameters should be floated only in the second stage of the fit
+ Bool_t secondStage_;
+
+ //! The current value of the amplitude
+ LauComplex amp_;
+
+ ClassDef( LauAbsModIndPartWave, 0 ) // model independent partial wave
};
#endif
diff --git a/inc/LauAbsPdf.hh b/inc/LauAbsPdf.hh
index c05ae51..bf4f7f0 100644
--- a/inc/LauAbsPdf.hh
+++ b/inc/LauAbsPdf.hh
@@ -1,552 +1,563 @@
/*
Copyright 2004 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauAbsPdf.hh
\brief File containing declaration of LauAbsPdf class.
*/
/*! \class LauAbsPdf
\brief Class for defining the abstract interface for PDF classes.
Class for defining the abstract interface for PDF classes.
Much common code is implemented but the following three methods are not:
evaluatePDF, calcNorm, calcPDFHeight
*/
#ifndef LAU_ABS_PDF
#define LAU_ABS_PDF
-#include <map>
-#include <vector>
+#include "LauAbsRValue.hh"
+#include "LauFitDataTree.hh"
+#include "LauParamFixed.hh"
+#include "LauParameter.hh"
#include "Rtypes.h"
#include "TRandom.h"
#include "TString.h"
-#include "LauFitDataTree.hh"
-#include "LauAbsRValue.hh"
-#include "LauParameter.hh"
-#include "LauParamFixed.hh"
+#include <map>
+#include <vector>
class LauKinematics;
-
class LauAbsPdf {
- public:
- //! The type used for containing multiple abscissa values.
- typedef std::vector<Double_t> LauAbscissas;
-
- //! The possible numerical intergration methods.
- enum IntMethod {
- GaussLegendre, /*!< Gauss-Legendre integration */
- Trapezoid /*!< Simple trapezoid integration */
- };
-
- //! Constructor for a 1D PDF
- /*!
- \param [in] theVarName the name of the abscissa variable
- \param [in] params the parameters of the PDF
- \param [in] minAbscissa the minimum value of the abscissa
- \param [in] maxAbscissa the maximum value of the abscissa
- */
- LauAbsPdf(const TString& theVarName, const std::vector<LauAbsRValue*>& params,
- Double_t minAbscissa, Double_t maxAbscissa);
-
- //! Constructor for a multidimensional PDF
- /*!
- \param [in] theVarNames the names of the abscissa variables
- \param [in] params the parameters of the PDF
- \param [in] minAbscissas the minimum values of the abscissas
- \param [in] maxAbscissas the maximum values of the abscissas
- */
- LauAbsPdf(const std::vector<TString>& theVarNames, const std::vector<LauAbsRValue*>& params,
- const LauFitData& minAbscissas, const LauFitData& maxAbscissas);
-
- //! Destructor
- virtual ~LauAbsPdf() {}
-
- //! Retrieve the name of the abscissa
- /*!
- \return the abscissa's name
- */
- virtual const TString& varName() const {return varNames_.find(0)->second;}
-
- //! Retrieve the names of the abscissas
- /*!
- \return the abscissas' names
- */
- virtual std::vector<TString> varNames() const;
-
- //! Retrieve the number of PDF parameters
- /*!
- \return the number of PDF parameters
- */
- virtual UInt_t nParameters() const {return param_.size();}
-
- //! Retrieve the number of fixed PDF parameters
- /*!
- \return the number of fixed PDF parameters
- */
- virtual UInt_t nFixedParameters() const;
-
- //! Retrieve the number of abscissas
- /*!
- \return the number of abscissas
- */
- virtual UInt_t nInputVars() const {return varNames_.size();}
-
- //! Specifies whether or not the PDF is DP dependent.
- /*!
- DP-dependent PDFs should override this method.
- \return true if the PDF is DP-dependent, false otherwise (the default)
- */
- virtual Bool_t isDPDependent() const {return kFALSE;}
-
- //! Retrieve the minimum value of the (primary) abscissa
- /*!
- \return the minimum value of the (primary) abscissa
- */
- virtual Double_t getMinAbscissa() const {return minAbscissas_.front();}
-
- //! Retrieve the maximum value of the (primary) abscissa
- /*!
- \return the maximum value of the (primary) abscissa
- */
- virtual Double_t getMaxAbscissa() const {return maxAbscissas_.front();}
-
- //! Retrieve the range of the (primary) abscissa
- /*!
- \return the range of the (primary) abscissa
- */
- virtual Double_t getRange() const {return this->getMaxAbscissa() - this->getMinAbscissa();}
-
- //! Retrieve the minimum value of the specified abscissa
- /*!
- \param [in] theVarName the name of the abscissa
- \return the minimum value of the specified abscissa
- */
- virtual Double_t getMinAbscissa( const TString& theVarName ) const;
-
- //! Retrieve the maximum value of the specified abscissa
- /*!
- \param [in] theVarName the name of the abscissa
- \return the maximum value of the specified abscissa
- */
- virtual Double_t getMaxAbscissa( const TString& theVarName ) const;
-
- //! Retrieve the range of the specified abscissa
- /*!
- \param [in] theVarName the name of the abscissa
- \return the range of the specified abscissa
- */
- virtual Double_t getRange( const TString& theVarName ) const {return this->getMaxAbscissa(theVarName) - this->getMinAbscissa(theVarName);}
-
- //! Retrieve the minimum values of all the abscissas
- /*!
- \return the minimum values of the abscissas
- */
- virtual LauFitData getMinAbscissas() const;
-
- //! Retrieve the maximum values of all the abscissas
- /*!
- \return the maximum values of the abscissas
- */
- virtual LauFitData getMaxAbscissas() const;
-
- //! Retrieve the ranges of all the abscissas
- /*!
- \return the ranges of the abscissas
- */
- virtual LauFitData getRanges() const;
-
- //! Update the pulls for all parameters
- virtual void updatePulls();
-
- //! Cache information from data
- /*!
- Will cache, for every event, the abscissa values and, if all parameters are fixed, the PDF value.
- \param [in] inputData the data to be used to calculate everything
- */
- virtual void cacheInfo(const LauFitDataTree& inputData);
-
- //! Calculate the likelihood (and all associated information) given value(s) of the abscissa(s)
- /*!
- \param [in] abscissas the value(s) of the abscissa(s)
- */
- virtual void calcLikelihoodInfo(const LauAbscissas& abscissas) = 0;
-
- //! Retrieve the likelihood (and all associated information) given the event number
- /*!
- \param [in] iEvt the event number
- */
- virtual void calcLikelihoodInfo(UInt_t iEvt);
-
- //! Retrieve the unnormalised likelihood value
- /*!
- \return the unnormalised likelihood value
- */
- virtual Double_t getUnNormLikelihood() const {return unNormPDFVal_;}
-
- //! Retrieve the normalisation factor
- /*!
- \return the normalisation factor
- */
- virtual Double_t getNorm() const {return norm_;}
-
- //! Retrieve the normalised likelihood value
- /*!
- \return the normalised likelihood value
- */
- virtual Double_t getLikelihood() const;
-
- //! For multidimentional PDFs, retrieve the normalised likelihood value of a named variable
- /*!
- Defaults to simply returning the complete likelihood. Should be overridden by multidimensional PDFs.
- \return the normalised likelihood value of the named variable
- */
- virtual Double_t getLikelihood( const TString& theVarName ) const;
-
- //! Retrieve the maximum height
- /*!
- \return the maximum height
- */
- virtual Double_t getMaxHeight() const {return maxHeight_;}
-
- //! Generate an event from the PDF
- /*!
- \param [in] kinematics used by some PDFs to determine the DP position, on which they have dependence
- */
- virtual LauFitData generate(const LauKinematics* kinematics);
-
- //! Set the random function used for toy MC generation
- /*!
- \param [in] randomFun the random function to be used
- */
- virtual void setRandomFun(TRandom* randomFun) {randomFun_ = randomFun;}
-
- //! Retrieve the parameters of the PDF, e.g. so that they can be loaded into a fit
- /*!
- \return the parameters of the PDF
- */
- virtual const std::vector<LauAbsRValue*>& getParameters() const { return param_; }
-
- //! Retrieve the parameters of the PDF, e.g. so that they can be loaded into a fit
- /*!
- \return the parameters of the PDF
- */
- virtual std::vector<LauAbsRValue*>& getParameters() { return param_; }
-
- //! Calculate the normalisation factor of the PDF
- /*!
- By default uses numerical integration.
- PDFs with analytical integrals should override this method.
- */
- virtual void calcNorm();
-
- //! Calculate the maximum height of the PDF
- /*!
- \param [in] kinematics used by some PDFs to determine the DP position, on which they have dependence
- */
- virtual void calcPDFHeight( const LauKinematics* kinematics ) = 0;
-
- //! Check if the maximum height of the PDF is up to date
- /*!
- \return true if the maximum height is up to date
- */
- virtual Bool_t heightUpToDate() const {return heightUpToDate_;}
-
- //! Set whether the height is up to date
- /*!
- \param [in] hutd whether the height is up to date
- */
- virtual void heightUpToDate(Bool_t hutd) {heightUpToDate_ = hutd;}
-
- //! Check if the PDF is to be cached
- /*!
- \return true if the PDF is to be cached
- */
- virtual Bool_t cachePDF() const {return cachePDF_;}
-
- //! Retrieve the number of points to integrate over when normalising
- /*!
- \return the number of points to integrate over when normalising
- */
- virtual Int_t nNormPoints() const {return nNormPoints_;}
-
- //! Set the number of points to integrate over when normalising
- /*!
- \param [in] nPoints the number of points
- */
- virtual void nNormPoints(Int_t nPoints) {nNormPoints_ = nPoints;}
-
- //! Retrieve the integration method used to normalise the PDF
- /*!
- \return the integration method used to normalise the PDF
- */
- virtual IntMethod integMethod() const {return integMethod_;}
-
- //! Set the integration method used to normalise the PDF
- /*!
- \param [in] method the integration method to be used
- */
- virtual void integMethod(IntMethod method) {integMethod_ = method;}
-
- protected:
- //! Set whether the PDF is to be cached
- /*!
- \param [in] doCachePDF whether the PDF is to be cached
- */
- virtual void cachePDF( Bool_t doCachePDF ) {cachePDF_ = doCachePDF;}
-
- //! Integrate the PDF using the Gauss-Legendre method
- /*!
- \return the integral of the PDF
- */
- virtual Double_t integrGaussLegendre();
-
- //! Integrate the PDF using the simple trapezoid method
- /*!
- \return the integral of the PDF
- */
- virtual Double_t integTrapezoid();
-
- //! Set the normalisation factor
- /*!
- \param [in] norm the normalisation factor
- */
- virtual void setNorm(Double_t norm) {norm_ = norm;}
-
- //! Set the maximum height
- /*!
- \param [in] maxHeight the new maximum height
- */
- virtual void setMaxHeight(Double_t maxHeight) {
- maxHeight_ = maxHeight;
- this->heightUpToDate(kTRUE);
- }
-
- //! Set the minimum value of the specified abscissa
- /*!
- \param [in] theVarName the name of the abscissa
- \param [in] minAbscissa value to set as minimum
- */
- virtual void setMinAbscissa(const TString& theVarName, Double_t minAbscissa);
-
- //! Set the maximum value of the specified abscissa
- /*!
- \param [in] theVarName the name of the abscissa
- \param [in] maxAbscissa value to set as maximum
- */
- virtual void setMaxAbscissa(const TString& theVarName, Double_t maxAbscissa);
-
- //! Set the range of the specified abscissa
- /*!
- \param [in] theVarName the name of the abscissa
- \param [in] minAbscissa value to set as minimum
- \param [in] maxAbscissa value to set as maximum
- */
- virtual void setRange(const TString& theVarName, Double_t minAbscissa, Double_t maxAbscissa) {
- this->setMinAbscissa(theVarName, minAbscissa);
- this->setMaxAbscissa(theVarName, maxAbscissa);
- }
-
- //! Check that all abscissas are within their allowed ranges
- /*!
- \param [in] abscissas the value(s) of the abscissa(s)
- \return true if all abscissas are within their allowed ranges
- */
- virtual Bool_t checkRange(const LauAbscissas& abscissas) const;
-
- //! Set the unnormalised likelihood
- virtual void setUnNormPDFVal(Double_t unNormPDFVal) {unNormPDFVal_ = unNormPDFVal;}
-
- //! Retrieve the specified parameter
- /*!
- \param [in] parName the parameter to retrieve
- */
- virtual LauAbsRValue* findParameter(const TString& parName);
-
- //! Retrieve the specified parameter
- /*!
- \param [in] parName the parameter to retrieve
- */
- virtual const LauAbsRValue* findParameter(const TString& parName) const;
-
- //! Retrieve the random function used for MC generation
- /*!
- \return the random function used for MC generation
- */
- virtual TRandom* getRandomFun() const {return randomFun_;}
-
- //! Retrieve the abscissa(s)
- /*!
- \return the abscissa(s)
- */
- virtual std::vector<LauAbscissas>& getAbscissas() {return abscissas_;}
-
- //! Retrieve the abscissa(s)
- /*!
- \return the abscissa(s)
- */
- virtual const std::vector<LauAbscissas>& getAbscissas() const {return abscissas_;}
-
- //! Retrieve the cached unnormalised likelihood values
- /*!
- \return the cached unnormalised likelihood values
- */
- virtual std::vector<Double_t>& getUnNormPDFValues() {return unNormPDFValues_;}
-
- //! Retrieve the cached unnormalised likelihood values
- /*!
- \return the cached unnormalised likelihood values
- */
- virtual const std::vector<Double_t>& getUnNormPDFValues() const {return unNormPDFValues_;}
-
- //! Add parameters to the PDF
- /*!
- \param [in] params the parameters to add
- */
- virtual void addParameters(std::vector<LauAbsRValue*>& params);
-
- //! Check whether the calcNorm method is running
- /*!
- \return true if the calcNorm method is running
- */
- virtual Bool_t withinNormCalc() const {return withinNormCalc_;}
-
- //! Set flag to track whether the calcNorm method is running
- /*!
- \param [in] yorn whether the calcNorm method is running
- */
- virtual void withinNormCalc(Bool_t yorn) {withinNormCalc_ = yorn;}
-
- //! Check whether the generate method is running
- /*!
- \return true if the generate method is running
- */
- virtual Bool_t withinGeneration() const {return withinGeneration_;}
-
- //! Set flag to track whether the generate method is running
- /*!
- \param [in] yorn whether the generate method is running
- */
- virtual void withinGeneration(Bool_t yorn) {withinGeneration_ = yorn;}
-
- //! Check whether the normalisation weights have been calculated
- /*!
- \return true if the normalisation weights have been calculated
- */
- virtual Bool_t normWeightsDone() const {return normWeightsDone_;}
-
- //! Set whether the normalisation weights have been calculated
- /*!
- \param [in] yorn whether the normalisation weights have been calculated
- */
- virtual void normWeightsDone(Bool_t yorn) {normWeightsDone_ = yorn;}
-
- //! Calculate the weights and abscissas used for normalisation
- virtual void getNormWeights();
-
- //! Retrieve the abscissa points used for normalisation
- /*!
- \return the abscissa points used for normalisation
- */
- virtual const std::vector<LauAbscissas>& normAbscissas() const {return normAbscissas_;}
-
- //! Retrieve the weights used for normalisation
- /*!
- \return the weights used for normalisation
- */
- virtual const std::vector<Double_t>& normWeights() const {return normWeights_;}
-
- private:
- //! Copy constructor (not implemented)
- LauAbsPdf(const LauAbsPdf& rhs);
-
- //! Copy assignment operator (not implemented)
- LauAbsPdf& operator=(const LauAbsPdf& rhs);
-
- //! The names of the PDF variables
- std::map<UInt_t,TString> varNames_;
-
- //! The parameters of the PDF (if any)
- std::vector<LauAbsRValue*> param_;
-
- //! Normalisation factor of the PDF
- Double_t norm_;
-
- //! Maximum height of the PDF
- Double_t maxHeight_;
-
- //! Track whether the height is up to date
- Bool_t heightUpToDate_;
-
- //! The minimum value(s) of the abscissa(s)
- LauAbscissas minAbscissas_;
-
- //! The maximum value(s) of the abscissa(s)
- LauAbscissas maxAbscissas_;
-
- //! The random function used for MC generation
- TRandom* randomFun_;
-
- //! Cached values of the abscissas
- std::vector<LauAbscissas> abscissas_;
-
- //! Cached unnormalised likelihood values
- std::vector<Double_t> unNormPDFValues_;
-
- //! Whether the unnormalised PDF values are cached
- /*! They are only cached if all parameters are fixed. */
- Bool_t cachePDF_;
-
- //! The unnormalised liklihood value
- Double_t unNormPDFVal_;
-
- //! number of points to integrate over when normalising
- Int_t nNormPoints_;
-
- //! The integration method used for normalising the PDF
- IntMethod integMethod_;
-
- //! Flag to keep track of whether the calcNorm method is running
- Bool_t withinNormCalc_;
-
- //! Flag to keep track of whether the generate method is running
- Bool_t withinGeneration_;
-
- //! Whether the normalisation weights have been calculated
- Bool_t normWeightsDone_;
-
- //! The normalisation abscissas
- std::vector<LauAbscissas> normAbscissas_;
-
- //! The normalisation weights
- std::vector<Double_t> normWeights_;
-
- ClassDef(LauAbsPdf,0) // Define the abstract PDF class
+ public:
+ //! The type used for containing multiple abscissa values.
+ typedef std::vector<Double_t> LauAbscissas;
+
+ //! The possible numerical intergration methods.
+ enum IntMethod {
+ GaussLegendre, /*!< Gauss-Legendre integration */
+ Trapezoid /*!< Simple trapezoid integration */
+ };
+
+ //! Constructor for a 1D PDF
+ /*!
+ \param [in] theVarName the name of the abscissa variable
+ \param [in] params the parameters of the PDF
+ \param [in] minAbscissa the minimum value of the abscissa
+ \param [in] maxAbscissa the maximum value of the abscissa
+ */
+ LauAbsPdf( const TString& theVarName,
+ const std::vector<LauAbsRValue*>& params,
+ Double_t minAbscissa,
+ Double_t maxAbscissa );
+
+ //! Constructor for a multidimensional PDF
+ /*!
+ \param [in] theVarNames the names of the abscissa variables
+ \param [in] params the parameters of the PDF
+ \param [in] minAbscissas the minimum values of the abscissas
+ \param [in] maxAbscissas the maximum values of the abscissas
+ */
+ LauAbsPdf( const std::vector<TString>& theVarNames,
+ const std::vector<LauAbsRValue*>& params,
+ const LauFitData& minAbscissas,
+ const LauFitData& maxAbscissas );
+
+ //! Destructor
+ virtual ~LauAbsPdf() {}
+
+ //! Retrieve the name of the abscissa
+ /*!
+ \return the abscissa's name
+ */
+ virtual const TString& varName() const { return varNames_.find( 0 )->second; }
+
+ //! Retrieve the names of the abscissas
+ /*!
+ \return the abscissas' names
+ */
+ virtual std::vector<TString> varNames() const;
+
+ //! Retrieve the number of PDF parameters
+ /*!
+ \return the number of PDF parameters
+ */
+ virtual UInt_t nParameters() const { return param_.size(); }
+
+ //! Retrieve the number of fixed PDF parameters
+ /*!
+ \return the number of fixed PDF parameters
+ */
+ virtual UInt_t nFixedParameters() const;
+
+ //! Retrieve the number of abscissas
+ /*!
+ \return the number of abscissas
+ */
+ virtual UInt_t nInputVars() const { return varNames_.size(); }
+
+ //! Specifies whether or not the PDF is DP dependent.
+ /*!
+ DP-dependent PDFs should override this method.
+
+ \return true if the PDF is DP-dependent, false otherwise (the default)
+ */
+ virtual Bool_t isDPDependent() const { return kFALSE; }
+
+ //! Retrieve the minimum value of the (primary) abscissa
+ /*!
+ \return the minimum value of the (primary) abscissa
+ */
+ virtual Double_t getMinAbscissa() const { return minAbscissas_.front(); }
+
+ //! Retrieve the maximum value of the (primary) abscissa
+ /*!
+ \return the maximum value of the (primary) abscissa
+ */
+ virtual Double_t getMaxAbscissa() const { return maxAbscissas_.front(); }
+
+ //! Retrieve the range of the (primary) abscissa
+ /*!
+ \return the range of the (primary) abscissa
+ */
+ virtual Double_t getRange() const { return this->getMaxAbscissa() - this->getMinAbscissa(); }
+
+ //! Retrieve the minimum value of the specified abscissa
+ /*!
+ \param [in] theVarName the name of the abscissa
+ \return the minimum value of the specified abscissa
+ */
+ virtual Double_t getMinAbscissa( const TString& theVarName ) const;
+
+ //! Retrieve the maximum value of the specified abscissa
+ /*!
+ \param [in] theVarName the name of the abscissa
+ \return the maximum value of the specified abscissa
+ */
+ virtual Double_t getMaxAbscissa( const TString& theVarName ) const;
+
+ //! Retrieve the range of the specified abscissa
+ /*!
+ \param [in] theVarName the name of the abscissa
+ \return the range of the specified abscissa
+ */
+ virtual Double_t getRange( const TString& theVarName ) const
+ {
+ return this->getMaxAbscissa( theVarName ) - this->getMinAbscissa( theVarName );
+ }
+
+ //! Retrieve the minimum values of all the abscissas
+ /*!
+ \return the minimum values of the abscissas
+ */
+ virtual LauFitData getMinAbscissas() const;
+
+ //! Retrieve the maximum values of all the abscissas
+ /*!
+ \return the maximum values of the abscissas
+ */
+ virtual LauFitData getMaxAbscissas() const;
+
+ //! Retrieve the ranges of all the abscissas
+ /*!
+ \return the ranges of the abscissas
+ */
+ virtual LauFitData getRanges() const;
+
+ //! Update the pulls for all parameters
+ virtual void updatePulls();
+
+ //! Cache information from data
+ /*!
+ Will cache, for every event, the abscissa values and, if all parameters are fixed, the PDF value.
+
+ \param [in] inputData the data to be used to calculate everything
+ */
+ virtual void cacheInfo( const LauFitDataTree& inputData );
+
+ //! Calculate the likelihood (and all associated information) given value(s) of the abscissa(s)
+ /*!
+ \param [in] abscissas the value(s) of the abscissa(s)
+ */
+ virtual void calcLikelihoodInfo( const LauAbscissas& abscissas ) = 0;
+
+ //! Retrieve the likelihood (and all associated information) given the event number
+ /*!
+ \param [in] iEvt the event number
+ */
+ virtual void calcLikelihoodInfo( UInt_t iEvt );
+
+ //! Retrieve the unnormalised likelihood value
+ /*!
+ \return the unnormalised likelihood value
+ */
+ virtual Double_t getUnNormLikelihood() const { return unNormPDFVal_; }
+
+ //! Retrieve the normalisation factor
+ /*!
+ \return the normalisation factor
+ */
+ virtual Double_t getNorm() const { return norm_; }
+
+ //! Retrieve the normalised likelihood value
+ /*!
+ \return the normalised likelihood value
+ */
+ virtual Double_t getLikelihood() const;
+
+ //! For multidimentional PDFs, retrieve the normalised likelihood value of a named variable
+ /*!
+ Defaults to simply returning the complete likelihood. Should be overridden by multidimensional PDFs.
+
+ \return the normalised likelihood value of the named variable
+ */
+ virtual Double_t getLikelihood( const TString& theVarName ) const;
+
+ //! Retrieve the maximum height
+ /*!
+ \return the maximum height
+ */
+ virtual Double_t getMaxHeight() const { return maxHeight_; }
+
+ //! Generate an event from the PDF
+ /*!
+ \param [in] kinematics used by some PDFs to determine the DP position, on which they have dependence
+ */
+ virtual LauFitData generate( const LauKinematics* kinematics );
+
+ //! Set the random function used for toy MC generation
+ /*!
+ \param [in] randomFun the random function to be used
+ */
+ virtual void setRandomFun( TRandom* randomFun ) { randomFun_ = randomFun; }
+
+ //! Retrieve the parameters of the PDF, e.g. so that they can be loaded into a fit
+ /*!
+ \return the parameters of the PDF
+ */
+ virtual const std::vector<LauAbsRValue*>& getParameters() const { return param_; }
+
+ //! Retrieve the parameters of the PDF, e.g. so that they can be loaded into a fit
+ /*!
+ \return the parameters of the PDF
+ */
+ virtual std::vector<LauAbsRValue*>& getParameters() { return param_; }
+
+ //! Calculate the normalisation factor of the PDF
+ /*!
+ By default uses numerical integration.
+ PDFs with analytical integrals should override this method.
+ */
+ virtual void calcNorm();
+
+ //! Calculate the maximum height of the PDF
+ /*!
+ \param [in] kinematics used by some PDFs to determine the DP position, on which they have dependence
+ */
+ virtual void calcPDFHeight( const LauKinematics* kinematics ) = 0;
+
+ //! Check if the maximum height of the PDF is up to date
+ /*!
+ \return true if the maximum height is up to date
+ */
+ virtual Bool_t heightUpToDate() const { return heightUpToDate_; }
+
+ //! Set whether the height is up to date
+ /*!
+ \param [in] hutd whether the height is up to date
+ */
+ virtual void heightUpToDate( Bool_t hutd ) { heightUpToDate_ = hutd; }
+
+ //! Check if the PDF is to be cached
+ /*!
+ \return true if the PDF is to be cached
+ */
+ virtual Bool_t cachePDF() const { return cachePDF_; }
+
+ //! Retrieve the number of points to integrate over when normalising
+ /*!
+ \return the number of points to integrate over when normalising
+ */
+ virtual Int_t nNormPoints() const { return nNormPoints_; }
+
+ //! Set the number of points to integrate over when normalising
+ /*!
+ \param [in] nPoints the number of points
+ */
+ virtual void nNormPoints( Int_t nPoints ) { nNormPoints_ = nPoints; }
+
+ //! Retrieve the integration method used to normalise the PDF
+ /*!
+ \return the integration method used to normalise the PDF
+ */
+ virtual IntMethod integMethod() const { return integMethod_; }
+
+ //! Set the integration method used to normalise the PDF
+ /*!
+ \param [in] method the integration method to be used
+ */
+ virtual void integMethod( IntMethod method ) { integMethod_ = method; }
+
+ protected:
+ //! Set whether the PDF is to be cached
+ /*!
+ \param [in] doCachePDF whether the PDF is to be cached
+ */
+ virtual void cachePDF( Bool_t doCachePDF ) { cachePDF_ = doCachePDF; }
+
+ //! Integrate the PDF using the Gauss-Legendre method
+ /*!
+ \return the integral of the PDF
+ */
+ virtual Double_t integrGaussLegendre();
+
+ //! Integrate the PDF using the simple trapezoid method
+ /*!
+ \return the integral of the PDF
+ */
+ virtual Double_t integTrapezoid();
+
+ //! Set the normalisation factor
+ /*!
+ \param [in] norm the normalisation factor
+ */
+ virtual void setNorm( Double_t norm ) { norm_ = norm; }
+
+ //! Set the maximum height
+ /*!
+ \param [in] maxHeight the new maximum height
+ */
+ virtual void setMaxHeight( Double_t maxHeight )
+ {
+ maxHeight_ = maxHeight;
+ this->heightUpToDate( kTRUE );
+ }
+
+ //! Set the minimum value of the specified abscissa
+ /*!
+ \param [in] theVarName the name of the abscissa
+ \param [in] minAbscissa value to set as minimum
+ */
+ virtual void setMinAbscissa( const TString& theVarName, Double_t minAbscissa );
+
+ //! Set the maximum value of the specified abscissa
+ /*!
+ \param [in] theVarName the name of the abscissa
+ \param [in] maxAbscissa value to set as maximum
+ */
+ virtual void setMaxAbscissa( const TString& theVarName, Double_t maxAbscissa );
+
+ //! Set the range of the specified abscissa
+ /*!
+ \param [in] theVarName the name of the abscissa
+ \param [in] minAbscissa value to set as minimum
+ \param [in] maxAbscissa value to set as maximum
+ */
+ virtual void setRange( const TString& theVarName, Double_t minAbscissa, Double_t maxAbscissa )
+ {
+ this->setMinAbscissa( theVarName, minAbscissa );
+ this->setMaxAbscissa( theVarName, maxAbscissa );
+ }
+
+ //! Check that all abscissas are within their allowed ranges
+ /*!
+ \param [in] abscissas the value(s) of the abscissa(s)
+ \return true if all abscissas are within their allowed ranges
+ */
+ virtual Bool_t checkRange( const LauAbscissas& abscissas ) const;
+
+ //! Set the unnormalised likelihood
+ virtual void setUnNormPDFVal( Double_t unNormPDFVal ) { unNormPDFVal_ = unNormPDFVal; }
+
+ //! Retrieve the specified parameter
+ /*!
+ \param [in] parName the parameter to retrieve
+ */
+ virtual LauAbsRValue* findParameter( const TString& parName );
+
+ //! Retrieve the specified parameter
+ /*!
+ \param [in] parName the parameter to retrieve
+ */
+ virtual const LauAbsRValue* findParameter( const TString& parName ) const;
+
+ //! Retrieve the random function used for MC generation
+ /*!
+ \return the random function used for MC generation
+ */
+ virtual TRandom* getRandomFun() const { return randomFun_; }
+
+ //! Retrieve the abscissa(s)
+ /*!
+ \return the abscissa(s)
+ */
+ virtual std::vector<LauAbscissas>& getAbscissas() { return abscissas_; }
+
+ //! Retrieve the abscissa(s)
+ /*!
+ \return the abscissa(s)
+ */
+ virtual const std::vector<LauAbscissas>& getAbscissas() const { return abscissas_; }
+
+ //! Retrieve the cached unnormalised likelihood values
+ /*!
+ \return the cached unnormalised likelihood values
+ */
+ virtual std::vector<Double_t>& getUnNormPDFValues() { return unNormPDFValues_; }
+
+ //! Retrieve the cached unnormalised likelihood values
+ /*!
+ \return the cached unnormalised likelihood values
+ */
+ virtual const std::vector<Double_t>& getUnNormPDFValues() const { return unNormPDFValues_; }
+
+ //! Add parameters to the PDF
+ /*!
+ \param [in] params the parameters to add
+ */
+ virtual void addParameters( std::vector<LauAbsRValue*>& params );
+
+ //! Check whether the calcNorm method is running
+ /*!
+ \return true if the calcNorm method is running
+ */
+ virtual Bool_t withinNormCalc() const { return withinNormCalc_; }
+
+ //! Set flag to track whether the calcNorm method is running
+ /*!
+ \param [in] yorn whether the calcNorm method is running
+ */
+ virtual void withinNormCalc( Bool_t yorn ) { withinNormCalc_ = yorn; }
+
+ //! Check whether the generate method is running
+ /*!
+ \return true if the generate method is running
+ */
+ virtual Bool_t withinGeneration() const { return withinGeneration_; }
+
+ //! Set flag to track whether the generate method is running
+ /*!
+ \param [in] yorn whether the generate method is running
+ */
+ virtual void withinGeneration( Bool_t yorn ) { withinGeneration_ = yorn; }
+
+ //! Check whether the normalisation weights have been calculated
+ /*!
+ \return true if the normalisation weights have been calculated
+ */
+ virtual Bool_t normWeightsDone() const { return normWeightsDone_; }
+
+ //! Set whether the normalisation weights have been calculated
+ /*!
+ \param [in] yorn whether the normalisation weights have been calculated
+ */
+ virtual void normWeightsDone( Bool_t yorn ) { normWeightsDone_ = yorn; }
+
+ //! Calculate the weights and abscissas used for normalisation
+ virtual void getNormWeights();
+
+ //! Retrieve the abscissa points used for normalisation
+ /*!
+ \return the abscissa points used for normalisation
+ */
+ virtual const std::vector<LauAbscissas>& normAbscissas() const { return normAbscissas_; }
+
+ //! Retrieve the weights used for normalisation
+ /*!
+ \return the weights used for normalisation
+ */
+ virtual const std::vector<Double_t>& normWeights() const { return normWeights_; }
+
+ private:
+ //! Copy constructor (not implemented)
+ LauAbsPdf( const LauAbsPdf& rhs );
+
+ //! Copy assignment operator (not implemented)
+ LauAbsPdf& operator=( const LauAbsPdf& rhs );
+
+ //! The names of the PDF variables
+ std::map<UInt_t, TString> varNames_;
+
+ //! The parameters of the PDF (if any)
+ std::vector<LauAbsRValue*> param_;
+
+ //! Normalisation factor of the PDF
+ Double_t norm_;
+
+ //! Maximum height of the PDF
+ Double_t maxHeight_;
+
+ //! Track whether the height is up to date
+ Bool_t heightUpToDate_;
+
+ //! The minimum value(s) of the abscissa(s)
+ LauAbscissas minAbscissas_;
+
+ //! The maximum value(s) of the abscissa(s)
+ LauAbscissas maxAbscissas_;
+
+ //! The random function used for MC generation
+ TRandom* randomFun_;
+
+ //! Cached values of the abscissas
+ std::vector<LauAbscissas> abscissas_;
+
+ //! Cached unnormalised likelihood values
+ std::vector<Double_t> unNormPDFValues_;
+
+ //! Whether the unnormalised PDF values are cached
+ /*! They are only cached if all parameters are fixed. */
+ Bool_t cachePDF_;
+
+ //! The unnormalised liklihood value
+ Double_t unNormPDFVal_;
+
+ //! number of points to integrate over when normalising
+ Int_t nNormPoints_;
+
+ //! The integration method used for normalising the PDF
+ IntMethod integMethod_;
+
+ //! Flag to keep track of whether the calcNorm method is running
+ Bool_t withinNormCalc_;
+
+ //! Flag to keep track of whether the generate method is running
+ Bool_t withinGeneration_;
+
+ //! Whether the normalisation weights have been calculated
+ Bool_t normWeightsDone_;
+
+ //! The normalisation abscissas
+ std::vector<LauAbscissas> normAbscissas_;
+
+ //! The normalisation weights
+ std::vector<Double_t> normWeights_;
+
+ ClassDef( LauAbsPdf, 0 ) // Define the abstract PDF class
};
#endif
diff --git a/inc/LauAbsRValue.hh b/inc/LauAbsRValue.hh
index a982b81..eb7e754 100644
--- a/inc/LauAbsRValue.hh
+++ b/inc/LauAbsRValue.hh
@@ -1,140 +1,139 @@
/*
Copyright 2014 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauAbsRValue.hh
- \brief File containing declaration of LauAbsRValue class.
+ \brief File containing declaration of LauAbsRValue class.
*/
/*! \class LauAbsRValue
- \brief Pure abstract base class for defining a parameter containing an R value
+ \brief Pure abstract base class for defining a parameter containing an R value
- Pure abstract base class for defining a parameter containing an R value,
- either a LauParameter or a LauFormulaPar
+ Pure abstract base class for defining a parameter containing an R value,
+ either a LauParameter or a LauFormulaPar
*/
#ifndef LAU_ABSRVALUE
#define LAU_ABSRVALUE
#include "TString.h"
#include <vector>
class LauParameter;
class LauAbsRValue {
- public:
- //! Constructor
- LauAbsRValue() {}
-
- //! Destructor
- virtual ~LauAbsRValue() {}
-
- //! Copy constructor
- LauAbsRValue(const LauAbsRValue& /*rhs*/) {}
-
- //! Copy assignment operator
- LauAbsRValue& operator=(const LauAbsRValue& /*rhs*/) {return *this;}
-
- //! Return the name of the parameter
- /*!
- \return the name of the parameter
- */
- virtual const TString& name() const =0;
-
- //! Set the parameter name
- /*!
- \param [in] newName the name of the parameter
- */
- virtual void name(const TString& newName) =0;
-
- //! Return the value of the parameter
- /*!
- \return the value of the parameter
- */
- virtual Double_t value() const =0;
-
- //! The unblinded value of the parameter
- /*!
- \return the unblinded value of the parameter
- */
- virtual Double_t unblindValue() const =0;
-
- //! The value generated for the parameter
- /*!
- \return the value generated for the parameter
- */
- virtual Double_t genValue() const =0;
-
- //! The initial value of the parameter
- /*!
- \return the initial value of the parameter given to the fitter
- */
- virtual Double_t initValue() const =0;
-
- //! Check whether a Gaussian constraints is applied
- /*!
- \return the boolean flag true/false whether a Gaussian constraint is applied
- */
- virtual Bool_t gaussConstraint() const =0;
-
- //! The penalty term from the Gaussian constraint
- /*!
- \return the penalty term from the Gaussian constraint
- */
- virtual Double_t constraintPenalty() const =0;
-
- //! Generate per-experiment constraint mean
- virtual void generateConstraintMean() =0;
-
- //! Return the list of LauParameters on which the LauAbsRValue depends
- /*!
- \return the list of LauParameters
- */
- virtual std::vector<LauParameter*> getPars() =0;
-
- //! Is the parameter also an L value or not
- /*!
- \return whether the parameter is also an L value
- */
- virtual Bool_t isLValue() const =0;
-
- //! Check is the parameter is fixed or floated
- /*!
- \return the boolean flag whether the parameter is fixed
- */
- virtual Bool_t fixed() const =0;
-
- //! The blinding state
- /*!
- \return the blinding state: kTRUE means that it is blinded, kFALSE that it is not blinded
- */
- virtual Bool_t blind() const =0;
-
- private:
-
- ClassDef(LauAbsRValue,1) // Abstract base class for R parameters
+ public:
+ //! Constructor
+ LauAbsRValue() {}
+
+ //! Destructor
+ virtual ~LauAbsRValue() {}
+
+ //! Copy constructor
+ LauAbsRValue( const LauAbsRValue& /*rhs*/ ) {}
+
+ //! Copy assignment operator
+ LauAbsRValue& operator=( const LauAbsRValue& /*rhs*/ ) { return *this; }
+
+ //! Return the name of the parameter
+ /*!
+ \return the name of the parameter
+ */
+ virtual const TString& name() const = 0;
+
+ //! Set the parameter name
+ /*!
+ \param [in] newName the name of the parameter
+ */
+ virtual void name( const TString& newName ) = 0;
+
+ //! Return the value of the parameter
+ /*!
+ \return the value of the parameter
+ */
+ virtual Double_t value() const = 0;
+
+ //! The unblinded value of the parameter
+ /*!
+ \return the unblinded value of the parameter
+ */
+ virtual Double_t unblindValue() const = 0;
+
+ //! The value generated for the parameter
+ /*!
+ \return the value generated for the parameter
+ */
+ virtual Double_t genValue() const = 0;
+
+ //! The initial value of the parameter
+ /*!
+ \return the initial value of the parameter given to the fitter
+ */
+ virtual Double_t initValue() const = 0;
+
+ //! Check whether a Gaussian constraints is applied
+ /*!
+ \return the boolean flag true/false whether a Gaussian constraint is applied
+ */
+ virtual Bool_t gaussConstraint() const = 0;
+
+ //! The penalty term from the Gaussian constraint
+ /*!
+ \return the penalty term from the Gaussian constraint
+ */
+ virtual Double_t constraintPenalty() const = 0;
+
+ //! Generate per-experiment constraint mean
+ virtual void generateConstraintMean() = 0;
+
+ //! Return the list of LauParameters on which the LauAbsRValue depends
+ /*!
+ \return the list of LauParameters
+ */
+ virtual std::vector<LauParameter*> getPars() = 0;
+
+ //! Is the parameter also an L value or not
+ /*!
+ \return whether the parameter is also an L value
+ */
+ virtual Bool_t isLValue() const = 0;
+
+ //! Check is the parameter is fixed or floated
+ /*!
+ \return the boolean flag whether the parameter is fixed
+ */
+ virtual Bool_t fixed() const = 0;
+
+ //! The blinding state
+ /*!
+ \return the blinding state: kTRUE means that it is blinded, kFALSE that it is not blinded
+ */
+ virtual Bool_t blind() const = 0;
+
+ private:
+ ClassDef( LauAbsRValue, 1 ) // Abstract base class for R parameters
};
#endif
diff --git a/inc/LauAbsResonance.hh b/inc/LauAbsResonance.hh
index adf337a..ae22e0b 100644
--- a/inc/LauAbsResonance.hh
+++ b/inc/LauAbsResonance.hh
@@ -1,581 +1,608 @@
/*
Copyright 2004 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauAbsResonance.hh
\brief File containing declaration of LauAbsResonance class.
*/
/*! \class LauAbsResonance
\brief Abstract class for defining type for resonance amplitude models (Breit-Wigner, Flatte etc.)
Abstract Class for defining the type for all classes used to model
resonances in the Dalitz plot, such as Breit-Wigner functions.
In addition, some common functionality is implemented, including data such
as the mass and width of the desired state.
*/
#ifndef LAU_ABS_RESONANCE
#define LAU_ABS_RESONANCE
-#include "TString.h"
-
#include "LauBlattWeisskopfFactor.hh"
#include "LauComplex.hh"
#include "LauParameter.hh"
+#include "TString.h"
+
class LauDaughters;
class LauKinematics;
class LauResonanceInfo;
class LauAbsResonance {
- public:
- //! Define the allowed resonance types
- enum LauResonanceModel {
- BW, /*!< simple Breit-Wigner */
- RelBW, /*!< relativistic Breit-Wigner */
- GS, /*!< a modified Breit-Wigner from Gounaris-Sakurai */
- Flatte, /*!< Flatte or coupled-channel Breit-Wigner */
- Sigma, /*!< special shape for the sigma or f_0(600) */
- Kappa, /*!< special shape for the kappa, a low-mass Kpi scalar */
- Dabba, /*!< special shape for the dabba, a low-mass Dpi scalar */
- LASS, /*!< the LASS amplitude to describe the Kpi S-wave */
- LASS_BW, /*!< the resonant part of the LASS amplitude */
- LASS_NR, /*!< the nonresonant part of the LASS amplitude */
- EFKLLM, /*!< a form-factor-based description of the Kpi S-wave */
- KMatrix, /*!< description using K-matrix and P-vector */
- FlatNR, /*!< a uniform nonresonant amplitude */
- NRModel, /*!< a theoretical model nonresonant amplitude */
- BelleNR, /*!< an empirical exponential nonresonant amplitude */
- PowerLawNR, /*!< an empirical power law nonresonant amplitude */
- BelleSymNR, /*!< an empirical exponential nonresonant amplitude for symmetrised DPs */
- BelleSymNRNoInter, /*!< an empirical exponential nonresonant amplitude for symmetrised DPs without interference */
- TaylorNR, /*!< an empirical Taylor expansion nonresonant amplitude for symmetrised DPs */
- PolNR, /*!< an empirical polynomial nonresonant amplitude */
- Pole, /*!< scalar Pole lineshape */
- PolarFFNR, /*!< Polar Form Factor nonresonant amplitude */
- PolarFFSymNR, /*!< Polar Form Factor nonresonant amplitude for symmetrised DPs */
- PolarFFSymNRNoInter, /*!< Polar Form Factor nonresonant amplitude for symmetrised DPs without interference */
- Rescattering, /*!< KK-PiPi inelastic scattering amplitude */
- Rescattering2, /*!< KK-PiPi inelastic scattering amplitude */
- RescatteringNoInter, /*!< KK-PiPi inelastic scattering amplitude */
- MIPW_MagPhase, /*!< a model independent partial wave - magnitude and phase representation */
- MIPW_RealImag, /*!< a model independent partial wave - real and imaginary part representation */
- GaussIncoh, /*!< an incoherent Gaussian shape */
- RhoOmegaMix_GS, /*!< mass mixing model using GS for res 1 and RBW for res 2 */
- RhoOmegaMix_RBW, /*!< mass mixing model using two RBWs */
- RhoOmegaMix_GS_1, /*!< mass mixing model using GS for res 1 and RBW for res 2, with denominator factor = 1 */
- RhoOmegaMix_RBW_1 /*!< mass mixing model using two RBWs, with denominator factor = 1 */
- };
-
- //! Define the allowed spin formalisms
- enum LauSpinType {
- Zemach_P, /*!< Zemach tensor formalism, bachelor momentum in resonance rest frame */
- Zemach_Pstar, /*!< Zemach tensor formalism, bachelor momentum in parent rest frame */
- Covariant, /*!< Covariant tensor formalism */
- Legendre /*!< Legendre polynomials only */
- };
-
- //! Is the resonance model incoherent?
- /*!
- \param [in] model the resonance model
- \return true if the model is incoherent
- */
- static bool isIncoherentModel(LauResonanceModel model);
-
- //! Constructor (for use by standard resonances)
- /*!
- \param [in] resInfo the object containing information on the resonance name, mass, width, spin, charge, etc.
- \param [in] resPairAmpInt the number of the daughter not produced by the resonance
- \param [in] daughters the daughter particles
- */
- LauAbsResonance(LauResonanceInfo* resInfo, const Int_t resPairAmpInt, const LauDaughters* daughters);
-
- //! Constructor (for use by K-matrix components)
- /*!
- \param [in] resName the name of the component
- \param [in] resPairAmpInt the number of the daughter not produced by the resonance
- \param [in] daughters the daughter particles
- \param [in] resSpin the spin of the final channel into which the K-matrix scatters
- */
- LauAbsResonance(const TString& resName, const Int_t resPairAmpInt, const LauDaughters* daughters, const Int_t resSpin);
-
- //! Destructor
- virtual ~LauAbsResonance();
-
- //! Initialise the model
- virtual void initialise() = 0;
-
- //! Calculate the complex amplitude
- /*!
- \param [in] kinematics the kinematic variables of the current event
- \return the complex amplitude
- */
- virtual LauComplex amplitude(const LauKinematics* kinematics);
-
- //! Get the resonance model type
- /*!
- \return the resonance model type
- */
- virtual LauResonanceModel getResonanceModel() const = 0;
-
- //! Get the spin type
- /*!
- \return the spin formalism
- */
- LauSpinType getSpinType() const {return spinType_;}
-
- //! Get the name of the resonance
- /*!
- \return the resonance name
- */
- const TString& getResonanceName() const {return resName_;}
-
- //! Get the name of the resonance
- /*!
- \return the resonance name
- */
- const TString& getSanitisedName() const {return sanitisedName_;}
-
- //! Get the integer to identify which DP axis the resonance belongs to
- /*!
- \return the DP axis identification number, the ID of the bachelor
- */
- Int_t getPairInt() const {return resPairAmpInt_;}
-
- //! Get the spin of the resonance
- /*!
- \return the resonance spin
- */
- Int_t getSpin() const {return resSpin_;}
-
- //! Get the charge of the resonance
- /*!
- \return the resonance charge
- */
- Int_t getCharge() const {return resCharge_;}
-
- //! Get the mass of the resonance
- /*!
- \return the resonance mass
- */
- Double_t getMass() const {return (resMass_!=0) ? resMass_->unblindValue() : -1.0;}
-
- //! Get the width of the resonance
- /*!
- \return the resonance width
- */
- Double_t getWidth() const {return (resWidth_!=0) ? resWidth_->unblindValue() : -1.0;}
-
- //! Get the mass parameter of the resonance
- /*!
- \return the resonance mass parameter
- */
- LauParameter* getMassPar() {return resMass_;}
-
- //! Get the width parameter of the resonance
- /*!
- \return the resonance width parameter
- */
- LauParameter* getWidthPar() {return resWidth_;}
-
- //! Retrieve the resonance parameters, e.g. so that they can be loaded into a fit
- /*!
- \return floating parameters of the resonance
- */
- virtual const std::vector<LauParameter*>& getFloatingParameters() { return this->getParameters(); };
-
- //! Is the amplitude pre-symmetrised?
- /*!
- The default value is kFALSE, so pre-symmetrised lineshapes should override this.
-
- \return whether the amplitude is already symmetrised
- */
- virtual Bool_t preSymmetrised() const {return kFALSE;}
-
- //! Get the helicity flip flag
- /*!
- \return the flip helicity flag
- */
- Bool_t flipHelicity() const {return flipHelicity_;}
-
- //! Set the helicity flip flag
- /*!
- \param [in] boolean the helicity flip status
- */
- void flipHelicity(const Bool_t boolean) {flipHelicity_ = boolean;}
-
- //! Get the ignore momenta flag
- /*!
- Whether to ignore the momentum factors in both the spin factor and the mass-dependent width
-
- \return the ignore momenta flag
- */
- Bool_t ignoreMomenta() const {return ignoreMomenta_;}
-
- //! Set the ignore momenta flag
- /*!
- Whether to ignore the momentum factors in both the spin factor and the mass-dependent width
-
- \param [in] boolean the ignore momenta status
- */
- void ignoreMomenta(const Bool_t boolean) {ignoreMomenta_ = boolean;}
-
- //! Get the ignore spin flag
- /*!
- Whether to set the spinTerm to unity always
- \return the ignore spin flag
- */
- Bool_t ignoreSpin() const {return ignoreSpin_;}
-
- //! Set the ignore spin flag
- /*!
- Whether to set the spinTerm to unity always
- \param [in] boolean the ignore spin status
- */
- void ignoreSpin(const Bool_t boolean) {ignoreSpin_ = boolean;}
-
- //! Get the ignore barrier factor scaling flag
- /*!
- Whether to ignore barrier factor scaling in the amplitude numerator, they are still used for the mass-dependent width
- \return the ignore barrier amplitude scaling flag
- */
- Bool_t ignoreBarrierScaling() const {return ignoreBarrierScaling_;}
-
- //! Set the ignore barrier factor scaling flag
- /*!
- Whether to ignore barrier factor scaling in the amplitude numerator, they are still used for the mass-dependent width
- \param [in] boolean the ignore barrier factor scaling status
- */
- void ignoreBarrierScaling(const Bool_t boolean) {ignoreBarrierScaling_ = boolean;}
-
- //! Allow the mass, width and spin of the resonance to be changed
- /*!
- Negative values wil be ignored, so if, for example, you
- want to only change the spin you can provide negative
- values for the mass and width
-
- \param [in] newMass new value of the resonance mass
- \param [in] newWidth new value of the resonance width
- \param [in] newSpin new value of the resonance spin
- */
- void changeResonance(const Double_t newMass, const Double_t newWidth, const Int_t newSpin);
-
- //! Allow the Blatt-Weisskopf radius for the resonance and parent factors to be changed
- /*!
- Negative values wil be ignored, so if, for example, you
- want to only change the parent radius you can provide a
- negative value for the resonance radius
-
- \param [in] resRadius new value of the resonance radius
- \param [in] parRadius new value of the parent radius
- */
- void changeBWBarrierRadii(const Double_t resRadius, const Double_t parRadius);
-
- //! Set value of the various parameters
- /*!
- \param [in] name the name of the parameter to be changed
- \param [in] value the new parameter value
- */
- virtual void setResonanceParameter(const TString& name, const Double_t value);
-
- //! Allow the various parameters to float in the fit
- /*!
- \param [in] name the name of the parameter to be floated
- */
- virtual void floatResonanceParameter(const TString& name);
-
- //! Access the given resonance parameter
- /*!
- \param [in] name the name of the parameter
- \return the corresponding parameter
- */
- virtual LauParameter* getResonanceParameter(const TString& name);
-
- //! Fix or release the resonance mass
- /*!
- \param [in] parFixed new status of mass
- */
- void fixMass(const Bool_t parFixed) { if (resMass_!=0) { resMass_->fixed(parFixed); } }
-
- //! Fix or release the resonance width
- /*!
- \param [in] parFixed new status of width
- */
- void fixWidth(const Bool_t parFixed) { if (resWidth_!=0) { resWidth_->fixed(parFixed); } }
-
- //! Get the status of resonance mass (fixed or released)
- /*!
- \return the status of resonance mass (fixed or released)
- */
- Bool_t fixMass() const { return (resMass_!=0) ? resMass_->fixed() : kTRUE; }
-
- //! Get the status of resonance width (fixed or released)
- /*!
- \return the status of resonance width (fixed or released)
- */
- Bool_t fixWidth() const { return (resWidth_!=0) ? resWidth_->fixed() : kTRUE; }
-
- //! Set the spin formalism to be used
- /*!
- \param [in] spinType the spin formalism
- */
- void setSpinType(const LauSpinType spinType) {spinType_ = spinType;}
-
- //! Set the form factor model and parameters
- /*!
- \param [in] resFactor the barrier factor for the resonance decay
- \param [in] parFactor the barrier factor for the parent decay
- */
- void setBarrierRadii(LauBlattWeisskopfFactor* resFactor, LauBlattWeisskopfFactor* parFactor)
- {
- resBWFactor_ = resFactor;
- parBWFactor_ = parFactor;
- }
-
- //! Fix or release the Blatt-Weisskopf barrier radii
- void fixBarrierRadii(const Bool_t fixResRadius, const Bool_t fixParRadius);
-
- //! Get the status of resonance barrier radius (fixed or released)
- Bool_t fixResRadius() const;
-
- //! Get the status of parent barrier radius (fixed or released)
- Bool_t fixParRadius() const;
-
- //! Get the radius of the resonance barrier factor
- Double_t getResRadius() const;
-
- //! Get the radius of the parent barrier factor
- Double_t getParRadius() const;
-
- protected:
- //! Get the name of the parent particle
- TString getNameParent() const;
- //! Get the name of the first daughter of the resonance
- TString getNameDaug1() const;
- //! Get the name of the second daughter of the resonance
- TString getNameDaug2() const;
- //! Get the name of the daughter that does not originate form the resonance
- TString getNameBachelor() const;
- //! Get the parent particle mass
- Double_t getMassParent() const;
- //! Get the mass of daughter 1
- Double_t getMassDaug1() const;
- //! Get the mass of daughter 2
- Double_t getMassDaug2() const;
- //! Get the mass of the bachelor daughter
- Double_t getMassBachelor() const;
- //! Get the Charge of the parent particle
- Int_t getChargeParent() const;
- //! Get the charge of daughter 1
- Int_t getChargeDaug1() const;
- //! Get the charge of daughter 2
- Int_t getChargeDaug2() const;
- //! Get the charge of the bachelor daughter
- Int_t getChargeBachelor() const;
-
- //! Get the current value of the daughter momentum in the resonance rest frame
- Double_t getQ() const {return q_;}
- //! Get the current value of the bachelor momentum in the resonance rest frame
- Double_t getP() const {return p_;}
- //! Get the current value of the bachelor momentum in the parent rest frame
- Double_t getPstar() const {return pstar_;}
- //! Get the current value of the full spin-dependent covariant factor
- Double_t getCovFactor() const {return covFactor_;}
-
- //! Get the centrifugal barrier for the parent decay
- LauBlattWeisskopfFactor* getParBWFactor() {return parBWFactor_;}
- //! Get the centrifugal barrier for the parent decay
- const LauBlattWeisskopfFactor* getParBWFactor() const {return parBWFactor_;}
- //! Get the centrifugal barrier for the resonance decay
- LauBlattWeisskopfFactor* getResBWFactor() {return resBWFactor_;}
- //! Get the centrifugal barrier for the resonance decay
- const LauBlattWeisskopfFactor* getResBWFactor() const {return resBWFactor_;}
-
- //! Access the resonance info object
- LauResonanceInfo* getResInfo() const {return resInfo_;}
-
- //! Access the daughters object
- const LauDaughters* getDaughters() const {return daughters_;}
-
- //! Calculate the amplitude spin term using the Zemach tensor formalism
- /*!
- \param [in] pProd the momentum factor (either q * p or q * pstar)
- */
- Double_t calcZemachSpinFactor( const Double_t pProd ) const;
-
- //! Calculate the amplitude spin term using the covariant tensor formalism
- /*!
- \param [in] pProd the momentum factor (q * pstar)
- */
- Double_t calcCovSpinFactor( const Double_t pProd );
-
- //! Calculate the spin-dependent covariant factor
- /*!
- \param [in] erm E_ij in the parent rest-frame divided by m_ij (equivalent to sqrt(1 + p^2/mParent^2))
- */
- void calcCovFactor( const Double_t erm );
-
- //! Calculate the Legendre polynomial for the spin factor
- /*!
- Uses the current-event value of cosHel_
- */
- Double_t calcLegendrePoly() const;
-
- //! Calculate the Legendre polynomial for the spin factor (specifying the cosHel value)
- /*!
- \param [in] cosHel the cosine of the helicity angle
- */
- Double_t calcLegendrePoly( const Double_t cosHel );
-
- //! Complex resonant amplitude
- /*!
- \param [in] mass appropriate invariant mass for the resonance
- \param [in] spinTerm spin term
- */
- virtual LauComplex resAmp(Double_t mass, Double_t spinTerm) = 0;
-
- //! Clear list of floating parameters
- void clearFloatingParameters() { resParameters_.clear(); }
-
- //! Add parameter to the list of floating parameters
- /*!
- \param [in] param the parameter to be added to the list
- */
- void addFloatingParameter( LauParameter* param );
-
- //! Access the list of floating parameters
- std::vector<LauParameter*>& getParameters() { return resParameters_; }
-
- private:
- //! Copy constructor (not implemented)
- LauAbsResonance(const LauAbsResonance& rhs);
-
- //! Copy assignment operator (not implemented)
- LauAbsResonance& operator=(const LauAbsResonance& rhs);
-
- //! Information on the resonance
- LauResonanceInfo* resInfo_{0};
-
- //! Information on the particles
- const LauDaughters* daughters_;
-
- //! Parent name
- TString nameParent_{""};
- //! Daughter 1 name
- TString nameDaug1_{""};
- //! Daughter 2 name
- TString nameDaug2_{""};
- //! Bachelor name
- TString nameBachelor_{""};
-
- //! Parent charge
- Int_t chargeParent_{0};
- //! Daughter 1 charge
- Int_t chargeDaug1_{0};
- //! Daughter 2 charge
- Int_t chargeDaug2_{0};
- //! Bachelor charge
- Int_t chargeBachelor_{0};
-
- //! Parent mass
- Double_t massParent_{0.0};
- //! Daughter 1 mass
- Double_t massDaug1_{0.0};
- //! Daughter 2 mass
- Double_t massDaug2_{0.0};
- //! Bachelor mass
- Double_t massBachelor_{0.0};
-
- //! Resonance name
- TString resName_;
-
- //! Resonance name with illegal characters removed
- TString sanitisedName_;
-
- //! Resonance mass
- LauParameter* resMass_{0};
- //! Resonance width
- LauParameter* resWidth_{0};
-
- //! All parameters of the resonance
- std::vector<LauParameter*> resParameters_;
-
- //! Resonance spin
- Int_t resSpin_;
- //! Resonance charge
- Int_t resCharge_{0};
- //! DP axis identifier
- Int_t resPairAmpInt_;
- //! Blatt Weisskopf barrier for parent decay
- LauBlattWeisskopfFactor* parBWFactor_{0};
- //! Blatt Weisskopf barrier for resonance decay
- LauBlattWeisskopfFactor* resBWFactor_{0};
-
- //! Spin formalism
- LauSpinType spinType_{Zemach_P};
-
- //! Boolean to flip helicity
- Bool_t flipHelicity_{kFALSE};
- //! Boolean to ignore the momentum factors in both the spin factor and the mass-dependent width
- Bool_t ignoreMomenta_{kFALSE};
- //! Boolean to set the spinTerm to unity always
- Bool_t ignoreSpin_{kFALSE};
- //! Boolean to ignore barrier factor scaling in the amplitude numerator, they are still used for the mass-dependent width
- Bool_t ignoreBarrierScaling_{kFALSE};
-
- // Event kinematics information
-
- //! Invariant mass
- Double_t mass_{0.0};
- //! Helicity angle cosine
- Double_t cosHel_{0.0};
-
- //! Daughter momentum in resonance rest frame
- Double_t q_{0.0};
- //! Bachelor momentum in resonance rest frame
- Double_t p_{0.0};
- //! Bachelor momentum in parent rest frame
- Double_t pstar_{0.0};
-
- //! Covariant factor
- /*!
- sqrt(1 + z*z), where z = p / mParent
-
- Can also be expressed as E_ij in the parent rest-frame divided by m_ij - indeed this is how LauKinematics calculates it.
-
- \see LauKinematics::getcov12
- \see LauKinematics::getcov13
- \see LauKinematics::getcov23
- */
- Double_t erm_{1.0};
-
- //! Covariant factor (full spin-dependent expression)
- Double_t covFactor_{1.0};
-
- ClassDef(LauAbsResonance,0) // Abstract resonance class
-
+ public:
+ //! Define the allowed resonance types
+ enum LauResonanceModel {
+ BW, /*!< simple Breit-Wigner */
+ RelBW, /*!< relativistic Breit-Wigner */
+ GS, /*!< a modified Breit-Wigner from Gounaris-Sakurai */
+ Flatte, /*!< Flatte or coupled-channel Breit-Wigner */
+ Sigma, /*!< special shape for the sigma or f_0(600) */
+ Kappa, /*!< special shape for the kappa, a low-mass Kpi scalar */
+ Dabba, /*!< special shape for the dabba, a low-mass Dpi scalar */
+ LASS, /*!< the LASS amplitude to describe the Kpi S-wave */
+ LASS_BW, /*!< the resonant part of the LASS amplitude */
+ LASS_NR, /*!< the nonresonant part of the LASS amplitude */
+ EFKLLM, /*!< a form-factor-based description of the Kpi S-wave */
+ KMatrix, /*!< description using K-matrix and P-vector */
+ FlatNR, /*!< a uniform nonresonant amplitude */
+ NRModel, /*!< a theoretical model nonresonant amplitude */
+ BelleNR, /*!< an empirical exponential nonresonant amplitude */
+ PowerLawNR, /*!< an empirical power law nonresonant amplitude */
+ BelleSymNR, /*!< an empirical exponential nonresonant amplitude for symmetrised DPs */
+ BelleSymNRNoInter, /*!< an empirical exponential nonresonant amplitude for symmetrised DPs without interference */
+ TaylorNR, /*!< an empirical Taylor expansion nonresonant amplitude for symmetrised DPs */
+ PolNR, /*!< an empirical polynomial nonresonant amplitude */
+ Pole, /*!< scalar Pole lineshape */
+ PolarFFNR, /*!< Polar Form Factor nonresonant amplitude */
+ PolarFFSymNR, /*!< Polar Form Factor nonresonant amplitude for symmetrised DPs */
+ PolarFFSymNRNoInter, /*!< Polar Form Factor nonresonant amplitude for symmetrised DPs without interference */
+ Rescattering, /*!< KK-PiPi inelastic scattering amplitude */
+ Rescattering2, /*!< KK-PiPi inelastic scattering amplitude */
+ RescatteringNoInter, /*!< KK-PiPi inelastic scattering amplitude */
+ MIPW_MagPhase, /*!< a model independent partial wave - magnitude and phase representation */
+ MIPW_RealImag, /*!< a model independent partial wave - real and imaginary part representation */
+ GaussIncoh, /*!< an incoherent Gaussian shape */
+ RhoOmegaMix_GS, /*!< mass mixing model using GS for res 1 and RBW for res 2 */
+ RhoOmegaMix_RBW, /*!< mass mixing model using two RBWs */
+ RhoOmegaMix_GS_1, /*!< mass mixing model using GS for res 1 and RBW for res 2, with denominator factor = 1 */
+ RhoOmegaMix_RBW_1 /*!< mass mixing model using two RBWs, with denominator factor = 1 */
+ };
+
+ //! Define the allowed spin formalisms
+ enum LauSpinType {
+ Zemach_P, /*!< Zemach tensor formalism, bachelor momentum in resonance rest frame */
+ Zemach_Pstar, /*!< Zemach tensor formalism, bachelor momentum in parent rest frame */
+ Covariant, /*!< Covariant tensor formalism */
+ Legendre /*!< Legendre polynomials only */
+ };
+
+ //! Is the resonance model incoherent?
+ /*!
+ \param [in] model the resonance model
+ \return true if the model is incoherent
+ */
+ static bool isIncoherentModel( LauResonanceModel model );
+
+ //! Constructor (for use by standard resonances)
+ /*!
+ \param [in] resInfo the object containing information on the resonance name, mass, width, spin, charge, etc.
+ \param [in] resPairAmpInt the number of the daughter not produced by the resonance
+ \param [in] daughters the daughter particles
+ */
+ LauAbsResonance( LauResonanceInfo* resInfo,
+ const Int_t resPairAmpInt,
+ const LauDaughters* daughters );
+
+ //! Constructor (for use by K-matrix components)
+ /*!
+ \param [in] resName the name of the component
+ \param [in] resPairAmpInt the number of the daughter not produced by the resonance
+ \param [in] daughters the daughter particles
+ \param [in] resSpin the spin of the final channel into which the K-matrix scatters
+ */
+ LauAbsResonance( const TString& resName,
+ const Int_t resPairAmpInt,
+ const LauDaughters* daughters,
+ const Int_t resSpin );
+
+ //! Destructor
+ virtual ~LauAbsResonance();
+
+ //! Initialise the model
+ virtual void initialise() = 0;
+
+ //! Calculate the complex amplitude
+ /*!
+ \param [in] kinematics the kinematic variables of the current event
+ \return the complex amplitude
+ */
+ virtual LauComplex amplitude( const LauKinematics* kinematics );
+
+ //! Get the resonance model type
+ /*!
+ \return the resonance model type
+ */
+ virtual LauResonanceModel getResonanceModel() const = 0;
+
+ //! Get the spin type
+ /*!
+ \return the spin formalism
+ */
+ LauSpinType getSpinType() const { return spinType_; }
+
+ //! Get the name of the resonance
+ /*!
+ \return the resonance name
+ */
+ const TString& getResonanceName() const { return resName_; }
+
+ //! Get the name of the resonance
+ /*!
+ \return the resonance name
+ */
+ const TString& getSanitisedName() const { return sanitisedName_; }
+
+ //! Get the integer to identify which DP axis the resonance belongs to
+ /*!
+ \return the DP axis identification number, the ID of the bachelor
+ */
+ Int_t getPairInt() const { return resPairAmpInt_; }
+
+ //! Get the spin of the resonance
+ /*!
+ \return the resonance spin
+ */
+ Int_t getSpin() const { return resSpin_; }
+
+ //! Get the charge of the resonance
+ /*!
+ \return the resonance charge
+ */
+ Int_t getCharge() const { return resCharge_; }
+
+ //! Get the mass of the resonance
+ /*!
+ \return the resonance mass
+ */
+ Double_t getMass() const { return ( resMass_ != 0 ) ? resMass_->unblindValue() : -1.0; }
+
+ //! Get the width of the resonance
+ /*!
+ \return the resonance width
+ */
+ Double_t getWidth() const { return ( resWidth_ != 0 ) ? resWidth_->unblindValue() : -1.0; }
+
+ //! Get the mass parameter of the resonance
+ /*!
+ \return the resonance mass parameter
+ */
+ LauParameter* getMassPar() { return resMass_; }
+
+ //! Get the width parameter of the resonance
+ /*!
+ \return the resonance width parameter
+ */
+ LauParameter* getWidthPar() { return resWidth_; }
+
+ //! Retrieve the resonance parameters, e.g. so that they can be loaded into a fit
+ /*!
+ \return floating parameters of the resonance
+ */
+ virtual const std::vector<LauParameter*>& getFloatingParameters()
+ {
+ return this->getParameters();
+ };
+
+ //! Is the amplitude pre-symmetrised?
+ /*!
+ The default value is kFALSE, so pre-symmetrised lineshapes should override this.
+
+ \return whether the amplitude is already symmetrised
+ */
+ virtual Bool_t preSymmetrised() const { return kFALSE; }
+
+ //! Get the helicity flip flag
+ /*!
+ \return the flip helicity flag
+ */
+ Bool_t flipHelicity() const { return flipHelicity_; }
+
+ //! Set the helicity flip flag
+ /*!
+ \param [in] boolean the helicity flip status
+ */
+ void flipHelicity( const Bool_t boolean ) { flipHelicity_ = boolean; }
+
+ //! Get the ignore momenta flag
+ /*!
+ Whether to ignore the momentum factors in both the spin factor and the mass-dependent width
+
+ \return the ignore momenta flag
+ */
+ Bool_t ignoreMomenta() const { return ignoreMomenta_; }
+
+ //! Set the ignore momenta flag
+ /*!
+ Whether to ignore the momentum factors in both the spin factor and the mass-dependent width
+
+ \param [in] boolean the ignore momenta status
+ */
+ void ignoreMomenta( const Bool_t boolean ) { ignoreMomenta_ = boolean; }
+
+ //! Get the ignore spin flag
+ /*!
+ Whether to set the spinTerm to unity always
+
+ \return the ignore spin flag
+ */
+ Bool_t ignoreSpin() const { return ignoreSpin_; }
+
+ //! Set the ignore spin flag
+ /*!
+ Whether to set the spinTerm to unity always
+
+ \param [in] boolean the ignore spin status
+ */
+ void ignoreSpin( const Bool_t boolean ) { ignoreSpin_ = boolean; }
+
+ //! Get the ignore barrier factor scaling flag
+ /*!
+ Whether to ignore barrier factor scaling in the amplitude numerator, they are still used for the mass-dependent width
+
+ \return the ignore barrier amplitude scaling flag
+ */
+ Bool_t ignoreBarrierScaling() const { return ignoreBarrierScaling_; }
+
+ //! Set the ignore barrier factor scaling flag
+ /*!
+ Whether to ignore barrier factor scaling in the amplitude numerator, they are still used for the mass-dependent width
+
+ \param [in] boolean the ignore barrier factor scaling status
+ */
+ void ignoreBarrierScaling( const Bool_t boolean ) { ignoreBarrierScaling_ = boolean; }
+
+ //! Allow the mass, width and spin of the resonance to be changed
+ /*!
+ Negative values wil be ignored, so if, for example, you
+ want to only change the spin you can provide negative
+ values for the mass and width
+
+ \param [in] newMass new value of the resonance mass
+ \param [in] newWidth new value of the resonance width
+ \param [in] newSpin new value of the resonance spin
+ */
+ void changeResonance( const Double_t newMass, const Double_t newWidth, const Int_t newSpin );
+
+ //! Allow the Blatt-Weisskopf radius for the resonance and parent factors to be changed
+ /*!
+ Negative values wil be ignored, so if, for example, you
+ want to only change the parent radius you can provide a
+ negative value for the resonance radius
+
+ \param [in] resRadius new value of the resonance radius
+ \param [in] parRadius new value of the parent radius
+ */
+ void changeBWBarrierRadii( const Double_t resRadius, const Double_t parRadius );
+
+ //! Set value of the various parameters
+ /*!
+ \param [in] name the name of the parameter to be changed
+ \param [in] value the new parameter value
+ */
+ virtual void setResonanceParameter( const TString& name, const Double_t value );
+
+ //! Allow the various parameters to float in the fit
+ /*!
+ \param [in] name the name of the parameter to be floated
+ */
+ virtual void floatResonanceParameter( const TString& name );
+
+ //! Access the given resonance parameter
+ /*!
+ \param [in] name the name of the parameter
+ \return the corresponding parameter
+ */
+ virtual LauParameter* getResonanceParameter( const TString& name );
+
+ //! Fix or release the resonance mass
+ /*!
+ \param [in] parFixed new status of mass
+ */
+ void fixMass( const Bool_t parFixed )
+ {
+ if ( resMass_ != 0 ) {
+ resMass_->fixed( parFixed );
+ }
+ }
+
+ //! Fix or release the resonance width
+ /*!
+ \param [in] parFixed new status of width
+ */
+ void fixWidth( const Bool_t parFixed )
+ {
+ if ( resWidth_ != 0 ) {
+ resWidth_->fixed( parFixed );
+ }
+ }
+
+ //! Get the status of resonance mass (fixed or released)
+ /*!
+ \return the status of resonance mass (fixed or released)
+ */
+ Bool_t fixMass() const { return ( resMass_ != 0 ) ? resMass_->fixed() : kTRUE; }
+
+ //! Get the status of resonance width (fixed or released)
+ /*!
+ \return the status of resonance width (fixed or released)
+ */
+ Bool_t fixWidth() const { return ( resWidth_ != 0 ) ? resWidth_->fixed() : kTRUE; }
+
+ //! Set the spin formalism to be used
+ /*!
+ \param [in] spinType the spin formalism
+ */
+ void setSpinType( const LauSpinType spinType ) { spinType_ = spinType; }
+
+ //! Set the form factor model and parameters
+ /*!
+ \param [in] resFactor the barrier factor for the resonance decay
+ \param [in] parFactor the barrier factor for the parent decay
+ */
+ void setBarrierRadii( LauBlattWeisskopfFactor* resFactor, LauBlattWeisskopfFactor* parFactor )
+ {
+ resBWFactor_ = resFactor;
+ parBWFactor_ = parFactor;
+ }
+
+ //! Fix or release the Blatt-Weisskopf barrier radii
+ void fixBarrierRadii( const Bool_t fixResRadius, const Bool_t fixParRadius );
+
+ //! Get the status of resonance barrier radius (fixed or released)
+ Bool_t fixResRadius() const;
+
+ //! Get the status of parent barrier radius (fixed or released)
+ Bool_t fixParRadius() const;
+
+ //! Get the radius of the resonance barrier factor
+ Double_t getResRadius() const;
+
+ //! Get the radius of the parent barrier factor
+ Double_t getParRadius() const;
+
+ protected:
+ //! Get the name of the parent particle
+ TString getNameParent() const;
+ //! Get the name of the first daughter of the resonance
+ TString getNameDaug1() const;
+ //! Get the name of the second daughter of the resonance
+ TString getNameDaug2() const;
+ //! Get the name of the daughter that does not originate form the resonance
+ TString getNameBachelor() const;
+ //! Get the parent particle mass
+ Double_t getMassParent() const;
+ //! Get the mass of daughter 1
+ Double_t getMassDaug1() const;
+ //! Get the mass of daughter 2
+ Double_t getMassDaug2() const;
+ //! Get the mass of the bachelor daughter
+ Double_t getMassBachelor() const;
+ //! Get the Charge of the parent particle
+ Int_t getChargeParent() const;
+ //! Get the charge of daughter 1
+ Int_t getChargeDaug1() const;
+ //! Get the charge of daughter 2
+ Int_t getChargeDaug2() const;
+ //! Get the charge of the bachelor daughter
+ Int_t getChargeBachelor() const;
+
+ //! Get the current value of the daughter momentum in the resonance rest frame
+ Double_t getQ() const { return q_; }
+
+ //! Get the current value of the bachelor momentum in the resonance rest frame
+ Double_t getP() const { return p_; }
+
+ //! Get the current value of the bachelor momentum in the parent rest frame
+ Double_t getPstar() const { return pstar_; }
+
+ //! Get the current value of the full spin-dependent covariant factor
+ Double_t getCovFactor() const { return covFactor_; }
+
+ //! Get the centrifugal barrier for the parent decay
+ LauBlattWeisskopfFactor* getParBWFactor() { return parBWFactor_; }
+
+ //! Get the centrifugal barrier for the parent decay
+ const LauBlattWeisskopfFactor* getParBWFactor() const { return parBWFactor_; }
+
+ //! Get the centrifugal barrier for the resonance decay
+ LauBlattWeisskopfFactor* getResBWFactor() { return resBWFactor_; }
+
+ //! Get the centrifugal barrier for the resonance decay
+ const LauBlattWeisskopfFactor* getResBWFactor() const { return resBWFactor_; }
+
+ //! Access the resonance info object
+ LauResonanceInfo* getResInfo() const { return resInfo_; }
+
+ //! Access the daughters object
+ const LauDaughters* getDaughters() const { return daughters_; }
+
+ //! Calculate the amplitude spin term using the Zemach tensor formalism
+ /*!
+ \param [in] pProd the momentum factor (either q * p or q * pstar)
+ */
+ Double_t calcZemachSpinFactor( const Double_t pProd ) const;
+
+ //! Calculate the amplitude spin term using the covariant tensor formalism
+ /*!
+ \param [in] pProd the momentum factor (q * pstar)
+ */
+ Double_t calcCovSpinFactor( const Double_t pProd );
+
+ //! Calculate the spin-dependent covariant factor
+ /*!
+ \param [in] erm E_ij in the parent rest-frame divided by m_ij (equivalent to sqrt(1 + p^2/mParent^2))
+ */
+ void calcCovFactor( const Double_t erm );
+
+ //! Calculate the Legendre polynomial for the spin factor
+ /*!
+ Uses the current-event value of cosHel_
+ */
+ Double_t calcLegendrePoly() const;
+
+ //! Calculate the Legendre polynomial for the spin factor (specifying the cosHel value)
+ /*!
+ \param [in] cosHel the cosine of the helicity angle
+ */
+ Double_t calcLegendrePoly( const Double_t cosHel );
+
+ //! Complex resonant amplitude
+ /*!
+ \param [in] mass appropriate invariant mass for the resonance
+ \param [in] spinTerm spin term
+ */
+ virtual LauComplex resAmp( Double_t mass, Double_t spinTerm ) = 0;
+
+ //! Clear list of floating parameters
+ void clearFloatingParameters() { resParameters_.clear(); }
+
+ //! Add parameter to the list of floating parameters
+ /*!
+ \param [in] param the parameter to be added to the list
+ */
+ void addFloatingParameter( LauParameter* param );
+
+ //! Access the list of floating parameters
+ std::vector<LauParameter*>& getParameters() { return resParameters_; }
+
+ private:
+ //! Copy constructor (not implemented)
+ LauAbsResonance( const LauAbsResonance& rhs );
+
+ //! Copy assignment operator (not implemented)
+ LauAbsResonance& operator=( const LauAbsResonance& rhs );
+
+ //! Information on the resonance
+ LauResonanceInfo* resInfo_ { 0 };
+
+ //! Information on the particles
+ const LauDaughters* daughters_;
+
+ //! Parent name
+ TString nameParent_ { "" };
+ //! Daughter 1 name
+ TString nameDaug1_ { "" };
+ //! Daughter 2 name
+ TString nameDaug2_ { "" };
+ //! Bachelor name
+ TString nameBachelor_ { "" };
+
+ //! Parent charge
+ Int_t chargeParent_ { 0 };
+ //! Daughter 1 charge
+ Int_t chargeDaug1_ { 0 };
+ //! Daughter 2 charge
+ Int_t chargeDaug2_ { 0 };
+ //! Bachelor charge
+ Int_t chargeBachelor_ { 0 };
+
+ //! Parent mass
+ Double_t massParent_ { 0.0 };
+ //! Daughter 1 mass
+ Double_t massDaug1_ { 0.0 };
+ //! Daughter 2 mass
+ Double_t massDaug2_ { 0.0 };
+ //! Bachelor mass
+ Double_t massBachelor_ { 0.0 };
+
+ //! Resonance name
+ TString resName_;
+
+ //! Resonance name with illegal characters removed
+ TString sanitisedName_;
+
+ //! Resonance mass
+ LauParameter* resMass_ { 0 };
+ //! Resonance width
+ LauParameter* resWidth_ { 0 };
+
+ //! All parameters of the resonance
+ std::vector<LauParameter*> resParameters_;
+
+ //! Resonance spin
+ Int_t resSpin_;
+ //! Resonance charge
+ Int_t resCharge_ { 0 };
+ //! DP axis identifier
+ Int_t resPairAmpInt_;
+ //! Blatt Weisskopf barrier for parent decay
+ LauBlattWeisskopfFactor* parBWFactor_ { 0 };
+ //! Blatt Weisskopf barrier for resonance decay
+ LauBlattWeisskopfFactor* resBWFactor_ { 0 };
+
+ //! Spin formalism
+ LauSpinType spinType_ { Zemach_P };
+
+ //! Boolean to flip helicity
+ Bool_t flipHelicity_ { kFALSE };
+ //! Boolean to ignore the momentum factors in both the spin factor and the mass-dependent width
+ Bool_t ignoreMomenta_ { kFALSE };
+ //! Boolean to set the spinTerm to unity always
+ Bool_t ignoreSpin_ { kFALSE };
+ //! Boolean to ignore barrier factor scaling in the amplitude numerator, they are still used for the mass-dependent width
+ Bool_t ignoreBarrierScaling_ { kFALSE };
+
+ // Event kinematics information
+
+ //! Invariant mass
+ Double_t mass_ { 0.0 };
+ //! Helicity angle cosine
+ Double_t cosHel_ { 0.0 };
+
+ //! Daughter momentum in resonance rest frame
+ Double_t q_ { 0.0 };
+ //! Bachelor momentum in resonance rest frame
+ Double_t p_ { 0.0 };
+ //! Bachelor momentum in parent rest frame
+ Double_t pstar_ { 0.0 };
+
+ //! Covariant factor
+ /*!
+ sqrt(1 + z*z), where z = p / mParent
+
+ Can also be expressed as E_ij in the parent rest-frame divided by m_ij - indeed this is how LauKinematics calculates it.
+
+ \see LauKinematics::getcov12
+ \see LauKinematics::getcov13
+ \see LauKinematics::getcov23
+ */
+ Double_t erm_ { 1.0 };
+
+ //! Covariant factor (full spin-dependent expression)
+ Double_t covFactor_ { 1.0 };
+
+ ClassDef( LauAbsResonance, 0 ) // Abstract resonance class
};
#endif
diff --git a/inc/LauArgusPdf.hh b/inc/LauArgusPdf.hh
index a255839..cfefde5 100644
--- a/inc/LauArgusPdf.hh
+++ b/inc/LauArgusPdf.hh
@@ -1,98 +1,100 @@
/*
Copyright 2006 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauArgusPdf.hh
\brief File containing declaration of LauArgusPdf class.
*/
/*! \class LauArgusPdf
\brief Class for defining an ARGUS PDF.
Class that allows the user to define an ARGUS PDF:
Phys. Lett. B 241, 278 (1990)
*/
#ifndef LAU_ARGUS_PDF
#define LAU_ARGUS_PDF
-#include <vector>
+#include "LauAbsPdf.hh"
#include "TString.h"
-#include "LauAbsPdf.hh"
+#include <vector>
class LauParameter;
-
class LauArgusPdf : public LauAbsPdf {
- public:
- //! Constructor
- /*!
- \param [in] theVarName the name of the abscissa variable
- \param [in] params the curve parameters - the shape, xi, and the end-point, m0, of the curve
- \param [in] minAbscissa the minimum value of the abscissa
- \param [in] maxAbscissa the maximum value of the abscissa
- */
- LauArgusPdf(const TString& theVarName, const std::vector<LauAbsRValue*>& params, Double_t minAbscissa, Double_t maxAbscissa);
+ public:
+ //! Constructor
+ /*!
+ \param [in] theVarName the name of the abscissa variable
+ \param [in] params the curve parameters - the shape, xi, and the end-point, m0, of the curve
+ \param [in] minAbscissa the minimum value of the abscissa
+ \param [in] maxAbscissa the maximum value of the abscissa
+ */
+ LauArgusPdf( const TString& theVarName,
+ const std::vector<LauAbsRValue*>& params,
+ Double_t minAbscissa,
+ Double_t maxAbscissa );
+
+ //! Destructor
+ virtual ~LauArgusPdf();
- //! Destructor
- virtual ~LauArgusPdf();
+ //! Calculate the likelihood (and intermediate info) for a given abscissa
+ /*!
+ \param [in] abscissas the values of the abscissa(s)
+ */
+ virtual void calcLikelihoodInfo( const LauAbscissas& abscissas );
- //! Calculate the likelihood (and intermediate info) for a given abscissa
- /*!
- \param [in] abscissas the values of the abscissa(s)
- */
- virtual void calcLikelihoodInfo(const LauAbscissas& abscissas);
-
- using LauAbsPdf::calcLikelihoodInfo;
+ using LauAbsPdf::calcLikelihoodInfo;
- //! Calculate the normalisation
- virtual void calcNorm();
+ //! Calculate the normalisation
+ virtual void calcNorm();
- //! Calculate the PDF height
- /*!
- \param [in] kinematics the current DP kinematics
- */
- virtual void calcPDFHeight( const LauKinematics* kinematics );
+ //! Calculate the PDF height
+ /*!
+ \param [in] kinematics the current DP kinematics
+ */
+ virtual void calcPDFHeight( const LauKinematics* kinematics );
- protected:
+ protected:
- private:
- //! Copy constructor (not implemented)
- LauArgusPdf(const LauArgusPdf& other);
+ private:
+ //! Copy constructor (not implemented)
+ LauArgusPdf( const LauArgusPdf& other );
- //! Copy assignment operator (not implemented)
- LauArgusPdf& operator=(const LauArgusPdf& other);
+ //! Copy assignment operator (not implemented)
+ LauArgusPdf& operator=( const LauArgusPdf& other );
- //! Shape of curve
- LauAbsRValue* xi_;
+ //! Shape of curve
+ LauAbsRValue* xi_;
- //! Endpoint of curve
- LauAbsRValue* m0_;
+ //! Endpoint of curve
+ LauAbsRValue* m0_;
- ClassDef(LauArgusPdf,0) // Define the ARGUS PDF
+ ClassDef( LauArgusPdf, 0 ) // Define the ARGUS PDF
};
#endif
diff --git a/inc/LauAsymmCalc.hh b/inc/LauAsymmCalc.hh
index 6477cfb..2a47044 100644
--- a/inc/LauAsymmCalc.hh
+++ b/inc/LauAsymmCalc.hh
@@ -1,84 +1,83 @@
/*
Copyright 2004 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauAsymmCalc.hh
\brief File containing declaration of LauAsymmCalc class.
*/
/*! \class LauAsymmCalc
\brief Class for calculating the asymmetry between two variables.
*/
#ifndef LAU_ASYMM_CALC
#define LAU_ASYMM_CALC
#include "Rtypes.h"
-
class LauAsymmCalc {
- public:
- //! Constructor
- /*!
- \param [in] negValue the negative value
- \param [in] posValue the positive value
- */
- LauAsymmCalc(Double_t negValue, Double_t posValue);
+ public:
+ //! Constructor
+ /*!
+ \param [in] negValue the negative value
+ \param [in] posValue the positive value
+ */
+ LauAsymmCalc( Double_t negValue, Double_t posValue );
- //! Destructor
- virtual ~LauAsymmCalc();
+ //! Destructor
+ virtual ~LauAsymmCalc();
- //! Copy constructor
- LauAsymmCalc(const LauAsymmCalc& rhs);
+ //! Copy constructor
+ LauAsymmCalc( const LauAsymmCalc& rhs );
- //! Copy assignment operator
- LauAsymmCalc& operator=(const LauAsymmCalc& rhs);
+ //! Copy assignment operator
+ LauAsymmCalc& operator=( const LauAsymmCalc& rhs );
- //! Retrieve the asymmetry
- /*!
- \return the asymmetry
- */
- Double_t getAsymmetry() {return asymm_;}
+ //! Retrieve the asymmetry
+ /*!
+ \return the asymmetry
+ */
+ Double_t getAsymmetry() { return asymm_; }
- protected:
- //! Calculate the asymmetry
- /*!
- \return the asymmetry
- */
- Double_t calcAsymmetry();
+ protected:
+ //! Calculate the asymmetry
+ /*!
+ \return the asymmetry
+ */
+ Double_t calcAsymmetry();
- private:
- //! The negative value
- Double_t negValue_;
+ private:
+ //! The negative value
+ Double_t negValue_;
- //! The positive value
- Double_t posValue_;
+ //! The positive value
+ Double_t posValue_;
- //! The asymmetry
- Double_t asymm_;
+ //! The asymmetry
+ Double_t asymm_;
- ClassDef(LauAsymmCalc,0) // Calculate asymmetry between two variables
+ ClassDef( LauAsymmCalc, 0 ) // Calculate asymmetry between two variables
};
#endif
diff --git a/inc/LauBelleCPCoeffSet.hh b/inc/LauBelleCPCoeffSet.hh
index fb0364f..b4f0f88 100644
--- a/inc/LauBelleCPCoeffSet.hh
+++ b/inc/LauBelleCPCoeffSet.hh
@@ -1,177 +1,190 @@
/*
Copyright 2006 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauBelleCPCoeffSet.hh
\brief File containing declaration of LauBelleCPCoeffSet class.
*/
/*! \class LauBelleCPCoeffSet
\brief Class for defining a complex coefficient using the Belle CP convention.
Holds a set of real values that define the complex coefficient of an amplitude component.
- The amplitude has the form a * exp(i*delta) * ( 1 +/- b * exp(i*phi) ) where
+ The amplitude has the form a * exp(i*delta) * ( 1 +/- b * exp(i*phi) ) where
a is a CP conserving magnitude,
b is a CP violating magnitude,
delta is the strong phase
and phi is the weak phase.
[Phys.Rev.Lett. 96 (2006) 251803]
*/
#ifndef LAU_BELLECP_COEFF_SET
#define LAU_BELLECP_COEFF_SET
-#include <iosfwd>
-#include <vector>
-
-#include "Rtypes.h"
-
#include "LauAbsCoeffSet.hh"
#include "LauComplex.hh"
#include "LauParameter.hh"
+#include "Rtypes.h"
+
+#include <iosfwd>
+#include <vector>
class LauBelleCPCoeffSet : public LauAbsCoeffSet {
- public:
- //! Constructor
- /*!
- \param [in] compName the name of the coefficient set
- \param [in] a the magnitude a
- \param [in] delta the strong phase
- \param [in] b the magnitude b
- \param [in] phi the weak phase
- \param [in] aFixed whether a is fixed
- \param [in] deltaFixed whether delta is fixed
- \param [in] bFixed whether b is fixed
- \param [in] phiFixed whether phi is fixed
- \param [in] bSecondStage whether b should be floated only in the second stage of the fit
- \param [in] phiSecondStage whether phi should be floated only in the second stage of the fit
- */
- LauBelleCPCoeffSet(const TString& compName, Double_t a, Double_t delta, Double_t b, Double_t phi,
- Bool_t aFixed, Bool_t deltaFixed, Bool_t bFixed, Bool_t phiFixed, Bool_t bSecondStage = kFALSE, Bool_t phiSecondStage = kFALSE);
-
- //! Destructor
- virtual ~LauBelleCPCoeffSet(){}
-
- //! Retrieve the parameters of the coefficient, e.g. so that they can be loaded into a fit
- /*!
- \return the parameters of the coefficient
- */
- virtual std::vector<LauParameter*> getParameters();
-
- //! Print the current values of the parameters
- virtual void printParValues() const;
-
- //! Print the column headings for a results table
- /*!
- \param [out] stream the stream to print to
- */
- virtual void printTableHeading(std::ostream& stream) const;
-
- //! Print the parameters of the complex coefficient as a row in the results table
- /*!
- \param [out] stream the stream to print to
- */
- virtual void printTableRow(std::ostream& stream) const;
-
- //! Randomise the starting values of the parameters for a fit
- virtual void randomiseInitValues();
-
- //! Make sure values are in "standard" ranges, e.g. phases should be between -pi and pi
- virtual void finaliseValues();
-
- //! Retrieve the complex coefficient for a particle
- /*!
- \return the complex coefficient for a particle
- */
- virtual const LauComplex& particleCoeff();
-
- //! Retrieve the complex coefficient for an antiparticle
- /*!
- \return the complex coefficient for an antiparticle
- */
- virtual const LauComplex& antiparticleCoeff();
-
- //! Set the parameters based on the complex coefficients for particles and antiparticles
- /*!
- \param [in] coeff the complex coefficient for a particle
- \param [in] coeffBar the complex coefficient for an antiparticle
- \param [in] init whether or not the initial and generated values should also be adjusted
- */
- virtual void setCoeffValues( const LauComplex& coeff, const LauComplex& coeffBar, Bool_t init );
-
- //! Calculate the CP asymmetry
- /*!
- \return the CP asymmetry
- */
- virtual LauParameter acp();
-
- //! Create a clone of the coefficient set
- /*!
- \param [in] newName the clone's name
- \param [in] cloneOption special option for the cloning operation
- \param [in] constFactor a constant factor to multiply the clone's parameters by
- \return a clone of the coefficient set
- */
- virtual LauAbsCoeffSet* createClone(const TString& newName, CloneOption cloneOption = All, Double_t constFactor = 1.0);
-
- private:
- //! Copy constructor
- /*!
- This creates cloned parameters, not copies.
- \param [in] rhs the coefficient to clone
- \param [in] cloneOption special option for the cloning operation
- \param [in] constFactor a constant factor to multiply the clone's parameters by
- */
- LauBelleCPCoeffSet(const LauBelleCPCoeffSet& rhs, CloneOption cloneOption = All, Double_t constFactor = 1.0);
-
- //! Copy assignment operator (not implemented)
- /*!
- \param [in] rhs the coefficient to clone
- */
- LauBelleCPCoeffSet& operator=(const LauBelleCPCoeffSet& rhs);
-
- // the actual fit parameters
- // (need to be pointers so they can be cloned)
- //! The magnitude a
- LauParameter* a_;
- //! The magnitude b
- LauParameter* b_;
- //! The strong phase
- LauParameter* delta_;
- //! The weak phase
- LauParameter* phi_;
-
- //! The particle complex coefficient
- LauComplex particleCoeff_;
- //! The antiparticle complex coefficient
- LauComplex antiparticleCoeff_;
-
- //! The CP asymmetry
- LauParameter acp_;
-
- ClassDef(LauBelleCPCoeffSet, 0)
+ public:
+ //! Constructor
+ /*!
+ \param [in] compName the name of the coefficient set
+ \param [in] a the magnitude a
+ \param [in] delta the strong phase
+ \param [in] b the magnitude b
+ \param [in] phi the weak phase
+ \param [in] aFixed whether a is fixed
+ \param [in] deltaFixed whether delta is fixed
+ \param [in] bFixed whether b is fixed
+ \param [in] phiFixed whether phi is fixed
+ \param [in] bSecondStage whether b should be floated only in the second stage of the fit
+ \param [in] phiSecondStage whether phi should be floated only in the second stage of the fit
+ */
+ LauBelleCPCoeffSet( const TString& compName,
+ Double_t a,
+ Double_t delta,
+ Double_t b,
+ Double_t phi,
+ Bool_t aFixed,
+ Bool_t deltaFixed,
+ Bool_t bFixed,
+ Bool_t phiFixed,
+ Bool_t bSecondStage = kFALSE,
+ Bool_t phiSecondStage = kFALSE );
+
+ //! Destructor
+ virtual ~LauBelleCPCoeffSet() {}
+
+ //! Retrieve the parameters of the coefficient, e.g. so that they can be loaded into a fit
+ /*!
+ \return the parameters of the coefficient
+ */
+ virtual std::vector<LauParameter*> getParameters();
+
+ //! Print the current values of the parameters
+ virtual void printParValues() const;
+
+ //! Print the column headings for a results table
+ /*!
+ \param [out] stream the stream to print to
+ */
+ virtual void printTableHeading( std::ostream& stream ) const;
+
+ //! Print the parameters of the complex coefficient as a row in the results table
+ /*!
+ \param [out] stream the stream to print to
+ */
+ virtual void printTableRow( std::ostream& stream ) const;
+
+ //! Randomise the starting values of the parameters for a fit
+ virtual void randomiseInitValues();
+
+ //! Make sure values are in "standard" ranges, e.g. phases should be between -pi and pi
+ virtual void finaliseValues();
+
+ //! Retrieve the complex coefficient for a particle
+ /*!
+ \return the complex coefficient for a particle
+ */
+ virtual const LauComplex& particleCoeff();
+
+ //! Retrieve the complex coefficient for an antiparticle
+ /*!
+ \return the complex coefficient for an antiparticle
+ */
+ virtual const LauComplex& antiparticleCoeff();
+
+ //! Set the parameters based on the complex coefficients for particles and antiparticles
+ /*!
+ \param [in] coeff the complex coefficient for a particle
+ \param [in] coeffBar the complex coefficient for an antiparticle
+ \param [in] init whether or not the initial and generated values should also be adjusted
+ */
+ virtual void setCoeffValues( const LauComplex& coeff, const LauComplex& coeffBar, Bool_t init );
+
+ //! Calculate the CP asymmetry
+ /*!
+ \return the CP asymmetry
+ */
+ virtual LauParameter acp();
+
+ //! Create a clone of the coefficient set
+ /*!
+ \param [in] newName the clone's name
+ \param [in] cloneOption special option for the cloning operation
+ \param [in] constFactor a constant factor to multiply the clone's parameters by
+ \return a clone of the coefficient set
+ */
+ virtual LauAbsCoeffSet* createClone( const TString& newName,
+ CloneOption cloneOption = All,
+ Double_t constFactor = 1.0 );
+
+ private:
+ //! Copy constructor
+ /*!
+ This creates cloned parameters, not copies.
+
+ \param [in] rhs the coefficient to clone
+ \param [in] cloneOption special option for the cloning operation
+ \param [in] constFactor a constant factor to multiply the clone's parameters by
+ */
+ LauBelleCPCoeffSet( const LauBelleCPCoeffSet& rhs,
+ CloneOption cloneOption = All,
+ Double_t constFactor = 1.0 );
+
+ //! Copy assignment operator (not implemented)
+ /*!
+ \param [in] rhs the coefficient to clone
+ */
+ LauBelleCPCoeffSet& operator=( const LauBelleCPCoeffSet& rhs );
+
+ // the actual fit parameters
+ // (need to be pointers so they can be cloned)
+ //! The magnitude a
+ LauParameter* a_;
+ //! The magnitude b
+ LauParameter* b_;
+ //! The strong phase
+ LauParameter* delta_;
+ //! The weak phase
+ LauParameter* phi_;
+
+ //! The particle complex coefficient
+ LauComplex particleCoeff_;
+ //! The antiparticle complex coefficient
+ LauComplex antiparticleCoeff_;
+
+ //! The CP asymmetry
+ LauParameter acp_;
+
+ ClassDef( LauBelleCPCoeffSet, 0 )
};
#endif
diff --git a/inc/LauBelleNR.hh b/inc/LauBelleNR.hh
index e50bd0a..89badb5 100644
--- a/inc/LauBelleNR.hh
+++ b/inc/LauBelleNR.hh
@@ -1,155 +1,159 @@
/*
Copyright 2004 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauBelleNR.hh
\brief File containing declaration of LauBelleNR class.
*/
/*! \class LauBelleNR
\brief Class for defining the Belle nonresonant model.
Defines the nonresonant model from the Belle collaboration.
arXiv:hep-ex/0412066
*/
#ifndef LAU_BELLE_NR
#define LAU_BELLE_NR
-#include "TString.h"
-
-#include "LauComplex.hh"
#include "LauAbsResonance.hh"
+#include "LauComplex.hh"
+
+#include "TString.h"
class LauKinematics;
class LauParameter;
-
class LauBelleNR : public LauAbsResonance {
- public:
- //! Constructor
- /*!
- \param [in] resInfo the object containing information on the resonance name, mass, width, spin, charge, etc.
- \param [in] resType the model of the resonance
- \param [in] resPairAmpInt the number of the daughter not produced by the resonance
- \param [in] daughters the daughter particles
- */
- LauBelleNR(LauResonanceInfo* resInfo, const LauAbsResonance::LauResonanceModel resType,
- const Int_t resPairAmpInt, const LauDaughters* daughters);
-
- //! Destructor
- virtual ~LauBelleNR();
-
- //! Override the enforcement of pure Legendre polynomial spin factors
- /*!
- By default this model uses pure Legendre polynomial
- spin factors, regardless of the default type set in
- LauResonanceMaker or any specific request from the user.
- This function allows the enforcement to be overridden.
-
- \param [in] forceLegendre boolean flag (kTRUE, the default, implies enforcement of pure Legendre spin factors, kFALSE overrides this to allow use of other formalisms)
- */
- void enforceLegendreSpinFactors( const Bool_t forceLegendre ) { forceLegendre_ = forceLegendre; }
-
- //! Initialise the model
- virtual void initialise();
-
- //! Get the resonance model type
- /*!
- \return the resonance model type
- */
- virtual LauAbsResonance::LauResonanceModel getResonanceModel() const {return model_;}
-
- //! Set value of the various parameters
- /*!
- \param [in] name the name of the parameter to be changed
- \param [in] value the new parameter value
- */
- virtual void setResonanceParameter(const TString& name, const Double_t value);
-
- //! Allow the various parameters to float in the fit
- /*!
- \param [in] name the name of the parameter to be floated
- */
- virtual void floatResonanceParameter(const TString& name);
-
- //! Access the given resonance parameter
- /*!
- \param [in] name the name of the parameter
- \return the corresponding parameter
- */
- virtual LauParameter* getResonanceParameter(const TString& name);
-
- //! Retrieve the resonance parameters, e.g. so that they can be loaded into a fit
- /*!
- \return floating parameters of the resonance
- */
- virtual const std::vector<LauParameter*>& getFloatingParameters();
-
- protected:
- //! Set the parameter alpha, the effective range
- /*!
- \param [in] alpha the new effective range parameter value
- */
- void setAlpha(const Double_t alpha);
-
- //! Get the effective range parameter
- /*!
- \return the effective range parameter
- */
- Double_t getAlpha() const {return (alpha_!=0) ? alpha_->unblindValue() : 0.0;}
-
- //! See if the alpha parameter is fixed or floating
- /*!
- \return kTRUE if the effective range parameter is fixed, kFALSE otherwise
- */
- Bool_t fixAlpha() const {return (alpha_!=0) ? alpha_->fixed() : kTRUE;}
-
- //! Complex resonant amplitude
- /*!
- \param [in] mass appropriate invariant mass for the resonance
- \param [in] spinTerm spin term
- */
- virtual LauComplex resAmp(Double_t mass, Double_t spinTerm);
-
- private:
- //! Copy constructor (not implemented)
- LauBelleNR(const LauBelleNR& rhs);
-
- //! Copy assignment operator (not implemented)
- LauBelleNR& operator=(const LauBelleNR& rhs);
-
- //! The range parameter
- LauParameter* alpha_;
-
- //! The model to use
- LauAbsResonance::LauResonanceModel model_;
-
- //! Force use of Legendre spin factors
- Bool_t forceLegendre_;
-
- ClassDef(LauBelleNR,0)
+ public:
+ //! Constructor
+ /*!
+ \param [in] resInfo the object containing information on the resonance name, mass, width, spin, charge, etc.
+ \param [in] resType the model of the resonance
+ \param [in] resPairAmpInt the number of the daughter not produced by the resonance
+ \param [in] daughters the daughter particles
+ */
+ LauBelleNR( LauResonanceInfo* resInfo,
+ const LauAbsResonance::LauResonanceModel resType,
+ const Int_t resPairAmpInt,
+ const LauDaughters* daughters );
+
+ //! Destructor
+ virtual ~LauBelleNR();
+
+ //! Override the enforcement of pure Legendre polynomial spin factors
+ /*!
+ By default this model uses pure Legendre polynomial
+ spin factors, regardless of the default type set in
+ LauResonanceMaker or any specific request from the user.
+ This function allows the enforcement to be overridden.
+
+ \param [in] forceLegendre boolean flag (kTRUE, the default, implies enforcement of pure Legendre spin factors, kFALSE overrides this to allow use of other formalisms)
+ */
+ void enforceLegendreSpinFactors( const Bool_t forceLegendre )
+ {
+ forceLegendre_ = forceLegendre;
+ }
+
+ //! Initialise the model
+ virtual void initialise();
+
+ //! Get the resonance model type
+ /*!
+ \return the resonance model type
+ */
+ virtual LauAbsResonance::LauResonanceModel getResonanceModel() const { return model_; }
+
+ //! Set value of the various parameters
+ /*!
+ \param [in] name the name of the parameter to be changed
+ \param [in] value the new parameter value
+ */
+ virtual void setResonanceParameter( const TString& name, const Double_t value );
+
+ //! Allow the various parameters to float in the fit
+ /*!
+ \param [in] name the name of the parameter to be floated
+ */
+ virtual void floatResonanceParameter( const TString& name );
+
+ //! Access the given resonance parameter
+ /*!
+ \param [in] name the name of the parameter
+ \return the corresponding parameter
+ */
+ virtual LauParameter* getResonanceParameter( const TString& name );
+
+ //! Retrieve the resonance parameters, e.g. so that they can be loaded into a fit
+ /*!
+ \return floating parameters of the resonance
+ */
+ virtual const std::vector<LauParameter*>& getFloatingParameters();
+
+ protected:
+ //! Set the parameter alpha, the effective range
+ /*!
+ \param [in] alpha the new effective range parameter value
+ */
+ void setAlpha( const Double_t alpha );
+
+ //! Get the effective range parameter
+ /*!
+ \return the effective range parameter
+ */
+ Double_t getAlpha() const { return ( alpha_ != 0 ) ? alpha_->unblindValue() : 0.0; }
+
+ //! See if the alpha parameter is fixed or floating
+ /*!
+ \return kTRUE if the effective range parameter is fixed, kFALSE otherwise
+ */
+ Bool_t fixAlpha() const { return ( alpha_ != 0 ) ? alpha_->fixed() : kTRUE; }
+
+ //! Complex resonant amplitude
+ /*!
+ \param [in] mass appropriate invariant mass for the resonance
+ \param [in] spinTerm spin term
+ */
+ virtual LauComplex resAmp( Double_t mass, Double_t spinTerm );
+
+ private:
+ //! Copy constructor (not implemented)
+ LauBelleNR( const LauBelleNR& rhs );
+
+ //! Copy assignment operator (not implemented)
+ LauBelleNR& operator=( const LauBelleNR& rhs );
+
+ //! The range parameter
+ LauParameter* alpha_;
+
+ //! The model to use
+ LauAbsResonance::LauResonanceModel model_;
+
+ //! Force use of Legendre spin factors
+ Bool_t forceLegendre_;
+
+ ClassDef( LauBelleNR, 0 )
};
#endif
diff --git a/inc/LauBelleSymNR.hh b/inc/LauBelleSymNR.hh
index 62e800c..edef6af 100644
--- a/inc/LauBelleSymNR.hh
+++ b/inc/LauBelleSymNR.hh
@@ -1,147 +1,147 @@
/*
Copyright 2013 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauBelleSymNR.hh
\brief File containing declaration of LauBelleSymNR class.
*/
/*! \class LauBelleSymNR
\brief Class for defining the symmetric Belle Non Resonant model
- Defines the Non Resonant model from the Belle collaboration for the case
+ Defines the Non Resonant model from the Belle collaboration for the case
of a symmetrical DP
*/
#ifndef LAU_BELLE_SYM_NR
#define LAU_BELLE_SYM_NR
-#include "TString.h"
-
-#include "LauComplex.hh"
#include "LauAbsResonance.hh"
+#include "LauComplex.hh"
-class LauKinematics;
+#include "TString.h"
+class LauKinematics;
class LauBelleSymNR : public LauAbsResonance {
- public:
- //! Constructor
- /*!
- \param [in] resInfo the object containing information on the resonance name, mass, width, spin, charge, etc.
- \param [in] resType the model of the resonance
- \param [in] resPairAmpInt the number of the daughter not produced by the resonance
- \param [in] daughters the daughter particles
- */
- LauBelleSymNR(LauResonanceInfo* resInfo, const LauAbsResonance::LauResonanceModel resType,
- const Int_t resPairAmpInt, const LauDaughters* daughters);
-
- //! Destructor
- virtual ~LauBelleSymNR();
-
- //! Initialise
- virtual void initialise();
-
- //! Get the complex dynamical amplitude
- /*!
- \param [in] kinematics the kinematic variables of the current event
- \return the complex amplitude
- */
- virtual LauComplex amplitude(const LauKinematics* kinematics);
-
- //! Get the resonance model type
- /*!
- \return the resonance model type
- */
- virtual LauAbsResonance::LauResonanceModel getResonanceModel() const {return model_;}
-
- //! Is the amplitude pre-symmetrised?
- /*!
- \return kTRUE, indicating that the amplitude is already symmetrised
- */
- virtual Bool_t preSymmetrised() const {return kTRUE;}
-
- //! Set value of the various parameters
- /*!
- \param [in] name the name of the parameter to be changed
- \param [in] value the new parameter value
- */
- virtual void setResonanceParameter(const TString& name, const Double_t value);
-
- //! Allow the various parameters to float in the fit
- /*!
- \param [in] name the name of the parameter to be floated
- */
- virtual void floatResonanceParameter(const TString& name);
-
- //! Access the given resonance parameter
- /*!
- \param [in] name the name of the parameter
- \return the corresponding parameter
- */
- virtual LauParameter* getResonanceParameter(const TString& name);
-
- //! Retrieve the resonance parameters, e.g. so that they can be loaded into a fit
- /*!
- \return floating parameters of the resonance
- */
- virtual const std::vector<LauParameter*>& getFloatingParameters();
-
- protected:
- //! Set the parameter alpha, the effective range
- /*!
- \param [in] alpha the new effective range parameter
- */
- void setAlpha(const Double_t alpha);
-
- //! Get the effective range parameter
- /*!
- \return the effective range parameter
- */
- Double_t getAlpha() const {return (alpha_!=0) ? alpha_->unblindValue() : 0.0;}
-
- //! See if the alpha parameter is fixed or floating
- Bool_t fixAlpha() const {return (alpha_!=0) ? alpha_->fixed() : kTRUE;}
-
- //! This is not called, amplitude is used directly instead
- virtual LauComplex resAmp(Double_t mass, Double_t spinTerm);
-
- private:
- //! Copy constructor (not implemented)
- LauBelleSymNR(const LauBelleSymNR& rhs);
-
- //! Copy assignment operator (not implemented)
- LauBelleSymNR& operator=(const LauBelleSymNR& rhs);
-
- //! The range parameter
- LauParameter* alpha_;
-
- //! The model to use
- LauAbsResonance::LauResonanceModel model_;
-
- ClassDef(LauBelleSymNR,0) // Belle Non-resonant model
-
+ public:
+ //! Constructor
+ /*!
+ \param [in] resInfo the object containing information on the resonance name, mass, width, spin, charge, etc.
+ \param [in] resType the model of the resonance
+ \param [in] resPairAmpInt the number of the daughter not produced by the resonance
+ \param [in] daughters the daughter particles
+ */
+ LauBelleSymNR( LauResonanceInfo* resInfo,
+ const LauAbsResonance::LauResonanceModel resType,
+ const Int_t resPairAmpInt,
+ const LauDaughters* daughters );
+
+ //! Destructor
+ virtual ~LauBelleSymNR();
+
+ //! Initialise
+ virtual void initialise();
+
+ //! Get the complex dynamical amplitude
+ /*!
+ \param [in] kinematics the kinematic variables of the current event
+ \return the complex amplitude
+ */
+ virtual LauComplex amplitude( const LauKinematics* kinematics );
+
+ //! Get the resonance model type
+ /*!
+ \return the resonance model type
+ */
+ virtual LauAbsResonance::LauResonanceModel getResonanceModel() const { return model_; }
+
+ //! Is the amplitude pre-symmetrised?
+ /*!
+ \return kTRUE, indicating that the amplitude is already symmetrised
+ */
+ virtual Bool_t preSymmetrised() const { return kTRUE; }
+
+ //! Set value of the various parameters
+ /*!
+ \param [in] name the name of the parameter to be changed
+ \param [in] value the new parameter value
+ */
+ virtual void setResonanceParameter( const TString& name, const Double_t value );
+
+ //! Allow the various parameters to float in the fit
+ /*!
+ \param [in] name the name of the parameter to be floated
+ */
+ virtual void floatResonanceParameter( const TString& name );
+
+ //! Access the given resonance parameter
+ /*!
+ \param [in] name the name of the parameter
+ \return the corresponding parameter
+ */
+ virtual LauParameter* getResonanceParameter( const TString& name );
+
+ //! Retrieve the resonance parameters, e.g. so that they can be loaded into a fit
+ /*!
+ \return floating parameters of the resonance
+ */
+ virtual const std::vector<LauParameter*>& getFloatingParameters();
+
+ protected:
+ //! Set the parameter alpha, the effective range
+ /*!
+ \param [in] alpha the new effective range parameter
+ */
+ void setAlpha( const Double_t alpha );
+
+ //! Get the effective range parameter
+ /*!
+ \return the effective range parameter
+ */
+ Double_t getAlpha() const { return ( alpha_ != 0 ) ? alpha_->unblindValue() : 0.0; }
+
+ //! See if the alpha parameter is fixed or floating
+ Bool_t fixAlpha() const { return ( alpha_ != 0 ) ? alpha_->fixed() : kTRUE; }
+
+ //! This is not called, amplitude is used directly instead
+ virtual LauComplex resAmp( Double_t mass, Double_t spinTerm );
+
+ private:
+ //! Copy constructor (not implemented)
+ LauBelleSymNR( const LauBelleSymNR& rhs );
+
+ //! Copy assignment operator (not implemented)
+ LauBelleSymNR& operator=( const LauBelleSymNR& rhs );
+
+ //! The range parameter
+ LauParameter* alpha_;
+
+ //! The model to use
+ LauAbsResonance::LauResonanceModel model_;
+
+ ClassDef( LauBelleSymNR, 0 ) // Belle Non-resonant model
};
#endif
diff --git a/inc/LauBifurcatedGaussPdf.hh b/inc/LauBifurcatedGaussPdf.hh
index e4af84c..44a22b9 100644
--- a/inc/LauBifurcatedGaussPdf.hh
+++ b/inc/LauBifurcatedGaussPdf.hh
@@ -1,101 +1,103 @@
/*
Copyright 2006 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauBifurcatedGaussPdf.hh
\brief File containing declaration of LauBifurcatedGaussPdf class.
*/
/*! \class LauBifurcatedGaussPdf
\brief Class for defining a bifurcated Gaussian PDF.
Class that allows the user to define a bifurcated Gaussian PDF,
a Gaussian that has different widths either side of the peak position.
*/
#ifndef LAU_BIFURCATED_GAUSS_PDF
#define LAU_BIFURCATED_GAUSS_PDF
-#include <vector>
+#include "LauAbsPdf.hh"
#include "TString.h"
-#include "LauAbsPdf.hh"
+#include <vector>
class LauParameter;
-
class LauBifurcatedGaussPdf : public LauAbsPdf {
- public:
- //! Constructor
- /*!
- \param [in] theVarName the name of the abscissa variable
- \param [in] params the PDF parameters - mean, sigmaL and sigmaR
- \param [in] minAbscissa the minimum value of the abscissa
- \param [in] maxAbscissa the maximum value of the abscissa
- */
- LauBifurcatedGaussPdf(const TString& theVarName, const std::vector<LauAbsRValue*>& params, Double_t minAbscissa, Double_t maxAbscissa);
-
- //! Destructor
- virtual ~LauBifurcatedGaussPdf();
-
- //! Calculate the likelihood (and intermediate info) for a given abscissa
- /*!
- \param [in] abscissas the values of the abscissa(s)
- */
- virtual void calcLikelihoodInfo(const LauAbscissas& abscissas);
-
- using LauAbsPdf::calcLikelihoodInfo;
-
- //! Calculate the normalisation
- virtual void calcNorm();
-
- //! Calculate the PDF height
- /*!
- \param [in] kinematics the current DP kinematics
- */
- virtual void calcPDFHeight( const LauKinematics* kinematics );
-
- protected:
-
- private:
- //! Copy constructor (not implemented)
- LauBifurcatedGaussPdf(const LauBifurcatedGaussPdf& other);
-
- //! Copy assignment operator (not implemented)
- LauBifurcatedGaussPdf& operator=(const LauBifurcatedGaussPdf& other);
-
- //! Gaussian mean
- LauAbsRValue* mean_;
-
- //! Sigma of left Gaussian
- LauAbsRValue* sigmaL_;
-
- //! Sigma of right Gaussian
- LauAbsRValue* sigmaR_;
-
- ClassDef(LauBifurcatedGaussPdf,0) // Define the Bifurcated Gaussian PDF
+ public:
+ //! Constructor
+ /*!
+ \param [in] theVarName the name of the abscissa variable
+ \param [in] params the PDF parameters - mean, sigmaL and sigmaR
+ \param [in] minAbscissa the minimum value of the abscissa
+ \param [in] maxAbscissa the maximum value of the abscissa
+ */
+ LauBifurcatedGaussPdf( const TString& theVarName,
+ const std::vector<LauAbsRValue*>& params,
+ Double_t minAbscissa,
+ Double_t maxAbscissa );
+
+ //! Destructor
+ virtual ~LauBifurcatedGaussPdf();
+
+ //! Calculate the likelihood (and intermediate info) for a given abscissa
+ /*!
+ \param [in] abscissas the values of the abscissa(s)
+ */
+ virtual void calcLikelihoodInfo( const LauAbscissas& abscissas );
+
+ using LauAbsPdf::calcLikelihoodInfo;
+
+ //! Calculate the normalisation
+ virtual void calcNorm();
+
+ //! Calculate the PDF height
+ /*!
+ \param [in] kinematics the current DP kinematics
+ */
+ virtual void calcPDFHeight( const LauKinematics* kinematics );
+
+ protected:
+
+ private:
+ //! Copy constructor (not implemented)
+ LauBifurcatedGaussPdf( const LauBifurcatedGaussPdf& other );
+
+ //! Copy assignment operator (not implemented)
+ LauBifurcatedGaussPdf& operator=( const LauBifurcatedGaussPdf& other );
+
+ //! Gaussian mean
+ LauAbsRValue* mean_;
+
+ //! Sigma of left Gaussian
+ LauAbsRValue* sigmaL_;
+
+ //! Sigma of right Gaussian
+ LauAbsRValue* sigmaR_;
+
+ ClassDef( LauBifurcatedGaussPdf, 0 ) // Define the Bifurcated Gaussian PDF
};
#endif
diff --git a/inc/LauBkgndDPModel.hh b/inc/LauBkgndDPModel.hh
index fed6012..c81b07c 100644
--- a/inc/LauBkgndDPModel.hh
+++ b/inc/LauBkgndDPModel.hh
@@ -1,190 +1,194 @@
/*
Copyright 2004 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauBkgndDPModel.hh
\brief File containing declaration of LauBkgndDPModel class.
*/
/*! \class LauBkgndDPModel
\brief Class for defining a histogram-based background Dalitz plot model
Class for defining a histogram-based background Dalitz plot model
*/
#ifndef LAU_BKGND_DP_MODEL
#define LAU_BKGND_DP_MODEL
-#include <vector>
#include "LauAbsBkgndDPModel.hh"
+#include <vector>
+
class TH2;
class Lau2DAbsDPPdf;
class LauDaughters;
class LauFitDataTree;
class LauVetoes;
-
class LauBkgndDPModel : public LauAbsBkgndDPModel {
- public:
- //! Constructor
- /*!
- \param [in] daughters the daughters in the decay
- \param [in] vetoes the vetoes in the Datliz plot
- */
- LauBkgndDPModel(LauDaughters* daughters, LauVetoes* vetoes);
-
- //! Destructor
- virtual ~LauBkgndDPModel();
-
- //! Set background histogram
- /*!
- \param [in] histo the 2D histogram describing the DP distribution
- \param [in] useInterpolation boolean flag to determine whether linear interpolation between bins should be used or simply the raw bin values
- \param [in] fluctuateBins boolean flag to determine whether the bin contents should be fluctuated in accordance with their errors.
- The seed for the random number generator used to fluctuate the bins should first be set using LauRandom::setSeed.
- \param [in] useUpperHalfOnly boolean flag to specify that the supplied histogram contains only the upper half of a symmetric DP (or lower half if using square DP coordinates)
- \param [in] squareDP boolean flag to determine whether the supplied histogram is given in square DP coordinates
- */
- void setBkgndHisto(const TH2* histo, Bool_t useInterpolation,
- Bool_t fluctuateBins, Bool_t useUpperHalfOnly,
- Bool_t squareDP = kFALSE);
-
- //! Set the background histogram and generate a spline
- /*!
- \param [in] histo the 2D histogram describing the DP distribution
- \param [in] fluctuateBins boolean flag to determine whether the bin contents should be fluctuated in accordance with their errors.
- The seed for the random number generator used to fluctuate the bins should first be set using LauRandom::setSeed.
- \param [in] useUpperHalfOnly boolean flag to specify that the supplied histogram contains only the upper half of a symmetric DP (or lower half if using square DP coordinates)
- \param [in] squareDP boolean flag to determine whether the supplied histogram is given in square DP coordinates
- */
- void setBkgndSpline(const TH2* histo, Bool_t fluctuateBins,
- Bool_t useUpperHalfOnly, Bool_t squareDP);
-
- //! Initialise the model
- virtual void initialise();
-
- //! Generate a toy MC event from the model
- /*!
- \return success/failure flag
- */
- virtual Bool_t generate();
-
- //! Get likelihood for a given DP position
- /*!
- \param [in] m13Sq the invariant mass squared of children 1 and 3
- \param [in] m23Sq the invariant mass squared of children 2 and 3
- \return the likelihood value
- */
- virtual Double_t getLikelihood( const Double_t m13Sq,
- const Double_t m23Sq );
-
- //! Get unnormalised likelihood for a given DP position
- /*!
- \param [in] m13Sq the invariant mass squared of children 1 and 3
- \param [in] m23Sq the invariant mass squared of children 2 and 3
- \return the unnormalised likelihood value
- */
- virtual Double_t getUnNormValue( const Double_t m13Sq,
- const Double_t m23Sq );
-
- //! Get likelihood for a given event
- /*!
- \param [in] iEvt the event number
- \return the likelihood value
- */
- virtual Double_t getLikelihood(UInt_t iEvt);
-
- //! Get unnormalised likelihood for a given event
- /*!
- \param [in] iEvt the event number
- \return the unnormalised likelihood value
- */
- virtual Double_t getUnNormValue(UInt_t iEvt);
-
- //! Get PDF normalisation constant
- /*!
- \return the PDF normalisation constant
- */
- virtual Double_t getPdfNorm() const {return pdfNorm_;}
-
- //! Cache the input data and (if appropriate) the per-event likelihood values
- /*!
- \param [in] fitDataTree the input data
- */
- virtual void fillDataTree(const LauFitDataTree& fitDataTree);
-
- protected:
- //! Calulate histogram value at a given point
- /*!
- \param [in] xVal the x-value
- \param [in] yVal the y-value
- \return the histogram value
- */
- Double_t calcHistValue(Double_t xVal, Double_t yVal);
-
- //! Set data event number
- /*!
- \param [in] iEvt the event number
- */
- virtual void setDataEventNo(UInt_t iEvt);
-
- private:
- //! Copy constructor (not implemented)
- LauBkgndDPModel(const LauBkgndDPModel& rhs);
-
- //! Copy assignment operator (not implemented)
- LauBkgndDPModel& operator=(const LauBkgndDPModel& rhs);
-
- //! Flags whether the DP is symmetrical or not
- Bool_t symmetricalDP_;
-
- //! Flags whether or not to work in square DP coordinates
- Bool_t squareDP_;
-
- //! PDF of Dalitz plot background, from a 2D histogram
- Lau2DAbsDPPdf* bgHistDPPdf_;
-
- //! Cached histogram values for each event
- std::vector<Double_t> bgData_;
-
- //! Histogram value for the current event
- Double_t curEvtHistVal_;
-
- //! Maximum height of PDF
- Double_t maxPdfHeight_;
-
- //! Normalisation of PDF
- Double_t pdfNorm_;
-
- //! Boolean to indicate if the warning that there is no histogram has already been issued
- Bool_t doneGenWarning_;
-
- //! Flag to track whether a warning has been issued for bin values less than zero
- mutable Bool_t lowBinWarningIssued_;
-
- ClassDef(LauBkgndDPModel,0) // DP background model
+ public:
+ //! Constructor
+ /*!
+ \param [in] daughters the daughters in the decay
+ \param [in] vetoes the vetoes in the Datliz plot
+ */
+ LauBkgndDPModel( LauDaughters* daughters, LauVetoes* vetoes );
+
+ //! Destructor
+ virtual ~LauBkgndDPModel();
+
+ //! Set background histogram
+ /*!
+ \param [in] histo the 2D histogram describing the DP distribution
+ \param [in] useInterpolation boolean flag to determine whether linear interpolation between bins should be used or simply the raw bin values
+ \param [in] fluctuateBins boolean flag to determine whether the bin contents should be fluctuated in accordance with their errors.
+ The seed for the random number generator used to fluctuate the bins should first be set using LauRandom::setSeed.
+
+ \param [in] useUpperHalfOnly boolean flag to specify that the supplied histogram contains only the upper half of a symmetric DP (or lower half if using square DP coordinates)
+ \param [in] squareDP boolean flag to determine whether the supplied histogram is given in square DP coordinates
+ */
+ void setBkgndHisto( const TH2* histo,
+ Bool_t useInterpolation,
+ Bool_t fluctuateBins,
+ Bool_t useUpperHalfOnly,
+ Bool_t squareDP = kFALSE );
+
+ //! Set the background histogram and generate a spline
+ /*!
+ \param [in] histo the 2D histogram describing the DP distribution
+ \param [in] fluctuateBins boolean flag to determine whether the bin contents should be fluctuated in accordance with their errors.
+ The seed for the random number generator used to fluctuate the bins should first be set using LauRandom::setSeed.
+
+ \param [in] useUpperHalfOnly boolean flag to specify that the supplied histogram contains only the upper half of a symmetric DP (or lower half if using square DP coordinates)
+ \param [in] squareDP boolean flag to determine whether the supplied histogram is given in square DP coordinates
+ */
+ void setBkgndSpline( const TH2* histo,
+ Bool_t fluctuateBins,
+ Bool_t useUpperHalfOnly,
+ Bool_t squareDP );
+
+ //! Initialise the model
+ virtual void initialise();
+
+ //! Generate a toy MC event from the model
+ /*!
+ \return success/failure flag
+ */
+ virtual Bool_t generate();
+
+ //! Get likelihood for a given DP position
+ /*!
+ \param [in] m13Sq the invariant mass squared of children 1 and 3
+ \param [in] m23Sq the invariant mass squared of children 2 and 3
+ \return the likelihood value
+ */
+ virtual Double_t getLikelihood( const Double_t m13Sq, const Double_t m23Sq );
+
+ //! Get unnormalised likelihood for a given DP position
+ /*!
+ \param [in] m13Sq the invariant mass squared of children 1 and 3
+ \param [in] m23Sq the invariant mass squared of children 2 and 3
+ \return the unnormalised likelihood value
+ */
+ virtual Double_t getUnNormValue( const Double_t m13Sq, const Double_t m23Sq );
+
+ //! Get likelihood for a given event
+ /*!
+ \param [in] iEvt the event number
+ \return the likelihood value
+ */
+ virtual Double_t getLikelihood( UInt_t iEvt );
+
+ //! Get unnormalised likelihood for a given event
+ /*!
+ \param [in] iEvt the event number
+ \return the unnormalised likelihood value
+ */
+ virtual Double_t getUnNormValue( UInt_t iEvt );
+
+ //! Get PDF normalisation constant
+ /*!
+ \return the PDF normalisation constant
+ */
+ virtual Double_t getPdfNorm() const { return pdfNorm_; }
+
+ //! Cache the input data and (if appropriate) the per-event likelihood values
+ /*!
+ \param [in] fitDataTree the input data
+ */
+ virtual void fillDataTree( const LauFitDataTree& fitDataTree );
+
+ protected:
+ //! Calulate histogram value at a given point
+ /*!
+ \param [in] xVal the x-value
+ \param [in] yVal the y-value
+ \return the histogram value
+ */
+ Double_t calcHistValue( Double_t xVal, Double_t yVal );
+
+ //! Set data event number
+ /*!
+ \param [in] iEvt the event number
+ */
+ virtual void setDataEventNo( UInt_t iEvt );
+
+ private:
+ //! Copy constructor (not implemented)
+ LauBkgndDPModel( const LauBkgndDPModel& rhs );
+
+ //! Copy assignment operator (not implemented)
+ LauBkgndDPModel& operator=( const LauBkgndDPModel& rhs );
+
+ //! Flags whether the DP is symmetrical or not
+ Bool_t symmetricalDP_;
+
+ //! Flags whether or not to work in square DP coordinates
+ Bool_t squareDP_;
+
+ //! PDF of Dalitz plot background, from a 2D histogram
+ Lau2DAbsDPPdf* bgHistDPPdf_;
+
+ //! Cached histogram values for each event
+ std::vector<Double_t> bgData_;
+
+ //! Histogram value for the current event
+ Double_t curEvtHistVal_;
+
+ //! Maximum height of PDF
+ Double_t maxPdfHeight_;
+
+ //! Normalisation of PDF
+ Double_t pdfNorm_;
+
+ //! Boolean to indicate if the warning that there is no histogram has already been issued
+ Bool_t doneGenWarning_;
+
+ //! Flag to track whether a warning has been issued for bin values less than zero
+ mutable Bool_t lowBinWarningIssued_;
+
+ ClassDef( LauBkgndDPModel, 0 ) // DP background model
};
#endif
diff --git a/inc/LauBlattWeisskopfFactor.hh b/inc/LauBlattWeisskopfFactor.hh
index 1f9d325..bdca271 100644
--- a/inc/LauBlattWeisskopfFactor.hh
+++ b/inc/LauBlattWeisskopfFactor.hh
@@ -1,146 +1,158 @@
/*
Copyright 2014 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauBlattWeisskopfFactor.hh
\brief File containing declaration of LauBlattWeisskopfFactor class.
*/
/*! \class LauBlattWeisskopfFactor
\brief Class that implements the Blatt-Weisskopf barrier factor
This factor is used in resonance models such as the Relativistic Breit-Wigner.
*/
#ifndef LAU_BLATTWEISSKOPFFACTOR
#define LAU_BLATTWEISSKOPFFACTOR
#include "Rtypes.h"
#include "TString.h"
class LauParameter;
class LauResonanceInfo;
-
class LauBlattWeisskopfFactor final {
- public:
- //! Define the allowed types of barrier factors
- enum BarrierType {
- BWBarrier, /*!< Blatt-Weisskopf barrier factor (for use when momentum terms not used in angular term) */
- BWPrimeBarrier, /*!< Blatt-Weisskopf barrier factor (for use when momentum terms are used in angular term) - the default */
- ExpBarrier /*!< expoential barrier factor (mostly used for virtual contributions) */
- };
-
- //! Define the rest frame in which the momentum should be calculated (only relevant for bachelor)
- enum RestFrame {
- Covariant, /*!< use expression from Covariant spin factor */
- ParentFrame, /*!< momentum calculated in parent rest frame */
- ResonanceFrame /*!< momentum calculated in resonance rest frame */
- };
-
- //! Define resonance categories that will share common barrier factor radii
- enum BlattWeisskopfCategory {
- Default, //*!< indicates that LauResonanceMaker should use the appropriate category for the given resonance */
- Parent, //*!< indicates that this is the factor for the decay of the parent particle */
- Indep, //*!< indicates that this resonance should be independent of all others */
- Light, //*!< default category for light unflavoured states, e.g. rho(77), f0(980), etc. */
- Kstar, //*!< default category for K* states */
- Charm, //*!< default category for D* states */
- StrangeCharm, //*!< default category for Ds* states */
- Charmonium, //*!< default category for ccbar states */
- Beauty, //*!< default category for B* states */
- StrangeBeauty, //*!< default category for Bs* states */
- CharmBeauty, //*!< default category for Bc* states */
- Custom1, //*!< user-defined category */
- Custom2, //*!< user-defined category */
- Custom3, //*!< user-defined category */
- Custom4 //*!< user-defined category */
- };
-
- //! Constructor
- LauBlattWeisskopfFactor( const LauResonanceInfo& resInfo, const BarrierType barrierType, const RestFrame restFrame, const BlattWeisskopfCategory category );
-
- //! Constructor
- LauBlattWeisskopfFactor( const LauResonanceInfo& resInfo, const Double_t resRadius, const BarrierType barrierType, const RestFrame restFrame, const BlattWeisskopfCategory category );
-
- //! Constructor
- LauBlattWeisskopfFactor( const Int_t spin, const Double_t resRadius, const BarrierType barrierType, const RestFrame restFrame, const BlattWeisskopfCategory category );
-
- //! Method to create a new factor with cloned radius parameter
- /*!
- \param newSpin the value of the spin to use for the created instance
- \param newBarrierType the BarrierType to use for the created instance
- */
- LauBlattWeisskopfFactor* createClone( const UInt_t newSpin , const BarrierType newBarrierType );
-
- //! Retrieve the radius parameter
- const LauParameter* getRadiusParameter() const { return radius_; }
-
- //! Retrieve the radius parameter
- LauParameter* getRadiusParameter() { return radius_; }
-
- //! Retrieve the barrier type
- BarrierType getBarrierType() const { return barrierType_; }
-
- //! Retrieve the rest frame information
- RestFrame getRestFrame() const { return restFrame_; }
-
- //! Calculate form factor value
- /*!
- \param p the value of the momentum
- */
- Double_t calcFormFactor( const Double_t p ) const;
-
- private:
- //! Copy constructor
- LauBlattWeisskopfFactor( const LauBlattWeisskopfFactor& other, const UInt_t newSpin, const BarrierType newBarrierType );
-
- //! Copy assignment operator (not implemented)
- LauBlattWeisskopfFactor& operator=( const LauBlattWeisskopfFactor& other );
-
- //! Set the name of the radius parameter
- TString setRadiusName( const LauResonanceInfo& resInfo, const BlattWeisskopfCategory category );
-
- //! Set the name of the radius parameter
- TString setRadiusName( const BlattWeisskopfCategory category );
-
- //! Set the name of the radius parameter
- TString setRadiusName( const TString& categoryName );
-
- //! Resonance spin
- const UInt_t spin_;
-
- //! Radius parameter
- LauParameter* radius_;
-
- //! Barrier type
- const BarrierType barrierType_;
-
- //! Rest frame
- const RestFrame restFrame_;
-
- ClassDef(LauBlattWeisskopfFactor, 0)
+ public:
+ //! Define the allowed types of barrier factors
+ enum BarrierType {
+ BWBarrier, /*!< Blatt-Weisskopf barrier factor (for use when momentum terms not used in angular term) */
+ BWPrimeBarrier, /*!< Blatt-Weisskopf barrier factor (for use when momentum terms are used in angular term) - the default */
+ ExpBarrier /*!< expoential barrier factor (mostly used for virtual contributions) */
+ };
+
+ //! Define the rest frame in which the momentum should be calculated (only relevant for bachelor)
+ enum RestFrame {
+ Covariant, /*!< use expression from Covariant spin factor */
+ ParentFrame, /*!< momentum calculated in parent rest frame */
+ ResonanceFrame /*!< momentum calculated in resonance rest frame */
+ };
+
+ //! Define resonance categories that will share common barrier factor radii
+ enum BlattWeisskopfCategory {
+ Default, //*!< indicates that LauResonanceMaker should use the appropriate category for the given resonance */
+ Parent, //*!< indicates that this is the factor for the decay of the parent particle */
+ Indep, //*!< indicates that this resonance should be independent of all others */
+ Light, //*!< default category for light unflavoured states, e.g. rho(77), f0(980), etc. */
+ Kstar, //*!< default category for K* states */
+ Charm, //*!< default category for D* states */
+ StrangeCharm, //*!< default category for Ds* states */
+ Charmonium, //*!< default category for ccbar states */
+ Beauty, //*!< default category for B* states */
+ StrangeBeauty, //*!< default category for Bs* states */
+ CharmBeauty, //*!< default category for Bc* states */
+ Custom1, //*!< user-defined category */
+ Custom2, //*!< user-defined category */
+ Custom3, //*!< user-defined category */
+ Custom4 //*!< user-defined category */
+ };
+
+ //! Constructor
+ LauBlattWeisskopfFactor( const LauResonanceInfo& resInfo,
+ const BarrierType barrierType,
+ const RestFrame restFrame,
+ const BlattWeisskopfCategory category );
+
+ //! Constructor
+ LauBlattWeisskopfFactor( const LauResonanceInfo& resInfo,
+ const Double_t resRadius,
+ const BarrierType barrierType,
+ const RestFrame restFrame,
+ const BlattWeisskopfCategory category );
+
+ //! Constructor
+ LauBlattWeisskopfFactor( const Int_t spin,
+ const Double_t resRadius,
+ const BarrierType barrierType,
+ const RestFrame restFrame,
+ const BlattWeisskopfCategory category );
+
+ //! Method to create a new factor with cloned radius parameter
+ /*!
+ \param newSpin the value of the spin to use for the created instance
+ \param newBarrierType the BarrierType to use for the created instance
+ */
+ LauBlattWeisskopfFactor* createClone( const UInt_t newSpin, const BarrierType newBarrierType );
+
+ //! Retrieve the radius parameter
+ const LauParameter* getRadiusParameter() const { return radius_; }
+
+ //! Retrieve the radius parameter
+ LauParameter* getRadiusParameter() { return radius_; }
+
+ //! Retrieve the barrier type
+ BarrierType getBarrierType() const { return barrierType_; }
+
+ //! Retrieve the rest frame information
+ RestFrame getRestFrame() const { return restFrame_; }
+
+ //! Calculate form factor value
+ /*!
+ \param p the value of the momentum
+ */
+ Double_t calcFormFactor( const Double_t p ) const;
+
+ private:
+ //! Copy constructor
+ LauBlattWeisskopfFactor( const LauBlattWeisskopfFactor& other,
+ const UInt_t newSpin,
+ const BarrierType newBarrierType );
+
+ //! Copy assignment operator (not implemented)
+ LauBlattWeisskopfFactor& operator=( const LauBlattWeisskopfFactor& other );
+
+ //! Set the name of the radius parameter
+ TString setRadiusName( const LauResonanceInfo& resInfo, const BlattWeisskopfCategory category );
+
+ //! Set the name of the radius parameter
+ TString setRadiusName( const BlattWeisskopfCategory category );
+
+ //! Set the name of the radius parameter
+ TString setRadiusName( const TString& categoryName );
+
+ //! Resonance spin
+ const UInt_t spin_;
+
+ //! Radius parameter
+ LauParameter* radius_;
+
+ //! Barrier type
+ const BarrierType barrierType_;
+
+ //! Rest frame
+ const RestFrame restFrame_;
+
+ ClassDef( LauBlattWeisskopfFactor, 0 )
};
#endif
diff --git a/inc/LauBlind.hh b/inc/LauBlind.hh
index cfe90bf..55c3380 100644
--- a/inc/LauBlind.hh
+++ b/inc/LauBlind.hh
@@ -1,111 +1,110 @@
/*
Copyright 2015 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauBlind.hh
\brief File containing declaration of LauBlind class.
*/
/*! \class LauBlind
\brief Class for blinding and unblinding a number based on a blinding string.
- Numbers are blinded by applying an offset. The blinding string is converted
- to an integer using TMath::Hash and this integer is used to seed a TRandom3.
+ Numbers are blinded by applying an offset. The blinding string is converted
+ to an integer using TMath::Hash and this integer is used to seed a TRandom3.
The offset is sampled from a Gaussian of defined width using the seeded TRandom3.
*/
#ifndef LAU_BLIND
#define LAU_BLIND
#include "TString.h"
class LauBlind {
- public:
- //! Constructor
- /*!
- \param [in] blindingStr the blinding string
- \param [in] width the width of the Gaussian for sampling the offset
- */
- LauBlind(const TString& blindingStr, const Double_t width);
-
- //! Copy constructor
- LauBlind(const LauBlind& rhs);
-
- //! Destructor
- virtual ~LauBlind();
-
- //! Obtain the blinded value
- /*!
- \param [in] val the unblinded value
- \return the blinded value
- */
- inline Double_t blind(const Double_t val) const { return val+offset_; }
-
- //! Obtain the unblinded value
- /*!
- \param [in] val the blinded value
- \return the unblinded value
- */
- inline Double_t unblind(const Double_t val) const { return val-offset_; }
-
- //! Obtain the blinding string
- /*!
- \return the blinding string
- */
- inline const TString& blindingString() const { return blindingString_; }
-
- //! Obtain the Gaussian width
- /*!
- \return the Gaussian width
- */
- inline Double_t blindingWidth() const { return blindingWidth_; }
-
- private:
- //! Copy assignment operator (not implemented)
- LauBlind& operator=(const LauBlind& rhs);
-
- //! Calculate the offset
- void calcOffset();
-
- //! The blinding string
- const TString blindingString_;
-
- //! The Gaussian width
- const Double_t blindingWidth_;
-
- //! The offset used to blind the value
- Double_t offset_;
-
- public:
- //! Default constructor
- /*!
- This is purely to allow I/O to succeed, should not generally be used
- */
- LauBlind();
-
-
- ClassDef(LauBlind, 1)
+ public:
+ //! Constructor
+ /*!
+ \param [in] blindingStr the blinding string
+ \param [in] width the width of the Gaussian for sampling the offset
+ */
+ LauBlind( const TString& blindingStr, const Double_t width );
+
+ //! Copy constructor
+ LauBlind( const LauBlind& rhs );
+
+ //! Destructor
+ virtual ~LauBlind();
+
+ //! Obtain the blinded value
+ /*!
+ \param [in] val the unblinded value
+ \return the blinded value
+ */
+ inline Double_t blind( const Double_t val ) const { return val + offset_; }
+
+ //! Obtain the unblinded value
+ /*!
+ \param [in] val the blinded value
+ \return the unblinded value
+ */
+ inline Double_t unblind( const Double_t val ) const { return val - offset_; }
+
+ //! Obtain the blinding string
+ /*!
+ \return the blinding string
+ */
+ inline const TString& blindingString() const { return blindingString_; }
+
+ //! Obtain the Gaussian width
+ /*!
+ \return the Gaussian width
+ */
+ inline Double_t blindingWidth() const { return blindingWidth_; }
+
+ private:
+ //! Copy assignment operator (not implemented)
+ LauBlind& operator=( const LauBlind& rhs );
+
+ //! Calculate the offset
+ void calcOffset();
+
+ //! The blinding string
+ const TString blindingString_;
+
+ //! The Gaussian width
+ const Double_t blindingWidth_;
+
+ //! The offset used to blind the value
+ Double_t offset_;
+
+ public:
+ //! Default constructor
+ /*!
+ This is purely to allow I/O to succeed, should not generally be used
+ */
+ LauBlind();
+
+ ClassDef( LauBlind, 1 )
};
#endif
diff --git a/inc/LauBreitWignerRes.hh b/inc/LauBreitWignerRes.hh
index efee832..c5005bf 100644
--- a/inc/LauBreitWignerRes.hh
+++ b/inc/LauBreitWignerRes.hh
@@ -1,93 +1,96 @@
/*
Copyright 2004 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauBreitWignerRes.hh
\brief File containing declaration of LauBreitWignerRes class.
*/
/*! \class LauBreitWignerRes
\brief Class for defining the simple Breit-Wigner resonance model
Class for defining the simple Breit-Wigner resonance model.
This is a non-relativistic Breit-Wigner, with no mass-dependent width or form factors.
*/
#ifndef LAU_BREIT_WIGNER_RES
#define LAU_BREIT_WIGNER_RES
-#include "TString.h"
-
-#include "LauComplex.hh"
#include "LauAbsResonance.hh"
+#include "LauComplex.hh"
+#include "TString.h"
class LauBreitWignerRes : public LauAbsResonance {
- public:
- //! Constructor
- /*!
- \param [in] resInfo the object containing information on the resonance name, mass, width, spin, charge, etc.
- \param [in] resPairAmpInt the number of the daughter not produced by the resonance
- \param [in] daughters the daughter particles
- */
- LauBreitWignerRes(LauResonanceInfo* resInfo, const Int_t resPairAmpInt, const LauDaughters* daughters);
-
- //! Destructor
- virtual ~LauBreitWignerRes();
-
- //! Initialise the model
- virtual void initialise();
-
- //! Get the resonance model type
- /*!
- \return the resonance model type
- */
- virtual LauAbsResonance::LauResonanceModel getResonanceModel() const {return LauAbsResonance::BW;}
-
- //! Retrieve the resonance parameters, e.g. so that they can be loaded into a fit
- /*!
- \return floating parameters of the resonance
- */
- virtual const std::vector<LauParameter*>& getFloatingParameters();
-
- protected:
- //! Complex resonant amplitude
- /*!
- \param [in] mass appropriate invariant mass for the resonance
- \param [in] spinTerm spin term
- */
- virtual LauComplex resAmp(Double_t mass, Double_t spinTerm);
-
- private:
- //! Copy constructor (not implemented)
- LauBreitWignerRes(const LauBreitWignerRes& rhs);
-
- //! Copy assignment operator (not implemented)
- LauBreitWignerRes& operator=(const LauBreitWignerRes& rhs);
-
- ClassDef(LauBreitWignerRes,0) // Breit-Wigner resonance model
-
+ public:
+ //! Constructor
+ /*!
+ \param [in] resInfo the object containing information on the resonance name, mass, width, spin, charge, etc.
+ \param [in] resPairAmpInt the number of the daughter not produced by the resonance
+ \param [in] daughters the daughter particles
+ */
+ LauBreitWignerRes( LauResonanceInfo* resInfo,
+ const Int_t resPairAmpInt,
+ const LauDaughters* daughters );
+
+ //! Destructor
+ virtual ~LauBreitWignerRes();
+
+ //! Initialise the model
+ virtual void initialise();
+
+ //! Get the resonance model type
+ /*!
+ \return the resonance model type
+ */
+ virtual LauAbsResonance::LauResonanceModel getResonanceModel() const
+ {
+ return LauAbsResonance::BW;
+ }
+
+ //! Retrieve the resonance parameters, e.g. so that they can be loaded into a fit
+ /*!
+ \return floating parameters of the resonance
+ */
+ virtual const std::vector<LauParameter*>& getFloatingParameters();
+
+ protected:
+ //! Complex resonant amplitude
+ /*!
+ \param [in] mass appropriate invariant mass for the resonance
+ \param [in] spinTerm spin term
+ */
+ virtual LauComplex resAmp( Double_t mass, Double_t spinTerm );
+
+ private:
+ //! Copy constructor (not implemented)
+ LauBreitWignerRes( const LauBreitWignerRes& rhs );
+
+ //! Copy assignment operator (not implemented)
+ LauBreitWignerRes& operator=( const LauBreitWignerRes& rhs );
+
+ ClassDef( LauBreitWignerRes, 0 ) // Breit-Wigner resonance model
};
#endif
diff --git a/inc/LauCPFitModel.hh b/inc/LauCPFitModel.hh
index 3d00aca..1c7839a 100644
--- a/inc/LauCPFitModel.hh
+++ b/inc/LauCPFitModel.hh
@@ -1,732 +1,751 @@
/*
Copyright 2004 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauCPFitModel.hh
\brief File containing declaration of LauCPFitModel class.
*/
/*! \class LauCPFitModel
\brief Class for defining a CP fit model.
LauCPFitModel is a class that allows the user to define a three-body Dalitz
plot according to the isobar model, i.e. defining a set of resonances that
have complex amplitudes that can interfere with each other.
It extends the LauSimpleFitModel in that it allows simultaneous fitting of
two parent flavours simultaneously. By default, it assumes perfect tagging
of those flavours but it can also be used in an untagged scenario.
*/
#ifndef LAU_CP_FIT_MODEL
#define LAU_CP_FIT_MODEL
-#include <vector>
-
-#include "TString.h"
-
#include "LauAbsFitModel.hh"
#include "LauComplex.hh"
#include "LauParameter.hh"
+#include "TString.h"
+
+#include <vector>
+
class TH2;
class LauAbsBkgndDPModel;
class LauAbsCoeffSet;
class LauIsobarDynamics;
class LauAbsPdf;
class LauEffModel;
class LauEmbeddedData;
class LauKinematics;
class LauScfMap;
-
class LauCPFitModel : public LauAbsFitModel {
- public:
- //! Constructor
- /*!
- \param [in] negModel DP model for the antiparticle
- \param [in] posModel DP model for the particle
- \param [in] tagged is the analysis tagged or untagged?
- \param [in] tagVarName the variable name in the data tree that specifies the event tag
- */
- LauCPFitModel(LauIsobarDynamics* negModel, LauIsobarDynamics* posModel, Bool_t tagged = kTRUE, const TString& tagVarName = "charge");
-
- //! Destructor
- virtual ~LauCPFitModel();
-
- //! Set the signal event yield
- /*!
- \param [in] nSigEvents contains the signal yield and option to fix it
- */
- virtual void setNSigEvents(LauParameter* nSigEvents);
-
- //! Set the signal event yield if there is an asymmetry
- /*!
- \param [in] nSigEvents contains the signal yield and option to fix it
- \param [in] sigAsym contains the signal asymmetry and option to fix it
- \param [in] forceAsym the option to force there to be an asymmetry
- */
- virtual void setNSigEvents(LauParameter* nSigEvents, LauParameter* sigAsym, Bool_t forceAsym = kFALSE);
-
- //! Set the background event yield(s)
- /*!
- The name of the parameter must be that of the corresponding background category (so that it can be correctly assigned)
-
- \param [in] nBkgndEvents contains the name, yield and option to fix the yield of the background
- */
- virtual void setNBkgndEvents(LauAbsRValue* nBkgndEvents);
-
- //! Set the background event yield(s)
- /*!
- The names of the parameters must be that of the corresponding background category (so that they can be correctly assigned)
-
- \param [in] nBkgndEvents contains the name, yield and option to fix the yield of the background
- \param [in] bkgndAsym contains the background asymmetry and option to fix it
- */
- virtual void setNBkgndEvents(LauAbsRValue* nBkgndEvents, LauAbsRValue* bkgndAsym);
-
- //! Set the background DP models
- /*!
- \param [in] bkgndClass the name of the background class
- \param [in] negModel the DP model of the B- background
- \param [in] posModel the DP model of the B+ background
- */
- void setBkgndDPModels(const TString& bkgndClass, LauAbsBkgndDPModel* negModel, LauAbsBkgndDPModel* posModel);
-
- //! 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 boolean flag to specify that the supplied histogram contains only the upper half of a symmetric DP (or lower half if using square DP coordinates)
- \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
- */
- void splitSignalComponent( const TH2* dpHisto, const Bool_t upperHalf = kFALSE, const Bool_t fluctuateBins = kFALSE, LauScfMap* scfMap = 0 );
-
- //! 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 a single global number
-
- \param [in] scfFrac the SCF fraction value
- \param [in] fixed whether the SCF fraction is fixed or floated in the fit
- */
- void splitSignalComponent( const Double_t scfFrac, const Bool_t fixed );
-
- //! Determine whether we are splitting the signal into TM and SCF parts
- Bool_t useSCF() const { return useSCF_; }
-
- //! Determine whether the SCF fraction is DP-dependent
- Bool_t useSCFHist() const { return useSCFHist_; }
-
- //! Determine if we are smearing the SCF DP PDF
- Bool_t smearSCFDP() const { return (scfMap_ != 0); }
-
- // Set the DeltaE and mES models, i.e. give us the PDFs
- //! Set the signal PDFs
- /*!
- \param [in] negPdf the PDF to be added to the B- signal model
- \param [in] posPdf the PDF to be added to the B+ signal model
- */
- void setSignalPdfs(LauAbsPdf* negPdf, LauAbsPdf* posPdf);
-
- //! Set the SCF PDF for a given variable
- /*!
- \param [in] negPdf the PDF to be added to the B- signal model
- \param [in] posPdf the PDF to be added to the B+ signal model
- */
- void setSCFPdfs(LauAbsPdf* negPdf, LauAbsPdf* posPdf);
-
- //! Set the background PDFs
- /*!
- \param [in] bkgndClass the name of the background class
- \param [in] negPdf the PDF to be added to the B- background model
- \param [in] posPdf the PDF to be added to the B+ background model
- */
- void setBkgndPdfs(const TString& bkgndClass, LauAbsPdf* negPdf, LauAbsPdf* posPdf);
-
- //! Embed full simulation events for the B- signal, rather than generating toy from the PDFs
- /*!
- \param [in] fileName the name of the file containing the events
- \param [in] treeName the name of the tree
- \param [in] reuseEventsWithinEnsemble sample with replacement but only replace events once each experiment has been generated
- \param [in] reuseEventsWithinExperiment sample with immediate replacement
- \param [in] useReweighting perform an accept/reject routine using the configured signal amplitude model based on the MC-truth DP coordinate
- */
- void embedNegSignal(const TString& fileName, const TString& treeName,
- Bool_t reuseEventsWithinEnsemble, Bool_t reuseEventsWithinExperiment = kFALSE,
- Bool_t useReweighting = kFALSE);
-
- //! Embed full simulation events for the given background class, rather than generating toy from the PDFs
- /*!
- \param [in] bgClass the name of the background class
- \param [in] fileName the name of the file containing the events
- \param [in] treeName the name of the tree
- \param [in] reuseEventsWithinEnsemble sample with replacement but only replace events once each experiment has been generated
- \param [in] reuseEventsWithinExperiment sample with immediate replacement
- */
- void embedNegBkgnd(const TString& bgClass, const TString& fileName, const TString& treeName,
- Bool_t reuseEventsWithinEnsemble, Bool_t reuseEventsWithinExperiment = kFALSE);
-
- //! Embed full simulation events for the B+ signal, rather than generating toy from the PDFs
- /*!
- \param [in] fileName the name of the file containing the events
- \param [in] treeName the name of the tree
- \param [in] reuseEventsWithinEnsemble sample with replacement but only replace events once each experiment has been generated
- \param [in] reuseEventsWithinExperiment sample with immediate replacement
- \param [in] useReweighting perform an accept/reject routine using the configured signal amplitude model based on the MC-truth DP coordinate
- */
- void embedPosSignal(const TString& fileName, const TString& treeName,
- Bool_t reuseEventsWithinEnsemble, Bool_t reuseEventsWithinExperiment = kFALSE,
- Bool_t useReweighting = kFALSE);
-
- //! Embed full simulation events for the given background class, rather than generating toy from the PDFs
- /*!
- \param [in] bgClass the name of the background class
- \param [in] fileName the name of the file containing the events
- \param [in] treeName the name of the tree
- \param [in] reuseEventsWithinEnsemble sample with replacement but only replace events once each experiment has been generated
- \param [in] reuseEventsWithinExperiment sample with immediate replacement
- */
- void embedPosBkgnd(const TString& bgClass, const TString& fileName, const TString& treeName,
- Bool_t reuseEventsWithinEnsemble, Bool_t reuseEventsWithinExperiment = kFALSE);
-
- //! Set the DP amplitude coefficients
- /*!
- The name of the coeffSet must match the name of one of the resonances in the DP model for the antiparticle (the name of the conjugate state in the model for the particle will be automatically determined).
-
- The supplied order of coefficients will be rearranged to match the order in which the resonances are stored in the dynamics, see LauIsobarDynamics::addResonance.
-
- \param [in] coeffSet the set of coefficients
- */
- virtual void setAmpCoeffSet(LauAbsCoeffSet* coeffSet);
-
- //! Calculate the DP amplitude(s) for a given DP position
- /*!
- If not already done, this function will initialise the DP models
- \param [in] m13Sq the invariant mass squared of children 1 and 3
- \param [in] m23Sq the invariant mass squared of children 2 and 3
- \return a container of complex amplitudes, labelled to indicate to which component they belong
- */
- virtual std::map<TString, LauComplex> getDPAmps( const Double_t m13Sq, const Double_t m23Sq );
-
- //! Calculate the DP likelihood(s) for a given DP position
- /*!
- If not already done, this function will initialise the DP models
- \param [in] m13Sq the invariant mass squared of children 1 and 3
- \param [in] m23Sq the invariant mass squared of children 2 and 3
- \return a container of likelihood values, labelled to indicate to which component they belong
- */
- virtual std::map<TString, Double_t> getDPLikelihoods( const Double_t m13Sq, const Double_t m23Sq );
-
- protected:
- //! Define a map to be used to store a category name and numbers
- typedef std::map< std::pair<TString,Int_t>, std::pair<Int_t,Double_t> > LauGenInfo;
-
- //! Typedef for a vector of background DP models
- typedef std::vector<LauAbsBkgndDPModel*> LauBkgndDPModelList;
-
- //! Typedef for a vector of background PDFs
- typedef std::vector<LauPdfPList> LauBkgndPdfsList;
-
- //! Typedef for a vector of background yields
- typedef std::vector<LauAbsRValue*> LauBkgndYieldList;
-
- //! Typedef for a vector of embedded data objects
- typedef std::vector<LauEmbeddedData*> LauBkgndEmbDataList;
-
- //! Typedef for a vector of booleans to flag if events are reused
- typedef std::vector<Bool_t> LauBkgndReuseEventsList;
-
-
- //! Weight events based on the DP model
- /*!
- \param [in] dataFileName the name of the data file
- \param [in] dataTreeName the name of the data tree
- */
- virtual void weightEvents( const TString& dataFileName, const TString& dataTreeName );
-
- //! Initialise the fit
- virtual void initialise();
-
- //! Initialise the signal DP models
- virtual void initialiseDPModels();
-
- //! Recalculate Normalization the signal DP models
- virtual void recalculateNormalisation();
-
- //! Update the coefficients
- virtual void updateCoeffs();
-
- //! Toy MC generation and fitting overloaded functions
- virtual Bool_t genExpt();
-
- //! Calculate things that depend on the fit parameters after they have been updated by Minuit
- virtual void propagateParUpdates();
-
- //! Read in the input fit data variables, e.g. m13Sq and m23Sq
- virtual void cacheInputFitVars();
-
- //! Check the initial fit parameters
- virtual void checkInitFitParams();
-
- //! Get the fit results and store them
- /*!
- \param [in] tablePrefixName prefix for the name of the output file
- */
- virtual void finaliseFitResults(const TString& tablePrefixName);
-
- //! Print the fit fractions, total DP rate and mean efficiency
- /*!
- \param [out] output the stream to which to print
- */
- virtual void printFitFractions(std::ostream& output);
-
- //! Print the asymmetries
- /*!
- \param [out] output the stream to which to print
- */
- virtual void printAsymmetries(std::ostream& output);
-
- //! Write the fit results in latex table format
- /*!
- \param [in] outputFile the name of the output file
- */
- virtual void writeOutTable(const TString& outputFile);
-
- //! Save the pdf Plots for all the resonances
- /*!
- \param [in] label prefix for the file name to be saved
- */
- virtual void savePDFPlots(const TString& label);
-
- //! Save the pdf Plots for the sum of resonances of a given spin
- /*!
- \param [in] label prefix for the file name to be saved
- \param [in] spin spin of the wave to be saved
- */
- virtual void savePDFPlotsWave(const TString& label, const Int_t& spin);
-
-
- //! Store the per event likelihood values
- virtual void storePerEvtLlhds();
-
- // Methods to do with calculating the likelihood functions
- // and manipulating the fitting parameters.
- //! Get the total likelihood for each event
- /*!
- \param [in] iEvt the event number
- */
- virtual Double_t getTotEvtLikelihood(UInt_t iEvt);
-
- //! Calculate the signal and background likelihoods for the DP for a given event
- /*!
- \param [in] iEvt the event number
- */
- virtual void getEvtDPLikelihood(UInt_t iEvt);
-
- //! Calculate the SCF likelihood for the DP for a given event
- /*!
- \param [in] iEvt the event number
- */
- virtual Double_t getEvtSCFDPLikelihood(UInt_t iEvt);
-
- //! Determine the signal and background likelihood for the extra variables for a given event
- /*!
- \param [in] iEvt the event number
- */
- virtual void getEvtExtraLikelihoods(UInt_t iEvt);
-
- //! Get the total number of events
- /*!
- \return the total number of events
- */
- virtual Double_t getEventSum() const;
-
- //! Set the fit parameters for the DP model
- void setSignalDPParameters();
-
- //! Set the fit parameters for the extra PDFs
- void setExtraPdfParameters();
-
- //! Set the initial yields
- void setFitNEvents();
-
- //! Set-up other parameters that are derived from the fit results, e.g. fit fractions
- void setExtraNtupleVars();
-
- //! Randomise the initial fit parameters
- void randomiseInitFitPars();
-
- //! Calculate the CP-conserving and CP-violating fit fractions
- /*!
- \param [in] initValues is this before or after the fit
- */
- void calcExtraFractions(Bool_t initValues = kFALSE);
-
- //! Calculate the CP asymmetries
- /*!
- \param [in] initValues is this before or after the fit
- */
- void calcAsymmetries(Bool_t initValues = kFALSE);
-
- //! Define the length of the background vectors
- virtual void setupBkgndVectors();
-
- //! Determine the number of events to generate for each hypothesis
- std::pair<LauGenInfo,Bool_t> eventsToGenerate();
-
- //! Generate signal event
- Bool_t generateSignalEvent();
-
- //! Generate background event
- /*!
- \param [in] bgID ID number of the background class
- */
- Bool_t generateBkgndEvent(UInt_t bgID);
-
- //! Setup the required ntuple branches
- void setupGenNtupleBranches();
-
- //! Store all of the DP information
- void setDPBranchValues();
-
- //! Generate from the extra PDFs
- /*!
- \param [in] extraPdfs the list of extra PDFs
- \param [in] embeddedData the embedded data sample
- */
- void generateExtraPdfValues(LauPdfPList* extraPdfs, LauEmbeddedData* embeddedData);
-
- //! Store the MC truth info on the TM/SCF nature of the embedded signal event
- /*!
- \param [in] embeddedData the full simulation information
- */
- Bool_t storeSignalMCMatch(LauEmbeddedData* embeddedData);
-
- //! Add sPlot branches for the extra PDFs
- /*!
- \param [in] extraPdfs the list of extra PDFs
- \param [in] prefix the list of prefixes for the branch names
- */
- void addSPlotNtupleBranches(const LauPdfPList* extraPdfs, const TString& prefix);
-
- //! Set the branches for the sPlot ntuple with extra PDFs
- /*!
- \param [in] extraPdfs the list of extra PDFs
- \param [in] prefix the list of prefixes for the branch names
- \param [in] iEvt the event number
- */
- Double_t setSPlotNtupleBranchValues(LauPdfPList* extraPdfs, const TString& prefix, UInt_t iEvt);
-
- //! Update the signal events after Minuit sets background parameters
- void updateSigEvents();
-
- //! Add branches to store experiment number and the event number within the experiment
- virtual void setupSPlotNtupleBranches();
-
- //! Returns the names of all variables in the fit
- virtual LauSPlot::NameSet variableNames() const;
-
- //! Returns the names and yields of species that are free in the fit
- virtual LauSPlot::NumbMap freeSpeciesNames() const;
+ public:
+ //! Constructor
+ /*!
+ \param [in] negModel DP model for the antiparticle
+ \param [in] posModel DP model for the particle
+ \param [in] tagged is the analysis tagged or untagged?
+ \param [in] tagVarName the variable name in the data tree that specifies the event tag
+ */
+ LauCPFitModel( LauIsobarDynamics* negModel,
+ LauIsobarDynamics* posModel,
+ Bool_t tagged = kTRUE,
+ const TString& tagVarName = "charge" );
+
+ //! Destructor
+ virtual ~LauCPFitModel();
+
+ //! Set the signal event yield
+ /*!
+ \param [in] nSigEvents contains the signal yield and option to fix it
+ */
+ virtual void setNSigEvents( LauParameter* nSigEvents );
+
+ //! Set the signal event yield if there is an asymmetry
+ /*!
+ \param [in] nSigEvents contains the signal yield and option to fix it
+ \param [in] sigAsym contains the signal asymmetry and option to fix it
+ \param [in] forceAsym the option to force there to be an asymmetry
+ */
+ virtual void setNSigEvents( LauParameter* nSigEvents,
+ LauParameter* sigAsym,
+ Bool_t forceAsym = kFALSE );
+
+ //! Set the background event yield(s)
+ /*!
+ The name of the parameter must be that of the corresponding background category (so that it can be correctly assigned)
+
+ \param [in] nBkgndEvents contains the name, yield and option to fix the yield of the background
+ */
+ virtual void setNBkgndEvents( LauAbsRValue* nBkgndEvents );
+
+ //! Set the background event yield(s)
+ /*!
+ The names of the parameters must be that of the corresponding background category (so that they can be correctly assigned)
+
+ \param [in] nBkgndEvents contains the name, yield and option to fix the yield of the background
+ \param [in] bkgndAsym contains the background asymmetry and option to fix it
+ */
+ virtual void setNBkgndEvents( LauAbsRValue* nBkgndEvents, LauAbsRValue* bkgndAsym );
+
+ //! Set the background DP models
+ /*!
+ \param [in] bkgndClass the name of the background class
+ \param [in] negModel the DP model of the B- background
+ \param [in] posModel the DP model of the B+ background
+ */
+ void setBkgndDPModels( const TString& bkgndClass,
+ LauAbsBkgndDPModel* negModel,
+ LauAbsBkgndDPModel* posModel );
+
+ //! 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 boolean flag to specify that the supplied histogram contains only the upper half of a symmetric DP (or lower half if using square DP coordinates)
+ \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
+ */
+ void splitSignalComponent( const TH2* dpHisto,
+ const Bool_t upperHalf = kFALSE,
+ const Bool_t fluctuateBins = kFALSE,
+ LauScfMap* scfMap = 0 );
+
+ //! 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 a single global number
+
+ \param [in] scfFrac the SCF fraction value
+ \param [in] fixed whether the SCF fraction is fixed or floated in the fit
+ */
+ void splitSignalComponent( const Double_t scfFrac, const Bool_t fixed );
+
+ //! Determine whether we are splitting the signal into TM and SCF parts
+ Bool_t useSCF() const { return useSCF_; }
+
+ //! Determine whether the SCF fraction is DP-dependent
+ Bool_t useSCFHist() const { return useSCFHist_; }
+
+ //! Determine if we are smearing the SCF DP PDF
+ Bool_t smearSCFDP() const { return ( scfMap_ != 0 ); }
+
+ // Set the DeltaE and mES models, i.e. give us the PDFs
+ //! Set the signal PDFs
+ /*!
+ \param [in] negPdf the PDF to be added to the B- signal model
+ \param [in] posPdf the PDF to be added to the B+ signal model
+ */
+ void setSignalPdfs( LauAbsPdf* negPdf, LauAbsPdf* posPdf );
+
+ //! Set the SCF PDF for a given variable
+ /*!
+ \param [in] negPdf the PDF to be added to the B- signal model
+ \param [in] posPdf the PDF to be added to the B+ signal model
+ */
+ void setSCFPdfs( LauAbsPdf* negPdf, LauAbsPdf* posPdf );
+
+ //! Set the background PDFs
+ /*!
+ \param [in] bkgndClass the name of the background class
+ \param [in] negPdf the PDF to be added to the B- background model
+ \param [in] posPdf the PDF to be added to the B+ background model
+ */
+ void setBkgndPdfs( const TString& bkgndClass, LauAbsPdf* negPdf, LauAbsPdf* posPdf );
+
+ //! Embed full simulation events for the B- signal, rather than generating toy from the PDFs
+ /*!
+ \param [in] fileName the name of the file containing the events
+ \param [in] treeName the name of the tree
+ \param [in] reuseEventsWithinEnsemble sample with replacement but only replace events once each experiment has been generated
+ \param [in] reuseEventsWithinExperiment sample with immediate replacement
+ \param [in] useReweighting perform an accept/reject routine using the configured signal amplitude model based on the MC-truth DP coordinate
+ */
+ void embedNegSignal( const TString& fileName,
+ const TString& treeName,
+ Bool_t reuseEventsWithinEnsemble,
+ Bool_t reuseEventsWithinExperiment = kFALSE,
+ Bool_t useReweighting = kFALSE );
+
+ //! Embed full simulation events for the given background class, rather than generating toy from the PDFs
+ /*!
+ \param [in] bgClass the name of the background class
+ \param [in] fileName the name of the file containing the events
+ \param [in] treeName the name of the tree
+ \param [in] reuseEventsWithinEnsemble sample with replacement but only replace events once each experiment has been generated
+ \param [in] reuseEventsWithinExperiment sample with immediate replacement
+ */
+ void embedNegBkgnd( const TString& bgClass,
+ const TString& fileName,
+ const TString& treeName,
+ Bool_t reuseEventsWithinEnsemble,
+ Bool_t reuseEventsWithinExperiment = kFALSE );
+
+ //! Embed full simulation events for the B+ signal, rather than generating toy from the PDFs
+ /*!
+ \param [in] fileName the name of the file containing the events
+ \param [in] treeName the name of the tree
+ \param [in] reuseEventsWithinEnsemble sample with replacement but only replace events once each experiment has been generated
+ \param [in] reuseEventsWithinExperiment sample with immediate replacement
+ \param [in] useReweighting perform an accept/reject routine using the configured signal amplitude model based on the MC-truth DP coordinate
+ */
+ void embedPosSignal( const TString& fileName,
+ const TString& treeName,
+ Bool_t reuseEventsWithinEnsemble,
+ Bool_t reuseEventsWithinExperiment = kFALSE,
+ Bool_t useReweighting = kFALSE );
+
+ //! Embed full simulation events for the given background class, rather than generating toy from the PDFs
+ /*!
+ \param [in] bgClass the name of the background class
+ \param [in] fileName the name of the file containing the events
+ \param [in] treeName the name of the tree
+ \param [in] reuseEventsWithinEnsemble sample with replacement but only replace events once each experiment has been generated
+ \param [in] reuseEventsWithinExperiment sample with immediate replacement
+ */
+ void embedPosBkgnd( const TString& bgClass,
+ const TString& fileName,
+ const TString& treeName,
+ Bool_t reuseEventsWithinEnsemble,
+ Bool_t reuseEventsWithinExperiment = kFALSE );
+
+ //! Set the DP amplitude coefficients
+ /*!
+ The name of the coeffSet must match the name of one of the resonances in the DP model for the antiparticle (the name of the conjugate state in the model for the particle will be automatically determined).
+
+ The supplied order of coefficients will be rearranged to match the order in which the resonances are stored in the dynamics, see LauIsobarDynamics::addResonance.
+
+ \param [in] coeffSet the set of coefficients
+ */
+ virtual void setAmpCoeffSet( LauAbsCoeffSet* coeffSet );
+
+ //! Calculate the DP amplitude(s) for a given DP position
+ /*!
+ If not already done, this function will initialise the DP models
+
+ \param [in] m13Sq the invariant mass squared of children 1 and 3
+ \param [in] m23Sq the invariant mass squared of children 2 and 3
+ \return a container of complex amplitudes, labelled to indicate to which component they belong
+ */
+ virtual std::map<TString, LauComplex> getDPAmps( const Double_t m13Sq, const Double_t m23Sq );
+
+ //! Calculate the DP likelihood(s) for a given DP position
+ /*!
+ If not already done, this function will initialise the DP models
+
+ \param [in] m13Sq the invariant mass squared of children 1 and 3
+ \param [in] m23Sq the invariant mass squared of children 2 and 3
+ \return a container of likelihood values, labelled to indicate to which component they belong
+ */
+ virtual std::map<TString, Double_t> getDPLikelihoods( const Double_t m13Sq, const Double_t m23Sq );
+
+ protected:
+ //! Define a map to be used to store a category name and numbers
+ typedef std::map<std::pair<TString, Int_t>, std::pair<Int_t, Double_t>> LauGenInfo;
+
+ //! Typedef for a vector of background DP models
+ typedef std::vector<LauAbsBkgndDPModel*> LauBkgndDPModelList;
+
+ //! Typedef for a vector of background PDFs
+ typedef std::vector<LauPdfPList> LauBkgndPdfsList;
+
+ //! Typedef for a vector of background yields
+ typedef std::vector<LauAbsRValue*> LauBkgndYieldList;
+
+ //! Typedef for a vector of embedded data objects
+ typedef std::vector<LauEmbeddedData*> LauBkgndEmbDataList;
+
+ //! Typedef for a vector of booleans to flag if events are reused
+ typedef std::vector<Bool_t> LauBkgndReuseEventsList;
+
+ //! Weight events based on the DP model
+ /*!
+ \param [in] dataFileName the name of the data file
+ \param [in] dataTreeName the name of the data tree
+ */
+ virtual void weightEvents( const TString& dataFileName, const TString& dataTreeName );
+
+ //! Initialise the fit
+ virtual void initialise();
+
+ //! Initialise the signal DP models
+ virtual void initialiseDPModels();
+
+ //! Recalculate Normalization the signal DP models
+ virtual void recalculateNormalisation();
+
+ //! Update the coefficients
+ virtual void updateCoeffs();
+
+ //! Toy MC generation and fitting overloaded functions
+ virtual Bool_t genExpt();
+
+ //! Calculate things that depend on the fit parameters after they have been updated by Minuit
+ virtual void propagateParUpdates();
+
+ //! Read in the input fit data variables, e.g. m13Sq and m23Sq
+ virtual void cacheInputFitVars();
+
+ //! Check the initial fit parameters
+ virtual void checkInitFitParams();
+
+ //! Get the fit results and store them
+ /*!
+ \param [in] tablePrefixName prefix for the name of the output file
+ */
+ virtual void finaliseFitResults( const TString& tablePrefixName );
+
+ //! Print the fit fractions, total DP rate and mean efficiency
+ /*!
+ \param [out] output the stream to which to print
+ */
+ virtual void printFitFractions( std::ostream& output );
+
+ //! Print the asymmetries
+ /*!
+ \param [out] output the stream to which to print
+ */
+ virtual void printAsymmetries( std::ostream& output );
+
+ //! Write the fit results in latex table format
+ /*!
+ \param [in] outputFile the name of the output file
+ */
+ virtual void writeOutTable( const TString& outputFile );
+
+ //! Save the pdf Plots for all the resonances
+ /*!
+ \param [in] label prefix for the file name to be saved
+ */
+ virtual void savePDFPlots( const TString& label );
+
+ //! Save the pdf Plots for the sum of resonances of a given spin
+ /*!
+ \param [in] label prefix for the file name to be saved
+ \param [in] spin spin of the wave to be saved
+ */
+ virtual void savePDFPlotsWave( const TString& label, const Int_t& spin );
+
+ //! Store the per event likelihood values
+ virtual void storePerEvtLlhds();
+
+ // Methods to do with calculating the likelihood functions
+ // and manipulating the fitting parameters.
+ //! Get the total likelihood for each event
+ /*!
+ \param [in] iEvt the event number
+ */
+ virtual Double_t getTotEvtLikelihood( UInt_t iEvt );
+
+ //! Calculate the signal and background likelihoods for the DP for a given event
+ /*!
+ \param [in] iEvt the event number
+ */
+ virtual void getEvtDPLikelihood( UInt_t iEvt );
+
+ //! Calculate the SCF likelihood for the DP for a given event
+ /*!
+ \param [in] iEvt the event number
+ */
+ virtual Double_t getEvtSCFDPLikelihood( UInt_t iEvt );
+
+ //! Determine the signal and background likelihood for the extra variables for a given event
+ /*!
+ \param [in] iEvt the event number
+ */
+ virtual void getEvtExtraLikelihoods( UInt_t iEvt );
+
+ //! Get the total number of events
+ /*!
+ \return the total number of events
+ */
+ virtual Double_t getEventSum() const;
+
+ //! Set the fit parameters for the DP model
+ void setSignalDPParameters();
+
+ //! Set the fit parameters for the extra PDFs
+ void setExtraPdfParameters();
+
+ //! Set the initial yields
+ void setFitNEvents();
+
+ //! Set-up other parameters that are derived from the fit results, e.g. fit fractions
+ void setExtraNtupleVars();
+
+ //! Randomise the initial fit parameters
+ void randomiseInitFitPars();
+
+ //! Calculate the CP-conserving and CP-violating fit fractions
+ /*!
+ \param [in] initValues is this before or after the fit
+ */
+ void calcExtraFractions( Bool_t initValues = kFALSE );
+
+ //! Calculate the CP asymmetries
+ /*!
+ \param [in] initValues is this before or after the fit
+ */
+ void calcAsymmetries( Bool_t initValues = kFALSE );
+
+ //! Define the length of the background vectors
+ virtual void setupBkgndVectors();
+
+ //! Determine the number of events to generate for each hypothesis
+ std::pair<LauGenInfo, Bool_t> eventsToGenerate();
+
+ //! Generate signal event
+ Bool_t generateSignalEvent();
+
+ //! Generate background event
+ /*!
+ \param [in] bgID ID number of the background class
+ */
+ Bool_t generateBkgndEvent( UInt_t bgID );
+
+ //! Setup the required ntuple branches
+ void setupGenNtupleBranches();
+
+ //! Store all of the DP information
+ void setDPBranchValues();
+
+ //! Generate from the extra PDFs
+ /*!
+ \param [in] extraPdfs the list of extra PDFs
+ \param [in] embeddedData the embedded data sample
+ */
+ void generateExtraPdfValues( LauPdfPList* extraPdfs, LauEmbeddedData* embeddedData );
+
+ //! Store the MC truth info on the TM/SCF nature of the embedded signal event
+ /*!
+ \param [in] embeddedData the full simulation information
+ */
+ Bool_t storeSignalMCMatch( LauEmbeddedData* embeddedData );
+
+ //! Add sPlot branches for the extra PDFs
+ /*!
+ \param [in] extraPdfs the list of extra PDFs
+ \param [in] prefix the list of prefixes for the branch names
+ */
+ void addSPlotNtupleBranches( const LauPdfPList* extraPdfs, const TString& prefix );
+
+ //! Set the branches for the sPlot ntuple with extra PDFs
+ /*!
+ \param [in] extraPdfs the list of extra PDFs
+ \param [in] prefix the list of prefixes for the branch names
+ \param [in] iEvt the event number
+ */
+ Double_t setSPlotNtupleBranchValues( LauPdfPList* extraPdfs, const TString& prefix, UInt_t iEvt );
+
+ //! Update the signal events after Minuit sets background parameters
+ void updateSigEvents();
+
+ //! Add branches to store experiment number and the event number within the experiment
+ virtual void setupSPlotNtupleBranches();
+
+ //! Returns the names of all variables in the fit
+ virtual LauSPlot::NameSet variableNames() const;
+
+ //! Returns the names and yields of species that are free in the fit
+ virtual LauSPlot::NumbMap freeSpeciesNames() const;
- //! Returns the names and yields of species that are fixed in the fit
- virtual LauSPlot::NumbMap fixdSpeciesNames() const;
+ //! Returns the names and yields of species that are fixed in the fit
+ virtual LauSPlot::NumbMap fixdSpeciesNames() const;
- //! Returns the species and variables for all 2D PDFs in the fit
- virtual LauSPlot::TwoDMap twodimPDFs() const;
+ //! Returns the species and variables for all 2D PDFs in the fit
+ virtual LauSPlot::TwoDMap twodimPDFs() const;
- //! Check if the signal is split into well-reconstructed and mis-reconstructed types
- virtual Bool_t splitSignal() const {return this->useSCF();}
+ //! Check if the signal is split into well-reconstructed and mis-reconstructed types
+ virtual Bool_t splitSignal() const { return this->useSCF(); }
- //! Check if the mis-reconstructed signal is to be smeared in the DP
- virtual Bool_t scfDPSmear() const {return (scfMap_ != 0);}
+ //! Check if the mis-reconstructed signal is to be smeared in the DP
+ virtual Bool_t scfDPSmear() const { return ( scfMap_ != 0 ); }
- //! Append fake data points to the inputData for each bin in the SCF smearing matrix
- /*!
- We'll be caching the DP amplitudes and efficiencies of the centres of the true bins.
- To do so, we attach some fake points at the end of inputData, the number of the entry
- minus the total number of events corresponding to the number of the histogram for that
- given true bin in the LauScfMap object. (What this means is that when Laura is provided with
- the LauScfMap object by the user, it's the latter who has to make sure that it contains the
- right number of histograms and in exactly the right order!)
+ //! Append fake data points to the inputData for each bin in the SCF smearing matrix
+ /*!
+ We'll be caching the DP amplitudes and efficiencies of the centres of the true bins.
+ To do so, we attach some fake points at the end of inputData, the number of the entry
+ minus the total number of events corresponding to the number of the histogram for that
+ given true bin in the LauScfMap object. (What this means is that when Laura is provided with
+ the LauScfMap object by the user, it's the latter who has to make sure that it contains the
+ right number of histograms and in exactly the right order!)
- \param [in] inputData the fit data
- */
- void appendBinCentres( LauFitDataTree* inputData );
+ \param [in] inputData the fit data
+ */
+ void appendBinCentres( LauFitDataTree* inputData );
- //! Retrieve the signal DP model for the B-
- LauIsobarDynamics* getNegSigModel() {return negSigModel_;}
- //! Retrieve the signal DP model for the B+
- LauIsobarDynamics* getPosSigModel() {return posSigModel_;}
+ //! Retrieve the signal DP model for the B-
+ LauIsobarDynamics* getNegSigModel() { return negSigModel_; }
- //! Retrieve a named parameter from a TTree
- /*!
- \param [in] tree a reference to the tree from which to obtain the parameters
- \param [in] name the name of the parameter to retrive
- */
- Double_t getParamFromTree( TTree& tree, const TString& name );
+ //! Retrieve the signal DP model for the B+
+ LauIsobarDynamics* getPosSigModel() { return posSigModel_; }
- //! Set a LauParameter to a given value
- /*!
- \param [in] param a pointer to the LauParameter to set
- \param [in] val the value to set
- \param [in] fix whether to fix the LauParameter or leave it floating
- */
- void fixParam( LauParameter* param, const Double_t val, const Bool_t fix );
+ //! Retrieve a named parameter from a TTree
+ /*!
+ \param [in] tree a reference to the tree from which to obtain the parameters
+ \param [in] name the name of the parameter to retrive
+ */
+ Double_t getParamFromTree( TTree& tree, const TString& name );
- //! Set a vector of LauParameters according to the specified method
- /*!
- \param [in] params the vector of pointers to LauParameter to set values of
- */
- void fixParams( std::vector<LauParameter*>& params );
+ //! Set a LauParameter to a given value
+ /*!
+ \param [in] param a pointer to the LauParameter to set
+ \param [in] val the value to set
+ \param [in] fix whether to fix the LauParameter or leave it floating
+ */
+ void fixParam( LauParameter* param, const Double_t val, const Bool_t fix );
- private:
- //! Copy constructor (not implemented)
- LauCPFitModel(const LauCPFitModel& rhs);
+ //! Set a vector of LauParameters according to the specified method
+ /*!
+ \param [in] params the vector of pointers to LauParameter to set values of
+ */
+ void fixParams( std::vector<LauParameter*>& params );
- //! Copy assignment operator (not implemented)
- LauCPFitModel& operator=(const LauCPFitModel& rhs);
+ private:
+ //! Copy constructor (not implemented)
+ LauCPFitModel( const LauCPFitModel& rhs );
- //! The B- signal Dalitz plot model
- LauIsobarDynamics *negSigModel_;
+ //! Copy assignment operator (not implemented)
+ LauCPFitModel& operator=( const LauCPFitModel& rhs );
- //! The B+ signal Dalitz plot model
- LauIsobarDynamics *posSigModel_;
+ //! The B- signal Dalitz plot model
+ LauIsobarDynamics* negSigModel_;
- //! The B- background Dalitz plot models
- LauBkgndDPModelList negBkgndDPModels_;
+ //! The B+ signal Dalitz plot model
+ LauIsobarDynamics* posSigModel_;
- //! The B+ background Dalitz plot models
- LauBkgndDPModelList posBkgndDPModels_;
+ //! The B- background Dalitz plot models
+ LauBkgndDPModelList negBkgndDPModels_;
- //! The B- Dalitz plot kinematics object
- LauKinematics *negKinematics_;
+ //! The B+ background Dalitz plot models
+ LauBkgndDPModelList posBkgndDPModels_;
- //! The B+ Dalitz plot kinematics object
- LauKinematics *posKinematics_;
+ //! The B- Dalitz plot kinematics object
+ LauKinematics* negKinematics_;
- //! The B- signal PDFs
- LauPdfPList negSignalPdfs_;
+ //! The B+ Dalitz plot kinematics object
+ LauKinematics* posKinematics_;
- //! The B+ signal PDFs
- LauPdfPList posSignalPdfs_;
+ //! The B- signal PDFs
+ LauPdfPList negSignalPdfs_;
- //! The B- SCF PDFs
- LauPdfPList negScfPdfs_;
+ //! The B+ signal PDFs
+ LauPdfPList posSignalPdfs_;
- //! The B+ SCF PDFs
- LauPdfPList posScfPdfs_;
+ //! The B- SCF PDFs
+ LauPdfPList negScfPdfs_;
- //! The B- background PDFs
- LauBkgndPdfsList negBkgndPdfs_;
+ //! The B+ SCF PDFs
+ LauPdfPList posScfPdfs_;
- //! The B+ background PDFs
- LauBkgndPdfsList posBkgndPdfs_;
+ //! The B- background PDFs
+ LauBkgndPdfsList negBkgndPdfs_;
- //! Background boolean
- Bool_t usingBkgnd_;
+ //! The B+ background PDFs
+ LauBkgndPdfsList posBkgndPdfs_;
- //! Number of signal components
- UInt_t nSigComp_;
+ //! Background boolean
+ Bool_t usingBkgnd_;
- //! Number of signal DP parameters
- UInt_t nSigDPPar_;
+ //! Number of signal components
+ UInt_t nSigComp_;
- //! Number of extra PDF parameters
- UInt_t nExtraPdfPar_;
+ //! Number of signal DP parameters
+ UInt_t nSigDPPar_;
- //! Number of normalisation parameters (yields, asymmetries)
- UInt_t nNormPar_;
+ //! Number of extra PDF parameters
+ UInt_t nExtraPdfPar_;
- //! Magnitudes and Phases
- std::vector<LauAbsCoeffSet*> coeffPars_;
+ //! Number of normalisation parameters (yields, asymmetries)
+ UInt_t nNormPar_;
- //! The B- fit fractions
- LauParArray negFitFrac_;
+ //! Magnitudes and Phases
+ std::vector<LauAbsCoeffSet*> coeffPars_;
- //! The B+ fit fractions
- LauParArray posFitFrac_;
+ //! The B- fit fractions
+ LauParArray negFitFrac_;
- //! Fit B- fractions (uncorrected for the efficiency)
- LauParArray negFitFracEffUnCorr_;
+ //! The B+ fit fractions
+ LauParArray posFitFrac_;
- //! Fit B+ fractions (uncorrected for the efficiency)
- LauParArray posFitFracEffUnCorr_;
+ //! Fit B- fractions (uncorrected for the efficiency)
+ LauParArray negFitFracEffUnCorr_;
- //! The CP violating fit fraction
- LauParArray CPVFitFrac_;
+ //! Fit B+ fractions (uncorrected for the efficiency)
+ LauParArray posFitFracEffUnCorr_;
- //! The CP conserving fit fraction
- LauParArray CPCFitFrac_;
+ //! The CP violating fit fraction
+ LauParArray CPVFitFrac_;
- //! The fit fraction asymmetries
- std::vector<LauParameter> fitFracAsymm_;
+ //! The CP conserving fit fraction
+ LauParArray CPCFitFrac_;
- //! A_CP parameter
- std::vector<LauParameter> acp_;
+ //! The fit fraction asymmetries
+ std::vector<LauParameter> fitFracAsymm_;
- //! The mean efficiency for B- model
- LauParameter negMeanEff_;
+ //! A_CP parameter
+ std::vector<LauParameter> acp_;
- //! The mean efficiency for B+ model
- LauParameter posMeanEff_;
+ //! The mean efficiency for B- model
+ LauParameter negMeanEff_;
- //! The average DP rate for B-
- LauParameter negDPRate_;
+ //! The mean efficiency for B+ model
+ LauParameter posMeanEff_;
- //! The average DP rate for B+
- LauParameter posDPRate_;
+ //! The average DP rate for B-
+ LauParameter negDPRate_;
- //! Signal yield
- LauParameter* signalEvents_;
+ //! The average DP rate for B+
+ LauParameter posDPRate_;
- //! Signal asymmetry
- LauParameter* signalAsym_;
+ //! Signal yield
+ LauParameter* signalEvents_;
- //! Option to force an asymmetry
- Bool_t forceAsym_;
+ //! Signal asymmetry
+ LauParameter* signalAsym_;
- //! Background yield(s)
- LauBkgndYieldList bkgndEvents_;
+ //! Option to force an asymmetry
+ Bool_t forceAsym_;
- //! Background asymmetries(s)
- LauBkgndYieldList bkgndAsym_;
+ //! Background yield(s)
+ LauBkgndYieldList bkgndEvents_;
- //! IS the analysis tagged?
- const Bool_t tagged_;
+ //! Background asymmetries(s)
+ LauBkgndYieldList bkgndAsym_;
- //! Event charge
- const TString tagVarName_;
+ //! IS the analysis tagged?
+ const Bool_t tagged_;
- //! Current event charge
- Int_t curEvtCharge_;
+ //! Event charge
+ const TString tagVarName_;
- //! Vector to store event charges
- std::vector<Int_t> evtCharges_;
+ //! Current event charge
+ Int_t curEvtCharge_;
- //! Is the signal split into TM and SCF
- Bool_t useSCF_;
+ //! Vector to store event charges
+ std::vector<Int_t> evtCharges_;
- //! Is the SCF fraction DP-dependent
- Bool_t useSCFHist_;
+ //! Is the signal split into TM and SCF
+ Bool_t useSCF_;
- //! The (global) SCF fraction parameter
- LauParameter scfFrac_;
+ //! Is the SCF fraction DP-dependent
+ Bool_t useSCFHist_;
- //! The histogram giving the DP-dependence of the SCF fraction
- LauEffModel* scfFracHist_;
+ //! The (global) SCF fraction parameter
+ LauParameter scfFrac_;
- //! The smearing matrix for the SCF DP PDF
- LauScfMap* scfMap_;
+ //! The histogram giving the DP-dependence of the SCF fraction
+ LauEffModel* scfFracHist_;
- //! The cached values of the SCF fraction for each event
- std::vector<Double_t> recoSCFFracs_;
+ //! The smearing matrix for the SCF DP PDF
+ LauScfMap* scfMap_;
- //! The cached values of the SCF fraction for each bin centre
- std::vector<Double_t> fakeSCFFracs_;
+ //! The cached values of the SCF fraction for each event
+ std::vector<Double_t> recoSCFFracs_;
- //! The cached values of the sqDP jacobians for each event
- std::vector<Double_t> recoJacobians_;
+ //! The cached values of the SCF fraction for each bin centre
+ std::vector<Double_t> fakeSCFFracs_;
- //! The cached values of the sqDP jacobians for each true bin
- std::vector<Double_t> fakeJacobians_;
+ //! The cached values of the sqDP jacobians for each event
+ std::vector<Double_t> recoJacobians_;
- //! Run choice variables
- Bool_t compareFitData_;
+ //! The cached values of the sqDP jacobians for each true bin
+ std::vector<Double_t> fakeJacobians_;
- //! Name of the parent particle
- TString negParent_;
+ //! Run choice variables
+ Bool_t compareFitData_;
- //! Name of the parent particle
- TString posParent_;
+ //! Name of the parent particle
+ TString negParent_;
- //! The complex coefficients for B-
- std::vector<LauComplex> negCoeffs_;
+ //! Name of the parent particle
+ TString posParent_;
- //! The complex coefficients for B+
- std::vector<LauComplex> posCoeffs_;
+ //! The complex coefficients for B-
+ std::vector<LauComplex> negCoeffs_;
- // Embedding full simulation events
+ //! The complex coefficients for B+
+ std::vector<LauComplex> posCoeffs_;
- //! The B- signal event tree
- LauEmbeddedData *negSignalTree_;
+ // Embedding full simulation events
- //! The B+ signal event tree
- LauEmbeddedData *posSignalTree_;
+ //! The B- signal event tree
+ LauEmbeddedData* negSignalTree_;
- //! The B- background event tree
- LauBkgndEmbDataList negBkgndTree_;
+ //! The B+ signal event tree
+ LauEmbeddedData* posSignalTree_;
- //! The B+ background event tree
- LauBkgndEmbDataList posBkgndTree_;
+ //! The B- background event tree
+ LauBkgndEmbDataList negBkgndTree_;
- //! Boolean to reuse signal events
- Bool_t reuseSignal_;
+ //! The B+ background event tree
+ LauBkgndEmbDataList posBkgndTree_;
- //! Boolean to use reweighting for B-
- Bool_t useNegReweighting_;
+ //! Boolean to reuse signal events
+ Bool_t reuseSignal_;
- //! Boolean to use reweighting for B+
- Bool_t usePosReweighting_;
+ //! Boolean to use reweighting for B-
+ Bool_t useNegReweighting_;
- //! Vector of booleans to reuse background events
- LauBkgndReuseEventsList reuseBkgnd_;
+ //! Boolean to use reweighting for B+
+ Bool_t usePosReweighting_;
- // Likelihood values
- //! Signal DP likelihood value
- Double_t sigDPLike_;
+ //! Vector of booleans to reuse background events
+ LauBkgndReuseEventsList reuseBkgnd_;
- //! SCF DP likelihood value
- Double_t scfDPLike_;
+ // Likelihood values
+ //! Signal DP likelihood value
+ Double_t sigDPLike_;
- //! Background DP likelihood value(s)
- std::vector<Double_t> bkgndDPLike_;
+ //! SCF DP likelihood value
+ Double_t scfDPLike_;
- //! Signal likelihood from extra PDFs
- Double_t sigExtraLike_;
+ //! Background DP likelihood value(s)
+ std::vector<Double_t> bkgndDPLike_;
- //! SCF likelihood from extra PDFs
- Double_t scfExtraLike_;
+ //! Signal likelihood from extra PDFs
+ Double_t sigExtraLike_;
- //! Background likelihood value(s) from extra PDFs
- std::vector<Double_t> bkgndExtraLike_;
+ //! SCF likelihood from extra PDFs
+ Double_t scfExtraLike_;
- //! Total signal likelihood
- Double_t sigTotalLike_;
+ //! Background likelihood value(s) from extra PDFs
+ std::vector<Double_t> bkgndExtraLike_;
- //! Total SCF likelihood
- Double_t scfTotalLike_;
+ //! Total signal likelihood
+ Double_t sigTotalLike_;
- //! Total background likelihood(s)
- std::vector<Double_t> bkgndTotalLike_;
+ //! Total SCF likelihood
+ Double_t scfTotalLike_;
- ClassDef(LauCPFitModel,0) // CP fit/ToyMC model
+ //! Total background likelihood(s)
+ std::vector<Double_t> bkgndTotalLike_;
+ ClassDef( LauCPFitModel, 0 ) // CP fit/ToyMC model
};
#endif
diff --git a/inc/LauCacheData.hh b/inc/LauCacheData.hh
index 05492f5..869d0cd 100644
--- a/inc/LauCacheData.hh
+++ b/inc/LauCacheData.hh
@@ -1,254 +1,259 @@
/*
Copyright 2005 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauCacheData.hh
\brief File containing declaration of LauCacheData class.
*/
/*! \class LauCacheData
\brief Class to contain cached data relating to an event.
Contains information on the dynamics of the event and some additional information such as the efficiency and the self cross feed fraction.
Used by the DP dynamics classes to store the cached event information.
*/
#ifndef LAU_CACHE_DATA
#define LAU_CACHE_DATA
#include <vector>
#include <Rtypes.h>
-
class LauCacheData {
- public:
- //! Constructor
- LauCacheData();
-
- //! Destructor
- virtual ~LauCacheData();
-
- //! Copy constructor
- /*!
- \param [in] rhs the object to copy
- */
- LauCacheData(const LauCacheData& rhs);
-
- //! Copy assignment operator
- /*!
- \param [in] rhs the object to clone
- */
- LauCacheData& operator=(const LauCacheData& rhs);
-
- //! Set the invariant mass squared of the first and third daugthers
- /*!
- \param [in] m13Sq the invariant mass squared of the first and third daugthers
- */
- inline void storem13Sq(Double_t m13Sq) {m13Sq_ = m13Sq;}
-
- //! Set the invariant mass squared of the second and third daugthers
- /*!
- \param [in] m23Sq the invariant mass squared of the second and third daugthers
- */
- inline void storem23Sq(Double_t m23Sq) {m23Sq_ = m23Sq;}
-
- //! Set the square Dalitz plot coordinate, m'
- /*!
- \param [in] mPrime the square Dalitz plot coordinate, m'
- */
- inline void storemPrime(Double_t mPrime) {mPrime_ = mPrime;}
-
- //! Set the square Dalitz plot coordinate, theta'
- /*!
- \param [in] thPrime the square Dalitz plot coordinate, theta'
- */
- inline void storethPrime(Double_t thPrime) {thPrime_ = thPrime;}
-
- //! Set the tagging category
- /*!
- \param [in] tagCat the tagging category
- */
- inline void storeTagCat(Int_t tagCat) {tagCat_ = tagCat;}
-
- //! Set the efficiency
- /*!
- \param [in] eff the efficiency
- */
- inline void storeEff(Double_t eff) {eff_ = eff;}
-
- //! Set the fraction of poorly constructed events (the self cross feed fraction)
- /*!
- \param [in] scfFraction the fraction of poorly constructed events
- */
- inline void storeScfFraction(Double_t scfFraction) {scfFraction_ = scfFraction;}
-
- //! Set the Jacobian for the transformation into square Dalitz coordinates
- /*!
- \param [in] jacobian the Jacobian
- */
- inline void storeJacobian(Double_t jacobian) {jacobian_ = jacobian;}
-
- //! Set the real parts of the amplitudes
- /*!
- \param [in] realAmp the real parts of the amplitudes
- */
- inline void storeRealAmp(const std::vector<Double_t>& realAmp) {realAmp_ = realAmp;}
-
- //! Set the imaginary parts of the amplitudes
- /*!
- \param [in] imagAmp the imaginary parts of the amplitudes
- */
- inline void storeImagAmp(const std::vector<Double_t>& imagAmp) {imagAmp_ = imagAmp;}
-
- //! Set the incoherent intensities
- /*!
- \param [in] incohIntensities the intensities of the incoherent contributions
- */
- inline void storeIncohIntensities(const std::vector<Double_t>& incohIntensities) {incohIntensities_ = incohIntensities;}
-
- //! Retrieve the invariant mass squared of the first and third daugthers
- /*!
- \return m13 squared
- */
- inline Double_t retrievem13Sq() const {return m13Sq_;}
-
- //! Retrieve the invariant mass squared of the second and third daugthers
- /*!
- \return m23 squared
- */
- inline Double_t retrievem23Sq() const {return m23Sq_;}
-
- //! Retrieve the square Dalitz plot coordinate, m'
- /*!
- \return m'
- */
- inline Double_t retrievemPrime() const {return mPrime_;}
-
- //! Retrieve the square Dalitz plot coordinate, theta'
- /*!
- \return theta'
- */
- inline Double_t retrievethPrime() const {return thPrime_;}
-
- //! Retrieve the tagging category
- /*!
- \return the tagging category
- */
- inline Int_t retrieveTagCat() const {return tagCat_;}
-
- //! Retrieve the efficiency
- /*!
- \return the efficiency
- */
- inline Double_t retrieveEff() const {return eff_;}
-
- //! Retrieve the fraction of poorly reconstructed events (the so-called self cross feed fraction)
- /*!
- \return the fraction of poorly reconstructed events
- */
- inline Double_t retrieveScfFraction() const {return scfFraction_;}
-
- //! Retrieve the Jacobian for the transformation into square-Dalitz-plot coordinates
- /*!
- \return the Jacobian
- */
- inline Double_t retrieveJacobian() const {return jacobian_;}
-
- //! Retrieve the real parts of the amplitudes
- /*!
- \return the real parts of the amplitudes
- */
- inline const std::vector<Double_t>& retrieveRealAmp() const {return realAmp_;}
-
- //! Retrieve the imaginary parts of the amplitudes
- /*!
- \return the imaginary parts of the amplitudes
- */
- inline const std::vector<Double_t>& retrieveImagAmp() const {return imagAmp_;}
-
- //! Retrieve the incoherent intensities
- /*!
- \return the intensities of the incoherent contributions
- */
- inline const std::vector<Double_t>& retrieveIncohIntensities() const {return incohIntensities_;}
-
- //! Retrieve the real parts of the amplitudes
- /*!
- \return the real parts of the amplitudes
- */
- inline std::vector<Double_t>& retrieveRealAmp() {return realAmp_;}
-
- //! Retrieve the imaginary parts of the amplitudes
- /*!
- \return the imaginary parts of the amplitudes
- */
- inline std::vector<Double_t>& retrieveImagAmp() {return imagAmp_;}
-
- //! Retrieve the incoherent intensities
- /*!
- \return the intensities of the incoherent contributions
- */
- inline std::vector<Double_t>& retrieveIncohIntensities() {return incohIntensities_;}
-
- protected:
-
- private:
- //! The invariant mass squared of the first and third daugthers
- Double_t m13Sq_;
-
- //! The invariant mass squared of the second and third daugthers
- Double_t m23Sq_;
-
- //! The square Dalitz plot coordinate, m'
- Double_t mPrime_;
-
- //! The square Dalitz plot coordinate, theta'
- Double_t thPrime_;
-
- //! The tagging category
- Int_t tagCat_;
-
- //! The efficiency
- Double_t eff_;
-
- //! The fraction of poorly constructed events (the self cross feed fraction)
- Double_t scfFraction_;
-
- //! The Jacobian for the transformation into square Dalitz coordinates
- Double_t jacobian_;
-
- //! The real parts of the amplitudes
- std::vector<Double_t> realAmp_;
-
- //! The imaginary parts of the amplitudes
- std::vector<Double_t> imagAmp_;
-
- //! The intensities of the incoherent contributions
- std::vector<Double_t> incohIntensities_;
-
- ClassDef(LauCacheData,0) // Cached Data Class
+ public:
+ //! Constructor
+ LauCacheData();
+
+ //! Destructor
+ virtual ~LauCacheData();
+
+ //! Copy constructor
+ /*!
+ \param [in] rhs the object to copy
+ */
+ LauCacheData( const LauCacheData& rhs );
+
+ //! Copy assignment operator
+ /*!
+ \param [in] rhs the object to clone
+ */
+ LauCacheData& operator=( const LauCacheData& rhs );
+
+ //! Set the invariant mass squared of the first and third daugthers
+ /*!
+ \param [in] m13Sq the invariant mass squared of the first and third daugthers
+ */
+ inline void storem13Sq( Double_t m13Sq ) { m13Sq_ = m13Sq; }
+
+ //! Set the invariant mass squared of the second and third daugthers
+ /*!
+ \param [in] m23Sq the invariant mass squared of the second and third daugthers
+ */
+ inline void storem23Sq( Double_t m23Sq ) { m23Sq_ = m23Sq; }
+
+ //! Set the square Dalitz plot coordinate, m'
+ /*!
+ \param [in] mPrime the square Dalitz plot coordinate, m'
+ */
+ inline void storemPrime( Double_t mPrime ) { mPrime_ = mPrime; }
+
+ //! Set the square Dalitz plot coordinate, theta'
+ /*!
+ \param [in] thPrime the square Dalitz plot coordinate, theta'
+ */
+ inline void storethPrime( Double_t thPrime ) { thPrime_ = thPrime; }
+
+ //! Set the tagging category
+ /*!
+ \param [in] tagCat the tagging category
+ */
+ inline void storeTagCat( Int_t tagCat ) { tagCat_ = tagCat; }
+
+ //! Set the efficiency
+ /*!
+ \param [in] eff the efficiency
+ */
+ inline void storeEff( Double_t eff ) { eff_ = eff; }
+
+ //! Set the fraction of poorly constructed events (the self cross feed fraction)
+ /*!
+ \param [in] scfFraction the fraction of poorly constructed events
+ */
+ inline void storeScfFraction( Double_t scfFraction ) { scfFraction_ = scfFraction; }
+
+ //! Set the Jacobian for the transformation into square Dalitz coordinates
+ /*!
+ \param [in] jacobian the Jacobian
+ */
+ inline void storeJacobian( Double_t jacobian ) { jacobian_ = jacobian; }
+
+ //! Set the real parts of the amplitudes
+ /*!
+ \param [in] realAmp the real parts of the amplitudes
+ */
+ inline void storeRealAmp( const std::vector<Double_t>& realAmp ) { realAmp_ = realAmp; }
+
+ //! Set the imaginary parts of the amplitudes
+ /*!
+ \param [in] imagAmp the imaginary parts of the amplitudes
+ */
+ inline void storeImagAmp( const std::vector<Double_t>& imagAmp ) { imagAmp_ = imagAmp; }
+
+ //! Set the incoherent intensities
+ /*!
+ \param [in] incohIntensities the intensities of the incoherent contributions
+ */
+ inline void storeIncohIntensities( const std::vector<Double_t>& incohIntensities )
+ {
+ incohIntensities_ = incohIntensities;
+ }
+
+ //! Retrieve the invariant mass squared of the first and third daugthers
+ /*!
+ \return m13 squared
+ */
+ inline Double_t retrievem13Sq() const { return m13Sq_; }
+
+ //! Retrieve the invariant mass squared of the second and third daugthers
+ /*!
+ \return m23 squared
+ */
+ inline Double_t retrievem23Sq() const { return m23Sq_; }
+
+ //! Retrieve the square Dalitz plot coordinate, m'
+ /*!
+ \return m'
+ */
+ inline Double_t retrievemPrime() const { return mPrime_; }
+
+ //! Retrieve the square Dalitz plot coordinate, theta'
+ /*!
+ \return theta'
+ */
+ inline Double_t retrievethPrime() const { return thPrime_; }
+
+ //! Retrieve the tagging category
+ /*!
+ \return the tagging category
+ */
+ inline Int_t retrieveTagCat() const { return tagCat_; }
+
+ //! Retrieve the efficiency
+ /*!
+ \return the efficiency
+ */
+ inline Double_t retrieveEff() const { return eff_; }
+
+ //! Retrieve the fraction of poorly reconstructed events (the so-called self cross feed fraction)
+ /*!
+ \return the fraction of poorly reconstructed events
+ */
+ inline Double_t retrieveScfFraction() const { return scfFraction_; }
+
+ //! Retrieve the Jacobian for the transformation into square-Dalitz-plot coordinates
+ /*!
+ \return the Jacobian
+ */
+ inline Double_t retrieveJacobian() const { return jacobian_; }
+
+ //! Retrieve the real parts of the amplitudes
+ /*!
+ \return the real parts of the amplitudes
+ */
+ inline const std::vector<Double_t>& retrieveRealAmp() const { return realAmp_; }
+
+ //! Retrieve the imaginary parts of the amplitudes
+ /*!
+ \return the imaginary parts of the amplitudes
+ */
+ inline const std::vector<Double_t>& retrieveImagAmp() const { return imagAmp_; }
+
+ //! Retrieve the incoherent intensities
+ /*!
+ \return the intensities of the incoherent contributions
+ */
+ inline const std::vector<Double_t>& retrieveIncohIntensities() const
+ {
+ return incohIntensities_;
+ }
+
+ //! Retrieve the real parts of the amplitudes
+ /*!
+ \return the real parts of the amplitudes
+ */
+ inline std::vector<Double_t>& retrieveRealAmp() { return realAmp_; }
+
+ //! Retrieve the imaginary parts of the amplitudes
+ /*!
+ \return the imaginary parts of the amplitudes
+ */
+ inline std::vector<Double_t>& retrieveImagAmp() { return imagAmp_; }
+
+ //! Retrieve the incoherent intensities
+ /*!
+ \return the intensities of the incoherent contributions
+ */
+ inline std::vector<Double_t>& retrieveIncohIntensities() { return incohIntensities_; }
+
+ protected:
+
+ private:
+ //! The invariant mass squared of the first and third daugthers
+ Double_t m13Sq_;
+
+ //! The invariant mass squared of the second and third daugthers
+ Double_t m23Sq_;
+
+ //! The square Dalitz plot coordinate, m'
+ Double_t mPrime_;
+
+ //! The square Dalitz plot coordinate, theta'
+ Double_t thPrime_;
+
+ //! The tagging category
+ Int_t tagCat_;
+
+ //! The efficiency
+ Double_t eff_;
+
+ //! The fraction of poorly constructed events (the self cross feed fraction)
+ Double_t scfFraction_;
+
+ //! The Jacobian for the transformation into square Dalitz coordinates
+ Double_t jacobian_;
+
+ //! The real parts of the amplitudes
+ std::vector<Double_t> realAmp_;
+
+ //! The imaginary parts of the amplitudes
+ std::vector<Double_t> imagAmp_;
+
+ //! The intensities of the incoherent contributions
+ std::vector<Double_t> incohIntensities_;
+
+ ClassDef( LauCacheData, 0 ) // Cached Data Class
};
#endif
diff --git a/inc/LauCalcChiSq.hh b/inc/LauCalcChiSq.hh
index e6683c6..6f250ac 100644
--- a/inc/LauCalcChiSq.hh
+++ b/inc/LauCalcChiSq.hh
@@ -1,163 +1,173 @@
/*
Copyright 2008 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
#include "TH2Poly.h"
#include "TString.h"
#include <vector>
/*! \file LauCalcChiSq.hh
\brief File containing declaration of LauCalcChiSq class.
*/
/*! \class LauCalcChiSq
\brief Utility class to allow the calculation of the chisq of the fit to the Dalitz plot
A utility class to allow the calculation of the chisq of the fit to the Dalitz plot.
A text config file is provided that gives the datasets for the data and toy
MC generated from the fit results. These can be in the traditional DP or
the square DP.
A sample config file is provided. The fields are:
- \<name of file containing data histogram\> \<name of data tree\> \<name of the x axis variable in data\> \<name of the y axis variable in data\><br>
- \<name of file containing toy MC histogram\> \<name of toy MC tree\> \<name of the x axis variable in toy MC\> \<name of the y axis variable in toy MC\><br>
- \<the minimum content for any bin\> \<the number of free parameter in the fit\> \<the scalefactor by which the toy MC bin content should be multiplied\> \<minimum x value\> \<maximum x value\> \<minimum y value\> \<maximum y value\>
+ \<name of file containing data histogram\> \<name of data tree\> \<name of the x axis variable in data\> \<name of the y axis variable in data\><br>
+ \<name of file containing toy MC histogram\> \<name of toy MC tree\> \<name of the x axis variable in toy MC\> \<name of the y axis variable in toy MC\><br>
+ \<the minimum content for any bin\> \<the number of free parameter in the fit\> \<the scalefactor by which the toy MC bin content should be multiplied\> \<minimum x value\> \<maximum x value\> \<minimum y value\> \<maximum y value\>
*/
class LauCalcChiSq {
- public:
-
- //! Constructor
- /*!
- \param [in] inputFileName name of the config file
- */
- LauCalcChiSq(const TString& inputFileName = "chiSqInput.txt");
-
- //! Destructor
- virtual ~LauCalcChiSq();
-
- //! Toggle verbose printout
- /*!
- \param [in] flag true to enable verbose printout, false to disable
- */
- inline void setVerbose(const Bool_t flag) {verbose_ = flag;}
-
- //! Run the calculations
- void run();
-
- private:
- //! Read the config file, read the data and create histograms
- void initialiseHistos();
-
- //! Choose the binning scheme
- /*!
- \param [in] xs x coordinates of low statistics sample
- \param [in] ys y coordinates of low statistics sample
- \param [in] nEntries number of entries in low statistics sample
- \param [out] divisions resulting binning scheme
- */
- void pickBinning(const Double_t* xs, const Double_t* ys, const Int_t nEntries, std::vector<Int_t>& divisions);
-
- //! Create the template histogram based on the binning scheme
- /*!
- This function is called recursively to perform subdivisions
-
- \param [in] xMin the minimum x coordinate of the region to be (sub)divided
- \param [in] xMax the maximum x coordinate of the region to be (sub)divided
- \param [in] yMin the minimum y coordinate of the region to be (sub)divided
- \param [in] yMax the maximum y coordinate of the region to be (sub)divided
- \param [in] xs x coordinates of low statistics sample
- \param [in] ys y coordinates of low statistics sample
- \param [in] nEntries number of entries in low statistics sample
- \param [in] divisions the binning scheme
- \param [in] iter indicates depth of the subdivisions
- */
- void getHisto(const Double_t xMin, const Double_t xMax, const Double_t yMin, const Double_t yMax, const Double_t* xs, const Double_t* ys, const Int_t nEntries, const std::vector<Int_t>& divisions, const UInt_t iter=0);
-
- //! Calculate the chisq from the data histograms
- void calculateChiSq();
-
- //! Create plots
- void makePlots();
-
- //! Name of the config file
- TString inputFileName_;
-
- //! Name of the low stats data file
- TString fileName1_;
- //! Name of the high stats data file
- TString fileName2_;
- //! Name of the low stats data tree
- TString treeName1_;
- //! Name of the high stats data tree
- TString treeName2_;
-
- //! Name of the x-coordinate branch in tree 1
- TString xName1_;
- //! Name of the x-coordinate branch in tree 2
- TString xName2_;
- //! Name of the y-coordinate branch in tree 1
- TString yName1_;
- //! Name of the y-coordinate branch in tree 2
- TString yName2_;
-
- //! The minimum bin content
- Float_t minContent_;
-
- //! Template histogram constructed from the binning scheme
- TH2Poly* theHisto_;
- //! Histogram (constructed from template) filled from tree 1
- TH2Poly* histo1_;
- //! Histogram (constructed from template) filled from tree 2
- TH2Poly* histo2_;
- //! Histogram (constructed from template) filled with pulls of tree1 vs tree2
- TH2Poly* pullHisto_;
- //! Histogram (constructed from template) filled with chisq of tree1 vs tree2
- TH2Poly* chiSqHisto_;
- //! Histogram (constructed from template) filled with signed chisq of tree1 vs tree2
- TH2Poly* chiSqSignedHisto_;
-
- //! Minimum x coordinate of histograms
- Float_t xMin_;
- //! Maximum x coordinate of histograms
- Float_t xMax_;
- //! Minimum y coordinate of histograms
- Float_t yMin_;
- //! Maximum y coordinate of histograms
- Float_t yMax_;
-
- //! Number of free parameters in fit (used for calculating the ndof)
- Int_t nParams_;
-
- //! Scalefactor between low and high stats data samples
- Float_t scaleFactor_;
-
- //! Verbose flag
- Bool_t verbose_;
-
- ClassDef(LauCalcChiSq,0)
+ public:
+ //! Constructor
+ /*!
+ \param [in] inputFileName name of the config file
+ */
+ LauCalcChiSq( const TString& inputFileName = "chiSqInput.txt" );
+
+ //! Destructor
+ virtual ~LauCalcChiSq();
+
+ //! Toggle verbose printout
+ /*!
+ \param [in] flag true to enable verbose printout, false to disable
+ */
+ inline void setVerbose( const Bool_t flag ) { verbose_ = flag; }
+
+ //! Run the calculations
+ void run();
+
+ private:
+ //! Read the config file, read the data and create histograms
+ void initialiseHistos();
+
+ //! Choose the binning scheme
+ /*!
+ \param [in] xs x coordinates of low statistics sample
+ \param [in] ys y coordinates of low statistics sample
+ \param [in] nEntries number of entries in low statistics sample
+ \param [out] divisions resulting binning scheme
+ */
+ void pickBinning( const Double_t* xs,
+ const Double_t* ys,
+ const Int_t nEntries,
+ std::vector<Int_t>& divisions );
+
+ //! Create the template histogram based on the binning scheme
+ /*!
+ This function is called recursively to perform subdivisions
+
+ \param [in] xMin the minimum x coordinate of the region to be (sub)divided
+ \param [in] xMax the maximum x coordinate of the region to be (sub)divided
+ \param [in] yMin the minimum y coordinate of the region to be (sub)divided
+ \param [in] yMax the maximum y coordinate of the region to be (sub)divided
+ \param [in] xs x coordinates of low statistics sample
+ \param [in] ys y coordinates of low statistics sample
+ \param [in] nEntries number of entries in low statistics sample
+ \param [in] divisions the binning scheme
+ \param [in] iter indicates depth of the subdivisions
+ */
+ void getHisto( const Double_t xMin,
+ const Double_t xMax,
+ const Double_t yMin,
+ const Double_t yMax,
+ const Double_t* xs,
+ const Double_t* ys,
+ const Int_t nEntries,
+ const std::vector<Int_t>& divisions,
+ const UInt_t iter = 0 );
+
+ //! Calculate the chisq from the data histograms
+ void calculateChiSq();
+
+ //! Create plots
+ void makePlots();
+
+ //! Name of the config file
+ TString inputFileName_;
+
+ //! Name of the low stats data file
+ TString fileName1_;
+ //! Name of the high stats data file
+ TString fileName2_;
+ //! Name of the low stats data tree
+ TString treeName1_;
+ //! Name of the high stats data tree
+ TString treeName2_;
+
+ //! Name of the x-coordinate branch in tree 1
+ TString xName1_;
+ //! Name of the x-coordinate branch in tree 2
+ TString xName2_;
+ //! Name of the y-coordinate branch in tree 1
+ TString yName1_;
+ //! Name of the y-coordinate branch in tree 2
+ TString yName2_;
+
+ //! The minimum bin content
+ Float_t minContent_;
+
+ //! Template histogram constructed from the binning scheme
+ TH2Poly* theHisto_;
+ //! Histogram (constructed from template) filled from tree 1
+ TH2Poly* histo1_;
+ //! Histogram (constructed from template) filled from tree 2
+ TH2Poly* histo2_;
+ //! Histogram (constructed from template) filled with pulls of tree1 vs tree2
+ TH2Poly* pullHisto_;
+ //! Histogram (constructed from template) filled with chisq of tree1 vs tree2
+ TH2Poly* chiSqHisto_;
+ //! Histogram (constructed from template) filled with signed chisq of tree1 vs tree2
+ TH2Poly* chiSqSignedHisto_;
+
+ //! Minimum x coordinate of histograms
+ Float_t xMin_;
+ //! Maximum x coordinate of histograms
+ Float_t xMax_;
+ //! Minimum y coordinate of histograms
+ Float_t yMin_;
+ //! Maximum y coordinate of histograms
+ Float_t yMax_;
+
+ //! Number of free parameters in fit (used for calculating the ndof)
+ Int_t nParams_;
+
+ //! Scalefactor between low and high stats data samples
+ Float_t scaleFactor_;
+
+ //! Verbose flag
+ Bool_t verbose_;
+
+ ClassDef( LauCalcChiSq, 0 )
};
diff --git a/inc/LauCartesianCPCoeffSet.hh b/inc/LauCartesianCPCoeffSet.hh
index 5e0a061..0658671 100644
--- a/inc/LauCartesianCPCoeffSet.hh
+++ b/inc/LauCartesianCPCoeffSet.hh
@@ -1,173 +1,186 @@
/*
Copyright 2006 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauCartesianCPCoeffSet.hh
\brief File containing declaration of LauCartesianCPCoeffSet class.
*/
/*! \class LauCartesianCPCoeffSet
\brief Class for defining a complex coefficient using the Cartesian CP convention.
Holds a set of real values that define the complex coefficient of an amplitude component.
The amplitude has the form x +/- delta_x + i * ( y +/- delta_y ).
[Phys.Rev. D78 (2008) 012004]
*/
#ifndef LAU_CARTESIANCP_COEFF_SET
#define LAU_CARTESIANCP_COEFF_SET
-#include <iosfwd>
-#include <vector>
-
-#include "Rtypes.h"
-
#include "LauAbsCoeffSet.hh"
#include "LauComplex.hh"
#include "LauParameter.hh"
+#include "Rtypes.h"
+
+#include <iosfwd>
+#include <vector>
class LauCartesianCPCoeffSet : public LauAbsCoeffSet {
- public:
- //! Constructor
- /*!
- \param [in] compName the name of the coefficient set
- \param [in] x the average real part
- \param [in] y the average imaginary part
- \param [in] deltaX the asymmetric real part
- \param [in] deltaY the asymmetric imaginary part
- \param [in] xFixed whether x is fixed
- \param [in] yFixed whether y is fixed
- \param [in] deltaXFixed whether deltaX is fixed
- \param [in] deltaYFixed whether deltaY is fixed
- \param [in] deltaXSecondStage whether deltaX should be floated only in the second stage of the fit
- \param [in] deltaYSecondStage whether deltaY should be floated only in the second stage of the fit
- */
- LauCartesianCPCoeffSet(const TString& compName, Double_t x, Double_t y, Double_t deltaX, Double_t deltaY,
- Bool_t xFixed, Bool_t yFixed, Bool_t deltaXFixed, Bool_t deltaYFixed, Bool_t deltaXSecondStage = kFALSE, Bool_t deltaYSecondStage = kFALSE);
-
- //! Destructor
- virtual ~LauCartesianCPCoeffSet(){}
-
- //! Retrieve the parameters of the coefficient, e.g. so that they can be loaded into a fit
- /*!
- \return the parameters of the coefficient
- */
- virtual std::vector<LauParameter*> getParameters();
-
- //! Print the current values of the parameters
- virtual void printParValues() const;
-
- //! Print the column headings for a results table
- /*!
- \param [out] stream the stream to print to
- */
- virtual void printTableHeading(std::ostream& stream) const;
-
- //! Print the parameters of the complex coefficient as a row in the results table
- /*!
- \param [out] stream the stream to print to
- */
- virtual void printTableRow(std::ostream& stream) const;
-
- //! Randomise the starting values of the parameters for a fit
- virtual void randomiseInitValues();
-
- //! Make sure values are in "standard" ranges, e.g. phases should be between -pi and pi
- virtual void finaliseValues();
-
- //! Retrieve the complex coefficient for a particle
- /*!
- \return the complex coefficient for a particle
- */
- virtual const LauComplex& particleCoeff();
-
- //! Retrieve the complex coefficient for an antiparticle
- /*!
- \return the complex coefficient for an antiparticle
- */
- virtual const LauComplex& antiparticleCoeff();
-
- //! Set the parameters based on the complex coefficients for particles and antiparticles
- /*!
- \param [in] coeff the complex coefficient for a particle
- \param [in] coeffBar the complex coefficient for an antiparticle
- \param [in] init whether or not the initial and generated values should also be adjusted
- */
- virtual void setCoeffValues( const LauComplex& coeff, const LauComplex& coeffBar, Bool_t init );
-
- //! Calculate the CP asymmetry
- /*!
- \return the CP asymmetry
- */
- virtual LauParameter acp();
-
- //! Create a clone of the coefficient set
- /*!
- \param [in] newName the clone's name
- \param [in] cloneOption special option for the cloning operation
- \param [in] constFactor a constant factor to multiply the clone's parameters by
- \return a clone of the coefficient set
- */
- virtual LauAbsCoeffSet* createClone(const TString& newName, CloneOption cloneOption = All, Double_t constFactor = 1.0);
-
- private:
- //! Copy constructor
- /*!
- This creates cloned parameters, not copies.
- \param [in] rhs the coefficient to clone
- \param [in] cloneOption special option for the cloning operation
- \param [in] constFactor a constant factor to multiply the clone's parameters by
- */
- LauCartesianCPCoeffSet(const LauCartesianCPCoeffSet& rhs, CloneOption cloneOption = All, Double_t constFactor = 1.0);
-
- //! Copy assignment operator (not implemented)
- /*!
- \param [in] rhs the coefficient to clone
- */
- LauCartesianCPCoeffSet& operator=(const LauCartesianCPCoeffSet& rhs);
-
- // the actual fit parameters
- // (need to be pointers so they can be cloned)
- //! The average real part
- LauParameter* x_;
- //! The average imaginary part
- LauParameter* y_;
- //! The asymmetric real part
- LauParameter* deltaX_;
- //! The asymmetric imaginary part
- LauParameter* deltaY_;
-
- //! The particle complex coefficient
- LauComplex particleCoeff_;
- //! The antiparticle complex coefficient
- LauComplex antiparticleCoeff_;
-
- //! The CP asymmetry
- LauParameter acp_;
-
- ClassDef(LauCartesianCPCoeffSet, 0)
+ public:
+ //! Constructor
+ /*!
+ \param [in] compName the name of the coefficient set
+ \param [in] x the average real part
+ \param [in] y the average imaginary part
+ \param [in] deltaX the asymmetric real part
+ \param [in] deltaY the asymmetric imaginary part
+ \param [in] xFixed whether x is fixed
+ \param [in] yFixed whether y is fixed
+ \param [in] deltaXFixed whether deltaX is fixed
+ \param [in] deltaYFixed whether deltaY is fixed
+ \param [in] deltaXSecondStage whether deltaX should be floated only in the second stage of the fit
+ \param [in] deltaYSecondStage whether deltaY should be floated only in the second stage of the fit
+ */
+ LauCartesianCPCoeffSet( const TString& compName,
+ Double_t x,
+ Double_t y,
+ Double_t deltaX,
+ Double_t deltaY,
+ Bool_t xFixed,
+ Bool_t yFixed,
+ Bool_t deltaXFixed,
+ Bool_t deltaYFixed,
+ Bool_t deltaXSecondStage = kFALSE,
+ Bool_t deltaYSecondStage = kFALSE );
+
+ //! Destructor
+ virtual ~LauCartesianCPCoeffSet() {}
+
+ //! Retrieve the parameters of the coefficient, e.g. so that they can be loaded into a fit
+ /*!
+ \return the parameters of the coefficient
+ */
+ virtual std::vector<LauParameter*> getParameters();
+
+ //! Print the current values of the parameters
+ virtual void printParValues() const;
+
+ //! Print the column headings for a results table
+ /*!
+ \param [out] stream the stream to print to
+ */
+ virtual void printTableHeading( std::ostream& stream ) const;
+
+ //! Print the parameters of the complex coefficient as a row in the results table
+ /*!
+ \param [out] stream the stream to print to
+ */
+ virtual void printTableRow( std::ostream& stream ) const;
+
+ //! Randomise the starting values of the parameters for a fit
+ virtual void randomiseInitValues();
+
+ //! Make sure values are in "standard" ranges, e.g. phases should be between -pi and pi
+ virtual void finaliseValues();
+
+ //! Retrieve the complex coefficient for a particle
+ /*!
+ \return the complex coefficient for a particle
+ */
+ virtual const LauComplex& particleCoeff();
+
+ //! Retrieve the complex coefficient for an antiparticle
+ /*!
+ \return the complex coefficient for an antiparticle
+ */
+ virtual const LauComplex& antiparticleCoeff();
+
+ //! Set the parameters based on the complex coefficients for particles and antiparticles
+ /*!
+ \param [in] coeff the complex coefficient for a particle
+ \param [in] coeffBar the complex coefficient for an antiparticle
+ \param [in] init whether or not the initial and generated values should also be adjusted
+ */
+ virtual void setCoeffValues( const LauComplex& coeff, const LauComplex& coeffBar, Bool_t init );
+
+ //! Calculate the CP asymmetry
+ /*!
+ \return the CP asymmetry
+ */
+ virtual LauParameter acp();
+
+ //! Create a clone of the coefficient set
+ /*!
+ \param [in] newName the clone's name
+ \param [in] cloneOption special option for the cloning operation
+ \param [in] constFactor a constant factor to multiply the clone's parameters by
+ \return a clone of the coefficient set
+ */
+ virtual LauAbsCoeffSet* createClone( const TString& newName,
+ CloneOption cloneOption = All,
+ Double_t constFactor = 1.0 );
+
+ private:
+ //! Copy constructor
+ /*!
+ This creates cloned parameters, not copies.
+
+ \param [in] rhs the coefficient to clone
+ \param [in] cloneOption special option for the cloning operation
+ \param [in] constFactor a constant factor to multiply the clone's parameters by
+ */
+ LauCartesianCPCoeffSet( const LauCartesianCPCoeffSet& rhs,
+ CloneOption cloneOption = All,
+ Double_t constFactor = 1.0 );
+
+ //! Copy assignment operator (not implemented)
+ /*!
+ \param [in] rhs the coefficient to clone
+ */
+ LauCartesianCPCoeffSet& operator=( const LauCartesianCPCoeffSet& rhs );
+
+ // the actual fit parameters
+ // (need to be pointers so they can be cloned)
+ //! The average real part
+ LauParameter* x_;
+ //! The average imaginary part
+ LauParameter* y_;
+ //! The asymmetric real part
+ LauParameter* deltaX_;
+ //! The asymmetric imaginary part
+ LauParameter* deltaY_;
+
+ //! The particle complex coefficient
+ LauComplex particleCoeff_;
+ //! The antiparticle complex coefficient
+ LauComplex antiparticleCoeff_;
+
+ //! The CP asymmetry
+ LauParameter acp_;
+
+ ClassDef( LauCartesianCPCoeffSet, 0 )
};
#endif
diff --git a/inc/LauCartesianGammaCPCoeffSet.hh b/inc/LauCartesianGammaCPCoeffSet.hh
index 6949c01..ea654ef 100644
--- a/inc/LauCartesianGammaCPCoeffSet.hh
+++ b/inc/LauCartesianGammaCPCoeffSet.hh
@@ -1,190 +1,207 @@
/*
Copyright 2014 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauCartesianGammaCPCoeffSet.hh
\brief File containing declaration of LauCartesianGammaCPCoeffSet class.
*/
/*! \class LauCartesianGammaCPCoeffSet
\brief Class for defining a complex coefficient using the Cartesian gamma CP convention.
Holds a set of real values that define the complex coefficient of an amplitude component.
The amplitude has the form ( x + i * y ) * ( 1 + xCP +/- delta_xCP + i * ( yCP +/- delta_yCP ) ).
[Phys. Rev. D79, 051301 (2009)]
*/
#ifndef LAU_CARTESIANGAMMACP_COEFF_SET
#define LAU_CARTESIANGAMMACP_COEFF_SET
-#include <iosfwd>
-#include <vector>
-
-#include "Rtypes.h"
-
#include "LauAbsCoeffSet.hh"
#include "LauComplex.hh"
#include "LauParameter.hh"
+#include "Rtypes.h"
+
+#include <iosfwd>
+#include <vector>
class LauCartesianGammaCPCoeffSet : public LauAbsCoeffSet {
- public:
- //! Constructor
- /*!
- \param [in] compName the name of the coefficient set
- \param [in] x the real nonCP part
- \param [in] y the imaginary nonCP part
- \param [in] xCP the average real CP part
- \param [in] yCP the average imaginary CP part
- \param [in] deltaXCP the asymmetric real CP part
- \param [in] deltaYCP the asymmetric imaginary CP part
- \param [in] xFixed whether x is fixed
- \param [in] yFixed whether y is fixed
- \param [in] xCPFixed whether xCP is fixed
- \param [in] yCPFixed whether yCP is fixed
- \param [in] deltaXCPFixed whether deltaXCP is fixed
- \param [in] deltaYCPFixed whether deltaYCP is fixed
- \param [in] deltaXCPSecondStage whether deltaXCP should be floated only in the second stage of the fit
- \param [in] deltaYCPSecondStage whether deltaYCP should be floated only in the second stage of the fit
- */
- LauCartesianGammaCPCoeffSet(const TString& compName, const Double_t x, const Double_t y, const Double_t xCP, const Double_t yCP, const Double_t deltaXCP, const Double_t deltaYCP,
- const Bool_t xFixed, const Bool_t yFixed, const Bool_t xCPFixed, const Bool_t yCPFixed, const Bool_t deltaXCPFixed, const Bool_t deltaYCPFixed,
- const Bool_t deltaXCPSecondStage = kFALSE, const Bool_t deltaYCPSecondStage = kFALSE);
-
- //! Destructor
- virtual ~LauCartesianGammaCPCoeffSet(){}
-
- //! Retrieve the parameters of the coefficient, e.g. so that they can be loaded into a fit
- /*!
- \return the parameters of the coefficient
- */
- virtual std::vector<LauParameter*> getParameters();
-
- //! Print the current values of the parameters
- virtual void printParValues() const;
-
- //! Print the column headings for a results table
- /*!
- \param [out] stream the stream to print to
- */
- virtual void printTableHeading(std::ostream& stream) const;
-
- //! Print the parameters of the complex coefficient as a row in the results table
- /*!
- \param [out] stream the stream to print to
- */
- virtual void printTableRow(std::ostream& stream) const;
-
- //! Randomise the starting values of the parameters for a fit
- virtual void randomiseInitValues();
-
- //! Make sure values are in "standard" ranges, e.g. phases should be between -pi and pi
- virtual void finaliseValues();
-
- //! Retrieve the complex coefficient for a particle
- /*!
- \return the complex coefficient for a particle
- */
- virtual const LauComplex& particleCoeff();
-
- //! Retrieve the complex coefficient for an antiparticle
- /*!
- \return the complex coefficient for an antiparticle
- */
- virtual const LauComplex& antiparticleCoeff();
-
- //! Set the parameters based on the complex coefficients for particles and antiparticles
- /*!
- This method is not supported by this class because there are more than four parameters so there is not a unique solution.
- \param [in] coeff the complex coefficient for a particle
- \param [in] coeffBar the complex coefficient for an antiparticle
- \param [in] init whether or not the initial and generated values should also be adjusted
- */
- virtual void setCoeffValues( const LauComplex& coeff, const LauComplex& coeffBar, Bool_t init );
-
- //! Calculate the CP asymmetry
- /*!
- \return the CP asymmetry
- */
- virtual LauParameter acp();
-
- //! Create a clone of the coefficient set
- /*!
- \param [in] newName the clone's name
- \param [in] cloneOption special option for the cloning operation
- \param [in] constFactor a constant factor to multiply the clone's parameters by
- \return a clone of the coefficient set
- */
- virtual LauAbsCoeffSet* createClone(const TString& newName, CloneOption cloneOption = All, Double_t constFactor = 1.0);
-
- private:
- //! Copy constructor
- /*!
- This creates cloned parameters, not copies.
- \param [in] rhs the coefficient to clone
- \param [in] cloneOption special option for the cloning operation
- \param [in] constFactor a constant factor to multiply the clone's parameters by
- */
- LauCartesianGammaCPCoeffSet(const LauCartesianGammaCPCoeffSet& rhs, CloneOption cloneOption = All, Double_t constFactor = 1.0);
-
- //! Copy assignment operator (not implemented)
- /*!
- \param [in] rhs the coefficient to clone
- */
- LauCartesianGammaCPCoeffSet& operator=(const LauCartesianGammaCPCoeffSet& rhs);
-
- // the actual fit parameters
- // (need to be pointers so they can be cloned)
- //! The nonCP real part
- LauParameter* x_;
- //! The nonCP imaginary part
- LauParameter* y_;
- //! The average CP real part
- LauParameter* xCP_;
- //! The average CP imaginary part
- LauParameter* yCP_;
- //! The asymmetric CP real part
- LauParameter* deltaXCP_;
- //! The asymmetric CP imaginary part
- LauParameter* deltaYCP_;
-
- //! The nonCP part of the complex coefficient
- LauComplex nonCPPart_;
- //! The CP part of the complex coefficient for the particle
- LauComplex cpPart_;
- //! The CP part of the complex coefficient for the antiparticle
- LauComplex cpAntiPart_;
-
- //! The particle complex coefficient
- LauComplex particleCoeff_;
- //! The antiparticle complex coefficient
- LauComplex antiparticleCoeff_;
-
- //! The CP asymmetry
- LauParameter acp_;
-
- ClassDef(LauCartesianGammaCPCoeffSet, 0)
+ public:
+ //! Constructor
+ /*!
+ \param [in] compName the name of the coefficient set
+ \param [in] x the real nonCP part
+ \param [in] y the imaginary nonCP part
+ \param [in] xCP the average real CP part
+ \param [in] yCP the average imaginary CP part
+ \param [in] deltaXCP the asymmetric real CP part
+ \param [in] deltaYCP the asymmetric imaginary CP part
+ \param [in] xFixed whether x is fixed
+ \param [in] yFixed whether y is fixed
+ \param [in] xCPFixed whether xCP is fixed
+ \param [in] yCPFixed whether yCP is fixed
+ \param [in] deltaXCPFixed whether deltaXCP is fixed
+ \param [in] deltaYCPFixed whether deltaYCP is fixed
+ \param [in] deltaXCPSecondStage whether deltaXCP should be floated only in the second stage of the fit
+ \param [in] deltaYCPSecondStage whether deltaYCP should be floated only in the second stage of the fit
+ */
+ LauCartesianGammaCPCoeffSet( const TString& compName,
+ const Double_t x,
+ const Double_t y,
+ const Double_t xCP,
+ const Double_t yCP,
+ const Double_t deltaXCP,
+ const Double_t deltaYCP,
+ const Bool_t xFixed,
+ const Bool_t yFixed,
+ const Bool_t xCPFixed,
+ const Bool_t yCPFixed,
+ const Bool_t deltaXCPFixed,
+ const Bool_t deltaYCPFixed,
+ const Bool_t deltaXCPSecondStage = kFALSE,
+ const Bool_t deltaYCPSecondStage = kFALSE );
+
+ //! Destructor
+ virtual ~LauCartesianGammaCPCoeffSet() {}
+
+ //! Retrieve the parameters of the coefficient, e.g. so that they can be loaded into a fit
+ /*!
+ \return the parameters of the coefficient
+ */
+ virtual std::vector<LauParameter*> getParameters();
+
+ //! Print the current values of the parameters
+ virtual void printParValues() const;
+
+ //! Print the column headings for a results table
+ /*!
+ \param [out] stream the stream to print to
+ */
+ virtual void printTableHeading( std::ostream& stream ) const;
+
+ //! Print the parameters of the complex coefficient as a row in the results table
+ /*!
+ \param [out] stream the stream to print to
+ */
+ virtual void printTableRow( std::ostream& stream ) const;
+
+ //! Randomise the starting values of the parameters for a fit
+ virtual void randomiseInitValues();
+
+ //! Make sure values are in "standard" ranges, e.g. phases should be between -pi and pi
+ virtual void finaliseValues();
+
+ //! Retrieve the complex coefficient for a particle
+ /*!
+ \return the complex coefficient for a particle
+ */
+ virtual const LauComplex& particleCoeff();
+
+ //! Retrieve the complex coefficient for an antiparticle
+ /*!
+ \return the complex coefficient for an antiparticle
+ */
+ virtual const LauComplex& antiparticleCoeff();
+
+ //! Set the parameters based on the complex coefficients for particles and antiparticles
+ /*!
+ This method is not supported by this class because there are more than four parameters so there is not a unique solution.
+
+ \param [in] coeff the complex coefficient for a particle
+ \param [in] coeffBar the complex coefficient for an antiparticle
+ \param [in] init whether or not the initial and generated values should also be adjusted
+ */
+ virtual void setCoeffValues( const LauComplex& coeff, const LauComplex& coeffBar, Bool_t init );
+
+ //! Calculate the CP asymmetry
+ /*!
+ \return the CP asymmetry
+ */
+ virtual LauParameter acp();
+
+ //! Create a clone of the coefficient set
+ /*!
+ \param [in] newName the clone's name
+ \param [in] cloneOption special option for the cloning operation
+ \param [in] constFactor a constant factor to multiply the clone's parameters by
+ \return a clone of the coefficient set
+ */
+ virtual LauAbsCoeffSet* createClone( const TString& newName,
+ CloneOption cloneOption = All,
+ Double_t constFactor = 1.0 );
+
+ private:
+ //! Copy constructor
+ /*!
+ This creates cloned parameters, not copies.
+
+ \param [in] rhs the coefficient to clone
+ \param [in] cloneOption special option for the cloning operation
+ \param [in] constFactor a constant factor to multiply the clone's parameters by
+ */
+ LauCartesianGammaCPCoeffSet( const LauCartesianGammaCPCoeffSet& rhs,
+ CloneOption cloneOption = All,
+ Double_t constFactor = 1.0 );
+
+ //! Copy assignment operator (not implemented)
+ /*!
+ \param [in] rhs the coefficient to clone
+ */
+ LauCartesianGammaCPCoeffSet& operator=( const LauCartesianGammaCPCoeffSet& rhs );
+
+ // the actual fit parameters
+ // (need to be pointers so they can be cloned)
+ //! The nonCP real part
+ LauParameter* x_;
+ //! The nonCP imaginary part
+ LauParameter* y_;
+ //! The average CP real part
+ LauParameter* xCP_;
+ //! The average CP imaginary part
+ LauParameter* yCP_;
+ //! The asymmetric CP real part
+ LauParameter* deltaXCP_;
+ //! The asymmetric CP imaginary part
+ LauParameter* deltaYCP_;
+
+ //! The nonCP part of the complex coefficient
+ LauComplex nonCPPart_;
+ //! The CP part of the complex coefficient for the particle
+ LauComplex cpPart_;
+ //! The CP part of the complex coefficient for the antiparticle
+ LauComplex cpAntiPart_;
+
+ //! The particle complex coefficient
+ LauComplex particleCoeff_;
+ //! The antiparticle complex coefficient
+ LauComplex antiparticleCoeff_;
+
+ //! The CP asymmetry
+ LauParameter acp_;
+
+ ClassDef( LauCartesianGammaCPCoeffSet, 0 )
};
#endif
diff --git a/inc/LauChebychevPdf.hh b/inc/LauChebychevPdf.hh
index 2eeb7e9..82119eb 100644
--- a/inc/LauChebychevPdf.hh
+++ b/inc/LauChebychevPdf.hh
@@ -1,108 +1,111 @@
/*
Copyright 2009 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauChebychevPdf.hh
\brief File containing declaration of LauChebychevPdf class.
*/
/*! \class LauChebychevPdf
\brief Class for defining a Chebychev Polynomial (1st kind) PDF.
Class that allows the user to define a Chebychev Polynomial (1st kind) PDF.
The guts of the implementation are from Gerhard Raven's RooFit class.
*/
/*****************************************************************************
* Class based on RooFit/RooChebychev. *
* Original copyright given below. *
*****************************************************************************
* Authors: *
* WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
* DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
* *
* Copyright (c) 2000-2005, Regents of the University of California *
* and Stanford University. All rights reserved. *
* *
* Redistribution and use in source and binary forms, *
* with or without modification, are permitted according to the terms *
* listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
*****************************************************************************/
#ifndef LAU_CHEBYCHEV_PDF
#define LAU_CHEBYCHEV_PDF
-#include <vector>
+#include "LauAbsPdf.hh"
#include "TString.h"
-#include "LauAbsPdf.hh"
+#include <vector>
class LauParameter;
class LauChebychevPdf : public LauAbsPdf {
- public:
- //! Constructor
- /*!
- \param [in] theVarName the name of the abscissa variable
- \param [in] params the PDF parameters - the polynomial coefficients (polynomial can be anything from 0 to 7 orders).
- \param [in] minAbscissa the minimum value of the abscissa
- \param [in] maxAbscissa the maximum value of the abscissa
- */
- LauChebychevPdf(const TString& theVarName, const std::vector<LauAbsRValue*>& params, Double_t minAbscissa, Double_t maxAbscissa);
-
- //! Destructor
- virtual ~LauChebychevPdf();
-
- //! Calculate the likelihood (and intermediate info) for a given abscissa
- /*!
- \param [in] abscissas the values of the abscissa(s)
- */
- virtual void calcLikelihoodInfo(const LauAbscissas& abscissas);
-
- using LauAbsPdf::calcLikelihoodInfo;
-
- //! Calculate the normalisation
- virtual void calcNorm();
-
- //! Calculate the PDF height
- /*!
- \param [in] kinematics the current DP kinematics
- */
- virtual void calcPDFHeight( const LauKinematics* kinematics );
-
- private:
- //! Copy constructor (not implemented)
- LauChebychevPdf(const LauChebychevPdf& other);
-
- //! Copy assignment operator (not implemented)
- LauChebychevPdf& operator=(const LauChebychevPdf& other);
-
- //! Coefficients of polynomial
- std::vector<LauAbsRValue*> coeffs_;
-
- ClassDef(LauChebychevPdf,0) // Chebychev PDF
+ public:
+ //! Constructor
+ /*!
+ \param [in] theVarName the name of the abscissa variable
+ \param [in] params the PDF parameters - the polynomial coefficients (polynomial can be anything from 0 to 7 orders).
+ \param [in] minAbscissa the minimum value of the abscissa
+ \param [in] maxAbscissa the maximum value of the abscissa
+ */
+ LauChebychevPdf( const TString& theVarName,
+ const std::vector<LauAbsRValue*>& params,
+ Double_t minAbscissa,
+ Double_t maxAbscissa );
+
+ //! Destructor
+ virtual ~LauChebychevPdf();
+
+ //! Calculate the likelihood (and intermediate info) for a given abscissa
+ /*!
+ \param [in] abscissas the values of the abscissa(s)
+ */
+ virtual void calcLikelihoodInfo( const LauAbscissas& abscissas );
+
+ using LauAbsPdf::calcLikelihoodInfo;
+
+ //! Calculate the normalisation
+ virtual void calcNorm();
+
+ //! Calculate the PDF height
+ /*!
+ \param [in] kinematics the current DP kinematics
+ */
+ virtual void calcPDFHeight( const LauKinematics* kinematics );
+
+ private:
+ //! Copy constructor (not implemented)
+ LauChebychevPdf( const LauChebychevPdf& other );
+
+ //! Copy assignment operator (not implemented)
+ LauChebychevPdf& operator=( const LauChebychevPdf& other );
+
+ //! Coefficients of polynomial
+ std::vector<LauAbsRValue*> coeffs_;
+
+ ClassDef( LauChebychevPdf, 0 ) // Chebychev PDF
};
#endif
diff --git a/inc/LauCleoCPCoeffSet.hh b/inc/LauCleoCPCoeffSet.hh
index 7ef14a5..e706771 100644
--- a/inc/LauCleoCPCoeffSet.hh
+++ b/inc/LauCleoCPCoeffSet.hh
@@ -1,177 +1,190 @@
/*
Copyright 2006 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauCleoCPCoeffSet.hh
\brief File containing declaration of LauCleoCPCoeffSet class.
*/
/*! \class LauCleoCPCoeffSet
\brief Class for defining a complex coefficient using the Cleo CP convention.
Holds a set of real values that define the complex coefficient of an amplitude component.
The amplitude has the form (a +/- b) * exp( i*(delta +/- phi) ) where
a is the average magnitude,
b is the asymmetric magnitude,
delta is the strong phase and
phi is the weak phase.
[Phys.Rev. D70 (2004) 091101]
*/
#ifndef LAU_CLEOCP_COEFF_SET
#define LAU_CLEOCP_COEFF_SET
-#include <iosfwd>
-#include <vector>
-
-#include "Rtypes.h"
-
#include "LauAbsCoeffSet.hh"
#include "LauComplex.hh"
#include "LauParameter.hh"
+#include "Rtypes.h"
+
+#include <iosfwd>
+#include <vector>
class LauCleoCPCoeffSet : public LauAbsCoeffSet {
- public:
- //! Constructor
- /*!
- \param [in] compName the name of the coefficient set
- \param [in] a the magnitude a
- \param [in] delta the strong phase
- \param [in] b the magnitude b
- \param [in] phi the weak phase
- \param [in] aFixed whether a is fixed
- \param [in] deltaFixed whether delta is fixed
- \param [in] bFixed whether b is fixed
- \param [in] phiFixed whether phi is fixed
- \param [in] bSecondStage whether b should be floated only in the second stage of the fit
- \param [in] phiSecondStage whether phi should be floated only in the second stage of the fit
- */
- LauCleoCPCoeffSet(const TString& compName, Double_t a, Double_t delta, Double_t b, Double_t phi,
- Bool_t aFixed, Bool_t deltaFixed, Bool_t bFixed, Bool_t phiFixed, Bool_t bSecondStage = kFALSE, Bool_t phiSecondStage = kFALSE);
-
- //! Destructor
- virtual ~LauCleoCPCoeffSet(){}
-
- //! Retrieve the parameters of the coefficient, e.g. so that they can be loaded into a fit
- /*!
- \return the parameters of the coefficient
- */
- virtual std::vector<LauParameter*> getParameters();
-
- //! Print the current values of the parameters
- virtual void printParValues() const;
-
- //! Print the column headings for a results table
- /*!
- \param [out] stream the stream to print to
- */
- virtual void printTableHeading(std::ostream& stream) const;
-
- //! Print the parameters of the complex coefficient as a row in the results table
- /*!
- \param [out] stream the stream to print to
- */
- virtual void printTableRow(std::ostream& stream) const;
-
- //! Randomise the starting values of the parameters for a fit
- virtual void randomiseInitValues();
-
- //! Make sure values are in "standard" ranges, e.g. phases should be between -pi and pi
- virtual void finaliseValues();
-
- //! Retrieve the complex coefficient for a particle
- /*!
- \return the complex coefficient for a particle
- */
- virtual const LauComplex& particleCoeff();
-
- //! Retrieve the complex coefficient for an antiparticle
- /*!
- \return the complex coefficient for an antiparticle
- */
- virtual const LauComplex& antiparticleCoeff();
-
- //! Set the parameters based on the complex coefficients for particles and antiparticles
- /*!
- \param [in] coeff the complex coefficient for a particle
- \param [in] coeffBar the complex coefficient for an antiparticle
- \param [in] init whether or not the initial and generated values should also be adjusted
- */
- virtual void setCoeffValues( const LauComplex& coeff, const LauComplex& coeffBar, Bool_t init );
-
- //! Calculate the CP asymmetry
- /*!
- \return the CP asymmetry
- */
- virtual LauParameter acp();
-
- //! Create a clone of the coefficient set
- /*!
- \param [in] newName the clone's name
- \param [in] cloneOption special option for the cloning operation
- \param [in] constFactor a constant factor to multiply the clone's parameters by
- \return a clone of the coefficient set
- */
- virtual LauAbsCoeffSet* createClone(const TString& newName, CloneOption cloneOption = All, Double_t constFactor = 1.0);
-
- private:
- //! Copy constructor
- /*!
- This creates cloned parameters, not copies.
- \param [in] rhs the coefficient to clone
- \param [in] cloneOption special option for the cloning operation
- \param [in] constFactor a constant factor to multiply the clone's parameters by
- */
- LauCleoCPCoeffSet(const LauCleoCPCoeffSet& rhs, CloneOption cloneOption = All, Double_t constFactor = 1.0);
-
- //! Copy assignment operator (not implemented)
- /*!
- \param [in] rhs the coefficient to clone
- */
- LauCleoCPCoeffSet& operator=(const LauCleoCPCoeffSet& rhs);
-
- // the actual fit parameters
- // (need to be pointers so they can be cloned)
- //! The magnitude a
- LauParameter* a_;
- //! The magnitude b
- LauParameter* b_;
- //! The strong phase
- LauParameter* delta_;
- //! The weak phase
- LauParameter* phi_;
-
- //! The particle complex coefficient
- LauComplex particleCoeff_;
- //! The antiparticle complex coefficient
- LauComplex antiparticleCoeff_;
-
- //! The CP asymmetry
- LauParameter acp_;
-
- ClassDef(LauCleoCPCoeffSet, 0)
+ public:
+ //! Constructor
+ /*!
+ \param [in] compName the name of the coefficient set
+ \param [in] a the magnitude a
+ \param [in] delta the strong phase
+ \param [in] b the magnitude b
+ \param [in] phi the weak phase
+ \param [in] aFixed whether a is fixed
+ \param [in] deltaFixed whether delta is fixed
+ \param [in] bFixed whether b is fixed
+ \param [in] phiFixed whether phi is fixed
+ \param [in] bSecondStage whether b should be floated only in the second stage of the fit
+ \param [in] phiSecondStage whether phi should be floated only in the second stage of the fit
+ */
+ LauCleoCPCoeffSet( const TString& compName,
+ Double_t a,
+ Double_t delta,
+ Double_t b,
+ Double_t phi,
+ Bool_t aFixed,
+ Bool_t deltaFixed,
+ Bool_t bFixed,
+ Bool_t phiFixed,
+ Bool_t bSecondStage = kFALSE,
+ Bool_t phiSecondStage = kFALSE );
+
+ //! Destructor
+ virtual ~LauCleoCPCoeffSet() {}
+
+ //! Retrieve the parameters of the coefficient, e.g. so that they can be loaded into a fit
+ /*!
+ \return the parameters of the coefficient
+ */
+ virtual std::vector<LauParameter*> getParameters();
+
+ //! Print the current values of the parameters
+ virtual void printParValues() const;
+
+ //! Print the column headings for a results table
+ /*!
+ \param [out] stream the stream to print to
+ */
+ virtual void printTableHeading( std::ostream& stream ) const;
+
+ //! Print the parameters of the complex coefficient as a row in the results table
+ /*!
+ \param [out] stream the stream to print to
+ */
+ virtual void printTableRow( std::ostream& stream ) const;
+
+ //! Randomise the starting values of the parameters for a fit
+ virtual void randomiseInitValues();
+
+ //! Make sure values are in "standard" ranges, e.g. phases should be between -pi and pi
+ virtual void finaliseValues();
+
+ //! Retrieve the complex coefficient for a particle
+ /*!
+ \return the complex coefficient for a particle
+ */
+ virtual const LauComplex& particleCoeff();
+
+ //! Retrieve the complex coefficient for an antiparticle
+ /*!
+ \return the complex coefficient for an antiparticle
+ */
+ virtual const LauComplex& antiparticleCoeff();
+
+ //! Set the parameters based on the complex coefficients for particles and antiparticles
+ /*!
+ \param [in] coeff the complex coefficient for a particle
+ \param [in] coeffBar the complex coefficient for an antiparticle
+ \param [in] init whether or not the initial and generated values should also be adjusted
+ */
+ virtual void setCoeffValues( const LauComplex& coeff, const LauComplex& coeffBar, Bool_t init );
+
+ //! Calculate the CP asymmetry
+ /*!
+ \return the CP asymmetry
+ */
+ virtual LauParameter acp();
+
+ //! Create a clone of the coefficient set
+ /*!
+ \param [in] newName the clone's name
+ \param [in] cloneOption special option for the cloning operation
+ \param [in] constFactor a constant factor to multiply the clone's parameters by
+ \return a clone of the coefficient set
+ */
+ virtual LauAbsCoeffSet* createClone( const TString& newName,
+ CloneOption cloneOption = All,
+ Double_t constFactor = 1.0 );
+
+ private:
+ //! Copy constructor
+ /*!
+ This creates cloned parameters, not copies.
+
+ \param [in] rhs the coefficient to clone
+ \param [in] cloneOption special option for the cloning operation
+ \param [in] constFactor a constant factor to multiply the clone's parameters by
+ */
+ LauCleoCPCoeffSet( const LauCleoCPCoeffSet& rhs,
+ CloneOption cloneOption = All,
+ Double_t constFactor = 1.0 );
+
+ //! Copy assignment operator (not implemented)
+ /*!
+ \param [in] rhs the coefficient to clone
+ */
+ LauCleoCPCoeffSet& operator=( const LauCleoCPCoeffSet& rhs );
+
+ // the actual fit parameters
+ // (need to be pointers so they can be cloned)
+ //! The magnitude a
+ LauParameter* a_;
+ //! The magnitude b
+ LauParameter* b_;
+ //! The strong phase
+ LauParameter* delta_;
+ //! The weak phase
+ LauParameter* phi_;
+
+ //! The particle complex coefficient
+ LauComplex particleCoeff_;
+ //! The antiparticle complex coefficient
+ LauComplex antiparticleCoeff_;
+
+ //! The CP asymmetry
+ LauParameter acp_;
+
+ ClassDef( LauCleoCPCoeffSet, 0 )
};
#endif
diff --git a/inc/LauComplex.hh b/inc/LauComplex.hh
index 6b69e8b..253ddad 100644
--- a/inc/LauComplex.hh
+++ b/inc/LauComplex.hh
@@ -1,358 +1,336 @@
/*
Copyright 2004 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauComplex.hh
\brief File containing declaration of LauComplex class.
*/
/*! \class LauComplex
\brief Class for defining a complex number
Class for complex number manipulation.
In the function descriptions, the form (a,b) is used to represent a complex
number. This is equivalent to the mathematical expression a + ib.
- */
+*/
/*****************************************************************************
* Class based on RooFit/RooComplex. *
* Original copyright given below. *
*****************************************************************************
* Authors: *
* WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
* DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
* *
* Copyright (c) 2000-2005, Regents of the University of California *
* and Stanford University. All rights reserved. *
* *
* Redistribution and use in source and binary forms, *
* with or without modification, are permitted according to the terms *
* listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
*****************************************************************************/
#ifndef LAU_COMPLEX
#define LAU_COMPLEX
-#include <iosfwd>
-
#include "Rtypes.h"
#include "TMath.h"
+#include <iosfwd>
class LauComplex {
- public:
- //! Default Constructor
- inline LauComplex() : re_(0.0), im_(0.0) {}
-
- //! Constructor
- /*!
- \param [in] a the value corresponding to the real part of the complex number
- \param [in] b the value corresponding to the imaginary part of the complex number
- */
- inline LauComplex(Double_t a, Double_t b) : re_(a), im_(b) {}
-
- //! Destructor
- virtual ~LauComplex() {}
-
- //! Copy constructor
- /*!
- \param [in] other the complex number to be copied
- */
- inline LauComplex(const LauComplex& other) : re_(other.re_), im_(other.im_) {}
-
- //! Copy assignment operator
- /*!
- \param [in] other the complex number to be copied
- \return the assigned complex number
- */
- inline LauComplex& operator=(const LauComplex& other)
- {
- if ( &other != this ) {
- re_ = other.re_;
- im_ = other.im_;
- }
- return *this;
- }
-
- //! Unary minus operator
- /*!
- \return the negated complex number
- */
- inline LauComplex operator-() const
- {
- return LauComplex(-re_,-im_);
- }
-
- //! Addition operator
- /*!
- \param [in] other the object to added to this one
- \return the sum of the two complex numbers
- */
- inline LauComplex operator+(const LauComplex& other) const
- {
- LauComplex tmpCmplx( *this );
- tmpCmplx += other;
- return tmpCmplx;
- }
-
- //! Subtraction operator
- /*!
- \param [in] other the object to be subtracted from this one
- \return the difference of the two complex numbers
- */
- inline LauComplex operator-(const LauComplex& other) const
- {
- LauComplex tmpCmplx( *this );
- tmpCmplx -= other;
- return tmpCmplx;
- }
-
- //! Multiplication operator
- /*!
- \param [in] other the object this one is to be multiplied by
- \return the product of the two complex numbers
- */
- inline LauComplex operator*(const LauComplex& other) const
- {
- LauComplex tmpCmplx( *this );
- tmpCmplx *= other;
- return tmpCmplx;
- }
-
- //! Division operator
- /*!
- \param [in] other the object this one is to be divided by
- \return the ratio of the two complex numbers
- */
- inline LauComplex operator/(const LauComplex& other) const
- {
- LauComplex tmpCmplx( *this );
- tmpCmplx /= other;
- return tmpCmplx;
- }
-
- //! Addition assignment operator
- /*!
- \param [in] other the object to be added to this one
- \return the result of the addition
- */
- inline LauComplex operator+=(const LauComplex& other)
- {
- this->re_ += other.re_;
- this->im_ += other.im_;
- return (*this);
- }
-
- //! Subtraction assignment operator
- /*!
- \param [in] other the object to be subtracted from this one
- \return the result of the subtraction
- */
- inline LauComplex operator-=(const LauComplex& other)
- {
- this->re_ -= other.re_;
- this->im_ -= other.im_;
- return (*this);
- }
-
- //! Multiplication assignment operator
- /*!
- \param [in] other the object this one is to be multiplied by
- \return the result of the multiplication
- */
- inline LauComplex operator*=(const LauComplex& other)
- {
- Double_t realPart = this->re_*other.re_ - this->im_*other.im_;
- Double_t imagPart = this->re_*other.im_ + this->im_*other.re_;
- this->setRealImagPart( realPart, imagPart );
- return (*this);
- }
-
- //! Division assignment operator
- /*!
- \param [in] other the object this one is to be divided by
- \return the results of the division
- */
- inline LauComplex operator/=(const LauComplex& other)
- {
- Double_t x(other.abs2());
- Double_t realPart = (this->re_*other.re_ + this->im_*other.im_)/x;
- Double_t imagPart = (this->im_*other.re_ - this->re_*other.im_)/x;
- this->setRealImagPart( realPart, imagPart );
- return (*this);
- }
-
- //! Boolean comparison operator
- /*!
- \param [in] other the object to compared with this one
- \return true/false for the comparison
- */
- inline Bool_t operator==(const LauComplex& other) const
- {
- return (re_==other.re_ && im_==other.im_) ;
- }
-
- //! Get the real part
- /*!
- \return the real part of the complex number
- */
- inline Double_t re() const
- {
- return re_;
- }
-
- //! Get the imaginary part
- /*!
- \return the imaginary part of the complex number
- */
- inline Double_t im() const
- {
- return im_;
- }
-
- //! Obtain the absolute value of the complex number
- /*!
- \return the absolute value (magnitude)
- */
- inline Double_t abs() const
- {
- return TMath::Sqrt( this->abs2() );
- }
-
- //! Obtain the square of the absolute value of the complex number
- /*!
- \return the square of the absolute value (magnitude^2)
- */
- inline Double_t abs2() const
- {
- return re_*re_ + im_*im_;
- }
-
- //! Obtain the phase angle of the complex number
- /*!
- \return the phase angle of the complex number
- */
- inline Double_t arg() const
- {
- return TMath::ATan2( im_, re_ );
- }
-
- //! Obtain the exponential of the complex number
- /*!
- \return the exponential of the complex number
- */
- inline LauComplex exp() const
- {
- Double_t mag(TMath::Exp(re_));
- return LauComplex(mag*TMath::Cos(im_),mag*TMath::Sin(im_));
- }
-
- //! Obtain the complex conjugate
- /*!
- \return the complex conjugate
- */
- inline LauComplex conj() const
- {
- return LauComplex(re_,-im_);
- }
-
- //! Transform this to its complex conjugate
- inline void makeConj()
- {
- im_ = -im_;
- }
-
- //! Obtain the complex number scaled by some factor
- /*!
- \param [in] scaleVal the value used to scale the complex number
- \return the complex number scaled by the scaleVal
- */
- inline LauComplex scale(Double_t scaleVal) const
- {
- return LauComplex(scaleVal*re_, scaleVal*im_);
- }
-
- //! Scale this by a factor
- /*!
- \param [in] scaleVal the value used to scale the complex number
- */
- inline void rescale(Double_t scaleVal)
- {
- re_ *= scaleVal;
- im_ *= scaleVal;
- }
-
- //! Set the real part
- /*!
- \param [in] realpart the value to be set as the real part
- */
- inline void setRealPart(Double_t realpart)
- {
- re_ = realpart;
- }
-
- //! Set the imaginary part
- /*!
- \param [in] imagpart the value to be set as the imaginary part
- */
- inline void setImagPart(Double_t imagpart)
- {
- im_ = imagpart;
- }
-
- //! Set both real and imaginary part
- /*!
- \param [in] realpart the value to be set as the real part
- \param [in] imagpart the value to be set as the imaginary part
- */
- inline void setRealImagPart(Double_t realpart, Double_t imagpart)
- {
- this->setRealPart( realpart );
- this->setImagPart( imagpart );
- }
-
- //! Set both real and imaginary part to zero
- inline void zero()
- {
- this->setRealImagPart(0.0,0.0);
- }
-
- //! Print the complex number
- void print() const;
-
- private:
- //! The real part
- Double_t re_;
- //! The imaginary part
- Double_t im_;
-
- ClassDef(LauComplex,0) // a non-persistent bare-bones complex class
+ public:
+ //! Default Constructor
+ inline LauComplex() :
+ re_( 0.0 ),
+ im_( 0.0 )
+ {
+ }
+
+ //! Constructor
+ /*!
+ \param [in] a the value corresponding to the real part of the complex number
+ \param [in] b the value corresponding to the imaginary part of the complex number
+ */
+ inline LauComplex( Double_t a, Double_t b ) :
+ re_( a ),
+ im_( b )
+ {
+ }
+
+ //! Destructor
+ virtual ~LauComplex() {}
+
+ //! Copy constructor
+ /*!
+ \param [in] other the complex number to be copied
+ */
+ inline LauComplex( const LauComplex& other ) :
+ re_( other.re_ ),
+ im_( other.im_ )
+ {
+ }
+
+ //! Copy assignment operator
+ /*!
+ \param [in] other the complex number to be copied
+ \return the assigned complex number
+ */
+ inline LauComplex& operator=( const LauComplex& other )
+ {
+ if ( &other != this ) {
+ re_ = other.re_;
+ im_ = other.im_;
+ }
+ return *this;
+ }
+
+ //! Unary minus operator
+ /*!
+ \return the negated complex number
+ */
+ inline LauComplex operator-() const { return LauComplex( -re_, -im_ ); }
+
+ //! Addition operator
+ /*!
+ \param [in] other the object to added to this one
+ \return the sum of the two complex numbers
+ */
+ inline LauComplex operator+( const LauComplex& other ) const
+ {
+ LauComplex tmpCmplx( *this );
+ tmpCmplx += other;
+ return tmpCmplx;
+ }
+
+ //! Subtraction operator
+ /*!
+ \param [in] other the object to be subtracted from this one
+ \return the difference of the two complex numbers
+ */
+ inline LauComplex operator-( const LauComplex& other ) const
+ {
+ LauComplex tmpCmplx( *this );
+ tmpCmplx -= other;
+ return tmpCmplx;
+ }
+
+ //! Multiplication operator
+ /*!
+ \param [in] other the object this one is to be multiplied by
+ \return the product of the two complex numbers
+ */
+ inline LauComplex operator*( const LauComplex& other ) const
+ {
+ LauComplex tmpCmplx( *this );
+ tmpCmplx *= other;
+ return tmpCmplx;
+ }
+
+ //! Division operator
+ /*!
+ \param [in] other the object this one is to be divided by
+ \return the ratio of the two complex numbers
+ */
+ inline LauComplex operator/( const LauComplex& other ) const
+ {
+ LauComplex tmpCmplx( *this );
+ tmpCmplx /= other;
+ return tmpCmplx;
+ }
+
+ //! Addition assignment operator
+ /*!
+ \param [in] other the object to be added to this one
+ \return the result of the addition
+ */
+ inline LauComplex operator+=( const LauComplex& other )
+ {
+ this->re_ += other.re_;
+ this->im_ += other.im_;
+ return ( *this );
+ }
+
+ //! Subtraction assignment operator
+ /*!
+ \param [in] other the object to be subtracted from this one
+ \return the result of the subtraction
+ */
+ inline LauComplex operator-=( const LauComplex& other )
+ {
+ this->re_ -= other.re_;
+ this->im_ -= other.im_;
+ return ( *this );
+ }
+
+ //! Multiplication assignment operator
+ /*!
+ \param [in] other the object this one is to be multiplied by
+ \return the result of the multiplication
+ */
+ inline LauComplex operator*=( const LauComplex& other )
+ {
+ Double_t realPart = this->re_ * other.re_ - this->im_ * other.im_;
+ Double_t imagPart = this->re_ * other.im_ + this->im_ * other.re_;
+ this->setRealImagPart( realPart, imagPart );
+ return ( *this );
+ }
+
+ //! Division assignment operator
+ /*!
+ \param [in] other the object this one is to be divided by
+ \return the results of the division
+ */
+ inline LauComplex operator/=( const LauComplex& other )
+ {
+ Double_t x( other.abs2() );
+ Double_t realPart = ( this->re_ * other.re_ + this->im_ * other.im_ ) / x;
+ Double_t imagPart = ( this->im_ * other.re_ - this->re_ * other.im_ ) / x;
+ this->setRealImagPart( realPart, imagPart );
+ return ( *this );
+ }
+
+ //! Boolean comparison operator
+ /*!
+ \param [in] other the object to compared with this one
+ \return true/false for the comparison
+ */
+ inline Bool_t operator==( const LauComplex& other ) const
+ {
+ return ( re_ == other.re_ && im_ == other.im_ );
+ }
+
+ //! Get the real part
+ /*!
+ \return the real part of the complex number
+ */
+ inline Double_t re() const { return re_; }
+
+ //! Get the imaginary part
+ /*!
+ \return the imaginary part of the complex number
+ */
+ inline Double_t im() const { return im_; }
+
+ //! Obtain the absolute value of the complex number
+ /*!
+ \return the absolute value (magnitude)
+ */
+ inline Double_t abs() const { return TMath::Sqrt( this->abs2() ); }
+
+ //! Obtain the square of the absolute value of the complex number
+ /*!
+ \return the square of the absolute value (magnitude^2)
+ */
+ inline Double_t abs2() const { return re_ * re_ + im_ * im_; }
+
+ //! Obtain the phase angle of the complex number
+ /*!
+ \return the phase angle of the complex number
+ */
+ inline Double_t arg() const { return TMath::ATan2( im_, re_ ); }
+
+ //! Obtain the exponential of the complex number
+ /*!
+ \return the exponential of the complex number
+ */
+ inline LauComplex exp() const
+ {
+ Double_t mag( TMath::Exp( re_ ) );
+ return LauComplex( mag * TMath::Cos( im_ ), mag * TMath::Sin( im_ ) );
+ }
+
+ //! Obtain the complex conjugate
+ /*!
+ \return the complex conjugate
+ */
+ inline LauComplex conj() const { return LauComplex( re_, -im_ ); }
+
+ //! Transform this to its complex conjugate
+ inline void makeConj() { im_ = -im_; }
+
+ //! Obtain the complex number scaled by some factor
+ /*!
+ \param [in] scaleVal the value used to scale the complex number
+ \return the complex number scaled by the scaleVal
+ */
+ inline LauComplex scale( Double_t scaleVal ) const
+ {
+ return LauComplex( scaleVal * re_, scaleVal * im_ );
+ }
+
+ //! Scale this by a factor
+ /*!
+ \param [in] scaleVal the value used to scale the complex number
+ */
+ inline void rescale( Double_t scaleVal )
+ {
+ re_ *= scaleVal;
+ im_ *= scaleVal;
+ }
+
+ //! Set the real part
+ /*!
+ \param [in] realpart the value to be set as the real part
+ */
+ inline void setRealPart( Double_t realpart ) { re_ = realpart; }
+
+ //! Set the imaginary part
+ /*!
+ \param [in] imagpart the value to be set as the imaginary part
+ */
+ inline void setImagPart( Double_t imagpart ) { im_ = imagpart; }
+
+ //! Set both real and imaginary part
+ /*!
+ \param [in] realpart the value to be set as the real part
+ \param [in] imagpart the value to be set as the imaginary part
+ */
+ inline void setRealImagPart( Double_t realpart, Double_t imagpart )
+ {
+ this->setRealPart( realpart );
+ this->setImagPart( imagpart );
+ }
+
+ //! Set both real and imaginary part to zero
+ inline void zero() { this->setRealImagPart( 0.0, 0.0 ); }
+
+ //! Print the complex number
+ void print() const;
+
+ private:
+ //! The real part
+ Double_t re_;
+ //! The imaginary part
+ Double_t im_;
+
+ ClassDef( LauComplex, 0 ) // a non-persistent bare-bones complex class
};
//! input operator formatting of a complex number
-std::istream& operator>>(std::istream& os, LauComplex& z);
+std::istream& operator>>( std::istream& os, LauComplex& z );
//! output operator formatting of a complex number
-std::ostream& operator<<(std::ostream& os, const LauComplex& z);
+std::ostream& operator<<( std::ostream& os, const LauComplex& z );
#endif
diff --git a/inc/LauConstants.hh b/inc/LauConstants.hh
index 384aeb9..b227116 100644
--- a/inc/LauConstants.hh
+++ b/inc/LauConstants.hh
@@ -1,128 +1,128 @@
/*
Copyright 2005 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauConstants.hh
\brief File containing LauConstants namespace.
*/
/*! \namespace LauConstants
\brief Namespace to contain various constants.
*/
#ifndef LAU_CONSTANTS
#define LAU_CONSTANTS
#include "Rtypes.h"
#include "TMath.h"
namespace LauConstants {
- // Masses updated to PDG 2020 values in March 2021
- //! Mass of charged D (GeV/c^2)
- const Double_t mD = 1.86965;
- //! Mass of neutral D (GeV/c^2)
- const Double_t mD0 = 1.86483;
- //! Mass of Ds (GeV/c^2)
- const Double_t mDs = 1.96834;
- //! Mass of charged B (GeV/c^2)
- const Double_t mB = 5.27934;
- //! Mass of neutral B_d (GeV/c^2)
- const Double_t mB0 = 5.27965;
- //! Mass of neutral B_s (GeV/c^2)
- const Double_t mBs0 = 5.36688;
- //! Mass of pi+- (GeV/c^2)
- const Double_t mPi = 0.13957039;
- //! Mass of pi0 (GeV/c^2)
- const Double_t mPi0 = 0.1349768;
- //! Mass of K+- (GeV/c^2)
- const Double_t mK = 0.493677;
- //! Mass of K0 (GeV/c^2)
- const Double_t mK0 = 0.497611;
- //! Mass of eta (GeV/c^2)
- const Double_t mEta = 0.547862;
- //! Mass of eta' (GeV/c^2)
- const Double_t mEtaPrime = 0.95778;
-
- //! Square of charged D mass
- const Double_t mDSq = mD*mD;
- //! Square of neutral D mass
- const Double_t mD0Sq = mD0*mD0;
- //! Square of Ds mass
- const Double_t mDsSq = mDs*mDs;
- //! Square of charged B mass
- const Double_t mBSq = mB*mB;
- //! Square of neutral B_d mass
- const Double_t mB0Sq = mB0*mB0;
- //! Square of neutral B_s mass
- const Double_t mBs0Sq = mBs0*mBs0;
- //! Square of pi+- mass
- const Double_t mPiSq = mPi*mPi;
- //! Square of pi0 mass
- const Double_t mPi0Sq = mPi0*mPi0;
- //! Square of K+- mass
- const Double_t mKSq = mK*mK;
- //! Square of K0 mass
- const Double_t mK0Sq = mK0*mK0;
- //! Square of eta mass
- const Double_t mEtaSq = mEta*mEta;
- //! Square of eta' mass
- const Double_t mEtaPrimeSq = mEtaPrime*mEtaPrime;
-
- //! Lifetime of the B+ in ps
- const Double_t tauB = 1.638;
- //! Lifetime of the B0 in ps
- const Double_t tauB0 = 1.519;
- //! Mass difference of the B_H and B_L - source PDG via HFLAV 2019
- const Double_t deltaMd = 0.5065;
- //! Angle beta of the unitarity triangle - source PDG via HFLAV 2019
- const Double_t beta = 22.2*TMath::DegToRad();
- //! Sine of twice the angle beta of the unitarity triangle
- const Double_t sin2beta = TMath::Sin(2.0*beta);
-
- //! Pi
- const Double_t pi = TMath::Pi();
- //! Square root of Pi
- const Double_t rootPi = TMath::Sqrt(TMath::Pi());
- //! Two times Pi
- const Double_t twoPi = 2.0*TMath::Pi();
- //! Three times Pi
- const Double_t threePi = 3.0*TMath::Pi();
- //! Six times Pi
- const Double_t sixPi = 6.0*TMath::Pi();
- //! One over Pi to the one-fourth
- const Double_t pim4 = 1.0/TMath::Power(TMath::Pi(), 0.25);
- //! Pi divided by two
- const Double_t piBy2 = 0.5*TMath::Pi();
- //! Square root of Pi divided by two
- const Double_t rootPiBy2 = TMath::Sqrt(0.5*TMath::Pi());
- //! One over Pi
- const Double_t invPi = 1.0/TMath::Pi();
- //! Square root of two
- const Double_t root2 = TMath::Sqrt(2.0);
- //! Logarithm of four
- const Double_t log4 = TMath::Log(4.0);
-
-};
+ // Masses updated to PDG 2020 values in March 2021
+ //! Mass of charged D (GeV/c^2)
+ const Double_t mD = 1.86965;
+ //! Mass of neutral D (GeV/c^2)
+ const Double_t mD0 = 1.86483;
+ //! Mass of Ds (GeV/c^2)
+ const Double_t mDs = 1.96834;
+ //! Mass of charged B (GeV/c^2)
+ const Double_t mB = 5.27934;
+ //! Mass of neutral B_d (GeV/c^2)
+ const Double_t mB0 = 5.27965;
+ //! Mass of neutral B_s (GeV/c^2)
+ const Double_t mBs0 = 5.36688;
+ //! Mass of pi+- (GeV/c^2)
+ const Double_t mPi = 0.13957039;
+ //! Mass of pi0 (GeV/c^2)
+ const Double_t mPi0 = 0.1349768;
+ //! Mass of K+- (GeV/c^2)
+ const Double_t mK = 0.493677;
+ //! Mass of K0 (GeV/c^2)
+ const Double_t mK0 = 0.497611;
+ //! Mass of eta (GeV/c^2)
+ const Double_t mEta = 0.547862;
+ //! Mass of eta' (GeV/c^2)
+ const Double_t mEtaPrime = 0.95778;
+
+ //! Square of charged D mass
+ const Double_t mDSq = mD * mD;
+ //! Square of neutral D mass
+ const Double_t mD0Sq = mD0 * mD0;
+ //! Square of Ds mass
+ const Double_t mDsSq = mDs * mDs;
+ //! Square of charged B mass
+ const Double_t mBSq = mB * mB;
+ //! Square of neutral B_d mass
+ const Double_t mB0Sq = mB0 * mB0;
+ //! Square of neutral B_s mass
+ const Double_t mBs0Sq = mBs0 * mBs0;
+ //! Square of pi+- mass
+ const Double_t mPiSq = mPi * mPi;
+ //! Square of pi0 mass
+ const Double_t mPi0Sq = mPi0 * mPi0;
+ //! Square of K+- mass
+ const Double_t mKSq = mK * mK;
+ //! Square of K0 mass
+ const Double_t mK0Sq = mK0 * mK0;
+ //! Square of eta mass
+ const Double_t mEtaSq = mEta * mEta;
+ //! Square of eta' mass
+ const Double_t mEtaPrimeSq = mEtaPrime * mEtaPrime;
+
+ //! Lifetime of the B+ in ps
+ const Double_t tauB = 1.638;
+ //! Lifetime of the B0 in ps
+ const Double_t tauB0 = 1.519;
+ //! Mass difference of the B_H and B_L - source PDG via HFLAV 2019
+ const Double_t deltaMd = 0.5065;
+ //! Angle beta of the unitarity triangle - source PDG via HFLAV 2019
+ const Double_t beta = 22.2 * TMath::DegToRad();
+ //! Sine of twice the angle beta of the unitarity triangle
+ const Double_t sin2beta = TMath::Sin( 2.0 * beta );
+
+ //! Pi
+ const Double_t pi = TMath::Pi();
+ //! Square root of Pi
+ const Double_t rootPi = TMath::Sqrt( TMath::Pi() );
+ //! Two times Pi
+ const Double_t twoPi = 2.0 * TMath::Pi();
+ //! Three times Pi
+ const Double_t threePi = 3.0 * TMath::Pi();
+ //! Six times Pi
+ const Double_t sixPi = 6.0 * TMath::Pi();
+ //! One over Pi to the one-fourth
+ const Double_t pim4 = 1.0 / TMath::Power( TMath::Pi(), 0.25 );
+ //! Pi divided by two
+ const Double_t piBy2 = 0.5 * TMath::Pi();
+ //! Square root of Pi divided by two
+ const Double_t rootPiBy2 = TMath::Sqrt( 0.5 * TMath::Pi() );
+ //! One over Pi
+ const Double_t invPi = 1.0 / TMath::Pi();
+ //! Square root of two
+ const Double_t root2 = TMath::Sqrt( 2.0 );
+ //! Logarithm of four
+ const Double_t log4 = TMath::Log( 4.0 );
+
+}; // namespace LauConstants
#endif
diff --git a/inc/LauCruijffPdf.hh b/inc/LauCruijffPdf.hh
index 28b6d6b..56c4962 100644
--- a/inc/LauCruijffPdf.hh
+++ b/inc/LauCruijffPdf.hh
@@ -1,114 +1,118 @@
/*
Copyright 2008 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauCruijffPdf.hh
\brief File containing declaration of LauCruijffPdf class.
*/
/*! \class LauCruijffPdf
\brief Class for defining a Cruijff PDF.
Class that allows the user to define a Cruijff PDF, a bifurcated Gaussian with asymmetric tails.
The guts of the implementation have been copied from Wouter Hulsbergen's RooFit class.
*/
/*****************************************************************************
* Class based on RooFit/RooCruijff. *
* Original copyright given below. *
*****************************************************************************
* Authors: *
* WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
* DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
* *
* Copyright (c) 2000-2005, Regents of the University of California *
* and Stanford University. All rights reserved. *
* *
* Redistribution and use in source and binary forms, *
* with or without modification, are permitted according to the terms *
* listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
*****************************************************************************/
#ifndef LAU_CRUIJFF_PDF
#define LAU_CRUIJFF_PDF
-#include "TString.h"
-#include "TRandom.h"
#include "LauAbsPdf.hh"
#include "LauParameter.hh"
+#include "TRandom.h"
+#include "TString.h"
+
#include <vector>
class LauCruijffPdf : public LauAbsPdf {
- public:
- //! Constructor
- /*!
- \param [in] theVarName the name of the abscissa variable
- \param [in] params the PDF parameters - mean, sigmaR, sigmaL, alphaR and alphaL
- \param [in] minAbscissa the minimum value of the abscissa
- \param [in] maxAbscissa the maximum value of the abscissa
- */
- LauCruijffPdf(const TString& theVarName, const std::vector<LauAbsRValue*>& params, Double_t minAbscissa, Double_t maxAbscissa);
-
- //! Destructor
- virtual ~LauCruijffPdf();
-
- //! Calculate the likelihood (and intermediate info) for a given abscissa
- /*!
- \param [in] abscissas the values of the abscissa(s)
- */
- virtual void calcLikelihoodInfo(const LauAbscissas& abscissas);
-
- using LauAbsPdf::calcLikelihoodInfo;
-
- //! Calculate the PDF height
- /*!
- \param [in] kinematics the current DP kinematics
- */
- virtual void calcPDFHeight( const LauKinematics* kinematics );
-
- protected:
-
- private:
- //! Copy constructor (not implemented)
- LauCruijffPdf(const LauCruijffPdf& other);
-
- //! Copy assignment operator (not implemented)
- LauCruijffPdf& operator=(const LauCruijffPdf& other);
-
- //! Gaussian mean
- LauAbsRValue* mean_;
- //! Sigma of left Gaussian
- LauAbsRValue* sigmaL_;
- //! Sigma of right Gaussian
- LauAbsRValue* sigmaR_;
- //! Alpha of left Gaussian
- LauAbsRValue* alphaL_;
- //! Alpha of right Gaussian
- LauAbsRValue* alphaR_;
-
- ClassDef(LauCruijffPdf,0) // Define the Cruijff PDF
+ public:
+ //! Constructor
+ /*!
+ \param [in] theVarName the name of the abscissa variable
+ \param [in] params the PDF parameters - mean, sigmaR, sigmaL, alphaR and alphaL
+ \param [in] minAbscissa the minimum value of the abscissa
+ \param [in] maxAbscissa the maximum value of the abscissa
+ */
+ LauCruijffPdf( const TString& theVarName,
+ const std::vector<LauAbsRValue*>& params,
+ Double_t minAbscissa,
+ Double_t maxAbscissa );
+
+ //! Destructor
+ virtual ~LauCruijffPdf();
+
+ //! Calculate the likelihood (and intermediate info) for a given abscissa
+ /*!
+ \param [in] abscissas the values of the abscissa(s)
+ */
+ virtual void calcLikelihoodInfo( const LauAbscissas& abscissas );
+
+ using LauAbsPdf::calcLikelihoodInfo;
+
+ //! Calculate the PDF height
+ /*!
+ \param [in] kinematics the current DP kinematics
+ */
+ virtual void calcPDFHeight( const LauKinematics* kinematics );
+
+ protected:
+
+ private:
+ //! Copy constructor (not implemented)
+ LauCruijffPdf( const LauCruijffPdf& other );
+
+ //! Copy assignment operator (not implemented)
+ LauCruijffPdf& operator=( const LauCruijffPdf& other );
+
+ //! Gaussian mean
+ LauAbsRValue* mean_;
+ //! Sigma of left Gaussian
+ LauAbsRValue* sigmaL_;
+ //! Sigma of right Gaussian
+ LauAbsRValue* sigmaR_;
+ //! Alpha of left Gaussian
+ LauAbsRValue* alphaL_;
+ //! Alpha of right Gaussian
+ LauAbsRValue* alphaR_;
+
+ ClassDef( LauCruijffPdf, 0 ) // Define the Cruijff PDF
};
#endif
diff --git a/inc/LauCrystalBallPdf.hh b/inc/LauCrystalBallPdf.hh
index d6ec37a..90fe78e 100644
--- a/inc/LauCrystalBallPdf.hh
+++ b/inc/LauCrystalBallPdf.hh
@@ -1,124 +1,125 @@
/*
Copyright 2006 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauCrystalBallPdf.hh
\brief File containing declaration of LauCrystalBallPdf class.
*/
/*! \class LauCrystalBallPdf
\brief Class for defining a Crystal Ball PDF.
Class that allows the user to define a Crystal Ball PDF, a Gaussian with power law tail on one side.
The guts of the implementation have been copied from RooFit.
*/
/*****************************************************************************
* Class based on RooFit/RooCBShape. *
* Original copyright given below. *
*****************************************************************************
* Authors: *
* WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
* DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
* *
* Copyright (c) 2000-2005, Regents of the University of California *
* and Stanford University. All rights reserved. *
* *
* Redistribution and use in source and binary forms, *
* with or without modification, are permitted according to the terms *
* listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
*****************************************************************************/
#ifndef LAU_CRYSTAL_BALL_PDF
#define LAU_CRYSTAL_BALL_PDF
-#include <vector>
+#include "LauAbsPdf.hh"
#include "TString.h"
-#include "LauAbsPdf.hh"
+#include <vector>
class LauParameter;
-
class LauCrystalBallPdf : public LauAbsPdf {
- public:
- //! Constructor
- /*!
- \param [in] theVarName the name of the abscissa variable
- \param [in] params the PDF parameters - mean and sigma of the Gaussian, alpha (the distance from the mean in which the Gaussian and the tail are matched up), n (power for the tail)
- \param [in] minAbscissa the minimum value of the abscissa
- \param [in] maxAbscissa the maximum value of the abscissa
- */
- LauCrystalBallPdf(const TString& theVarName, const std::vector<LauAbsRValue*>& params, Double_t minAbscissa, Double_t maxAbscissa);
-
- //! Destructor
- virtual ~LauCrystalBallPdf();
-
- //! Calculate the likelihood (and intermediate info) for a given abscissa
- /*!
- \param [in] abscissas the values of the abscissa(s)
- */
- virtual void calcLikelihoodInfo(const LauAbscissas& abscissas);
-
- using LauAbsPdf::calcLikelihoodInfo;
-
- //! Calculate the normalisation
- virtual void calcNorm();
-
- //! Calculate the PDF height
- /*!
- \param [in] kinematics the current DP kinematics
- */
- virtual void calcPDFHeight( const LauKinematics* kinematics );
-
- protected:
-
- //! Calculate the approximate error function of argument
- /*!
- \param [in] arg the argument for which to calculate the error function
- \return error function of argument
- */
- Double_t approxErf(Double_t arg) const;
-
- private:
- //! Copy constructor (not implemented)
- LauCrystalBallPdf(const LauCrystalBallPdf& other);
-
- //! Copy assignment operator (not implemented)
- LauCrystalBallPdf& operator=(const LauCrystalBallPdf& other);
-
- //! Gaussian mean
- LauAbsRValue* mean_;
- //! Gaussian sigma
- LauAbsRValue* sigma_;
- //! Alpha - distance from the mean in which the Gaussian and the tail are matched up
- LauAbsRValue* alpha_;
- //! Power for tail (goes as 1/x^n)
- LauAbsRValue* n_;
-
- ClassDef(LauCrystalBallPdf,0) // Define the Crystal Ball PDF
+ public:
+ //! Constructor
+ /*!
+ \param [in] theVarName the name of the abscissa variable
+ \param [in] params the PDF parameters - mean and sigma of the Gaussian, alpha (the distance from the mean in which the Gaussian and the tail are matched up), n (power for the tail)
+ \param [in] minAbscissa the minimum value of the abscissa
+ \param [in] maxAbscissa the maximum value of the abscissa
+ */
+ LauCrystalBallPdf( const TString& theVarName,
+ const std::vector<LauAbsRValue*>& params,
+ Double_t minAbscissa,
+ Double_t maxAbscissa );
+
+ //! Destructor
+ virtual ~LauCrystalBallPdf();
+
+ //! Calculate the likelihood (and intermediate info) for a given abscissa
+ /*!
+ \param [in] abscissas the values of the abscissa(s)
+ */
+ virtual void calcLikelihoodInfo( const LauAbscissas& abscissas );
+
+ using LauAbsPdf::calcLikelihoodInfo;
+
+ //! Calculate the normalisation
+ virtual void calcNorm();
+
+ //! Calculate the PDF height
+ /*!
+ \param [in] kinematics the current DP kinematics
+ */
+ virtual void calcPDFHeight( const LauKinematics* kinematics );
+
+ protected:
+ //! Calculate the approximate error function of argument
+ /*!
+ \param [in] arg the argument for which to calculate the error function
+ \return error function of argument
+ */
+ Double_t approxErf( Double_t arg ) const;
+
+ private:
+ //! Copy constructor (not implemented)
+ LauCrystalBallPdf( const LauCrystalBallPdf& other );
+
+ //! Copy assignment operator (not implemented)
+ LauCrystalBallPdf& operator=( const LauCrystalBallPdf& other );
+
+ //! Gaussian mean
+ LauAbsRValue* mean_;
+ //! Gaussian sigma
+ LauAbsRValue* sigma_;
+ //! Alpha - distance from the mean in which the Gaussian and the tail are matched up
+ LauAbsRValue* alpha_;
+ //! Power for tail (goes as 1/x^n)
+ LauAbsRValue* n_;
+
+ ClassDef( LauCrystalBallPdf, 0 ) // Define the Crystal Ball PDF
};
#endif
diff --git a/inc/LauDPDepBifurGaussPdf.hh b/inc/LauDPDepBifurGaussPdf.hh
index fe0628a..8b09609 100644
--- a/inc/LauDPDepBifurGaussPdf.hh
+++ b/inc/LauDPDepBifurGaussPdf.hh
@@ -1,177 +1,178 @@
/*
Copyright 2007 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauDPDepBifurGaussPdf.hh
\brief File containing declaration of LauDPDepBifurGaussPdf class.
*/
/*! \class LauDPDepBifurGaussPdf
\brief Class for defining a Bifurcated Gaussian PDF (DP dependent).
Class that allows the user to define a Bifurcated Gaussian PDF where one or more of the parameters have a dependence on the DP position.
*/
#ifndef LAU_DPDEP_BIFURGAUSS_PDF
#define LAU_DPDEP_BIFURGAUSS_PDF
-#include <vector>
+#include "LauAbsPdf.hh"
#include "TString.h"
-#include "LauAbsPdf.hh"
-
+#include <vector>
class LauDaughters;
class LauDPDepBifurGaussPdf : public LauAbsPdf {
- public:
- //! Define possibilties for the DP axes
- enum DPAxis {
- M12, /*!< dependence is on m^2_12 */
- M13, /*!< dependence is on m^2_13 */
- M23, /*!< dependence is on m^2_23 */
- CentreDist, /*!< dependence is on the distance from the DP centre */
- MMIN, /*!< dependence is on the minimum of m^2_13 and m^2_23 */
- MMAX /*!< dependence is on the maximum of m^2_13 and m^2_23 */
- };
-
- //! Define possibilties for the scaling method
- enum ScaleMethod {
- poly, /*!< dependence is polynomial */
- polyNegPower /*!< dependence is a Laurent polynomial with only negative powers */
- };
-
- //! Constructor
- /*!
- \param [in] theVarName the name of the abscissa variable
- \param [in] params the PDF parameters - mean and sigma
- \param [in] minAbscissa the minimum value of the abscissa
- \param [in] maxAbscissa the maximum value of the abscissa
- \param [in] daughters the daughter particles
- \param [in] meanCoeffs the coefficients of the DP dependence of the Gaussian mean
- \param [in] sigmaLCoeffs the coefficients of the DP dependence of the sigma for the left Gaussian
- \param [in] sigmaRCoeffs the coefficients of the DP dependence of the sigma for the right Gaussian
- \param [in] dpAxis the DP axis that defines the parameter dependence
- */
- LauDPDepBifurGaussPdf(const TString& theVarName, const std::vector<LauAbsRValue*>& params,
- Double_t minAbscissa, Double_t maxAbscissa,
- const LauDaughters* daughters,
- const std::vector<Double_t>& meanCoeffs,
- const std::vector<Double_t>& sigmaLCoeffs,
- const std::vector<Double_t>& sigmaRCoeffs,
- DPAxis dpAxis);
-
- //! Destructor
- virtual ~LauDPDepBifurGaussPdf();
-
- //! Specifies whether or not the PDF is DP dependent.
- /*!
- \return true if the PDF is DP-dependent (the default)
- */
- virtual Bool_t isDPDependent() const {return kTRUE;}
-
- //! Calculate the likelihood (and intermediate info) for a given abscissa
- /*!
- \param [in] abscissas the values of the abscissa(s)
- */
- virtual void calcLikelihoodInfo(const LauAbscissas& abscissas);
-
- using LauAbsPdf::calcLikelihoodInfo;
-
- //! Calculate the normalisation
- virtual void calcNorm();
-
- //! Calculate the PDF height
- /*!
- \param [in] kinematics the current DP kinematics
- */
- virtual void calcPDFHeight( const LauKinematics* kinematics );
-
- //! Retrieve scaling method information
- /*!
- \return scaling method
- */
- ScaleMethod scaleMethod() const {return scaleMethod_;}
-
- //! Set the scaling method
- /*!
- \param [in] method the scaling method
- */
- void scaleMethod(ScaleMethod method) {scaleMethod_ = method;}
-
- protected:
- //! Scale the Gaussian parameters with polynomial method
- /*!
- \param [in] perEventDist the event distribution
- */
- void scalePars_poly(Double_t perEventDist);
-
- //! Scale the Gaussian parameters with negative power polynomial method
- /*!
- \param [in] perEventDist the event distribution
- */
- void scalePars_polyNegPower(Double_t perEventDist);
-
- private:
- //! Copy constructor (not implemented)
- LauDPDepBifurGaussPdf(const LauDPDepBifurGaussPdf& other);
-
- //! Copy assignment operator (not implemented)
- LauDPDepBifurGaussPdf& operator=(const LauDPDepBifurGaussPdf& other);
-
- //! The current DP kinematics
- const LauKinematics* kinematics_;
-
- //! Gaussian mean
- LauAbsRValue* mean_;
- //! Left Gaussian sigma
- LauAbsRValue* sigmaL_;
- //! Right Gaussian sigma
- LauAbsRValue* sigmaR_;
-
- //! Gaussian mean
- Double_t meanVal_;
- //! Left Gaussian sigma
- Double_t sigmaLVal_;
- //! Right Gaussian sigma
- Double_t sigmaRVal_;
-
- //! Coefficients of Gaussian mean
- const std::vector<Double_t> meanCoeffs_;
- //! Coefficients of left Gaussian sigma
- const std::vector<Double_t> sigmaLCoeffs_;
- //! Coefficients of right Gaussian sigma
- const std::vector<Double_t> sigmaRCoeffs_;
-
- //! The DP axis we depend on
- DPAxis dpAxis_;
-
- //! Scaling method information
- ScaleMethod scaleMethod_;
-
- ClassDef(LauDPDepBifurGaussPdf,0) // Define the MVA PDF
+ public:
+ //! Define possibilties for the DP axes
+ enum DPAxis {
+ M12, /*!< dependence is on m^2_12 */
+ M13, /*!< dependence is on m^2_13 */
+ M23, /*!< dependence is on m^2_23 */
+ CentreDist, /*!< dependence is on the distance from the DP centre */
+ MMIN, /*!< dependence is on the minimum of m^2_13 and m^2_23 */
+ MMAX /*!< dependence is on the maximum of m^2_13 and m^2_23 */
+ };
+
+ //! Define possibilties for the scaling method
+ enum ScaleMethod {
+ poly, /*!< dependence is polynomial */
+ polyNegPower /*!< dependence is a Laurent polynomial with only negative powers */
+ };
+
+ //! Constructor
+ /*!
+ \param [in] theVarName the name of the abscissa variable
+ \param [in] params the PDF parameters - mean and sigma
+ \param [in] minAbscissa the minimum value of the abscissa
+ \param [in] maxAbscissa the maximum value of the abscissa
+ \param [in] daughters the daughter particles
+ \param [in] meanCoeffs the coefficients of the DP dependence of the Gaussian mean
+ \param [in] sigmaLCoeffs the coefficients of the DP dependence of the sigma for the left Gaussian
+ \param [in] sigmaRCoeffs the coefficients of the DP dependence of the sigma for the right Gaussian
+ \param [in] dpAxis the DP axis that defines the parameter dependence
+ */
+ LauDPDepBifurGaussPdf( const TString& theVarName,
+ const std::vector<LauAbsRValue*>& params,
+ Double_t minAbscissa,
+ Double_t maxAbscissa,
+ const LauDaughters* daughters,
+ const std::vector<Double_t>& meanCoeffs,
+ const std::vector<Double_t>& sigmaLCoeffs,
+ const std::vector<Double_t>& sigmaRCoeffs,
+ DPAxis dpAxis );
+
+ //! Destructor
+ virtual ~LauDPDepBifurGaussPdf();
+
+ //! Specifies whether or not the PDF is DP dependent.
+ /*!
+ \return true if the PDF is DP-dependent (the default)
+ */
+ virtual Bool_t isDPDependent() const { return kTRUE; }
+
+ //! Calculate the likelihood (and intermediate info) for a given abscissa
+ /*!
+ \param [in] abscissas the values of the abscissa(s)
+ */
+ virtual void calcLikelihoodInfo( const LauAbscissas& abscissas );
+
+ using LauAbsPdf::calcLikelihoodInfo;
+
+ //! Calculate the normalisation
+ virtual void calcNorm();
+
+ //! Calculate the PDF height
+ /*!
+ \param [in] kinematics the current DP kinematics
+ */
+ virtual void calcPDFHeight( const LauKinematics* kinematics );
+
+ //! Retrieve scaling method information
+ /*!
+ \return scaling method
+ */
+ ScaleMethod scaleMethod() const { return scaleMethod_; }
+
+ //! Set the scaling method
+ /*!
+ \param [in] method the scaling method
+ */
+ void scaleMethod( ScaleMethod method ) { scaleMethod_ = method; }
+
+ protected:
+ //! Scale the Gaussian parameters with polynomial method
+ /*!
+ \param [in] perEventDist the event distribution
+ */
+ void scalePars_poly( Double_t perEventDist );
+
+ //! Scale the Gaussian parameters with negative power polynomial method
+ /*!
+ \param [in] perEventDist the event distribution
+ */
+ void scalePars_polyNegPower( Double_t perEventDist );
+
+ private:
+ //! Copy constructor (not implemented)
+ LauDPDepBifurGaussPdf( const LauDPDepBifurGaussPdf& other );
+
+ //! Copy assignment operator (not implemented)
+ LauDPDepBifurGaussPdf& operator=( const LauDPDepBifurGaussPdf& other );
+
+ //! The current DP kinematics
+ const LauKinematics* kinematics_;
+
+ //! Gaussian mean
+ LauAbsRValue* mean_;
+ //! Left Gaussian sigma
+ LauAbsRValue* sigmaL_;
+ //! Right Gaussian sigma
+ LauAbsRValue* sigmaR_;
+
+ //! Gaussian mean
+ Double_t meanVal_;
+ //! Left Gaussian sigma
+ Double_t sigmaLVal_;
+ //! Right Gaussian sigma
+ Double_t sigmaRVal_;
+
+ //! Coefficients of Gaussian mean
+ const std::vector<Double_t> meanCoeffs_;
+ //! Coefficients of left Gaussian sigma
+ const std::vector<Double_t> sigmaLCoeffs_;
+ //! Coefficients of right Gaussian sigma
+ const std::vector<Double_t> sigmaRCoeffs_;
+
+ //! The DP axis we depend on
+ DPAxis dpAxis_;
+
+ //! Scaling method information
+ ScaleMethod scaleMethod_;
+
+ ClassDef( LauDPDepBifurGaussPdf, 0 ) // Define the MVA PDF
};
#endif
diff --git a/inc/LauDPDepCruijffPdf.hh b/inc/LauDPDepCruijffPdf.hh
index f22a185..fc9c03d 100644
--- a/inc/LauDPDepCruijffPdf.hh
+++ b/inc/LauDPDepCruijffPdf.hh
@@ -1,186 +1,187 @@
/*
Copyright 2009 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauDPDepCruijffPdf.hh
\brief File containing declaration of LauDPDepCruijffPdf class.
*/
/*! \class LauDPDepCruijffPdf
\brief Class for defining a Cruijff PDF (with DP dependence).
Class that allows the user to define a Cruijff PDF where one or more of the parameters have a polynomial dependence on the DP position.
*/
#ifndef LAU_DPDEP_CRUIJFF_PDF
#define LAU_DPDEP_CRUIJFF_PDF
-#include <vector>
+#include "LauAbsPdf.hh"
#include "TString.h"
-#include "LauAbsPdf.hh"
+#include <vector>
class LauDaughters;
class LauKinematics;
class LauParameter;
-
class LauDPDepCruijffPdf : public LauAbsPdf {
- public:
- //! Define possibilties for the DP axes
- enum DPAxis {
- M12, /*!< dependence is on m^2_12 */
- M13, /*!< dependence is on m^2_13 */
- M23, /*!< dependence is on m^2_23 */
- CentreDist, /*!< dependence is on the distance from the DP centre */
- MMIN, /*!< dependence is on the minimum of m^2_13 and m^2_23 */
- MMAX /*!< dependence is on the maximum of m^2_13 and m^2_23 */
- };
-
- //! Constructor
- /*!
- \param [in] theVarName the name of the abscissa variable
- \param [in] params the PDF parameters - mean, sigmaR, sigmaL, alphaR and alphaL
- \param [in] minAbscissa the minimum value of the abscissa
- \param [in] maxAbscissa the maximum value of the abscissa
- \param [in] daughters the daughter particles
- \param [in] meanCoeffs the coefficients of the DP dependence of the Gaussian mean
- \param [in] sigmaLCoeffs the coefficients of the DP dependence of the sigma for the left Gaussian
- \param [in] sigmaRCoeffs the coefficients of the DP dependence of the sigma for the right Gaussian
- \param [in] alphaLCoeffs the coefficients of the DP dependence of the alpha for the left Gaussian
- \param [in] alphaRCoeffs the coefficients of the DP dependence of the alpha for the right Gaussian
- \param [in] dpAxis the DP axis that defines the parameter dependence
- */
- LauDPDepCruijffPdf(const TString& theVarName, const std::vector<LauAbsRValue*>& params,
- Double_t minAbscissa, Double_t maxAbscissa,
- const LauDaughters* daughters,
- const std::vector<Double_t>& meanCoeffs,
- const std::vector<Double_t>& sigmaLCoeffs,
- const std::vector<Double_t>& sigmaRCoeffs,
- const std::vector<Double_t>& alphaLCoeffs,
- const std::vector<Double_t>& alphaRCoeffs,
- DPAxis dpAxis);
-
- //! Destructor
- virtual ~LauDPDepCruijffPdf();
-
- //! Specifies whether or not the PDF is DP dependent.
- /*!
- \return true if the PDF is DP-dependent (the default)
- */
- virtual Bool_t isDPDependent() const {return kTRUE;}
-
- //! Calculate the likelihood (and intermediate info) for a given abscissa
- /*!
- \param [in] abscissas the values of the abscissa(s)
- */
- virtual void calcLikelihoodInfo(const LauAbscissas& abscissas);
-
- using LauAbsPdf::calcLikelihoodInfo;
-
- //! Calculate the normalisation
- virtual void calcNorm();
-
- //! Calculate the PDF height
- /*!
- \param [in] kinematics the current DP kinematics
- */
- virtual void calcPDFHeight( const LauKinematics* kinematics );
-
- protected:
- //! Scale parameters by their dependence on the DP position
- /*!
- \param [in] dpPos the DP position
- */
- void scalePars( Double_t dpPos );
-
- //! Current PDF value
- /*!
- \param [in] abscissa the values of the abscissa(s)
- */
- Double_t currentPDFValue(Double_t abscissa) const;
-
- //! Integrate the PDF using the Gauss-Legendre method
- /*!
- \return the integral of the PDF
- */
- virtual Double_t integrGaussLegendre();
-
- //! Integrate the PDF using the simple trapezoid method
- /*!
- \return the integral of the PDF
- */
- virtual Double_t integTrapezoid();
-
- private:
- //! Copy constructor (not implemented)
- LauDPDepCruijffPdf(const LauDPDepCruijffPdf& other);
-
- //! Copy assignment operator (not implemented)
- LauDPDepCruijffPdf& operator=(const LauDPDepCruijffPdf& other);
-
- //! The current DP kinematics
- const LauKinematics* kinematics_;
-
- //! Gaussian mean
- LauAbsRValue* mean_;
- //! Sigma of left Gaussian
- LauAbsRValue* sigmaL_;
- //! Sigma of right Gaussian
- LauAbsRValue* sigmaR_;
- //! Alpha of left Gaussian
- LauAbsRValue* alphaL_;
- //! Alpha of right Gaussian
- LauAbsRValue* alphaR_;
-
- //! Gaussian mean
- Double_t meanVal_;
- //! Sigma of left Gaussian
- Double_t sigmaLVal_;
- //! Sigma of right Gaussian
- Double_t sigmaRVal_;
- //! Alpha of left Gaussian
- Double_t alphaLVal_;
- //! Alpha of right Gaussian
- Double_t alphaRVal_;
-
- //! Coefficients of Gaussian mean
- const std::vector<Double_t> meanCoeffs_;
- //! Coefficients of sigma for the left Gaussian
- const std::vector<Double_t> sigmaLCoeffs_;
- //! Coefficients of sigma for the right Gaussian
- const std::vector<Double_t> sigmaRCoeffs_;
- //! Coefficients of alpha for the left Gaussian
- const std::vector<Double_t> alphaLCoeffs_;
- //! Coefficients of alpha for the right Gaussian
- const std::vector<Double_t> alphaRCoeffs_;
-
- //! The DP axis we depend on
- DPAxis dpAxis_;
-
- ClassDef(LauDPDepCruijffPdf,0) // Define the Cruijff PDF
+ public:
+ //! Define possibilties for the DP axes
+ enum DPAxis {
+ M12, /*!< dependence is on m^2_12 */
+ M13, /*!< dependence is on m^2_13 */
+ M23, /*!< dependence is on m^2_23 */
+ CentreDist, /*!< dependence is on the distance from the DP centre */
+ MMIN, /*!< dependence is on the minimum of m^2_13 and m^2_23 */
+ MMAX /*!< dependence is on the maximum of m^2_13 and m^2_23 */
+ };
+
+ //! Constructor
+ /*!
+ \param [in] theVarName the name of the abscissa variable
+ \param [in] params the PDF parameters - mean, sigmaR, sigmaL, alphaR and alphaL
+ \param [in] minAbscissa the minimum value of the abscissa
+ \param [in] maxAbscissa the maximum value of the abscissa
+ \param [in] daughters the daughter particles
+ \param [in] meanCoeffs the coefficients of the DP dependence of the Gaussian mean
+ \param [in] sigmaLCoeffs the coefficients of the DP dependence of the sigma for the left Gaussian
+ \param [in] sigmaRCoeffs the coefficients of the DP dependence of the sigma for the right Gaussian
+ \param [in] alphaLCoeffs the coefficients of the DP dependence of the alpha for the left Gaussian
+ \param [in] alphaRCoeffs the coefficients of the DP dependence of the alpha for the right Gaussian
+ \param [in] dpAxis the DP axis that defines the parameter dependence
+ */
+ LauDPDepCruijffPdf( const TString& theVarName,
+ const std::vector<LauAbsRValue*>& params,
+ Double_t minAbscissa,
+ Double_t maxAbscissa,
+ const LauDaughters* daughters,
+ const std::vector<Double_t>& meanCoeffs,
+ const std::vector<Double_t>& sigmaLCoeffs,
+ const std::vector<Double_t>& sigmaRCoeffs,
+ const std::vector<Double_t>& alphaLCoeffs,
+ const std::vector<Double_t>& alphaRCoeffs,
+ DPAxis dpAxis );
+
+ //! Destructor
+ virtual ~LauDPDepCruijffPdf();
+
+ //! Specifies whether or not the PDF is DP dependent.
+ /*!
+ \return true if the PDF is DP-dependent (the default)
+ */
+ virtual Bool_t isDPDependent() const { return kTRUE; }
+
+ //! Calculate the likelihood (and intermediate info) for a given abscissa
+ /*!
+ \param [in] abscissas the values of the abscissa(s)
+ */
+ virtual void calcLikelihoodInfo( const LauAbscissas& abscissas );
+
+ using LauAbsPdf::calcLikelihoodInfo;
+
+ //! Calculate the normalisation
+ virtual void calcNorm();
+
+ //! Calculate the PDF height
+ /*!
+ \param [in] kinematics the current DP kinematics
+ */
+ virtual void calcPDFHeight( const LauKinematics* kinematics );
+
+ protected:
+ //! Scale parameters by their dependence on the DP position
+ /*!
+ \param [in] dpPos the DP position
+ */
+ void scalePars( Double_t dpPos );
+
+ //! Current PDF value
+ /*!
+ \param [in] abscissa the values of the abscissa(s)
+ */
+ Double_t currentPDFValue( Double_t abscissa ) const;
+
+ //! Integrate the PDF using the Gauss-Legendre method
+ /*!
+ \return the integral of the PDF
+ */
+ virtual Double_t integrGaussLegendre();
+
+ //! Integrate the PDF using the simple trapezoid method
+ /*!
+ \return the integral of the PDF
+ */
+ virtual Double_t integTrapezoid();
+
+ private:
+ //! Copy constructor (not implemented)
+ LauDPDepCruijffPdf( const LauDPDepCruijffPdf& other );
+
+ //! Copy assignment operator (not implemented)
+ LauDPDepCruijffPdf& operator=( const LauDPDepCruijffPdf& other );
+
+ //! The current DP kinematics
+ const LauKinematics* kinematics_;
+
+ //! Gaussian mean
+ LauAbsRValue* mean_;
+ //! Sigma of left Gaussian
+ LauAbsRValue* sigmaL_;
+ //! Sigma of right Gaussian
+ LauAbsRValue* sigmaR_;
+ //! Alpha of left Gaussian
+ LauAbsRValue* alphaL_;
+ //! Alpha of right Gaussian
+ LauAbsRValue* alphaR_;
+
+ //! Gaussian mean
+ Double_t meanVal_;
+ //! Sigma of left Gaussian
+ Double_t sigmaLVal_;
+ //! Sigma of right Gaussian
+ Double_t sigmaRVal_;
+ //! Alpha of left Gaussian
+ Double_t alphaLVal_;
+ //! Alpha of right Gaussian
+ Double_t alphaRVal_;
+
+ //! Coefficients of Gaussian mean
+ const std::vector<Double_t> meanCoeffs_;
+ //! Coefficients of sigma for the left Gaussian
+ const std::vector<Double_t> sigmaLCoeffs_;
+ //! Coefficients of sigma for the right Gaussian
+ const std::vector<Double_t> sigmaRCoeffs_;
+ //! Coefficients of alpha for the left Gaussian
+ const std::vector<Double_t> alphaLCoeffs_;
+ //! Coefficients of alpha for the right Gaussian
+ const std::vector<Double_t> alphaRCoeffs_;
+
+ //! The DP axis we depend on
+ DPAxis dpAxis_;
+
+ ClassDef( LauDPDepCruijffPdf, 0 ) // Define the Cruijff PDF
};
#endif
diff --git a/inc/LauDPDepGaussPdf.hh b/inc/LauDPDepGaussPdf.hh
index dfc88b6..4f9dfce 100644
--- a/inc/LauDPDepGaussPdf.hh
+++ b/inc/LauDPDepGaussPdf.hh
@@ -1,144 +1,145 @@
/*
Copyright 2009 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauDPDepGaussPdf.hh
\brief File containing declaration of LauDPDepGaussPdf class.
*/
/*! \class LauDPDepGaussPdf
\brief Class for defining a Gaussian PDF (DP dependent).
Class that allows the user to define a Gaussian PDF where one or more of the parameters have a polynomial dependence on the DP position.
*/
#ifndef LAU_DPDEP_GAUSS_PDF
#define LAU_DPDEP_GAUSS_PDF
-#include <vector>
+#include "LauAbsPdf.hh"
#include "TString.h"
-#include "LauAbsPdf.hh"
+#include <vector>
class LauDaughters;
class LauKinematics;
class LauParameter;
-
class LauDPDepGaussPdf : public LauAbsPdf {
- public:
- //! Define possibilties for the DP axes
- enum DPAxis {
- M12, /*!< dependence is on m^2_12 */
- M13, /*!< dependence is on m^2_13 */
- M23, /*!< dependence is on m^2_23 */
- CentreDist, /*!< dependence is on the distance from the DP centre */
- MMIN, /*!< dependence is on the minimum of m^2_13 and m^2_23 */
- MMAX /*!< dependence is on the maximum of m^2_13 and m^2_23 */
- };
-
- //! Constructor
- /*!
- \param [in] theVarName the name of the abscissa variable
- \param [in] params the PDF parameters - mean and sigma
- \param [in] minAbscissa the minimum value of the abscissa
- \param [in] maxAbscissa the maximum value of the abscissa
- \param [in] daughters the daughter particles
- \param [in] meanCoeffs the coefficients of the DP dependence of the Gaussian mean
- \param [in] sigmaCoeffs the coefficients of the DP dependence of the Gaussian sigma
- \param [in] dpAxis the DP axis that defines the parameter dependence
- */
- LauDPDepGaussPdf(const TString& theVarName, const std::vector<LauAbsRValue*>& params,
- Double_t minAbscissa, Double_t maxAbscissa,
- const LauDaughters* daughters,
- const std::vector<Double_t>& meanCoeffs,
- const std::vector<Double_t>& sigmaCoeffs,
- DPAxis dpAxis);
-
- //! Destructor
- virtual ~LauDPDepGaussPdf();
-
- //! Specifies whether or not the PDF is DP dependent.
- /*!
- \return true if the PDF is DP-dependent (the default)
- */
- virtual Bool_t isDPDependent() const {return kTRUE;}
-
- //! Calculate the likelihood (and intermediate info) for a given abscissa
- /*!
- \param [in] abscissas the values of the abscissa(s)
- */
- virtual void calcLikelihoodInfo(const LauAbscissas& abscissas);
-
- using LauAbsPdf::calcLikelihoodInfo;
-
- //! Calculate the normalisation
- virtual void calcNorm();
-
- //! Calculate the PDF height
- /*!
- \param [in] kinematics the current DP kinematics
- */
- virtual void calcPDFHeight( const LauKinematics* kinematics );
-
- protected:
- //! Scale parameters by their dependence on the DP position
- /*!
- \param [in] dpPos the DP position
- */
- void scalePars( Double_t dpPos );
-
- private:
- //! Copy constructor (not implemented)
- LauDPDepGaussPdf(const LauDPDepGaussPdf& other);
-
- //! Copy assignment operator (not implemented)
- LauDPDepGaussPdf& operator=(const LauDPDepGaussPdf& other);
-
- //! The current DP kinematics
- const LauKinematics* kinematics_;
-
- //! Gaussian mean
- LauAbsRValue* mean_;
- //! Gaussian sigma
- LauAbsRValue* sigma_;
-
- //! Gaussian mean
- Double_t meanVal_;
- //! Gaussian sigma
- Double_t sigmaVal_;
-
- //! Coefficients of Gaussian mean
- const std::vector<Double_t> meanCoeffs_;
- //! Coefficients of Gaussian sigma
- const std::vector<Double_t> sigmaCoeffs_;
-
- //! The DP axis we depend on
- DPAxis dpAxis_;
-
- ClassDef(LauDPDepGaussPdf,0) // Define the Gaussian PDF
+ public:
+ //! Define possibilties for the DP axes
+ enum DPAxis {
+ M12, /*!< dependence is on m^2_12 */
+ M13, /*!< dependence is on m^2_13 */
+ M23, /*!< dependence is on m^2_23 */
+ CentreDist, /*!< dependence is on the distance from the DP centre */
+ MMIN, /*!< dependence is on the minimum of m^2_13 and m^2_23 */
+ MMAX /*!< dependence is on the maximum of m^2_13 and m^2_23 */
+ };
+
+ //! Constructor
+ /*!
+ \param [in] theVarName the name of the abscissa variable
+ \param [in] params the PDF parameters - mean and sigma
+ \param [in] minAbscissa the minimum value of the abscissa
+ \param [in] maxAbscissa the maximum value of the abscissa
+ \param [in] daughters the daughter particles
+ \param [in] meanCoeffs the coefficients of the DP dependence of the Gaussian mean
+ \param [in] sigmaCoeffs the coefficients of the DP dependence of the Gaussian sigma
+ \param [in] dpAxis the DP axis that defines the parameter dependence
+ */
+ LauDPDepGaussPdf( const TString& theVarName,
+ const std::vector<LauAbsRValue*>& params,
+ Double_t minAbscissa,
+ Double_t maxAbscissa,
+ const LauDaughters* daughters,
+ const std::vector<Double_t>& meanCoeffs,
+ const std::vector<Double_t>& sigmaCoeffs,
+ DPAxis dpAxis );
+
+ //! Destructor
+ virtual ~LauDPDepGaussPdf();
+
+ //! Specifies whether or not the PDF is DP dependent.
+ /*!
+ \return true if the PDF is DP-dependent (the default)
+ */
+ virtual Bool_t isDPDependent() const { return kTRUE; }
+
+ //! Calculate the likelihood (and intermediate info) for a given abscissa
+ /*!
+ \param [in] abscissas the values of the abscissa(s)
+ */
+ virtual void calcLikelihoodInfo( const LauAbscissas& abscissas );
+
+ using LauAbsPdf::calcLikelihoodInfo;
+
+ //! Calculate the normalisation
+ virtual void calcNorm();
+
+ //! Calculate the PDF height
+ /*!
+ \param [in] kinematics the current DP kinematics
+ */
+ virtual void calcPDFHeight( const LauKinematics* kinematics );
+
+ protected:
+ //! Scale parameters by their dependence on the DP position
+ /*!
+ \param [in] dpPos the DP position
+ */
+ void scalePars( Double_t dpPos );
+
+ private:
+ //! Copy constructor (not implemented)
+ LauDPDepGaussPdf( const LauDPDepGaussPdf& other );
+
+ //! Copy assignment operator (not implemented)
+ LauDPDepGaussPdf& operator=( const LauDPDepGaussPdf& other );
+
+ //! The current DP kinematics
+ const LauKinematics* kinematics_;
+
+ //! Gaussian mean
+ LauAbsRValue* mean_;
+ //! Gaussian sigma
+ LauAbsRValue* sigma_;
+
+ //! Gaussian mean
+ Double_t meanVal_;
+ //! Gaussian sigma
+ Double_t sigmaVal_;
+
+ //! Coefficients of Gaussian mean
+ const std::vector<Double_t> meanCoeffs_;
+ //! Coefficients of Gaussian sigma
+ const std::vector<Double_t> sigmaCoeffs_;
+
+ //! The DP axis we depend on
+ DPAxis dpAxis_;
+
+ ClassDef( LauDPDepGaussPdf, 0 ) // Define the Gaussian PDF
};
#endif
diff --git a/inc/LauDPDepMapPdf.hh b/inc/LauDPDepMapPdf.hh
index 35d2b6f..2f28abe 100644
--- a/inc/LauDPDepMapPdf.hh
+++ b/inc/LauDPDepMapPdf.hh
@@ -1,161 +1,160 @@
/*
Copyright 2013 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauDPDepMapPdf.hh
\brief File containing declaration of LauDPDepMapPdf class.
*/
/*! \class LauDPDepMapPdf
\brief Class to allow having different PDFs in different regions of the DP.
Class to allow having different PDFs in different regions of the DP.
The DP regions are specified in a 2D histogram or in a 1D histogram of some projection of the DP.
Each PDF is then associated with that region.
*/
-
#ifndef LAU_DPDEPMAP_PDF
#define LAU_DPDEPMAP_PDF
-#include <vector>
+#include "LauAbsPdf.hh"
#include "Rtypes.h"
-#include "LauAbsPdf.hh"
+#include <vector>
class LauDaughters;
class Lau2DAbsDP;
class LauParameter;
class TH2;
class TH1;
-
class LauDPDepMapPdf : public LauAbsPdf {
- public:
- //! Define possibilties for the DP axes
- enum DPAxis {
- M12, /*!< dependence is on m^2_12 */
- M13, /*!< dependence is on m^2_13 */
- M23, /*!< dependence is on m^2_23 */
- CentreDist, /*!< dependence is on the distance from the DP centre */
- MMIN, /*!< dependence is on the minimum of m^2_13 and m^2_23 */
- MMAX /*!< dependence is on the maximum of m^2_13 and m^2_23 */
- };
-
- //! Constructor - map described by 2D histogram
- /*!
- \param [in] pdfs the PDFs
- \param [in] daughters the daughter particles
- \param [in] dpHisto the 2D histogram
- \param [in] upperHalf boolean flag to specify that the supplied histogram contains only the upper half of a symmetric DP (or lower half if using square DP coordinates)
- */
- LauDPDepMapPdf( const std::vector<LauAbsPdf*> &pdfs,
- const LauDaughters* daughters,
- const TH2* dpHisto, Bool_t upperHalf = kFALSE);
-
- //! Constructor - map described by 1D histogram of a DP "axis"
- /*!
- \param [in] pdfs the PDFs
- \param [in] daughters the daughter particles
- \param [in] dpAxisHisto the 1D histogram
- \param [in] dpAxis the DP axis
- */
- LauDPDepMapPdf( const std::vector<LauAbsPdf*> &pdfs,
- const LauDaughters* daughters,
- const TH1* dpAxisHisto,
- DPAxis dpAxis);
-
- //! Destructor
- virtual ~LauDPDepMapPdf();
-
- //! Specifies whether or not the PDF is DP dependent.
- /*!
- \return true if the PDF is DP-dependent (the default)
- */
- virtual Bool_t isDPDependent() const {return kTRUE;}
-
- //! Cache information from data
- /*!
- \param [in] inputData the input data
- */
- virtual void cacheInfo(const LauFitDataTree& inputData);
-
- //! Calculate the likelihood (and intermediate info) for a given abscissa
- /*!
- \param [in] abscissas the values of the abscissa(s)
- */
- virtual void calcLikelihoodInfo(const LauAbscissas& abscissas);
-
- //! Calculate the likelihood (and intermediate info) for a given event number
- /*!
- \param [in] iEvt event number
- */
- virtual void calcLikelihoodInfo(UInt_t iEvt);
-
- //! Calculate the normalisation
- virtual void calcNorm();
-
- //! Calculate the PDF height
- /*!
- \param [in] kinematics the current DP kinematics
- */
- virtual void calcPDFHeight( const LauKinematics* kinematics );
-
- protected:
- //! Determine the DP region
- /*!
- \param [in] m13Sq the invariant mass squared of daughters 1 and 3
- \param [in] m23Sq the invariant mass squared of daughters 2 and 3
- */
- UInt_t determineDPRegion( Double_t m13Sq, Double_t m23Sq ) const;
-
- private:
- //! Copy constructor - not implemented
- LauDPDepMapPdf(const LauDPDepMapPdf& other);
-
- //! Copy assignment operator - not implemented
- LauDPDepMapPdf& operator=(const LauDPDepMapPdf& other);
-
- //! Daughter particles
- LauDaughters* daughters_;
-
- //! The PDFs
- std::vector<LauAbsPdf*> pdfs_;
-
- //! 2D histogram - DP
- Lau2DAbsDP* dpDependence_;
- //! 1D histogram - DP axis
- TH1* dpAxisDependence_;
-
- //! The DP axis we depend on
- DPAxis dpAxis_;
-
- //! Cached indices values
- std::vector<UInt_t> indices_;
-
- ClassDef(LauDPDepMapPdf,0) // Define the sum PDF
+ public:
+ //! Define possibilties for the DP axes
+ enum DPAxis {
+ M12, /*!< dependence is on m^2_12 */
+ M13, /*!< dependence is on m^2_13 */
+ M23, /*!< dependence is on m^2_23 */
+ CentreDist, /*!< dependence is on the distance from the DP centre */
+ MMIN, /*!< dependence is on the minimum of m^2_13 and m^2_23 */
+ MMAX /*!< dependence is on the maximum of m^2_13 and m^2_23 */
+ };
+
+ //! Constructor - map described by 2D histogram
+ /*!
+ \param [in] pdfs the PDFs
+ \param [in] daughters the daughter particles
+ \param [in] dpHisto the 2D histogram
+ \param [in] upperHalf boolean flag to specify that the supplied histogram contains only the upper half of a symmetric DP (or lower half if using square DP coordinates)
+ */
+ LauDPDepMapPdf( const std::vector<LauAbsPdf*>& pdfs,
+ const LauDaughters* daughters,
+ const TH2* dpHisto,
+ Bool_t upperHalf = kFALSE );
+
+ //! Constructor - map described by 1D histogram of a DP "axis"
+ /*!
+ \param [in] pdfs the PDFs
+ \param [in] daughters the daughter particles
+ \param [in] dpAxisHisto the 1D histogram
+ \param [in] dpAxis the DP axis
+ */
+ LauDPDepMapPdf( const std::vector<LauAbsPdf*>& pdfs,
+ const LauDaughters* daughters,
+ const TH1* dpAxisHisto,
+ DPAxis dpAxis );
+
+ //! Destructor
+ virtual ~LauDPDepMapPdf();
+
+ //! Specifies whether or not the PDF is DP dependent.
+ /*!
+ \return true if the PDF is DP-dependent (the default)
+ */
+ virtual Bool_t isDPDependent() const { return kTRUE; }
+
+ //! Cache information from data
+ /*!
+ \param [in] inputData the input data
+ */
+ virtual void cacheInfo( const LauFitDataTree& inputData );
+
+ //! Calculate the likelihood (and intermediate info) for a given abscissa
+ /*!
+ \param [in] abscissas the values of the abscissa(s)
+ */
+ virtual void calcLikelihoodInfo( const LauAbscissas& abscissas );
+
+ //! Calculate the likelihood (and intermediate info) for a given event number
+ /*!
+ \param [in] iEvt event number
+ */
+ virtual void calcLikelihoodInfo( UInt_t iEvt );
+
+ //! Calculate the normalisation
+ virtual void calcNorm();
+
+ //! Calculate the PDF height
+ /*!
+ \param [in] kinematics the current DP kinematics
+ */
+ virtual void calcPDFHeight( const LauKinematics* kinematics );
+
+ protected:
+ //! Determine the DP region
+ /*!
+ \param [in] m13Sq the invariant mass squared of daughters 1 and 3
+ \param [in] m23Sq the invariant mass squared of daughters 2 and 3
+ */
+ UInt_t determineDPRegion( Double_t m13Sq, Double_t m23Sq ) const;
+
+ private:
+ //! Copy constructor - not implemented
+ LauDPDepMapPdf( const LauDPDepMapPdf& other );
+
+ //! Copy assignment operator - not implemented
+ LauDPDepMapPdf& operator=( const LauDPDepMapPdf& other );
+
+ //! Daughter particles
+ LauDaughters* daughters_;
+
+ //! The PDFs
+ std::vector<LauAbsPdf*> pdfs_;
+
+ //! 2D histogram - DP
+ Lau2DAbsDP* dpDependence_;
+ //! 1D histogram - DP axis
+ TH1* dpAxisDependence_;
+
+ //! The DP axis we depend on
+ DPAxis dpAxis_;
+
+ //! Cached indices values
+ std::vector<UInt_t> indices_;
+
+ ClassDef( LauDPDepMapPdf, 0 ) // Define the sum PDF
};
#endif
diff --git a/inc/LauDPDepSumPdf.hh b/inc/LauDPDepSumPdf.hh
index aa358fa..075d871 100644
--- a/inc/LauDPDepSumPdf.hh
+++ b/inc/LauDPDepSumPdf.hh
@@ -1,167 +1,169 @@
/*
Copyright 2009 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauDPDepSumPdf.hh
\brief File containing declaration of LauDPDepSumPdf class.
*/
/*! \class LauDPDepSumPdf
\brief Class for defining a PDF that is the DP-dependent sum of two other PDFs.
-
+
Class for defining a PDF that is the sum of two other PDFs, where the relative fraction of the two PDFs depends on the Dalitz-plot position.
*/
#ifndef LAU_DPDEPSUM_PDF
#define LAU_DPDEPSUM_PDF
-#include "Rtypes.h"
-
#include "LauAbsPdf.hh"
+#include "Rtypes.h"
+
class LauDaughters;
class LauEffModel;
class LauParameter;
class TH2;
-
class LauDPDepSumPdf : public LauAbsPdf {
- public:
- //! Define possibilties for the DP axes
- enum DPAxis {
- M12, /*!< dependence is on m^2_12 */
- M13, /*!< dependence is on m^2_13 */
- M23, /*!< dependence is on m^2_23 */
- CentreDist, /*!< dependence is on the distance from the DP centre */
- MMIN, /*!< dependence is on the minimum of m^2_13 and m^2_23 */
- MMAX /*!< dependence is on the maximum of m^2_13 and m^2_23 */
- };
-
- //! Constructor - fraction determined by 2D histogram
- /*!
- \param [in] pdf1 the first PDF
- \param [in] pdf2 the second PDF
- \param [in] daughters the daughter particles
- \param [in] dpHisto the 2D histogram
- \param [in] upperHalf boolean flag to specify that the supplied histogram contains only the upper half of a symmetric DP (or lower half if using square DP coordinates)
- \param [in] useSpline specifies whether a spline is used to interpolate the histogram
- */
- LauDPDepSumPdf(LauAbsPdf* pdf1, LauAbsPdf* pdf2,
- const LauDaughters* daughters,
- const TH2* dpHisto, Bool_t upperHalf = kFALSE,
- Bool_t useSpline = kFALSE);
-
- //! Constructor - fraction determined by a polynomial of a DP "axis"
- /*!
- \param [in] pdf1 the first PDF
- \param [in] pdf2 the second PDF
- \param [in] frac the fractional contribution of the first PDF to the final PDF
- \param [in] daughters the daughter particles
- \param [in] fracCoeffs the coefficients of the DP dependence of the PDF fraction
- \param [in] dpAxis the DP axis that defines the parameter dependence
- */
- LauDPDepSumPdf(LauAbsPdf* pdf1, LauAbsPdf* pdf2,
- LauParameter* frac,
- const LauDaughters* daughters,
- const std::vector<Double_t>& fracCoeffs,
- DPAxis dpAxis);
-
- //! Destructor
- virtual ~LauDPDepSumPdf();
-
- //! Specifies whether or not the PDF is DP dependent.
- /*!
- \return true if the PDF is DP-dependent (the default)
- */
- virtual Bool_t isDPDependent() const {return kTRUE;}
-
- //! Cache information from data
- /*!
- \param [in] inputData the input data
- */
- virtual void cacheInfo(const LauFitDataTree& inputData);
-
- //! Calculate the likelihood (and intermediate info) for a given abscissa
- /*!
- \param [in] abscissas the values of the abscissa(s)
- */
- virtual void calcLikelihoodInfo(const LauAbscissas& abscissas);
-
- //! Calculate the likelihood (and intermediate info) for a given event number
- /*!
- \param [in] iEvt event number
- */
- virtual void calcLikelihoodInfo(UInt_t iEvt);
-
- //! Calculate the normalisation
- virtual void calcNorm();
-
- //! Calculate the PDF height
- /*!
- \param [in] kinematics the current DP kinematics
- */
- virtual void calcPDFHeight( const LauKinematics* kinematics );
-
- protected:
- //! Scale fraction according to DP position
- /*!
- \param [in] dpPos the DP position
- */
- void scaleFrac( Double_t dpPos );
-
- private:
- //! Copy constructor - not implemented
- LauDPDepSumPdf(const LauDPDepSumPdf& other);
-
- //! Copy assignment operator - not implemented
- LauDPDepSumPdf& operator=(const LauDPDepSumPdf& other);
-
- //! Daughter particles
- LauDaughters* daughters_;
-
- //! First PDF
- LauAbsPdf* pdf1_;
- //! Second PDF
- LauAbsPdf* pdf2_;
-
- //! Fractional contribution of first PDF to the final PDF
- LauAbsRValue* frac_;
- //! Fractional contribution of first PDF to the final PDF
- Double_t fracVal_;
- //! DP dependence
- LauEffModel* dpDependence_;
-
- //! Polynomial used to scale fraction
- const std::vector<Double_t> fracCoeffs_;
-
- //! The DP axis we depend on
- DPAxis dpAxis_;
-
- //! Cached values of fractions
- std::vector<Double_t> fractions_;
-
- ClassDef(LauDPDepSumPdf,0) // Define the sum PDF
+ public:
+ //! Define possibilties for the DP axes
+ enum DPAxis {
+ M12, /*!< dependence is on m^2_12 */
+ M13, /*!< dependence is on m^2_13 */
+ M23, /*!< dependence is on m^2_23 */
+ CentreDist, /*!< dependence is on the distance from the DP centre */
+ MMIN, /*!< dependence is on the minimum of m^2_13 and m^2_23 */
+ MMAX /*!< dependence is on the maximum of m^2_13 and m^2_23 */
+ };
+
+ //! Constructor - fraction determined by 2D histogram
+ /*!
+ \param [in] pdf1 the first PDF
+ \param [in] pdf2 the second PDF
+ \param [in] daughters the daughter particles
+ \param [in] dpHisto the 2D histogram
+ \param [in] upperHalf boolean flag to specify that the supplied histogram contains only the upper half of a symmetric DP (or lower half if using square DP coordinates)
+ \param [in] useSpline specifies whether a spline is used to interpolate the histogram
+ */
+ LauDPDepSumPdf( LauAbsPdf* pdf1,
+ LauAbsPdf* pdf2,
+ const LauDaughters* daughters,
+ const TH2* dpHisto,
+ Bool_t upperHalf = kFALSE,
+ Bool_t useSpline = kFALSE );
+
+ //! Constructor - fraction determined by a polynomial of a DP "axis"
+ /*!
+ \param [in] pdf1 the first PDF
+ \param [in] pdf2 the second PDF
+ \param [in] frac the fractional contribution of the first PDF to the final PDF
+ \param [in] daughters the daughter particles
+ \param [in] fracCoeffs the coefficients of the DP dependence of the PDF fraction
+ \param [in] dpAxis the DP axis that defines the parameter dependence
+ */
+ LauDPDepSumPdf( LauAbsPdf* pdf1,
+ LauAbsPdf* pdf2,
+ LauParameter* frac,
+ const LauDaughters* daughters,
+ const std::vector<Double_t>& fracCoeffs,
+ DPAxis dpAxis );
+
+ //! Destructor
+ virtual ~LauDPDepSumPdf();
+
+ //! Specifies whether or not the PDF is DP dependent.
+ /*!
+ \return true if the PDF is DP-dependent (the default)
+ */
+ virtual Bool_t isDPDependent() const { return kTRUE; }
+
+ //! Cache information from data
+ /*!
+ \param [in] inputData the input data
+ */
+ virtual void cacheInfo( const LauFitDataTree& inputData );
+
+ //! Calculate the likelihood (and intermediate info) for a given abscissa
+ /*!
+ \param [in] abscissas the values of the abscissa(s)
+ */
+ virtual void calcLikelihoodInfo( const LauAbscissas& abscissas );
+
+ //! Calculate the likelihood (and intermediate info) for a given event number
+ /*!
+ \param [in] iEvt event number
+ */
+ virtual void calcLikelihoodInfo( UInt_t iEvt );
+
+ //! Calculate the normalisation
+ virtual void calcNorm();
+
+ //! Calculate the PDF height
+ /*!
+ \param [in] kinematics the current DP kinematics
+ */
+ virtual void calcPDFHeight( const LauKinematics* kinematics );
+
+ protected:
+ //! Scale fraction according to DP position
+ /*!
+ \param [in] dpPos the DP position
+ */
+ void scaleFrac( Double_t dpPos );
+
+ private:
+ //! Copy constructor - not implemented
+ LauDPDepSumPdf( const LauDPDepSumPdf& other );
+
+ //! Copy assignment operator - not implemented
+ LauDPDepSumPdf& operator=( const LauDPDepSumPdf& other );
+
+ //! Daughter particles
+ LauDaughters* daughters_;
+
+ //! First PDF
+ LauAbsPdf* pdf1_;
+ //! Second PDF
+ LauAbsPdf* pdf2_;
+
+ //! Fractional contribution of first PDF to the final PDF
+ LauAbsRValue* frac_;
+ //! Fractional contribution of first PDF to the final PDF
+ Double_t fracVal_;
+ //! DP dependence
+ LauEffModel* dpDependence_;
+
+ //! Polynomial used to scale fraction
+ const std::vector<Double_t> fracCoeffs_;
+
+ //! The DP axis we depend on
+ DPAxis dpAxis_;
+
+ //! Cached values of fractions
+ std::vector<Double_t> fractions_;
+
+ ClassDef( LauDPDepSumPdf, 0 ) // Define the sum PDF
};
#endif
diff --git a/inc/LauDPPartialIntegralInfo.hh b/inc/LauDPPartialIntegralInfo.hh
index 2faf60d..c6fe96a 100644
--- a/inc/LauDPPartialIntegralInfo.hh
+++ b/inc/LauDPPartialIntegralInfo.hh
@@ -1,276 +1,309 @@
/*
Copyright 2014 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauDPPartialIntegralInfo.hh
\brief File containing declaration of LauDPPartialIntegralInfo class.
*/
/*! \class LauDPPartialIntegralInfo
\brief Class for defining (a section of) the Dalitz plot integration binning scheme
Defines the range and bin size of the integration grid.
Stores the weights and Jacobian for each grid point.
Also stores the amplitude values for each model component at each grid point.
*/
#ifndef LAU_DPPARTIALINTEGRAL_INFO
#define LAU_DPPARTIALINTEGRAL_INFO
-#include <iosfwd>
+#include "LauComplex.hh"
#include "TString.h"
-#include "LauComplex.hh"
+#include <iosfwd>
class LauKinematics;
-
class LauDPPartialIntegralInfo {
- public:
- //! Constructor
- /*!
- \param [in] minm13 the minimum of the m13 range
- \param [in] maxm13 the maximum of the m13 range
- \param [in] minm23 the minimum of the m23 range
- \param [in] maxm23 the maximum of the m23 range
- \param [in] m13BinWidth the m13 bin width
- \param [in] m23BinWidth the m23 bin width
- \param [in] precision the precision required for the Gauss-Legendre weights
- \param [in] nAmp the number of coherent amplitude components
- \param [in] nIncohAmp the number of incoherent amplitude components
- \param [in] squareDP whether or not to use the square DP for the integration - if so, m13 is actually mPrime and m23 is actually thetaPrime
- \param [in] kinematics the kinematics object to use to calculate the Jacobians (only relevant if squareDP is true)
- */
- LauDPPartialIntegralInfo(const Double_t minm13, const Double_t maxm13,
- const Double_t minm23, const Double_t maxm23,
- const Double_t m13BinWidth, const Double_t m23BinWidth,
- const Double_t precision,
- const UInt_t nAmp,
- const UInt_t nIncohAmp,
- const Bool_t squareDP = kFALSE,
- const LauKinematics* kinematics = 0);
-
- //! Destructor
- virtual ~LauDPPartialIntegralInfo();
-
- //! Retrieve the minm13 of DP
- /*!
- \return the the minm13 of DP
- */
- inline Double_t getMinm13() const {return minm13_;}
-
- //! Retrieve the maxm13 of DP
- /*!
- \return the the maxm13 of DP
- */
- inline Double_t getMaxm13() const {return maxm13_;}
-
- //! Retrieve the minm23 of DP
- /*!
- \return the the minm23 of DP
- */
- inline Double_t getMinm23() const {return minm23_;}
-
- //! Retrieve the maxm23 of DP
- /*!
- \return the the maxm23 of DP
- */
- inline Double_t getMaxm23() const {return maxm23_;}
-
- //! Retrieve the m13BinWidth of DP
- /*!
- \return the the m13BinWidth of DP
- */
- inline Double_t getM13BinWidth() const {return m13BinWidth_;}
-
- //! Retrieve the m23BinWidth of DP
- /*!
- \return the the m23BinWidth of DP
- */
- inline Double_t getM23BinWidth() const {return m23BinWidth_;}
-
- //! Retrieve the number of bins in m13
- /*!
- \return the number of bins in m13
- */
- inline UInt_t getnm13Points() const {return nm13Points_;}
-
- //! Retrieve the number of bins in m23
- /*!
- \return the number of bins in m23
- */
- inline UInt_t getnm23Points() const {return nm23Points_;}
-
- //! Retrieve the square DP flag
- /*!
- \return whether or not the integration is performed in the square DP
- */
- inline Bool_t getSquareDP() const {return squareDP_;}
-
- //! Retrieve the weight for the given grid point
- /*!
- \param [in] m13Point the grid index in m13
- \param [in] m23Point the grid index in m23
- \return the value of the weight
- */
- inline Double_t getWeight(const UInt_t m13Point, const UInt_t m23Point) const {return weights_[m13Point][m23Point];}
-
- //! Retrieve the m13 value at the given grid point
- /*!
- \param [in] m13Point the grid index in m13
- \return the m13 value
- */
- inline Double_t getM13Value(const UInt_t m13Point) const {return m13Points_[m13Point];}
-
- //! Retrieve the m23 value at the given grid point
- /*!
- \param [in] m23Point the grid index in m23
- \return the m23 value
- */
- inline Double_t getM23Value(const UInt_t m23Point) const {return m23Points_[m23Point];}
-
- //! Retrieve the efficiency for the given grid point
- /*!
- \param [in] m13Point the grid index in m13
- \param [in] m23Point the grid index in m23
- \return the efficiency value
- */
- inline Double_t getEfficiency(const UInt_t m13Point, const UInt_t m23Point) const { return efficiencies_[m13Point][m23Point]; }
-
- //! Store the efficiency for the given grid point
- /*!
- \param [in] m13Point the grid index in m13
- \param [in] m23Point the grid index in m23
- \param [in] efficiency the new efficiency value
- */
- inline void storeEfficiency(const UInt_t m13Point, const UInt_t m23Point, const Double_t efficiency) { efficiencies_[m13Point][m23Point] = efficiency; }
-
- //! Retrieve the amplitude for the given grid point and amplitude index
- /*!
- \param [in] m13Point the grid index in m13
- \param [in] m23Point the grid index in m23
- \param [in] iAmp the amplitude index
- \return the amplitude value
- */
- inline const LauComplex& getAmplitude(const UInt_t m13Point, const UInt_t m23Point, const UInt_t iAmp) const { return amplitudes_[m13Point][m23Point][iAmp]; }
-
- //! Store the amplitude for the given grid point and amplitude index
- /*!
- \param [in] m13Point the grid index in m13
- \param [in] m23Point the grid index in m23
- \param [in] iAmp the amplitude index
- \param [in] amplitude the new amplitude value
- */
- inline void storeAmplitude(const UInt_t m13Point, const UInt_t m23Point, const UInt_t iAmp, const LauComplex& amplitude) { amplitudes_[m13Point][m23Point][iAmp] = amplitude; }
-
- //! Retrieve the intensity for the given grid point and intensity index
- /*!
- \param [in] m13Point the grid index in m13
- \param [in] m23Point the grid index in m23
- \param [in] iAmp the intensity index
- \return the intensity value
- */
- inline Double_t getIntensity(const UInt_t m13Point, const UInt_t m23Point, const UInt_t iAmp) const { return incohIntensities_[m13Point][m23Point][iAmp]; }
-
- //! Store the intensity for the given grid point and intensity index
- /*!
- \param [in] m13Point the grid index in m13
- \param [in] m23Point the grid index in m23
- \param [in] iAmp the intensity index
- \param [in] intensity the new intensity value
- */
- inline void storeIntensity(const UInt_t m13Point, const UInt_t m23Point, const UInt_t iAmp, const Double_t intensity) { incohIntensities_[m13Point][m23Point][iAmp] = intensity; }
-
- private:
- //! Copy constructor (not implemented)
- LauDPPartialIntegralInfo( const LauDPPartialIntegralInfo& other );
-
- //! Copy assignment operator (not implemented)
- LauDPPartialIntegralInfo& operator=( const LauDPPartialIntegralInfo& other );
-
- //! The minimum of the m13 range
- const Double_t minm13_;
-
- //! The maximum of the m13 range
- const Double_t maxm13_;
-
- //! The minimum of the m23 range
- const Double_t minm23_;
-
- //! The maximum of the m23 range
- const Double_t maxm23_;
-
- //! The bin width for m13
- const Double_t m13BinWidth_;
-
- //! The bin width for m23
- const Double_t m23BinWidth_;
-
- //! The number of bins in m13
- const UInt_t nm13Points_;
-
- //! The number of bins in m23
- const UInt_t nm23Points_;
-
- //! The number of amplitude components
- const UInt_t nAmp_;
-
- //! The number of amplitude components
- const UInt_t nIncohAmp_;
-
- //! Flag whether or not we're using the square DP for the integration
- const Bool_t squareDP_;
-
- //! The m13 positions of the grid points
- std::vector<Double_t> m13Points_;
-
- //! The m23 positions of the grid points
- std::vector<Double_t> m23Points_;
-
- //! The Gauss-Legendre weights of the m13 grid points
- std::vector<Double_t> m13Weights_;
-
- //! The Gauss-Legendre weights of the m23 grid points
- std::vector<Double_t> m23Weights_;
-
- //! The combined weights at each 2D grid point
- std::vector< std::vector<Double_t> > weights_;
-
- //! The efficiency at each 2D grid point
- std::vector< std::vector<Double_t> > efficiencies_;
-
- //! The amplitude values at each 2D grid point
- std::vector< std::vector< std::vector<LauComplex> > > amplitudes_;
-
- //! The incoherent intensity values at each 2D grid point
- std::vector< std::vector< std::vector<Double_t> > > incohIntensities_;
-
- ClassDef(LauDPPartialIntegralInfo, 0)
+ public:
+ //! Constructor
+ /*!
+ \param [in] minm13 the minimum of the m13 range
+ \param [in] maxm13 the maximum of the m13 range
+ \param [in] minm23 the minimum of the m23 range
+ \param [in] maxm23 the maximum of the m23 range
+ \param [in] m13BinWidth the m13 bin width
+ \param [in] m23BinWidth the m23 bin width
+ \param [in] precision the precision required for the Gauss-Legendre weights
+ \param [in] nAmp the number of coherent amplitude components
+ \param [in] nIncohAmp the number of incoherent amplitude components
+ \param [in] squareDP whether or not to use the square DP for the integration - if so, m13 is actually mPrime and m23 is actually thetaPrime
+ \param [in] kinematics the kinematics object to use to calculate the Jacobians (only relevant if squareDP is true)
+ */
+ LauDPPartialIntegralInfo( const Double_t minm13,
+ const Double_t maxm13,
+ const Double_t minm23,
+ const Double_t maxm23,
+ const Double_t m13BinWidth,
+ const Double_t m23BinWidth,
+ const Double_t precision,
+ const UInt_t nAmp,
+ const UInt_t nIncohAmp,
+ const Bool_t squareDP = kFALSE,
+ const LauKinematics* kinematics = 0 );
+
+ //! Destructor
+ virtual ~LauDPPartialIntegralInfo();
+
+ //! Retrieve the minm13 of DP
+ /*!
+ \return the the minm13 of DP
+ */
+ inline Double_t getMinm13() const { return minm13_; }
+
+ //! Retrieve the maxm13 of DP
+ /*!
+ \return the the maxm13 of DP
+ */
+ inline Double_t getMaxm13() const { return maxm13_; }
+
+ //! Retrieve the minm23 of DP
+ /*!
+ \return the the minm23 of DP
+ */
+ inline Double_t getMinm23() const { return minm23_; }
+
+ //! Retrieve the maxm23 of DP
+ /*!
+ \return the the maxm23 of DP
+ */
+ inline Double_t getMaxm23() const { return maxm23_; }
+
+ //! Retrieve the m13BinWidth of DP
+ /*!
+ \return the the m13BinWidth of DP
+ */
+ inline Double_t getM13BinWidth() const { return m13BinWidth_; }
+
+ //! Retrieve the m23BinWidth of DP
+ /*!
+ \return the the m23BinWidth of DP
+ */
+ inline Double_t getM23BinWidth() const { return m23BinWidth_; }
+
+ //! Retrieve the number of bins in m13
+ /*!
+ \return the number of bins in m13
+ */
+ inline UInt_t getnm13Points() const { return nm13Points_; }
+
+ //! Retrieve the number of bins in m23
+ /*!
+ \return the number of bins in m23
+ */
+ inline UInt_t getnm23Points() const { return nm23Points_; }
+
+ //! Retrieve the square DP flag
+ /*!
+ \return whether or not the integration is performed in the square DP
+ */
+ inline Bool_t getSquareDP() const { return squareDP_; }
+
+ //! Retrieve the weight for the given grid point
+ /*!
+ \param [in] m13Point the grid index in m13
+ \param [in] m23Point the grid index in m23
+ \return the value of the weight
+ */
+ inline Double_t getWeight( const UInt_t m13Point, const UInt_t m23Point ) const
+ {
+ return weights_[m13Point][m23Point];
+ }
+
+ //! Retrieve the m13 value at the given grid point
+ /*!
+ \param [in] m13Point the grid index in m13
+ \return the m13 value
+ */
+ inline Double_t getM13Value( const UInt_t m13Point ) const { return m13Points_[m13Point]; }
+
+ //! Retrieve the m23 value at the given grid point
+ /*!
+ \param [in] m23Point the grid index in m23
+ \return the m23 value
+ */
+ inline Double_t getM23Value( const UInt_t m23Point ) const { return m23Points_[m23Point]; }
+
+ //! Retrieve the efficiency for the given grid point
+ /*!
+ \param [in] m13Point the grid index in m13
+ \param [in] m23Point the grid index in m23
+ \return the efficiency value
+ */
+ inline Double_t getEfficiency( const UInt_t m13Point, const UInt_t m23Point ) const
+ {
+ return efficiencies_[m13Point][m23Point];
+ }
+
+ //! Store the efficiency for the given grid point
+ /*!
+ \param [in] m13Point the grid index in m13
+ \param [in] m23Point the grid index in m23
+ \param [in] efficiency the new efficiency value
+ */
+ inline void storeEfficiency( const UInt_t m13Point,
+ const UInt_t m23Point,
+ const Double_t efficiency )
+ {
+ efficiencies_[m13Point][m23Point] = efficiency;
+ }
+
+ //! Retrieve the amplitude for the given grid point and amplitude index
+ /*!
+ \param [in] m13Point the grid index in m13
+ \param [in] m23Point the grid index in m23
+ \param [in] iAmp the amplitude index
+ \return the amplitude value
+ */
+ inline const LauComplex& getAmplitude( const UInt_t m13Point,
+ const UInt_t m23Point,
+ const UInt_t iAmp ) const
+ {
+ return amplitudes_[m13Point][m23Point][iAmp];
+ }
+
+ //! Store the amplitude for the given grid point and amplitude index
+ /*!
+ \param [in] m13Point the grid index in m13
+ \param [in] m23Point the grid index in m23
+ \param [in] iAmp the amplitude index
+ \param [in] amplitude the new amplitude value
+ */
+ inline void storeAmplitude( const UInt_t m13Point,
+ const UInt_t m23Point,
+ const UInt_t iAmp,
+ const LauComplex& amplitude )
+ {
+ amplitudes_[m13Point][m23Point][iAmp] = amplitude;
+ }
+
+ //! Retrieve the intensity for the given grid point and intensity index
+ /*!
+ \param [in] m13Point the grid index in m13
+ \param [in] m23Point the grid index in m23
+ \param [in] iAmp the intensity index
+ \return the intensity value
+ */
+ inline Double_t getIntensity( const UInt_t m13Point, const UInt_t m23Point, const UInt_t iAmp ) const
+ {
+ return incohIntensities_[m13Point][m23Point][iAmp];
+ }
+
+ //! Store the intensity for the given grid point and intensity index
+ /*!
+ \param [in] m13Point the grid index in m13
+ \param [in] m23Point the grid index in m23
+ \param [in] iAmp the intensity index
+ \param [in] intensity the new intensity value
+ */
+ inline void storeIntensity( const UInt_t m13Point,
+ const UInt_t m23Point,
+ const UInt_t iAmp,
+ const Double_t intensity )
+ {
+ incohIntensities_[m13Point][m23Point][iAmp] = intensity;
+ }
+
+ private:
+ //! Copy constructor (not implemented)
+ LauDPPartialIntegralInfo( const LauDPPartialIntegralInfo& other );
+
+ //! Copy assignment operator (not implemented)
+ LauDPPartialIntegralInfo& operator=( const LauDPPartialIntegralInfo& other );
+
+ //! The minimum of the m13 range
+ const Double_t minm13_;
+
+ //! The maximum of the m13 range
+ const Double_t maxm13_;
+
+ //! The minimum of the m23 range
+ const Double_t minm23_;
+
+ //! The maximum of the m23 range
+ const Double_t maxm23_;
+
+ //! The bin width for m13
+ const Double_t m13BinWidth_;
+
+ //! The bin width for m23
+ const Double_t m23BinWidth_;
+
+ //! The number of bins in m13
+ const UInt_t nm13Points_;
+
+ //! The number of bins in m23
+ const UInt_t nm23Points_;
+
+ //! The number of amplitude components
+ const UInt_t nAmp_;
+
+ //! The number of amplitude components
+ const UInt_t nIncohAmp_;
+
+ //! Flag whether or not we're using the square DP for the integration
+ const Bool_t squareDP_;
+
+ //! The m13 positions of the grid points
+ std::vector<Double_t> m13Points_;
+
+ //! The m23 positions of the grid points
+ std::vector<Double_t> m23Points_;
+
+ //! The Gauss-Legendre weights of the m13 grid points
+ std::vector<Double_t> m13Weights_;
+
+ //! The Gauss-Legendre weights of the m23 grid points
+ std::vector<Double_t> m23Weights_;
+
+ //! The combined weights at each 2D grid point
+ std::vector<std::vector<Double_t>> weights_;
+
+ //! The efficiency at each 2D grid point
+ std::vector<std::vector<Double_t>> efficiencies_;
+
+ //! The amplitude values at each 2D grid point
+ std::vector<std::vector<std::vector<LauComplex>>> amplitudes_;
+
+ //! The incoherent intensity values at each 2D grid point
+ std::vector<std::vector<std::vector<Double_t>>> incohIntensities_;
+
+ ClassDef( LauDPPartialIntegralInfo, 0 )
};
//! output operator formatting
std::ostream& operator<<( std::ostream& stream, const LauDPPartialIntegralInfo& infoRecord );
#endif
diff --git a/inc/LauDabbaRes.hh b/inc/LauDabbaRes.hh
index a77ef7f..fe107ec 100644
--- a/inc/LauDabbaRes.hh
+++ b/inc/LauDabbaRes.hh
@@ -1,182 +1,183 @@
/*
Copyright 2010 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauDabbaRes.hh
\brief File containing declaration of LauDabbaRes class.
*/
/*! \class LauDabbaRes
\brief Class for defining the Dabba resonance model
Class for defining the Dabba resonance model
Formulae and data values from arXiv:0901.2217 - author D.V.Bugg
*/
#ifndef LAU_DABBA_RES
#define LAU_DABBA_RES
-#include "TString.h"
-
#include "LauAbsResonance.hh"
#include "LauComplex.hh"
+#include "TString.h"
class LauDabbaRes : public LauAbsResonance {
- public:
- //! Constructor
- /*!
- \param [in] resInfo the object containing information on the resonance name, mass, width, spin, charge, etc.
- \param [in] resPairAmpInt the number of the daughter not produced by the resonance
- \param [in] daughters the daughter particles
- */
- LauDabbaRes(LauResonanceInfo* resInfo, const Int_t resPairAmpInt, const LauDaughters* daughters);
-
- //! Destructor
- virtual ~LauDabbaRes();
-
- //! Initialise the model
- virtual void initialise();
-
- //! Get the resonance model type
- /*!
- \return the resonance model type
- */
- virtual LauAbsResonance::LauResonanceModel getResonanceModel() const {return LauAbsResonance::Dabba;}
-
- //! Set value of the various parameters
- /*!
- \param [in] name the name of the parameter to be changed
- \param [in] value the new parameter value
- */
- virtual void setResonanceParameter(const TString& name, const Double_t value);
-
- //! Allow the various parameters to float in the fit
- /*!
- \param [in] name the name of the parameter to be floated
- */
- virtual void floatResonanceParameter(const TString& name);
-
- //! Access the given resonance parameter
- /*!
- \param [in] name the name of the parameter
- \return the corresponding parameter
- */
- virtual LauParameter* getResonanceParameter(const TString& name);
-
- //! Retrieve the resonance parameters, e.g. so that they can be loaded into a fit
- /*!
- \return floating parameters of the resonance
- */
- virtual const std::vector<LauParameter*>& getFloatingParameters();
-
- protected:
- //! Set the b parameter
- /*!
- \param [in] b new value for b parameter
- */
- void setBValue(const Double_t b);
-
- //! Set the alpha parameter
- /*!
- \param [in] alpha new value for alpha parameter
- */
- void setAlphaValue(const Double_t alpha);
-
- //! Set the beta parameter
- /*!
- \param [in] beta new value for beta parameter
- */
- void setBetaValue(const Double_t beta);
-
- //! Get the b parameter value
- /*!
- \return value of the b parameter
- */
- Double_t getBValue() const { return (b_!=0) ? b_->unblindValue() : 0.0; }
-
- //! Get the alpha parameter value
- /*!
- \return value of the alpha parameter
- */
- Double_t getAlphaValue() const { return (alpha_!=0) ? alpha_->unblindValue() : 0.0; }
-
- //! Get the beta parameter value
- /*!
- \return value of the beta parameter
- */
- Double_t getBetaValue() const { return (beta_!=0) ? beta_->unblindValue() : 0.0; }
-
- //! Fix the b parameter value
- /*!
- \return kTRUE if the b parameter is fixed, kFALSE otherwise
- */
- Bool_t fixBValue() const { return (b_!=0) ? b_->fixed() : 0.0; }
-
- //! Fix the alpha parameter value
- /*!
- \return kTRUE if the alpha parameter is fixed, kFALSE otherwise
- */
- Bool_t fixAlphaValue() const { return (alpha_!=0) ? alpha_->fixed() : 0.0; }
-
- //! Fix the beta parameter value
- /*!
- \return kTRUE if the beta parameter is fixed, kFALSE otherwise
- */
- Bool_t fixBetaValue() const { return (beta_!=0) ? beta_->fixed() : 0.0; }
-
- //! Complex resonant amplitude
- /*!
- \param [in] mass appropriate invariant mass for the resonance
- \param [in] spinTerm spin term
- */
- virtual LauComplex resAmp(Double_t mass, Double_t spinTerm);
-
- //! Check that the daughter particles are D and pi
- void checkDaughterTypes() const;
-
- private:
- //! Copy constructor (not implemented)
- LauDabbaRes(const LauDabbaRes& rhs);
-
- //! Copy assignment operator (not implemented)
- LauDabbaRes& operator=(const LauDabbaRes& rhs);
-
- //! Defined as mD + mPi all squared
- Double_t mSumSq_;
- //! Defined as mD*mD - 0.5*mPi*mPi
- Double_t sAdler_;
-
- //! Constant factor
- LauParameter* b_;
- //! Constant factor
- LauParameter* alpha_;
- //! Constant factor
- LauParameter* beta_;
-
- ClassDef(LauDabbaRes,0) // Dabba resonance model
-
+ public:
+ //! Constructor
+ /*!
+ \param [in] resInfo the object containing information on the resonance name, mass, width, spin, charge, etc.
+ \param [in] resPairAmpInt the number of the daughter not produced by the resonance
+ \param [in] daughters the daughter particles
+ */
+ LauDabbaRes( LauResonanceInfo* resInfo, const Int_t resPairAmpInt, const LauDaughters* daughters );
+
+ //! Destructor
+ virtual ~LauDabbaRes();
+
+ //! Initialise the model
+ virtual void initialise();
+
+ //! Get the resonance model type
+ /*!
+ \return the resonance model type
+ */
+ virtual LauAbsResonance::LauResonanceModel getResonanceModel() const
+ {
+ return LauAbsResonance::Dabba;
+ }
+
+ //! Set value of the various parameters
+ /*!
+ \param [in] name the name of the parameter to be changed
+ \param [in] value the new parameter value
+ */
+ virtual void setResonanceParameter( const TString& name, const Double_t value );
+
+ //! Allow the various parameters to float in the fit
+ /*!
+ \param [in] name the name of the parameter to be floated
+ */
+ virtual void floatResonanceParameter( const TString& name );
+
+ //! Access the given resonance parameter
+ /*!
+ \param [in] name the name of the parameter
+ \return the corresponding parameter
+ */
+ virtual LauParameter* getResonanceParameter( const TString& name );
+
+ //! Retrieve the resonance parameters, e.g. so that they can be loaded into a fit
+ /*!
+ \return floating parameters of the resonance
+ */
+ virtual const std::vector<LauParameter*>& getFloatingParameters();
+
+ protected:
+ //! Set the b parameter
+ /*!
+ \param [in] b new value for b parameter
+ */
+ void setBValue( const Double_t b );
+
+ //! Set the alpha parameter
+ /*!
+ \param [in] alpha new value for alpha parameter
+ */
+ void setAlphaValue( const Double_t alpha );
+
+ //! Set the beta parameter
+ /*!
+ \param [in] beta new value for beta parameter
+ */
+ void setBetaValue( const Double_t beta );
+
+ //! Get the b parameter value
+ /*!
+ \return value of the b parameter
+ */
+ Double_t getBValue() const { return ( b_ != 0 ) ? b_->unblindValue() : 0.0; }
+
+ //! Get the alpha parameter value
+ /*!
+ \return value of the alpha parameter
+ */
+ Double_t getAlphaValue() const { return ( alpha_ != 0 ) ? alpha_->unblindValue() : 0.0; }
+
+ //! Get the beta parameter value
+ /*!
+ \return value of the beta parameter
+ */
+ Double_t getBetaValue() const { return ( beta_ != 0 ) ? beta_->unblindValue() : 0.0; }
+
+ //! Fix the b parameter value
+ /*!
+ \return kTRUE if the b parameter is fixed, kFALSE otherwise
+ */
+ Bool_t fixBValue() const { return ( b_ != 0 ) ? b_->fixed() : 0.0; }
+
+ //! Fix the alpha parameter value
+ /*!
+ \return kTRUE if the alpha parameter is fixed, kFALSE otherwise
+ */
+ Bool_t fixAlphaValue() const { return ( alpha_ != 0 ) ? alpha_->fixed() : 0.0; }
+
+ //! Fix the beta parameter value
+ /*!
+ \return kTRUE if the beta parameter is fixed, kFALSE otherwise
+ */
+ Bool_t fixBetaValue() const { return ( beta_ != 0 ) ? beta_->fixed() : 0.0; }
+
+ //! Complex resonant amplitude
+ /*!
+ \param [in] mass appropriate invariant mass for the resonance
+ \param [in] spinTerm spin term
+ */
+ virtual LauComplex resAmp( Double_t mass, Double_t spinTerm );
+
+ //! Check that the daughter particles are D and pi
+ void checkDaughterTypes() const;
+
+ private:
+ //! Copy constructor (not implemented)
+ LauDabbaRes( const LauDabbaRes& rhs );
+
+ //! Copy assignment operator (not implemented)
+ LauDabbaRes& operator=( const LauDabbaRes& rhs );
+
+ //! Defined as mD + mPi all squared
+ Double_t mSumSq_;
+ //! Defined as mD*mD - 0.5*mPi*mPi
+ Double_t sAdler_;
+
+ //! Constant factor
+ LauParameter* b_;
+ //! Constant factor
+ LauParameter* alpha_;
+ //! Constant factor
+ LauParameter* beta_;
+
+ ClassDef( LauDabbaRes, 0 ) // Dabba resonance model
};
#endif
diff --git a/inc/LauDatabasePDG.hh b/inc/LauDatabasePDG.hh
index acb60a1..adebeea 100644
--- a/inc/LauDatabasePDG.hh
+++ b/inc/LauDatabasePDG.hh
@@ -1,147 +1,147 @@
/*
Copyright 2008 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauDatabasePDG.hh
\brief File containing declaration of LauDatabasePDG class.
*/
/*! \class LauDatabasePDG
- \brief Singleton class that provides access to particle property records.
-
+ \brief Singleton class that provides access to particle property records.
+
Singleton class that provides access to particle property records from the
ROOT database and adds missing particles to the default setup.
Particles may be accessed by both string and PDG code.
*/
#ifndef LAU_DATABASE_PDG
#define LAU_DATABASE_PDG
-#include <map>
#include "TString.h"
+#include <map>
+
class TDatabasePDG;
class LauParticlePDG;
class LauDatabasePDG {
- public:
- //! Get particle object based on the PDG code
- /*!
- \param [in] code PDG code
- \return pointer to the particle record
- */
- static const LauParticlePDG* particle(Int_t code);
-
- //! Get particle object based on the particle name string
- /*!
- \param [in] string particle name string
- \return pointer to the particle record
- */
- static const LauParticlePDG* particle(const TString& string);
-
- //! Method to convert from a particle name string into a PDG code
- /*!
- \param [in] string the particle name string
- \return the corresponding PDG code
- */
- static Int_t code(const TString& string);
-
- //! Method to convert from a PDG code to a particle name string
- /*!
- \param [in] code the particle PDG code
- \return the corresponding particle name
- */
- static TString string(Int_t code);
-
- private:
- // private methods
-
- //! Constructor
- LauDatabasePDG();
-
- //! Destructor
- virtual ~LauDatabasePDG();
-
- //! Copy constructor (not inplemented)
- LauDatabasePDG( const LauDatabasePDG& other );
-
- //! Copy assignment (not implemented)
- LauDatabasePDG& operator=( const LauDatabasePDG& other );
-
- //! Get the database instance
- static LauDatabasePDG& get();
-
- //! Add particles to the ROOT database that are missing from the default setup
- void addMissingParticles();
-
- //! Create particle in the database for a given PDG code and return the new particle
- /*!
- \param [in] theCode PDG code of the associated particle
- \return pointer to the particle record
- */
- const LauParticlePDG* createParticle(Int_t theCode);
-
- //! Create particle in the database for a given string and return the new particle
- /*!
- \param [in] theString particle string to be created
- \return pointer to the particle record
- */
- const LauParticlePDG* createParticle(const TString& theString);
-
- //! Get the associated pdgCode for a given particle name string
- /*!
- \param [in] theString particle string to be associated to the pdgCode
- \return the corresponding PDG code
- */
- Int_t pdgCode(const TString& theString);
-
- //! Get the associated name string for a given pdgCode
- /*!
- \param [in] theCode particle pdgCode
- \return the corresponding particle name
- */
- TString pdgName(Int_t theCode);
-
- // private data
-
- //! The singleton instance
- static LauDatabasePDG* theInstance_;
-
- //! The ROOT database
- TDatabasePDG* theDatabase_;
-
- //! The type to hold the list of wrapped particle objects
- typedef std::map<Int_t,const LauParticlePDG*> LauPDGList;
-
- //! The list of particle objects
- LauPDGList particles_;
-
- //! Debug flag - set in constructor
- const Bool_t debug_;
-
- ClassDef(LauDatabasePDG,0)
-
+ public:
+ //! Get particle object based on the PDG code
+ /*!
+ \param [in] code PDG code
+ \return pointer to the particle record
+ */
+ static const LauParticlePDG* particle( Int_t code );
+
+ //! Get particle object based on the particle name string
+ /*!
+ \param [in] string particle name string
+ \return pointer to the particle record
+ */
+ static const LauParticlePDG* particle( const TString& string );
+
+ //! Method to convert from a particle name string into a PDG code
+ /*!
+ \param [in] string the particle name string
+ \return the corresponding PDG code
+ */
+ static Int_t code( const TString& string );
+
+ //! Method to convert from a PDG code to a particle name string
+ /*!
+ \param [in] code the particle PDG code
+ \return the corresponding particle name
+ */
+ static TString string( Int_t code );
+
+ private:
+ // private methods
+
+ //! Constructor
+ LauDatabasePDG();
+
+ //! Destructor
+ virtual ~LauDatabasePDG();
+
+ //! Copy constructor (not inplemented)
+ LauDatabasePDG( const LauDatabasePDG& other );
+
+ //! Copy assignment (not implemented)
+ LauDatabasePDG& operator=( const LauDatabasePDG& other );
+
+ //! Get the database instance
+ static LauDatabasePDG& get();
+
+ //! Add particles to the ROOT database that are missing from the default setup
+ void addMissingParticles();
+
+ //! Create particle in the database for a given PDG code and return the new particle
+ /*!
+ \param [in] theCode PDG code of the associated particle
+ \return pointer to the particle record
+ */
+ const LauParticlePDG* createParticle( Int_t theCode );
+
+ //! Create particle in the database for a given string and return the new particle
+ /*!
+ \param [in] theString particle string to be created
+ \return pointer to the particle record
+ */
+ const LauParticlePDG* createParticle( const TString& theString );
+
+ //! Get the associated pdgCode for a given particle name string
+ /*!
+ \param [in] theString particle string to be associated to the pdgCode
+ \return the corresponding PDG code
+ */
+ Int_t pdgCode( const TString& theString );
+
+ //! Get the associated name string for a given pdgCode
+ /*!
+ \param [in] theCode particle pdgCode
+ \return the corresponding particle name
+ */
+ TString pdgName( Int_t theCode );
+
+ // private data
+
+ //! The singleton instance
+ static LauDatabasePDG* theInstance_;
+
+ //! The ROOT database
+ TDatabasePDG* theDatabase_;
+
+ //! The type to hold the list of wrapped particle objects
+ typedef std::map<Int_t, const LauParticlePDG*> LauPDGList;
+
+ //! The list of particle objects
+ LauPDGList particles_;
+
+ //! Debug flag - set in constructor
+ const Bool_t debug_;
+
+ ClassDef( LauDatabasePDG, 0 )
};
#endif
diff --git a/inc/LauDaughters.hh b/inc/LauDaughters.hh
index 7329515..d8374e3 100644
--- a/inc/LauDaughters.hh
+++ b/inc/LauDaughters.hh
@@ -1,219 +1,222 @@
/*
Copyright 2004 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauDaughters.hh
\brief File containing declaration of LauDaughters class.
*/
/*! \class LauDaughters
\brief Class that defines the particular 3-body decay under study.
The decay has the form P -> h1 h2 h3 (P stands for the parent particle, and h for the daughters).
- The constructor accepts both string name and PDG code types to describe the particles.
+ The constructor accepts both string name and PDG code types to describe the particles.
*/
#ifndef LAU_DAUGHTERS
#define LAU_DAUGHTERS
-#include <vector>
+#include "LauKinematics.hh"
#include "TString.h"
-#include "LauKinematics.hh"
+#include <vector>
class LauParticlePDG;
class LauDaughters {
- public:
- //! Constructor from PDG codes
- /*!
- \param [in] codeParent the parent particle PDG code
- \param [in] code1 the first daughter PDG code
- \param [in] code2 the second daughter PDG code
- \param [in] code3 the third daughter PDG code
- \param [in] useSquareDP the boolean flag decision to use Square Dalitz plot (kTRUE) or standard Dalitz plot (kFALSE). Default value is kFALSE.
- */
- LauDaughters(Int_t codeParent, Int_t code1, Int_t code2, Int_t code3, Bool_t useSquareDP = kFALSE);
-
- //! Constructor from particle names
- /*!
- \param [in] nameParent the parent particle string name
- \param [in] name1 the first daughter string name
- \param [in] name2 the second daughter string name
- \param [in] name3 the third daughter string name
- \param [in] useSquareDP the boolean flag decision to use Square Dalitz plot (kTRUE) or standard Dalitz plot (kFALSE). Default value is kFALSE.
- */
- LauDaughters(const TString& nameParent, const TString& name1, const TString& name2, const TString& name3, Bool_t useSquareDP = kFALSE);
-
- //! Destructor
- virtual ~LauDaughters();
-
- //! Copy constructor
- LauDaughters( const LauDaughters& rhs );
-
- //! Is Dalitz plot symmetric, i.e. 2 identical particles
- /*!
- \return true/false whether the DP is symmetric
- */
- Bool_t gotSymmetricalDP() const {return symmetricalDP_;}
-
- //! Is Dalitz plot fully symmetric, i.e. 3 identical particles
- /*!
- \return true/false whether the DP is fully symmetric
- */
- Bool_t gotFullySymmetricDP() const {return fullySymmetricDP_;}
-
- //! Is Dalitz plot flavour-conjugate, i.e. CP(d1) = d2 and CP(d3) = d3
- /*!
- \return true/false whether the DP is flavour-conjugate
- */
- Bool_t gotFlavourConjugateDP() const {return flavourConjugateDP_;}
-
- //! Determine to use or not the square Dalitz plot
- /*!
- \return true/false to use the squareDP model
- */
- Bool_t squareDP() const {return kinematics_->squareDP();}
-
- //! Get mass of first daughter particle
- Double_t getMassDaug1() const;
- //! Get mass of second daughter particle
- Double_t getMassDaug2() const;
- //! Get mass of third daughter particle
- Double_t getMassDaug3() const;
- //! Get mass of the parent particle
- Double_t getMassParent() const;
-
- //! Get name of the first daughter particle
- TString getNameDaug1() const;
- //! Get name of the second daughter particle
- TString getNameDaug2() const;
- //! Get name of the third daughter particle
- TString getNameDaug3() const;
- //! Get name of the parent particle
- TString getNameParent() const;
-
- //! Get sanitised name of the first daughter particle
- TString getSanitisedNameDaug1() const;
- //! Get sanitised name of the second daughter particle
- TString getSanitisedNameDaug2() const;
- //! Get sanitised name of the third daughter particle
- TString getSanitisedNameDaug3() const;
- //! Get sanitised name of the parent particle
- TString getSanitisedNameParent() const;
-
- //! Get PDG code of the first daughter particle
- Int_t getTypeDaug1() const;
- //! Get PDG code of the second daughter particle
- Int_t getTypeDaug2() const;
- //! Get PDG code of the third daughter particle
- Int_t getTypeDaug3() const;
- //! Get PDG code of the parent particle
- Int_t getTypeParent() const;
-
- //! Get charge of the first daughter particle
- Int_t getChargeDaug1() const;
- //! Get charge of the second daughter particle
- Int_t getChargeDaug2() const;
- //! Get charge of the third daughter particle
- Int_t getChargeDaug3() const;
- //! Get charge of the parent particle
- Int_t getChargeParent() const;
- //! Get charge of a particular two-daughter combination
- /*!
- \param [in] resPairAmpInt the index of the daughter not in the combination
- \return the charge of the two-daughter combination
- */
- Int_t getCharge(Int_t resPairAmpInt) const;
-
- //! Retrieve the Dalitz plot kinematics
- /*!
- \return the Dalitz plot kinematics
- */
- LauKinematics* getKinematics() {return kinematics_;}
-
- //! Retrieve the Dalitz plot kinematics
- /*!
- \return the Dalitz plot kinematics
- */
- const LauKinematics* getKinematics() const {return kinematics_;}
-
- protected:
- //! Create list of all the allowed parent/daughter particles
- void createParticleLists();
-
- //! Set the parent particle type
- /*!
- \param [in] nameParent the name of the parent particle
- */
- void setParentType(const TString& nameParent);
-
- //! Set the three daughter types
- /*!
- \param [in] name1 the name of the first daughter
- \param [in] name2 the name of the second daughter
- \param [in] name3 the name of the third daughter
- */
- void setDaugType(const TString& name1, const TString& name2, const TString& name3);
-
- //! Check whether there is a symmetrical Dalitz plot
- void testDPSymmetry();
-
- //! Check masses and charges of daughters
- void sanityCheck();
-
- private:
- //! Copy assignment operator (not implemented)
- LauDaughters& operator=( const LauDaughters& rhs );
-
- //! Dalitz plot kinematics
- LauKinematics* kinematics_;
-
- //! All possible daughter types
- std::vector<const LauParticlePDG*> allowedDaughters_;
-
- //! All possible parent types
- std::vector<const LauParticlePDG*> allowedParents_;
-
- //! The parent particle
- const LauParticlePDG* parent_;
-
- //! The daughter particles
- std::vector<const LauParticlePDG*> daughters_;
-
- //! Boolean flag for symmetrical Dalitz plot
- Bool_t symmetricalDP_;
-
- //! Boolean flag for fully symmetric Dalitz plot
- Bool_t fullySymmetricDP_;
-
- //! Flavour-conjugate Dalitz plot
- Bool_t flavourConjugateDP_;
-
- ClassDef(LauDaughters, 0)
-
+ public:
+ //! Constructor from PDG codes
+ /*!
+ \param [in] codeParent the parent particle PDG code
+ \param [in] code1 the first daughter PDG code
+ \param [in] code2 the second daughter PDG code
+ \param [in] code3 the third daughter PDG code
+ \param [in] useSquareDP the boolean flag decision to use Square Dalitz plot (kTRUE) or standard Dalitz plot (kFALSE). Default value is kFALSE.
+ */
+ LauDaughters( Int_t codeParent, Int_t code1, Int_t code2, Int_t code3, Bool_t useSquareDP = kFALSE );
+
+ //! Constructor from particle names
+ /*!
+ \param [in] nameParent the parent particle string name
+ \param [in] name1 the first daughter string name
+ \param [in] name2 the second daughter string name
+ \param [in] name3 the third daughter string name
+ \param [in] useSquareDP the boolean flag decision to use Square Dalitz plot (kTRUE) or standard Dalitz plot (kFALSE). Default value is kFALSE.
+ */
+ LauDaughters( const TString& nameParent,
+ const TString& name1,
+ const TString& name2,
+ const TString& name3,
+ Bool_t useSquareDP = kFALSE );
+
+ //! Destructor
+ virtual ~LauDaughters();
+
+ //! Copy constructor
+ LauDaughters( const LauDaughters& rhs );
+
+ //! Is Dalitz plot symmetric, i.e. 2 identical particles
+ /*!
+ \return true/false whether the DP is symmetric
+ */
+ Bool_t gotSymmetricalDP() const { return symmetricalDP_; }
+
+ //! Is Dalitz plot fully symmetric, i.e. 3 identical particles
+ /*!
+ \return true/false whether the DP is fully symmetric
+ */
+ Bool_t gotFullySymmetricDP() const { return fullySymmetricDP_; }
+
+ //! Is Dalitz plot flavour-conjugate, i.e. CP(d1) = d2 and CP(d3) = d3
+ /*!
+ \return true/false whether the DP is flavour-conjugate
+ */
+ Bool_t gotFlavourConjugateDP() const { return flavourConjugateDP_; }
+
+ //! Determine to use or not the square Dalitz plot
+ /*!
+ \return true/false to use the squareDP model
+ */
+ Bool_t squareDP() const { return kinematics_->squareDP(); }
+
+ //! Get mass of first daughter particle
+ Double_t getMassDaug1() const;
+ //! Get mass of second daughter particle
+ Double_t getMassDaug2() const;
+ //! Get mass of third daughter particle
+ Double_t getMassDaug3() const;
+ //! Get mass of the parent particle
+ Double_t getMassParent() const;
+
+ //! Get name of the first daughter particle
+ TString getNameDaug1() const;
+ //! Get name of the second daughter particle
+ TString getNameDaug2() const;
+ //! Get name of the third daughter particle
+ TString getNameDaug3() const;
+ //! Get name of the parent particle
+ TString getNameParent() const;
+
+ //! Get sanitised name of the first daughter particle
+ TString getSanitisedNameDaug1() const;
+ //! Get sanitised name of the second daughter particle
+ TString getSanitisedNameDaug2() const;
+ //! Get sanitised name of the third daughter particle
+ TString getSanitisedNameDaug3() const;
+ //! Get sanitised name of the parent particle
+ TString getSanitisedNameParent() const;
+
+ //! Get PDG code of the first daughter particle
+ Int_t getTypeDaug1() const;
+ //! Get PDG code of the second daughter particle
+ Int_t getTypeDaug2() const;
+ //! Get PDG code of the third daughter particle
+ Int_t getTypeDaug3() const;
+ //! Get PDG code of the parent particle
+ Int_t getTypeParent() const;
+
+ //! Get charge of the first daughter particle
+ Int_t getChargeDaug1() const;
+ //! Get charge of the second daughter particle
+ Int_t getChargeDaug2() const;
+ //! Get charge of the third daughter particle
+ Int_t getChargeDaug3() const;
+ //! Get charge of the parent particle
+ Int_t getChargeParent() const;
+ //! Get charge of a particular two-daughter combination
+ /*!
+ \param [in] resPairAmpInt the index of the daughter not in the combination
+ \return the charge of the two-daughter combination
+ */
+ Int_t getCharge( Int_t resPairAmpInt ) const;
+
+ //! Retrieve the Dalitz plot kinematics
+ /*!
+ \return the Dalitz plot kinematics
+ */
+ LauKinematics* getKinematics() { return kinematics_; }
+
+ //! Retrieve the Dalitz plot kinematics
+ /*!
+ \return the Dalitz plot kinematics
+ */
+ const LauKinematics* getKinematics() const { return kinematics_; }
+
+ protected:
+ //! Create list of all the allowed parent/daughter particles
+ void createParticleLists();
+
+ //! Set the parent particle type
+ /*!
+ \param [in] nameParent the name of the parent particle
+ */
+ void setParentType( const TString& nameParent );
+
+ //! Set the three daughter types
+ /*!
+ \param [in] name1 the name of the first daughter
+ \param [in] name2 the name of the second daughter
+ \param [in] name3 the name of the third daughter
+ */
+ void setDaugType( const TString& name1, const TString& name2, const TString& name3 );
+
+ //! Check whether there is a symmetrical Dalitz plot
+ void testDPSymmetry();
+
+ //! Check masses and charges of daughters
+ void sanityCheck();
+
+ private:
+ //! Copy assignment operator (not implemented)
+ LauDaughters& operator=( const LauDaughters& rhs );
+
+ //! Dalitz plot kinematics
+ LauKinematics* kinematics_;
+
+ //! All possible daughter types
+ std::vector<const LauParticlePDG*> allowedDaughters_;
+
+ //! All possible parent types
+ std::vector<const LauParticlePDG*> allowedParents_;
+
+ //! The parent particle
+ const LauParticlePDG* parent_;
+
+ //! The daughter particles
+ std::vector<const LauParticlePDG*> daughters_;
+
+ //! Boolean flag for symmetrical Dalitz plot
+ Bool_t symmetricalDP_;
+
+ //! Boolean flag for fully symmetric Dalitz plot
+ Bool_t fullySymmetricDP_;
+
+ //! Flavour-conjugate Dalitz plot
+ Bool_t flavourConjugateDP_;
+
+ ClassDef( LauDaughters, 0 )
};
#endif
diff --git a/inc/LauEFKLLMRes.hh b/inc/LauEFKLLMRes.hh
index a05868b..aa6abaa 100644
--- a/inc/LauEFKLLMRes.hh
+++ b/inc/LauEFKLLMRes.hh
@@ -1,147 +1,151 @@
/*
Copyright 2015 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauEFKLLMRes.hh
\brief File containing declaration of LauEFKLLMRes class.
*/
/*! \class LauEFKLLMRes
\brief Class for defining the EFKLLM K-pi S-wave model
Class for defining the EFKLLM form-factor model for the K-pi S-wave.
The model consists of a tabulated form-factor, which is interpolated using cubic splines (one for magnitude values and one for phase values), multiplied by a mass-dependence (e.g. constant, 1/m^2, etc.).
The massFactor resonance parameter is the power of the mass dependence - defaults to zero, i.e. constant.
For more details see B. El-Bennich et al. Phys. Rev. D 79, 094005 (2009), arXiv:0902.3645 [hep-ph].
(The acronym EFKLLM is constructed from the surnames of the authors of the above paper.)
*/
#ifndef LAU_EFKLLM_RES
#define LAU_EFKLLM_RES
-#include "TString.h"
-
-#include "LauComplex.hh"
#include "LauAbsResonance.hh"
+#include "LauComplex.hh"
-class Lau1DCubicSpline;
+#include "TString.h"
+class Lau1DCubicSpline;
class LauEFKLLMRes : public LauAbsResonance {
- public:
- //! Constructor
- /*!
- \param [in] resInfo the object containing information on the resonance name, mass, width, spin, charge, etc.
- \param [in] resPairAmpInt the number of the daughter not produced by the resonance
- \param [in] daughters the daughter particles
- */
- LauEFKLLMRes(LauResonanceInfo* resInfo, const Int_t resPairAmpInt, const LauDaughters* daughters);
-
- //! Destructor
- virtual ~LauEFKLLMRes();
-
- //! Read the form factor information from text file
- /*!
- Creates the splines from the tabulated form factor data.
- These are shared between all instances of this class.
-
- \param [in] inputFile the name of the file to be read
- */
- static void setupFormFactor(const TString& inputFile);
-
- //! Initialise the model
- virtual void initialise();
-
- //! Get the resonance model type
- /*!
- \return the resonance model type
- */
- virtual LauAbsResonance::LauResonanceModel getResonanceModel() const {return LauAbsResonance::EFKLLM;}
-
- //! Set value of a resonance parameter
- /*!
- \param [in] name the name of the parameter to be changed
- \param [in] value the new parameter value
- */
- virtual void setResonanceParameter(const TString& name, const Double_t value);
-
- //! Allow the various parameters to float in the fit
- /*!
- \param [in] name the name of the parameter to be floated
- */
- virtual void floatResonanceParameter(const TString& name);
-
- //! Access the given resonance parameter
- /*!
- \param [in] name the name of the parameter
- \return the corresponding parameter
- */
- virtual LauParameter* getResonanceParameter(const TString& name);
-
- //! Retrieve the resonance parameters, e.g. so that they can be loaded into a fit
- /*!
- \return floating parameters of the resonance
- */
- virtual const std::vector<LauParameter*>& getFloatingParameters();
-
- protected:
- //! Set the power of the mass dependence
- /*!
- \param [in] massFactor the new power of the mass dependence
- */
- void setMassFactor(const Double_t massFactor);
-
- //! Get the power of the mass dependence
- /*!
- \return the power of the mass dependence
- */
- Double_t getMassFactor() const {return (massFactor_!=0) ? massFactor_->unblindValue() : 0.0;}
-
- //! See if the mass factor parameter is fixed or floating
- /*!
- \return kTRUE if the mass factor parameter is fixed, kFALSE otherwise
- */
- Bool_t fixMassFactor() const {return (massFactor_!=0) ? massFactor_->fixed() : kTRUE;}
-
- //! Complex resonant amplitude
- /*!
- \param [in] mass appropriate invariant mass for the resonance
- \param [in] spinTerm spin term
- */
- virtual LauComplex resAmp(Double_t mass, Double_t spinTerm);
-
- private:
- //! Spline describing the magnitude variation of the form-factor
- static Lau1DCubicSpline* magSpline_;
- //! Spline describing the phase variation of the form-factor
- static Lau1DCubicSpline* phaseSpline_;
-
- //! The power of the mass dependence
- LauParameter* massFactor_;
-
- ClassDef(LauEFKLLMRes,0) // EFKLLM resonance model
-
+ public:
+ //! Constructor
+ /*!
+ \param [in] resInfo the object containing information on the resonance name, mass, width, spin, charge, etc.
+ \param [in] resPairAmpInt the number of the daughter not produced by the resonance
+ \param [in] daughters the daughter particles
+ */
+ LauEFKLLMRes( LauResonanceInfo* resInfo, const Int_t resPairAmpInt, const LauDaughters* daughters );
+
+ //! Destructor
+ virtual ~LauEFKLLMRes();
+
+ //! Read the form factor information from text file
+ /*!
+ Creates the splines from the tabulated form factor data.
+ These are shared between all instances of this class.
+
+ \param [in] inputFile the name of the file to be read
+ */
+ static void setupFormFactor( const TString& inputFile );
+
+ //! Initialise the model
+ virtual void initialise();
+
+ //! Get the resonance model type
+ /*!
+ \return the resonance model type
+ */
+ virtual LauAbsResonance::LauResonanceModel getResonanceModel() const
+ {
+ return LauAbsResonance::EFKLLM;
+ }
+
+ //! Set value of a resonance parameter
+ /*!
+ \param [in] name the name of the parameter to be changed
+ \param [in] value the new parameter value
+ */
+ virtual void setResonanceParameter( const TString& name, const Double_t value );
+
+ //! Allow the various parameters to float in the fit
+ /*!
+ \param [in] name the name of the parameter to be floated
+ */
+ virtual void floatResonanceParameter( const TString& name );
+
+ //! Access the given resonance parameter
+ /*!
+ \param [in] name the name of the parameter
+ \return the corresponding parameter
+ */
+ virtual LauParameter* getResonanceParameter( const TString& name );
+
+ //! Retrieve the resonance parameters, e.g. so that they can be loaded into a fit
+ /*!
+ \return floating parameters of the resonance
+ */
+ virtual const std::vector<LauParameter*>& getFloatingParameters();
+
+ protected:
+ //! Set the power of the mass dependence
+ /*!
+ \param [in] massFactor the new power of the mass dependence
+ */
+ void setMassFactor( const Double_t massFactor );
+
+ //! Get the power of the mass dependence
+ /*!
+ \return the power of the mass dependence
+ */
+ Double_t getMassFactor() const
+ {
+ return ( massFactor_ != 0 ) ? massFactor_->unblindValue() : 0.0;
+ }
+
+ //! See if the mass factor parameter is fixed or floating
+ /*!
+ \return kTRUE if the mass factor parameter is fixed, kFALSE otherwise
+ */
+ Bool_t fixMassFactor() const { return ( massFactor_ != 0 ) ? massFactor_->fixed() : kTRUE; }
+
+ //! Complex resonant amplitude
+ /*!
+ \param [in] mass appropriate invariant mass for the resonance
+ \param [in] spinTerm spin term
+ */
+ virtual LauComplex resAmp( Double_t mass, Double_t spinTerm );
+
+ private:
+ //! Spline describing the magnitude variation of the form-factor
+ static Lau1DCubicSpline* magSpline_;
+ //! Spline describing the phase variation of the form-factor
+ static Lau1DCubicSpline* phaseSpline_;
+
+ //! The power of the mass dependence
+ LauParameter* massFactor_;
+
+ ClassDef( LauEFKLLMRes, 0 ) // EFKLLM resonance model
};
#endif
diff --git a/inc/LauEffModel.hh b/inc/LauEffModel.hh
index d6ae85a..ebca92e 100644
--- a/inc/LauEffModel.hh
+++ b/inc/LauEffModel.hh
@@ -1,270 +1,306 @@
/*
Copyright 2004 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauEffModel.hh
\brief File containing declaration of LauEffModel class.
*/
/*! \class LauEffModel
\brief Class that implements the efficiency description across the signal Dalitz plot.
Class that defines the efficiency model variation across the signal Dalitz plot.
The method is based in a predetermined two-dimensional histogram to characterize the phase space acceptance.
- The efficiency variation is defined in terms of x = m_13^2, y = m_23^2 for the Dalitz plot (default)
+ The efficiency variation is defined in terms of x = m_13^2, y = m_23^2 for the Dalitz plot (default)
or x = m', y = theta' for the square Dalitz plot
*/
#ifndef LAUEFFMODEL
#define LAUEFFMODEL
#include "LauAbsEffModel.hh"
class TH2;
class LauDaughters;
class LauKinematics;
class LauVetoes;
class Lau2DAbsDP;
-
class LauEffModel : public LauAbsEffModel {
- public:
- //! Constructor
- /*!
- \param [in] daughters the daughters particles of the Dalitz plot model
- \param [in] vetoes the object describing the vetoes applied in the phase space
- */
- LauEffModel(const LauDaughters* daughters, const LauVetoes* vetoes);
-
- //! Destructor
- virtual ~LauEffModel();
-
- //! Set the efficiency variation across the phase space using a predetermined 2D histogram.
- /*!
- The efficiency is defined in terms of x = m_13^2, y = m_23^2 or x = m', y = theta' for the square Dalitz plot
-
- \param [in] effHisto the 2-dimensional histogram that describes the efficiency variation
- \param [in] useInterpolation boolean flag decision to switch on/off linear interpolation between bins should be used or simply the raw bin values.
- \param [in] fluctuateBins boolean flag to determine whether the bin contents should be fluctuated in accordance with their errors.
- The seed for the random number generator used to fluctuate the bins should first be set using LauRandom::setSeed.
- \param [in] avEff the desired average efficiency - see Lau2DHistDP::raiseOrLowerBins, values less than zero switch off this behaviour.
- The seed for the random number generator used to raise or lower the bins should first be set using LauRandom::setSeed.
- \param [in] absError the error on that efficiency - see Lau2DHistDP::raiseOrLowerBins, values less than zero switch off this behaviour
- \param [in] useUpperHalfOnly boolean flag to specify that the supplied histogram contains only the upper half of a symmetric DP (or lower half if using square DP coordinates)
- \param [in] squareDP boolean flag to determine whether the supplied histogram is given in square DP coordinates
- */
- void setEffHisto(const TH2* effHisto,
- Bool_t useInterpolation = kTRUE, Bool_t fluctuateBins = kFALSE,
- Double_t avEff = -1.0, Double_t absError = -1.0,
- Bool_t useUpperHalfOnly = kFALSE, Bool_t squareDP = kFALSE);
-
- //! Set the efficiency variation across the phase space using a predetermined 2D histogram.
- /*!
- The efficiency is defined in terms of x = m_13^2, y = m_23^2 or x = m', y = theta' for the square Dalitz plot
-
- \param [in] effHisto the 2-dimensional histogram that describes the efficiency variation
- \param [in] errorHi the 2-dimensional histogram that describes the upper uncertainty on the efficiency variation
- \param [in] errorLo the 2-dimensional histogram that describes the lower uncertainty on the efficiency variation
- \param [in] useInterpolation boolean flag decision to switch on/off linear interpolation between bins should be used or simply the raw bin values.
- \param [in] fluctuateBins boolean flag to determine whether the bin contents should be fluctuated in accordance with their errors.
- The seed for the random number generator used to fluctuate the bins should first be set using LauRandom::setSeed.
- \param [in] avEff the desired average efficiency - see Lau2DHistDP::raiseOrLowerBins, values less than zero switch off this behaviour.
- The seed for the random number generator used to raise or lower the bins should first be set using LauRandom::setSeed.
- \param [in] absError the error on that efficiency - see Lau2DHistDP::raiseOrLowerBins, values less than zero switch off this behaviour
- \param [in] useUpperHalfOnly boolean flag to specify that the supplied histogram contains only the upper half of a symmetric DP (or lower half if using square DP coordinates)
- \param [in] squareDP boolean flag to determine whether the supplied histogram is given in square DP coordinates
- */
- void setEffHisto(const TH2* effHisto, const TH2* errorHi, const TH2* errorLo,
- Bool_t useInterpolation = kTRUE, Bool_t fluctuateBins = kFALSE,
- Double_t avEff = -1.0, Double_t absError = -1.0,
- Bool_t useUpperHalfOnly = kFALSE, Bool_t squareDP = kFALSE);
-
- //! Set the efficiency variation across the phase space using a spline based on a predetermined 2D histogram.
- /*!
- The efficiency is defined in terms of x = m_13^2, y = m_23^2 or x = m', y = theta' for the square Dalitz plot
-
- \param [in] effHisto the 2-dimensional histogram that describes the efficiency variation
- \param [in] fluctuateBins boolean flag to determine whether the bin contents should be fluctuated in accordance with their errors.
- The seed for the random number generator used to fluctuate the bins should first be set using LauRandom::setSeed.
- \param [in] avEff the desired average efficiency - see Lau2DHistDP::raiseOrLowerBins, values less than zero switch off this behaviour.
- The seed for the random number generator used to raise or lower the bins should first be set using LauRandom::setSeed.
- \param [in] absError the error on that efficiency - see Lau2DHistDP::raiseOrLowerBins, values less than zero switch off this behaviour
- \param [in] useUpperHalfOnly boolean flag to specify that the supplied histogram contains only the upper half of a symmetric DP (or lower half if using square DP coordinates)
- \param [in] squareDP boolean flag to determine whether the supplied histogram is given in square DP coordinates
- */
- void setEffSpline(const TH2* effHisto,
- Bool_t fluctuateBins = kFALSE,
- Double_t avEff = -1.0, Double_t absError = -1.0,
- Bool_t useUpperHalfOnly = kFALSE, Bool_t squareDP = kFALSE);
-
- //! Set the efficiency variation across the phase space using a spline based on a predetermined 2D histogram.
- /*!
- The efficiency is defined in terms of x = m_13^2, y = m_23^2 or x = m', y = theta' for the square Dalitz plot
-
- \param [in] effHisto the 2-dimensional histogram that describes the efficiency variation
- \param [in] errorHi the 2-dimensional histogram that describes the upper uncertainty on the efficiency variation
- \param [in] errorLo the 2-dimensional histogram that describes the lower uncertainty on the efficiency variation
- \param [in] fluctuateBins boolean flag to determine whether the bin contents should be fluctuated in accordance with their errors.
- The seed for the random number generator used to fluctuate the bins should first be set using LauRandom::setSeed.
- \param [in] avEff the desired average efficiency - see Lau2DHistDP::raiseOrLowerBins, values less than zero switch off this behaviour.
- The seed for the random number generator used to raise or lower the bins should first be set using LauRandom::setSeed.
- \param [in] absError the error on that efficiency - see Lau2DHistDP::raiseOrLowerBins, values less than zero switch off this behaviour
- \param [in] useUpperHalfOnly boolean flag to specify that the supplied histogram contains only the upper half of a symmetric DP (or lower half if using square DP coordinates)
- \param [in] squareDP boolean flag to determine whether the supplied histogram is given in square DP coordinates
- */
- void setEffSpline(const TH2* effHisto, const TH2* errorHi, const TH2* errorLo,
- Bool_t fluctuateBins = kFALSE,
- Double_t avEff = -1.0, Double_t absError = -1.0,
- Bool_t useUpperHalfOnly = kFALSE, Bool_t squareDP = kFALSE);
-
- //! Add a multiplicative efficiency variation across the phase space using a predetermined 2D histogram.
- /*!
- The efficiency is defined in terms of x = m_13^2, y = m_23^2 or x = m', y = theta' for the square Dalitz plot
-
- \param [in] effHisto the 2-dimensional histogram that describes the efficiency variation
- \param [in] useInterpolation boolean flag decision to switch on/off linear interpolation between bins should be used or simply the raw bin values.
- \param [in] avEff the desired average efficiency - see Lau2DHistDP::raiseOrLowerBins, values less than zero switch off this behaviour.
- The seed for the random number generator used to raise or lower the bins should first be set using LauRandom::setSeed.
- \param [in] absError the error on that efficiency - see Lau2DHistDP::raiseOrLowerBins, values less than zero switch off this behaviour
- \param [in] useUpperHalfOnly boolean flag to specify that the supplied histogram contains only the upper half of a symmetric DP (or lower half if using square DP coordinates)
- \param [in] squareDP boolean flag to determine whether the supplied histogram is given in square DP coordinates
- */
- void addEffHisto(const TH2* effHisto,
- Bool_t useInterpolation = kTRUE,
- Double_t avEff = -1.0, Double_t absError = -1.0,
- Bool_t useUpperHalfOnly = kFALSE, Bool_t squareDP = kFALSE);
-
- //! Add a multiplicative efficiency variation across the phase space using a predetermined 2D histogram.
- /*!
- The efficiency is defined in terms of x = m_13^2, y = m_23^2 or x = m', y = theta' for the square Dalitz plot
-
- \param [in] effHisto the 2-dimensional histogram that describes the efficiency variation
- \param [in] errorHi the 2-dimensional histogram that describes the upper uncertainty on the efficiency variation
- \param [in] errorLo the 2-dimensional histogram that describes the lower uncertainty on the efficiency variation
- \param [in] useInterpolation boolean flag decision to switch on/off linear interpolation between bins should be used or simply the raw bin values.
- \param [in] avEff the desired average efficiency - see Lau2DHistDP::raiseOrLowerBins, values less than zero switch off this behaviour.
- The seed for the random number generator used to raise or lower the bins should first be set using LauRandom::setSeed.
- \param [in] absError the error on that efficiency - see Lau2DHistDP::raiseOrLowerBins, values less than zero switch off this behaviour
- \param [in] useUpperHalfOnly boolean flag to specify that the supplied histogram contains only the upper half of a symmetric DP (or lower half if using square DP coordinates)
- \param [in] squareDP boolean flag to determine whether the supplied histogram is given in square DP coordinates
- */
- void addEffHisto(const TH2* effHisto, const TH2* errorHi, const TH2* errorLo,
- Bool_t useInterpolation = kTRUE,
- Double_t avEff = -1.0, Double_t absError = -1.0,
- Bool_t useUpperHalfOnly = kFALSE, Bool_t squareDP = kFALSE);
-
- //! Add a multiplicative efficiency variation across the phase space using a spline based on a predetermined 2D histogram.
- /*!
- The efficiency is defined in terms of x = m_13^2, y = m_23^2 or x = m', y = theta' for the square Dalitz plot
-
- \param [in] effHisto the 2-dimensional histogram that describes the efficiency variation
- \param [in] avEff the desired average efficiency - see Lau2DHistDP::raiseOrLowerBins, values less than zero switch off this behaviour.
- The seed for the random number generator used to raise or lower the bins should first be set using LauRandom::setSeed.
- \param [in] absError the error on that efficiency - see Lau2DHistDP::raiseOrLowerBins, values less than zero switch off this behaviour
- \param [in] useUpperHalfOnly boolean flag to specify that the supplied histogram contains only the upper half of a symmetric DP (or lower half if using square DP coordinates)
- \param [in] squareDP boolean flag to determine whether the supplied histogram is given in square DP coordinates
- */
- void addEffSpline(const TH2* effHisto,
- Double_t avEff = -1.0, Double_t absError = -1.0,
- Bool_t useUpperHalfOnly = kFALSE, Bool_t squareDP = kFALSE);
-
- //! Add a multiplicative efficiency variation across the phase space using a spline based on a predetermined 2D histogram.
- /*!
- The efficiency is defined in terms of x = m_13^2, y = m_23^2 or x = m', y = theta' for the square Dalitz plot
-
- \param [in] effHisto the 2-dimensional histogram that describes the efficiency variation
- \param [in] errorHi the 2-dimensional histogram that describes the upper uncertainty on the efficiency variation
- \param [in] errorLo the 2-dimensional histogram that describes the lower uncertainty on the efficiency variation
- \param [in] avEff the desired average efficiency - see Lau2DHistDP::raiseOrLowerBins, values less than zero switch off this behaviour.
- The seed for the random number generator used to raise or lower the bins should first be set using LauRandom::setSeed.
- \param [in] absError the error on that efficiency - see Lau2DHistDP::raiseOrLowerBins, values less than zero switch off this behaviour
- \param [in] useUpperHalfOnly boolean flag to specify that the supplied histogram contains only the upper half of a symmetric DP (or lower half if using square DP coordinates)
- \param [in] squareDP boolean flag to determine whether the supplied histogram is given in square DP coordinates
- */
- void addEffSpline(const TH2* effHisto, const TH2* errorHi, const TH2* errorLo,
- Double_t avEff = -1.0, Double_t absError = -1.0,
- Bool_t useUpperHalfOnly = kFALSE, Bool_t squareDP = kFALSE);
-
- //! Determine the efficiency for a given point in the Dalitz plot.
- /*!
- The method uses the 2D histogram set by the setEffHisto() function and the vetoes information.
-
- \param [in] kinematics the object that defines the DP position
- \return the efficiency value at the given point in the DP
- */
- Double_t calcEfficiency( const LauKinematics* kinematics ) const;
-
- //! Determine whether the given DP position is outside the vetoes
- /*!
- \param [in] kinematics the object that defines the DP position
- \return kTRUE if the DP position is outside all veto regions, kFALSE otherwise
- */
- Bool_t passVeto( const LauKinematics* kinematics ) const;
-
- //! Determine whether the efficiency histogram has had its bins fluctuated within their errors
- Bool_t fluctuateEffHisto() const {return fluctuateEffHisto_;}
-
- //! Return the daughters object
- /*
- \return the LauDaughters object associated with the DP
- */
- const LauDaughters* getDaughters() const {return daughters_;}
-
- private:
- //! Copy constructor - not implemented
- LauEffModel( const LauEffModel& rhs );
-
- //! Copy assignment operator - not implemented
- LauEffModel& operator=( const LauEffModel& rhs );
-
- //! Get the efficiency from a two-dimensional histogram
- /*!
- \param [in] kinematics the object that defines the DP position
- */
- Double_t getEffHistValue( const LauKinematics* kinematics ) const;
-
- //! The daughters object
- const LauDaughters* daughters_;
-
- //! The vetoes object
- const LauVetoes* vetoes_;
-
- //! The efficiency histogram objects
- std::vector<Lau2DAbsDP*> effHisto_;
-
- //! Fluctuate histogram within the error
- Bool_t fluctuateEffHisto_;
-
- //! Flag to track whether a warning has been issued for bin values less than zero
- mutable Bool_t lowBinWarningIssued_;
-
- //! Flag to track whether a warning has been issued for bin values greater than one
- mutable Bool_t highBinWarningIssued_;
-
- ClassDef(LauEffModel, 0) // Implement the signal efficiency across the DP
-
+ public:
+ //! Constructor
+ /*!
+ \param [in] daughters the daughters particles of the Dalitz plot model
+ \param [in] vetoes the object describing the vetoes applied in the phase space
+ */
+ LauEffModel( const LauDaughters* daughters, const LauVetoes* vetoes );
+
+ //! Destructor
+ virtual ~LauEffModel();
+
+ //! Set the efficiency variation across the phase space using a predetermined 2D histogram.
+ /*!
+ The efficiency is defined in terms of x = m_13^2, y = m_23^2 or x = m', y = theta' for the square Dalitz plot
+
+ \param [in] effHisto the 2-dimensional histogram that describes the efficiency variation
+ \param [in] useInterpolation boolean flag decision to switch on/off linear interpolation between bins should be used or simply the raw bin values.
+ \param [in] fluctuateBins boolean flag to determine whether the bin contents should be fluctuated in accordance with their errors.
+ The seed for the random number generator used to fluctuate the bins should first be set using LauRandom::setSeed.
+
+ \param [in] avEff the desired average efficiency - see Lau2DHistDP::raiseOrLowerBins, values less than zero switch off this behaviour.
+ The seed for the random number generator used to raise or lower the bins should first be set using LauRandom::setSeed.
+
+ \param [in] absError the error on that efficiency - see Lau2DHistDP::raiseOrLowerBins, values less than zero switch off this behaviour
+ \param [in] useUpperHalfOnly boolean flag to specify that the supplied histogram contains only the upper half of a symmetric DP (or lower half if using square DP coordinates)
+ \param [in] squareDP boolean flag to determine whether the supplied histogram is given in square DP coordinates
+ */
+ void setEffHisto( const TH2* effHisto,
+ Bool_t useInterpolation = kTRUE,
+ Bool_t fluctuateBins = kFALSE,
+ Double_t avEff = -1.0,
+ Double_t absError = -1.0,
+ Bool_t useUpperHalfOnly = kFALSE,
+ Bool_t squareDP = kFALSE );
+
+ //! Set the efficiency variation across the phase space using a predetermined 2D histogram.
+ /*!
+ The efficiency is defined in terms of x = m_13^2, y = m_23^2 or x = m', y = theta' for the square Dalitz plot
+
+ \param [in] effHisto the 2-dimensional histogram that describes the efficiency variation
+ \param [in] errorHi the 2-dimensional histogram that describes the upper uncertainty on the efficiency variation
+ \param [in] errorLo the 2-dimensional histogram that describes the lower uncertainty on the efficiency variation
+ \param [in] useInterpolation boolean flag decision to switch on/off linear interpolation between bins should be used or simply the raw bin values.
+ \param [in] fluctuateBins boolean flag to determine whether the bin contents should be fluctuated in accordance with their errors.
+ The seed for the random number generator used to fluctuate the bins should first be set using LauRandom::setSeed.
+
+ \param [in] avEff the desired average efficiency - see Lau2DHistDP::raiseOrLowerBins, values less than zero switch off this behaviour.
+ The seed for the random number generator used to raise or lower the bins should first be set using LauRandom::setSeed.
+
+ \param [in] absError the error on that efficiency - see Lau2DHistDP::raiseOrLowerBins, values less than zero switch off this behaviour
+ \param [in] useUpperHalfOnly boolean flag to specify that the supplied histogram contains only the upper half of a symmetric DP (or lower half if using square DP coordinates)
+ \param [in] squareDP boolean flag to determine whether the supplied histogram is given in square DP coordinates
+ */
+ void setEffHisto( const TH2* effHisto,
+ const TH2* errorHi,
+ const TH2* errorLo,
+ Bool_t useInterpolation = kTRUE,
+ Bool_t fluctuateBins = kFALSE,
+ Double_t avEff = -1.0,
+ Double_t absError = -1.0,
+ Bool_t useUpperHalfOnly = kFALSE,
+ Bool_t squareDP = kFALSE );
+
+ //! Set the efficiency variation across the phase space using a spline based on a predetermined 2D histogram.
+ /*!
+ The efficiency is defined in terms of x = m_13^2, y = m_23^2 or x = m', y = theta' for the square Dalitz plot
+
+ \param [in] effHisto the 2-dimensional histogram that describes the efficiency variation
+ \param [in] fluctuateBins boolean flag to determine whether the bin contents should be fluctuated in accordance with their errors.
+ The seed for the random number generator used to fluctuate the bins should first be set using LauRandom::setSeed.
+
+ \param [in] avEff the desired average efficiency - see Lau2DHistDP::raiseOrLowerBins, values less than zero switch off this behaviour.
+ The seed for the random number generator used to raise or lower the bins should first be set using LauRandom::setSeed.
+
+ \param [in] absError the error on that efficiency - see Lau2DHistDP::raiseOrLowerBins, values less than zero switch off this behaviour
+ \param [in] useUpperHalfOnly boolean flag to specify that the supplied histogram contains only the upper half of a symmetric DP (or lower half if using square DP coordinates)
+ \param [in] squareDP boolean flag to determine whether the supplied histogram is given in square DP coordinates
+ */
+ void setEffSpline( const TH2* effHisto,
+ Bool_t fluctuateBins = kFALSE,
+ Double_t avEff = -1.0,
+ Double_t absError = -1.0,
+ Bool_t useUpperHalfOnly = kFALSE,
+ Bool_t squareDP = kFALSE );
+
+ //! Set the efficiency variation across the phase space using a spline based on a predetermined 2D histogram.
+ /*!
+ The efficiency is defined in terms of x = m_13^2, y = m_23^2 or x = m', y = theta' for the square Dalitz plot
+
+ \param [in] effHisto the 2-dimensional histogram that describes the efficiency variation
+ \param [in] errorHi the 2-dimensional histogram that describes the upper uncertainty on the efficiency variation
+ \param [in] errorLo the 2-dimensional histogram that describes the lower uncertainty on the efficiency variation
+ \param [in] fluctuateBins boolean flag to determine whether the bin contents should be fluctuated in accordance with their errors.
+ The seed for the random number generator used to fluctuate the bins should first be set using LauRandom::setSeed.
+
+ \param [in] avEff the desired average efficiency - see Lau2DHistDP::raiseOrLowerBins, values less than zero switch off this behaviour.
+ The seed for the random number generator used to raise or lower the bins should first be set using LauRandom::setSeed.
+
+ \param [in] absError the error on that efficiency - see Lau2DHistDP::raiseOrLowerBins, values less than zero switch off this behaviour
+ \param [in] useUpperHalfOnly boolean flag to specify that the supplied histogram contains only the upper half of a symmetric DP (or lower half if using square DP coordinates)
+ \param [in] squareDP boolean flag to determine whether the supplied histogram is given in square DP coordinates
+ */
+ void setEffSpline( const TH2* effHisto,
+ const TH2* errorHi,
+ const TH2* errorLo,
+ Bool_t fluctuateBins = kFALSE,
+ Double_t avEff = -1.0,
+ Double_t absError = -1.0,
+ Bool_t useUpperHalfOnly = kFALSE,
+ Bool_t squareDP = kFALSE );
+
+ //! Add a multiplicative efficiency variation across the phase space using a predetermined 2D histogram.
+ /*!
+ The efficiency is defined in terms of x = m_13^2, y = m_23^2 or x = m', y = theta' for the square Dalitz plot
+
+ \param [in] effHisto the 2-dimensional histogram that describes the efficiency variation
+ \param [in] useInterpolation boolean flag decision to switch on/off linear interpolation between bins should be used or simply the raw bin values.
+ \param [in] avEff the desired average efficiency - see Lau2DHistDP::raiseOrLowerBins, values less than zero switch off this behaviour.
+ The seed for the random number generator used to raise or lower the bins should first be set using LauRandom::setSeed.
+
+ \param [in] absError the error on that efficiency - see Lau2DHistDP::raiseOrLowerBins, values less than zero switch off this behaviour
+ \param [in] useUpperHalfOnly boolean flag to specify that the supplied histogram contains only the upper half of a symmetric DP (or lower half if using square DP coordinates)
+ \param [in] squareDP boolean flag to determine whether the supplied histogram is given in square DP coordinates
+ */
+ void addEffHisto( const TH2* effHisto,
+ Bool_t useInterpolation = kTRUE,
+ Double_t avEff = -1.0,
+ Double_t absError = -1.0,
+ Bool_t useUpperHalfOnly = kFALSE,
+ Bool_t squareDP = kFALSE );
+
+ //! Add a multiplicative efficiency variation across the phase space using a predetermined 2D histogram.
+ /*!
+ The efficiency is defined in terms of x = m_13^2, y = m_23^2 or x = m', y = theta' for the square Dalitz plot
+
+ \param [in] effHisto the 2-dimensional histogram that describes the efficiency variation
+ \param [in] errorHi the 2-dimensional histogram that describes the upper uncertainty on the efficiency variation
+ \param [in] errorLo the 2-dimensional histogram that describes the lower uncertainty on the efficiency variation
+ \param [in] useInterpolation boolean flag decision to switch on/off linear interpolation between bins should be used or simply the raw bin values.
+ \param [in] avEff the desired average efficiency - see Lau2DHistDP::raiseOrLowerBins, values less than zero switch off this behaviour.
+ The seed for the random number generator used to raise or lower the bins should first be set using LauRandom::setSeed.
+
+ \param [in] absError the error on that efficiency - see Lau2DHistDP::raiseOrLowerBins, values less than zero switch off this behaviour
+ \param [in] useUpperHalfOnly boolean flag to specify that the supplied histogram contains only the upper half of a symmetric DP (or lower half if using square DP coordinates)
+ \param [in] squareDP boolean flag to determine whether the supplied histogram is given in square DP coordinates
+ */
+ void addEffHisto( const TH2* effHisto,
+ const TH2* errorHi,
+ const TH2* errorLo,
+ Bool_t useInterpolation = kTRUE,
+ Double_t avEff = -1.0,
+ Double_t absError = -1.0,
+ Bool_t useUpperHalfOnly = kFALSE,
+ Bool_t squareDP = kFALSE );
+
+ //! Add a multiplicative efficiency variation across the phase space using a spline based on a predetermined 2D histogram.
+ /*!
+ The efficiency is defined in terms of x = m_13^2, y = m_23^2 or x = m', y = theta' for the square Dalitz plot
+
+ \param [in] effHisto the 2-dimensional histogram that describes the efficiency variation
+ \param [in] avEff the desired average efficiency - see Lau2DHistDP::raiseOrLowerBins, values less than zero switch off this behaviour.
+ The seed for the random number generator used to raise or lower the bins should first be set using LauRandom::setSeed.
+
+ \param [in] absError the error on that efficiency - see Lau2DHistDP::raiseOrLowerBins, values less than zero switch off this behaviour
+ \param [in] useUpperHalfOnly boolean flag to specify that the supplied histogram contains only the upper half of a symmetric DP (or lower half if using square DP coordinates)
+ \param [in] squareDP boolean flag to determine whether the supplied histogram is given in square DP coordinates
+ */
+ void addEffSpline( const TH2* effHisto,
+ Double_t avEff = -1.0,
+ Double_t absError = -1.0,
+ Bool_t useUpperHalfOnly = kFALSE,
+ Bool_t squareDP = kFALSE );
+
+ //! Add a multiplicative efficiency variation across the phase space using a spline based on a predetermined 2D histogram.
+ /*!
+ The efficiency is defined in terms of x = m_13^2, y = m_23^2 or x = m', y = theta' for the square Dalitz plot
+
+ \param [in] effHisto the 2-dimensional histogram that describes the efficiency variation
+ \param [in] errorHi the 2-dimensional histogram that describes the upper uncertainty on the efficiency variation
+ \param [in] errorLo the 2-dimensional histogram that describes the lower uncertainty on the efficiency variation
+ \param [in] avEff the desired average efficiency - see Lau2DHistDP::raiseOrLowerBins, values less than zero switch off this behaviour.
+ The seed for the random number generator used to raise or lower the bins should first be set using LauRandom::setSeed.
+
+ \param [in] absError the error on that efficiency - see Lau2DHistDP::raiseOrLowerBins, values less than zero switch off this behaviour
+ \param [in] useUpperHalfOnly boolean flag to specify that the supplied histogram contains only the upper half of a symmetric DP (or lower half if using square DP coordinates)
+ \param [in] squareDP boolean flag to determine whether the supplied histogram is given in square DP coordinates
+ */
+ void addEffSpline( const TH2* effHisto,
+ const TH2* errorHi,
+ const TH2* errorLo,
+ Double_t avEff = -1.0,
+ Double_t absError = -1.0,
+ Bool_t useUpperHalfOnly = kFALSE,
+ Bool_t squareDP = kFALSE );
+
+ //! Determine the efficiency for a given point in the Dalitz plot.
+ /*!
+ The method uses the 2D histogram set by the setEffHisto() function and the vetoes information.
+
+ \param [in] kinematics the object that defines the DP position
+ \return the efficiency value at the given point in the DP
+ */
+ Double_t calcEfficiency( const LauKinematics* kinematics ) const;
+
+ //! Determine whether the given DP position is outside the vetoes
+ /*!
+ \param [in] kinematics the object that defines the DP position
+ \return kTRUE if the DP position is outside all veto regions, kFALSE otherwise
+ */
+ Bool_t passVeto( const LauKinematics* kinematics ) const;
+
+ //! Determine whether the efficiency histogram has had its bins fluctuated within their errors
+ Bool_t fluctuateEffHisto() const { return fluctuateEffHisto_; }
+
+ //! Return the daughters object
+ /*
+ \return the LauDaughters object associated with the DP
+ */
+ const LauDaughters* getDaughters() const { return daughters_; }
+
+ private:
+ //! Copy constructor - not implemented
+ LauEffModel( const LauEffModel& rhs );
+
+ //! Copy assignment operator - not implemented
+ LauEffModel& operator=( const LauEffModel& rhs );
+
+ //! Get the efficiency from a two-dimensional histogram
+ /*!
+ \param [in] kinematics the object that defines the DP position
+ */
+ Double_t getEffHistValue( const LauKinematics* kinematics ) const;
+
+ //! The daughters object
+ const LauDaughters* daughters_;
+
+ //! The vetoes object
+ const LauVetoes* vetoes_;
+
+ //! The efficiency histogram objects
+ std::vector<Lau2DAbsDP*> effHisto_;
+
+ //! Fluctuate histogram within the error
+ Bool_t fluctuateEffHisto_;
+
+ //! Flag to track whether a warning has been issued for bin values less than zero
+ mutable Bool_t lowBinWarningIssued_;
+
+ //! Flag to track whether a warning has been issued for bin values greater than one
+ mutable Bool_t highBinWarningIssued_;
+
+ ClassDef( LauEffModel, 0 ) // Implement the signal efficiency across the DP
};
#endif
diff --git a/inc/LauEmbeddedData.hh b/inc/LauEmbeddedData.hh
index 92d1ce2..ce2aa53 100644
--- a/inc/LauEmbeddedData.hh
+++ b/inc/LauEmbeddedData.hh
@@ -1,146 +1,148 @@
/*
Copyright 2007 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauEmbeddedData.hh
\brief File containing declaration of LauEmbeddedData class.
*/
/*! \class LauEmbeddedData
- \brief Class to store the data for embedding in toy experiments
+ \brief Class to store the data for embedding in toy experiments
Class to store the data from external data sources, such as full simulation, for embedding in toy experiments
*/
#ifndef LAU_EMBEDDED_DATA
#define LAU_EMBEDDED_DATA
+#include "LauFitDataTree.hh"
+
#include <set>
#include <vector>
-#include "LauFitDataTree.hh"
-
class LauKinematics;
class LauIsobarDynamics;
-
class LauEmbeddedData {
- public:
- //! Constructor
- /*!
- \param [in] fileName the ntuple file name
- \param [in] treeName the tree name
- \param [in] allowReuseOfEvents flag to indicated whether events are allowed to be sampled more than once
- */
- LauEmbeddedData(const TString& fileName, const TString& treeName, Bool_t allowReuseOfEvents);
-
- //! Destructor
- virtual ~LauEmbeddedData();
-
- //! Find and read the branches in data tree
- /*!
- \return success/failure flag
- */
- Bool_t findBranches();
-
- //! Retrieve the number of branches
- /*!
- \return the number of branches
- */
- UInt_t nBranches() const {return theDataTree_ ? theDataTree_->nBranches() : 0;}
-
- //! Retrieve the number of events
- /*!
- \return the number of events
- */
- UInt_t nEvents() const {return theDataTree_ ? theDataTree_->nEvents() : 0;}
-
- //! Retrieve the number of events that have already been sampled
- /*!
- \return the number of used events
- */
- UInt_t nUsedEvents() const {return usedEvents_.size();}
-
- //! Boolean to determine whether branch exists
- /*!
- \param [in] name the branch name
- */
- Bool_t haveBranch(const TString& name) const {return theDataTree_ ? theDataTree_->haveBranch(name) : kFALSE;}
-
- //! Retrieve an event from the data sample
- /*!
- \param [in] kinematics object in which to store the kinematics of the Dalitz plot
- */
- void getEmbeddedEvent(LauKinematics* kinematics);
-
- //! Retrieve an event from the data sample, applying an accept/reject based on the given DP model
- /*!
- \param [in] dynamics the amplitude model
- */
- Bool_t getReweightedEvent(LauIsobarDynamics* dynamics);
-
- //! Get the value of a specified branch
- /*!
- \param [in] name the branch name
- \return the branch value
- */
- Double_t getValue(const TString& name) const;
-
- //! Get values of specified branches
- /*!
- \param [in] names the branch names
- \return the branch values
- */
- LauFitData getValues(const std::vector<TString>& names) const;
-
- //! Clear the list of used events
- void clearUsedList() {usedEvents_.clear();}
-
- protected:
- //! Boolean determining whether events should be reused
- /*!
- \return flag determining whether events should be reused
- */
- Bool_t reuseEvents() const {return reuseEvents_;}
-
- private:
- //! Copy constructor (not implemented)
- LauEmbeddedData(const LauEmbeddedData& rhs);
-
- //! Copy assignment operator (not implemented)
- LauEmbeddedData& operator=(const LauEmbeddedData& rhs);
-
- //! The structure containing the data
- LauFitDataTree* theDataTree_;
- //! The data for the currently retrieved event
- LauFitData theData_;
- //! Flag whether events can be reused
- Bool_t reuseEvents_;
- //! Used events
- std::set<UInt_t> usedEvents_;
-
- ClassDef(LauEmbeddedData, 0) // a non-persistent bare-bones complex class
+ public:
+ //! Constructor
+ /*!
+ \param [in] fileName the ntuple file name
+ \param [in] treeName the tree name
+ \param [in] allowReuseOfEvents flag to indicated whether events are allowed to be sampled more than once
+ */
+ LauEmbeddedData( const TString& fileName, const TString& treeName, Bool_t allowReuseOfEvents );
+
+ //! Destructor
+ virtual ~LauEmbeddedData();
+
+ //! Find and read the branches in data tree
+ /*!
+ \return success/failure flag
+ */
+ Bool_t findBranches();
+
+ //! Retrieve the number of branches
+ /*!
+ \return the number of branches
+ */
+ UInt_t nBranches() const { return theDataTree_ ? theDataTree_->nBranches() : 0; }
+
+ //! Retrieve the number of events
+ /*!
+ \return the number of events
+ */
+ UInt_t nEvents() const { return theDataTree_ ? theDataTree_->nEvents() : 0; }
+
+ //! Retrieve the number of events that have already been sampled
+ /*!
+ \return the number of used events
+ */
+ UInt_t nUsedEvents() const { return usedEvents_.size(); }
+
+ //! Boolean to determine whether branch exists
+ /*!
+ \param [in] name the branch name
+ */
+ Bool_t haveBranch( const TString& name ) const
+ {
+ return theDataTree_ ? theDataTree_->haveBranch( name ) : kFALSE;
+ }
+
+ //! Retrieve an event from the data sample
+ /*!
+ \param [in] kinematics object in which to store the kinematics of the Dalitz plot
+ */
+ void getEmbeddedEvent( LauKinematics* kinematics );
+
+ //! Retrieve an event from the data sample, applying an accept/reject based on the given DP model
+ /*!
+ \param [in] dynamics the amplitude model
+ */
+ Bool_t getReweightedEvent( LauIsobarDynamics* dynamics );
+
+ //! Get the value of a specified branch
+ /*!
+ \param [in] name the branch name
+ \return the branch value
+ */
+ Double_t getValue( const TString& name ) const;
+
+ //! Get values of specified branches
+ /*!
+ \param [in] names the branch names
+ \return the branch values
+ */
+ LauFitData getValues( const std::vector<TString>& names ) const;
+
+ //! Clear the list of used events
+ void clearUsedList() { usedEvents_.clear(); }
+
+ protected:
+ //! Boolean determining whether events should be reused
+ /*!
+ \return flag determining whether events should be reused
+ */
+ Bool_t reuseEvents() const { return reuseEvents_; }
+
+ private:
+ //! Copy constructor (not implemented)
+ LauEmbeddedData( const LauEmbeddedData& rhs );
+
+ //! Copy assignment operator (not implemented)
+ LauEmbeddedData& operator=( const LauEmbeddedData& rhs );
+
+ //! The structure containing the data
+ LauFitDataTree* theDataTree_;
+ //! The data for the currently retrieved event
+ LauFitData theData_;
+ //! Flag whether events can be reused
+ Bool_t reuseEvents_;
+ //! Used events
+ std::set<UInt_t> usedEvents_;
+
+ ClassDef( LauEmbeddedData, 0 ) // a non-persistent bare-bones complex class
};
#endif
diff --git a/inc/LauExponentialPdf.hh b/inc/LauExponentialPdf.hh
index f6ee6f1..6a45e9d 100644
--- a/inc/LauExponentialPdf.hh
+++ b/inc/LauExponentialPdf.hh
@@ -1,96 +1,98 @@
/*
Copyright 2011 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauExponentialPdf.hh
\brief File containing declaration of LauExponentialPdf class.
*/
/*! \class LauExponentialPdf
- \brief Class for defining an Exponential PDF
+ \brief Class for defining an Exponential PDF
- Class that allows the user to define an Exponential PDF,
+ Class that allows the user to define an Exponential PDF,
requires a single parameter for the slope of the exponential:
exp(slope*x)
*/
#ifndef LAU_EXPONENTIAL_PDF
#define LAU_EXPONENTIAL_PDF
-#include <vector>
+#include "LauAbsPdf.hh"
#include "TString.h"
-#include "LauAbsPdf.hh"
+#include <vector>
class LauParameter;
-
class LauExponentialPdf : public LauAbsPdf {
- public:
- //! Constructor
- /*!
- \param [in] theVarName the name of the abscissa variable
- \param [in] params the PDF parameters - slope
- \param [in] minAbscissa the minimum value of the abscissa
- \param [in] maxAbscissa the maximum value of the abscissa
- */
- LauExponentialPdf(const TString& theVarName, const std::vector<LauAbsRValue*>& params, Double_t minAbscissa, Double_t maxAbscissa);
-
- //! Destructor
- virtual ~LauExponentialPdf();
-
- //! Calculate the likelihood (and intermediate info) for a given abscissa
- /*!
- \param [in] abscissas the values of the abscissa(s)
- */
- virtual void calcLikelihoodInfo(const LauAbscissas& abscissas);
-
- using LauAbsPdf::calcLikelihoodInfo;
-
- //! Calculate the normalisation
- virtual void calcNorm();
-
- //! Calculate the PDF height
- /*!
- \param [in] kinematics the current DP kinematics
- */
- virtual void calcPDFHeight( const LauKinematics* kinematics );
-
- protected:
-
- private:
- //! Copy constructor (not implemented)
- LauExponentialPdf(const LauExponentialPdf& rhs);
-
- //! Copy assignment operator (not implemented)
- LauExponentialPdf& operator=(const LauExponentialPdf& rhs);
-
- //! Exponential slope ie exp(slope*x)
- LauAbsRValue* slope_;
-
- ClassDef(LauExponentialPdf,0) // Define the Exponential PDF
+ public:
+ //! Constructor
+ /*!
+ \param [in] theVarName the name of the abscissa variable
+ \param [in] params the PDF parameters - slope
+ \param [in] minAbscissa the minimum value of the abscissa
+ \param [in] maxAbscissa the maximum value of the abscissa
+ */
+ LauExponentialPdf( const TString& theVarName,
+ const std::vector<LauAbsRValue*>& params,
+ Double_t minAbscissa,
+ Double_t maxAbscissa );
+
+ //! Destructor
+ virtual ~LauExponentialPdf();
+
+ //! Calculate the likelihood (and intermediate info) for a given abscissa
+ /*!
+ \param [in] abscissas the values of the abscissa(s)
+ */
+ virtual void calcLikelihoodInfo( const LauAbscissas& abscissas );
+
+ using LauAbsPdf::calcLikelihoodInfo;
+
+ //! Calculate the normalisation
+ virtual void calcNorm();
+
+ //! Calculate the PDF height
+ /*!
+ \param [in] kinematics the current DP kinematics
+ */
+ virtual void calcPDFHeight( const LauKinematics* kinematics );
+
+ protected:
+
+ private:
+ //! Copy constructor (not implemented)
+ LauExponentialPdf( const LauExponentialPdf& rhs );
+
+ //! Copy assignment operator (not implemented)
+ LauExponentialPdf& operator=( const LauExponentialPdf& rhs );
+
+ //! Exponential slope ie exp(slope*x)
+ LauAbsRValue* slope_;
+
+ ClassDef( LauExponentialPdf, 0 ) // Define the Exponential PDF
};
#endif
diff --git a/inc/LauFitDataTree.hh b/inc/LauFitDataTree.hh
index d713a0f..08fd2f4 100644
--- a/inc/LauFitDataTree.hh
+++ b/inc/LauFitDataTree.hh
@@ -1,224 +1,230 @@
/*
Copyright 2004 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauFitDataTree.hh
\brief File containing declaration of LauFitDataTree class.
*/
/*! \class LauFitDataTree
\brief Class to store the input fit variables.
Events are loaded from a tree and fake events may be added manually.
*/
#ifndef LAU_FIT_DATA_TREE
#define LAU_FIT_DATA_TREE
-#include <vector>
-#include <map>
-
#include "TEventList.h"
#include "TTree.h"
+#include <map>
+#include <vector>
+
class TFile;
class TLeaf;
//! Type for holding event data
-typedef std::map<TString,Double_t> LauFitData;
-
+typedef std::map<TString, Double_t> LauFitData;
class LauFitDataTree {
- public:
- //! Constructor
- /*!
- \param [in] rootFileName the name of the file containing the data
- \param [in] rootTreeName the name of the tree containing the data
- */
- LauFitDataTree(const TString& rootFileName, const TString& rootTreeName);
-
- //! Destructor
- virtual ~LauFitDataTree();
-
- //! Retrieve the file name
- /*!
- \return the file name
- */
- const TString& fileName() const {return rootFileName_;}
-
- //! Retrieve the tree name
- /*!
- \return the tree name
- */
- const TString& treeName() const {return rootTreeName_;}
-
- //! Find all of the branches in the tree
- /*!
- \returns true if sucessful, otherwise returns false and prints an error message
- */
- Bool_t findBranches();
-
- //! Read all events from the tree
- void readAllData();
-
- //! Read events only for the given experiment
- /*!
- \param [in] iExpt the experiment to read
- */
- void readExperimentData( UInt_t iExpt );
-
- //! Add fake events to the data
- /*!
- Used, for example, for storing the information on the histogram bin centres for calculating the DP smearing of mis-reconstructed events, see, for example, LauSimpleFitModel::splitSignalComponent and LauScfMap
-
- \param [in] xCoords the values of m13 squared for the fake events
- \param [in] yCoords the values of m23 squared for the fake events
- */
- void appendFakePoints(const std::vector<Double_t>& xCoords, const std::vector<Double_t>& yCoords);
-
- //! Obtain the number of branches in the tree
- /*!
- \return the number of branches
- */
- UInt_t nBranches() const;
-
- //! Retrieve the number of events in the tree
- /*!
- \return the number of events in the tree
- */
- UInt_t nTreeEvents() const {return rootTree_ ? static_cast<UInt_t>(rootTree_->GetEntries()) : 0;}
-
- //! Retrieve the number of events
- /*!
- \return the number of events in the current experiment if one is selected, otherwise the total number of events in the tree
- */
- UInt_t nEvents() const {return eventList_ ? static_cast<UInt_t>(eventList_->GetN()) : this->nTreeEvents();}
-
- //! Retrieve the number of fake events
- /*!
- \return the number of fake events
- */
- UInt_t nFakeEvents() const {return fakeEvents_.size();}
-
- //! Retrieve the total number of events
- /*!
- \return the total number of events
- */
- UInt_t nTotalEvents() const {return this->nTreeEvents()+this->nFakeEvents();}
-
- //! Check if the named branch is stored
- /*!
- \param [in] name the name of the branch
- \return true if the branch is stored, otherwise return false
- */
- Bool_t haveBranch(const TString& name) const;
-
- //! Retrieve the data for a given event
- /*!
- \param [in] iEvt the index of the event
- \return the event data
- */
- const LauFitData& getData(UInt_t iEvt) const;
-
- //! Disable all branches
- void disableAllBranches() const;
-
- //! Enable all branches
- void enableAllBranches() const;
-
- //! Enable the named branch
- /*!
- \param [in] name the name of the branch
- */
- void enableBranch(const TString& name) const;
-
- //! Disable the named branch
- /*!
- \param [in] name the name of the branch
- */
- void disableBranch(const TString& name) const;
-
- protected:
- //! Open the file and tree
- void openFileAndTree();
-
- //! Load events from the tree
- /*!
- If an event list is present, load only those events, otherwise load all events
- */
- void loadData();
-
- private:
- //! Copy constructor (not implemented)
- LauFitDataTree(const LauFitDataTree& rhs);
-
- //! Copy assignment operator (not implemented)
- LauFitDataTree& operator=(const LauFitDataTree& rhs);
-
- //! The type used to map the leaf names to the vector indices
- typedef std::map<TString,UInt_t> LauNameIndexMap;
-
- //! The type used to contain the data for each event
- typedef std::vector<Double_t> LauEventData;
-
- //! The type used to hold the leaves
- typedef std::vector<TLeaf*> LauLeafList;
-
- //! The name of the file containing the data
- TString rootFileName_;
-
- //! The name of the tree ocntaining the data
- TString rootTreeName_;
-
- //! The file containing the data
- TFile* rootFile_;
-
- //! The tree containing the data
- TTree* rootTree_;
-
- //! A list of the events in the current experiment
- TEventList* eventList_;
-
- //! Stores the mapping from the leaf names to the vector indices
- LauNameIndexMap leafNames_;
-
- //! Stores the current event
- mutable LauEventData eventData_;
+ public:
+ //! Constructor
+ /*!
+ \param [in] rootFileName the name of the file containing the data
+ \param [in] rootTreeName the name of the tree containing the data
+ */
+ LauFitDataTree( const TString& rootFileName, const TString& rootTreeName );
+
+ //! Destructor
+ virtual ~LauFitDataTree();
+
+ //! Retrieve the file name
+ /*!
+ \return the file name
+ */
+ const TString& fileName() const { return rootFileName_; }
+
+ //! Retrieve the tree name
+ /*!
+ \return the tree name
+ */
+ const TString& treeName() const { return rootTreeName_; }
+
+ //! Find all of the branches in the tree
+ /*!
+ \returns true if sucessful, otherwise returns false and prints an error message
+ */
+ Bool_t findBranches();
+
+ //! Read all events from the tree
+ void readAllData();
+
+ //! Read events only for the given experiment
+ /*!
+ \param [in] iExpt the experiment to read
+ */
+ void readExperimentData( UInt_t iExpt );
+
+ //! Add fake events to the data
+ /*!
+ Used, for example, for storing the information on the histogram bin centres for calculating the DP smearing of mis-reconstructed events, see, for example, LauSimpleFitModel::splitSignalComponent and LauScfMap
+
+ \param [in] xCoords the values of m13 squared for the fake events
+ \param [in] yCoords the values of m23 squared for the fake events
+ */
+ void appendFakePoints( const std::vector<Double_t>& xCoords,
+ const std::vector<Double_t>& yCoords );
+
+ //! Obtain the number of branches in the tree
+ /*!
+ \return the number of branches
+ */
+ UInt_t nBranches() const;
+
+ //! Retrieve the number of events in the tree
+ /*!
+ \return the number of events in the tree
+ */
+ UInt_t nTreeEvents() const
+ {
+ return rootTree_ ? static_cast<UInt_t>( rootTree_->GetEntries() ) : 0;
+ }
+
+ //! Retrieve the number of events
+ /*!
+ \return the number of events in the current experiment if one is selected, otherwise the total number of events in the tree
+ */
+ UInt_t nEvents() const
+ {
+ return eventList_ ? static_cast<UInt_t>( eventList_->GetN() ) : this->nTreeEvents();
+ }
+
+ //! Retrieve the number of fake events
+ /*!
+ \return the number of fake events
+ */
+ UInt_t nFakeEvents() const { return fakeEvents_.size(); }
+
+ //! Retrieve the total number of events
+ /*!
+ \return the total number of events
+ */
+ UInt_t nTotalEvents() const { return this->nTreeEvents() + this->nFakeEvents(); }
+
+ //! Check if the named branch is stored
+ /*!
+ \param [in] name the name of the branch
+ \return true if the branch is stored, otherwise return false
+ */
+ Bool_t haveBranch( const TString& name ) const;
+
+ //! Retrieve the data for a given event
+ /*!
+ \param [in] iEvt the index of the event
+ \return the event data
+ */
+ const LauFitData& getData( UInt_t iEvt ) const;
+
+ //! Disable all branches
+ void disableAllBranches() const;
+
+ //! Enable all branches
+ void enableAllBranches() const;
+
+ //! Enable the named branch
+ /*!
+ \param [in] name the name of the branch
+ */
+ void enableBranch( const TString& name ) const;
+
+ //! Disable the named branch
+ /*!
+ \param [in] name the name of the branch
+ */
+ void disableBranch( const TString& name ) const;
+
+ protected:
+ //! Open the file and tree
+ void openFileAndTree();
+
+ //! Load events from the tree
+ /*!
+ If an event list is present, load only those events, otherwise load all events
+ */
+ void loadData();
+
+ private:
+ //! Copy constructor (not implemented)
+ LauFitDataTree( const LauFitDataTree& rhs );
+
+ //! Copy assignment operator (not implemented)
+ LauFitDataTree& operator=( const LauFitDataTree& rhs );
+
+ //! The type used to map the leaf names to the vector indices
+ typedef std::map<TString, UInt_t> LauNameIndexMap;
+
+ //! The type used to contain the data for each event
+ typedef std::vector<Double_t> LauEventData;
+
+ //! The type used to hold the leaves
+ typedef std::vector<TLeaf*> LauLeafList;
+
+ //! The name of the file containing the data
+ TString rootFileName_;
+
+ //! The name of the tree ocntaining the data
+ TString rootTreeName_;
+
+ //! The file containing the data
+ TFile* rootFile_;
+
+ //! The tree containing the data
+ TTree* rootTree_;
+
+ //! A list of the events in the current experiment
+ TEventList* eventList_;
+
+ //! Stores the mapping from the leaf names to the vector indices
+ LauNameIndexMap leafNames_;
+
+ //! Stores the current event
+ mutable LauEventData eventData_;
- //! Stores the current event (for external use)
- mutable LauFitData eventDataOut_;
+ //! Stores the current event (for external use)
+ mutable LauFitData eventDataOut_;
- //! The leaf objects
- LauLeafList leaves_;
+ //! The leaf objects
+ LauLeafList leaves_;
- //! The events read from the tree
- std::vector<LauEventData> treeEvents_;
+ //! The events read from the tree
+ std::vector<LauEventData> treeEvents_;
- //! The fake events, which are not from the tree
- std::vector<LauEventData> fakeEvents_;
+ //! The fake events, which are not from the tree
+ std::vector<LauEventData> fakeEvents_;
- ClassDef(LauFitDataTree, 0)
+ ClassDef( LauFitDataTree, 0 )
};
#endif
diff --git a/inc/LauFitNtuple.hh b/inc/LauFitNtuple.hh
index 482d368..b22eecf 100644
--- a/inc/LauFitNtuple.hh
+++ b/inc/LauFitNtuple.hh
@@ -1,138 +1,140 @@
/*
Copyright 2004 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauFitNtuple.hh
\brief File containing declaration of LauFitNtuple class.
*/
/*! \class LauFitNtuple
\brief Class to store the results from the fit into an ntuple
Class to store the results from the fit into an ntuple.
The fitted values and their errors are stored. In the case of toy MC, the true values are also stored, along with the pulls.
Derived quantities can also be stored, such as the fit fractions. What precisely is stored depends on the fit model.
*/
//****************************************************************************
// Class to store the results from the fit/toy MC into an ntuple
// -- CLASS DESCRIPTION [MISC] --
/// Class to store the results from the fit/toy MC into an ntuple
#ifndef LAU_FIT_NTUPLE
#define LAU_FIT_NTUPLE
-#include <set>
-#include <vector>
+#include "LauAbsFitter.hh"
#include "TMatrixDfwd.h"
#include "TString.h"
-#include "LauAbsFitter.hh"
+#include <set>
+#include <vector>
class TFile;
class TTree;
class LauParameter;
-
class LauFitNtuple {
- public:
- //! Constructor
- /*!
- \param [in] fileName the name for the ntuple
- \param [in] storeAsymErrors whether or not to store the asymmetric error variables
- */
- LauFitNtuple(const TString& fileName, Bool_t storeAsymErrors);
-
- //! Destructor
- virtual ~LauFitNtuple();
-
- //! Store the correlation matrix and other fit information
- /*!
- \param [in] iExpt the experiment number
- \param [in] fitStatus the status of the fit
- \param [in] covMatrix the fit covariance matrix
- */
- void storeCorrMatrix(const UInt_t iExpt, const LauAbsFitter::FitStatus& fitStatus, const TMatrixD& covMatrix);
-
- //! Store parameters and their errors
- /*!
- \param [in] fitVars the fit parameters
- \param [in] constrainedVars the names of fit parameters that are included in multi-dimensional constraints
- \param [in] extraVars variables in addition to the fit parameters, e.g. derived quantities such as fit fractions
- */
- void storeParsAndErrors(const std::vector<LauParameter*>& fitVars, const std::set<TString>& constrainedVars, const std::vector<LauParameter>& extraVars);
-
- //! Update the fit ntuple
- void updateFitNtuple();
-
- //! Write out fit results
- void writeOutFitResults();
-
- private:
- //! Copy constructor (not implemented)
- LauFitNtuple(const LauFitNtuple& rhs);
-
- //! Copy assignment operator (not implemented)
- LauFitNtuple& operator=(const LauFitNtuple& rhs);
-
- //! Name of root file
- TString rootFileName_;
- //! Root file
- TFile* rootFile_;
- //! Fit results
- TTree* fitResults_;
-
- //! Fit variables
- std::vector<LauParameter*> fitVars_;
- //! Fit variables that are included in a multi-dimensional constraint
- std::set<TString> constrainedVars_;
- //! Extra variables
- std::vector<LauParameter> extraVars_;
-
- //! Correlation matrix
- std::vector< std::vector<Double_t> > corrMatrix_;
-
- //! Flags whether the fit tree has been defined
- Bool_t definedFitTree_;
- //! Flags whether or not to store the asymmetric error information
- Bool_t storeAsymErrors_;
-
- //! Status of fit
- LauAbsFitter::FitStatus fitStatus_;
- //! Number of fit parameters
- UInt_t nFitPars_;
- //! Number of free parameters
- UInt_t nFreePars_;
- //! Number of extra parameters
- UInt_t nExtraPars_;
- //! Experiment number
- Int_t iExpt_;
-
- ClassDef(LauFitNtuple,0) // Fit/toyMC results ntuple
-
+ public:
+ //! Constructor
+ /*!
+ \param [in] fileName the name for the ntuple
+ \param [in] storeAsymErrors whether or not to store the asymmetric error variables
+ */
+ LauFitNtuple( const TString& fileName, Bool_t storeAsymErrors );
+
+ //! Destructor
+ virtual ~LauFitNtuple();
+
+ //! Store the correlation matrix and other fit information
+ /*!
+ \param [in] iExpt the experiment number
+ \param [in] fitStatus the status of the fit
+ \param [in] covMatrix the fit covariance matrix
+ */
+ void storeCorrMatrix( const UInt_t iExpt,
+ const LauAbsFitter::FitStatus& fitStatus,
+ const TMatrixD& covMatrix );
+
+ //! Store parameters and their errors
+ /*!
+ \param [in] fitVars the fit parameters
+ \param [in] constrainedVars the names of fit parameters that are included in multi-dimensional constraints
+ \param [in] extraVars variables in addition to the fit parameters, e.g. derived quantities such as fit fractions
+ */
+ void storeParsAndErrors( const std::vector<LauParameter*>& fitVars,
+ const std::set<TString>& constrainedVars,
+ const std::vector<LauParameter>& extraVars );
+
+ //! Update the fit ntuple
+ void updateFitNtuple();
+
+ //! Write out fit results
+ void writeOutFitResults();
+
+ private:
+ //! Copy constructor (not implemented)
+ LauFitNtuple( const LauFitNtuple& rhs );
+
+ //! Copy assignment operator (not implemented)
+ LauFitNtuple& operator=( const LauFitNtuple& rhs );
+
+ //! Name of root file
+ TString rootFileName_;
+ //! Root file
+ TFile* rootFile_;
+ //! Fit results
+ TTree* fitResults_;
+
+ //! Fit variables
+ std::vector<LauParameter*> fitVars_;
+ //! Fit variables that are included in a multi-dimensional constraint
+ std::set<TString> constrainedVars_;
+ //! Extra variables
+ std::vector<LauParameter> extraVars_;
+
+ //! Correlation matrix
+ std::vector<std::vector<Double_t>> corrMatrix_;
+
+ //! Flags whether the fit tree has been defined
+ Bool_t definedFitTree_;
+ //! Flags whether or not to store the asymmetric error information
+ Bool_t storeAsymErrors_;
+
+ //! Status of fit
+ LauAbsFitter::FitStatus fitStatus_;
+ //! Number of fit parameters
+ UInt_t nFitPars_;
+ //! Number of free parameters
+ UInt_t nFreePars_;
+ //! Number of extra parameters
+ UInt_t nExtraPars_;
+ //! Experiment number
+ Int_t iExpt_;
+
+ ClassDef( LauFitNtuple, 0 ) // Fit/toyMC results ntuple
};
#endif
diff --git a/inc/LauFitObject.hh b/inc/LauFitObject.hh
index 1c99d99..4957d23 100644
--- a/inc/LauFitObject.hh
+++ b/inc/LauFitObject.hh
@@ -1,405 +1,421 @@
/*
Copyright 2013 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauFitObject.hh
\brief File containing declaration of LauFitObject class.
*/
#ifndef LAU_FIT_OBJECT
#define LAU_FIT_OBJECT
-#include <set>
-#include <vector>
+#include "LauAbsFitter.hh"
+#include "LauFormulaPar.hh"
#include "TMatrixD.h"
#include "TObject.h"
#include "TString.h"
#include "TVectorD.h"
-#include "LauAbsFitter.hh"
-#include "LauFormulaPar.hh"
+#include <set>
+#include <vector>
/*! \class LauFitObject
\brief The abstract interface for the objects that control the calculation of the likelihood.
*/
class LauFitObject : public TObject {
- public:
- //! Destructor
- virtual ~LauFitObject() = default;
-
- //! Turn on or off the computation of asymmetric errors (e.g. MINOS routine in Minuit)
- /*!
- \param [in] useAsymmErrors boolean specifying whether or not the computation of asymmetric errors is enabled
- */
- void useAsymmFitErrors(Bool_t useAsymmErrors) {useAsymmFitErrors_ = useAsymmErrors;}
-
- //! Report whether or not calculation of asymmetric errors is enabled
- Bool_t useAsymmFitErrors() const {return useAsymmFitErrors_;}
-
- //! Turn on or off the two stage fit
- /*!
- The two-stage fit allows certain parameters to be fixed
- in one stage and floated in another stage of the fit.
- Can be used, for example, in a CP fit where the
- CP-parameters are fixed to zero in the first stage
- (while the CP-average parameters are determined), then
- floated in the second.
-
- \param [in] doTwoStageFit boolean specifying whether or not the two-stage fit should be enabled
- */
- void twoStageFit(Bool_t doTwoStageFit) {twoStageFit_ = doTwoStageFit;}
-
- //! Report whether the two-stage fit is enabled
- Bool_t twoStageFit() const {return twoStageFit_;}
-
- //! Mark that the fit is calculating asymmetric errors
- /*!
- This is called by the fitter interface to mark when
- entering and exiting the asymmetric error calculation.
-
- \param [in] inAsymErrCalc boolean marking that the fit is calculating the asymmetric errors
- */
- virtual void withinAsymErrorCalc(const Bool_t inAsymErrCalc) {withinAsymErrorCalc_ = inAsymErrCalc;}
-
- //! Query whether the fit is calculating the asymmetric errors
- /*!
- \return kTRUE if the fit is calculating the asymmetric errors, kFALSE otherwise
- */
- Bool_t withinAsymErrorCalc() const {return withinAsymErrorCalc_;}
-
- //! Set the number of experiments, the first experiment, and whether this is toy
- /*!
- The default settings are nExperiments = 1, firstExperiment = 0, toyExpts = kFALSE,
- i.e. the settings for fitting a single data sample.
- As such, this function only needs to be called if generating/fitting toy samples.
-
- \param [in] nExperiments the number of experiments
- \param [in] firstExperiment the number of the first experiment
- \param [in] toyExpts whether this is toy - determines whether to generate per-experiment means for each Gaussian constraint, as per arXiv:1210.7141
- */
- void setNExpts(UInt_t nExperiments, UInt_t firstExperiment, Bool_t toyExpts);
-
- //! Obtain the total number of events in the current experiment
- UInt_t eventsPerExpt() const {return evtsPerExpt_;}
-
- //! Obtain the number of experiments
- UInt_t nExpt() const {return nExpt_;}
-
- //! Obtain the number of the first experiment
- UInt_t firstExpt() const {return firstExpt_;}
-
- //! Obtain the number of the current experiment
- UInt_t iExpt() const {return iExpt_;}
-
- //! Obtain whether this is toy
- Bool_t toyExpts() const {return toyExpts_;}
-
- //! This function sets the parameter values from Minuit
- /*!
- This function has to be public since it is called from the global FCN.
- It should not be called otherwise!
-
- \param [in] par an array storing the various parameter values
- \param [in] npar the number of free parameters
- */
- virtual void setParsFromMinuit(Double_t* par, Int_t npar) = 0;
-
- //! Calculate the new value of the negative log likelihood
- /*!
- This function has to be public since it is called from the global FCN.
- It should not be called otherwise!
- */
- virtual Double_t getTotNegLogLikelihood() = 0;
-
- //! Store constraint information for fit parameters
- /*!
- \deprecated Renamed to addFormulaConstraint, please switch to use this. Will be dropped in next major release.
-
- \param [in] formula the formula to be used in the LauFormulaPar
- \param [in] pars a vector of LauParameter names to be used in the Formula, in the order specified by the formula
- \param [in] mean the value of the mean of the Gaussian constraint
- \param [in] width the value of the width of the Gaussian constraint
- */
- void addConstraint(const TString& formula, const std::vector<TString>& pars, const Double_t mean, const Double_t width);
-
- //! Store constraint information for fit parameters
- /*!
- \param [in] formula the formula to be used in the LauFormulaPar
- \param [in] pars a vector of LauParameter names to be used in the Formula, in the order specified by the formula
- \param [in] mean the value of the mean of the Gaussian constraint
- \param [in] width the value of the width of the Gaussian constraint
- */
- void addFormulaConstraint(const TString& formula, const std::vector<TString>& pars, const Double_t mean, const Double_t width);
-
- //! Store n-dimensional constraint information for fit parameters
- /*!
- \param [in] pars a vector of LauParameter names to be used in the constraint
- \param [in] means the values of the means of the Gaussian constraint
- \param [in] covMat the covariance matrix of the parameters of the Gaussian constraint
- */
- void addMultiDimConstraint(const std::vector<TString>& pars, const TVectorD& means, const TMatrixD& covMat);
-
- protected:
- //! Constructor
- LauFitObject();
-
- /*!
- \enum ConstraintType
- \brief Enumeration of the different types of constraint
- */
- enum class ConstraintType {
- Formula, //!< Formula-based constraint on a combination of parameters
- MultDim //!< Multi-dimensional constraint on several parameters
- };
-
- // Setup a struct to store information on constrained fit parameters
- /*!
- \struct FormulaConstraint
- \brief Struct to store formula-based constraint information
- */
- struct FormulaConstraint {
- //! The formula to be used in the LauFormulaPar
- TString formula_;
- //! The list of LauParameter names to be used in the LauFormulaPar
- std::vector<TString> conPars_;
- //! The mean value of the Gaussian constraint to be applied
- Double_t mean_;
- //! The width of the Gaussian constraint to be applied
- Double_t width_;
- //! The LauFormulaPar pointer
- std::unique_ptr<LauFormulaPar> formulaPar_;
- };
-
- // Setup a class to store information on n-dimensional constrained fit parameters
- /*!
- \class MultiDimConstraint
- \brief Class to store n-dimensional constraint information
- */
- class MultiDimConstraint {
- public:
- //! Default constructor
- MultiDimConstraint() = default;
-
- //! Constructor
- MultiDimConstraint( const std::vector<TString>& parNames, const TVectorD& means, const TMatrixD& covMat );
-
- //! Get the penalty term
- Double_t constraintPenalty() const;
-
- //! Generate per-experiment constraint means
- void generateConstraintMeans();
-
- //! The list of LauParameter names to be used in the constraint
- std::vector<TString> conPars_;
- //! The true mean values of the constraint
- TVectorD trueMeans_;
- //! The per-experiment mean values of the constraint
- TVectorD means_;
- //! The inverse covariance matrix of the parameters
- TMatrixD invCovMat_;
- //! The Cholesky Decomposition of the covariance matrix of the parameters
- TMatrixD sqrtCovMat_;
- //! The LauParameters used in the constraints
- std::vector<LauParameter*> conLauPars_;
- };
-
- //! Check if parameters names for constraints have already been used elsewhere
- /*!
- Also adds the names to the appropriate set
-
- \param [in] names a vector of parameter names
- \param [in] conType the type of constraint being added - determines which set to which to add the parmaeters
- \return kTRUE if no repetitions found, kFALSE if one or more repetitions found
- */
- Bool_t checkRepetition(const std::vector<TString>& names, const ConstraintType conType);
-
- //! Generate per-experiment mean for each Gaussian constraint
- /*!
- Generates a new mean for all Gaussian constraints.
- The constraints on a single fit parameter and the
- formula-based constraints are provided as the argument,
- while the multi-dimensional constraints are already a
- member variable.
-
- \param [in,out] conVars the fit parameter and formula-based constraints
- */
- void generateConstraintMeans( std::vector<LauAbsRValue*>& conVars );
-
- //! Const access to the formula constraints store
- const std::vector<FormulaConstraint>& formulaConstraints() const {return formulaConstraints_;}
-
- //! Access to the formula constraints store
- std::vector<FormulaConstraint>& formulaConstraints() {return formulaConstraints_;}
-
- //! Const access to the ND constraints store
- const std::vector<MultiDimConstraint>& multiDimConstraints() const {return multiDimConstraints_;}
-
- //! Access to the ND constraints store
- std::vector<MultiDimConstraint>& multiDimConstraints() {return multiDimConstraints_;}
-
- //! Const access to the parameter names used in formula constraints
- const std::set<TString>& formulaConstrainedPars() const {return formulaConstrainedPars_;}
-
- //! Access to the parameter names used in formula constraints
- std::set<TString>& formulaConstrainedPars() {return formulaConstrainedPars_;}
-
- //! Const access to the parameter names used in ND constraints
- const std::set<TString>& multiDimConstrainedPars() const {return multiDimConstrainedPars_;}
-
- //! Access to the parameter names used in ND constraints
- std::set<TString>& multiDimConstrainedPars() {return multiDimConstrainedPars_;}
-
- //! Reset the good/bad fit counters
- void resetFitCounters();
-
- //! Set the ID of the current experiment
- /*!
- \param [in] curExpt the experiment number
- */
- void setCurrentExperiment( const UInt_t curExpt ) { iExpt_ = curExpt; }
-
- //! Indicate the start of a new fit
- /*!
- \param [in] nPars the total number of fit parameters
- \param [in] nFreePars the number of free fit parameters
- */
- void startNewFit( const UInt_t nPars, const UInt_t nFreePars );
+ public:
+ //! Destructor
+ virtual ~LauFitObject() = default;
+
+ //! Turn on or off the computation of asymmetric errors (e.g. MINOS routine in Minuit)
+ /*!
+ \param [in] useAsymmErrors boolean specifying whether or not the computation of asymmetric errors is enabled
+ */
+ void useAsymmFitErrors( Bool_t useAsymmErrors ) { useAsymmFitErrors_ = useAsymmErrors; }
+
+ //! Report whether or not calculation of asymmetric errors is enabled
+ Bool_t useAsymmFitErrors() const { return useAsymmFitErrors_; }
+
+ //! Turn on or off the two stage fit
+ /*!
+ The two-stage fit allows certain parameters to be fixed
+ in one stage and floated in another stage of the fit.
+ Can be used, for example, in a CP fit where the
+ CP-parameters are fixed to zero in the first stage
+ (while the CP-average parameters are determined), then
+ floated in the second.
+
+ \param [in] doTwoStageFit boolean specifying whether or not the two-stage fit should be enabled
+ */
+ void twoStageFit( Bool_t doTwoStageFit ) { twoStageFit_ = doTwoStageFit; }
+
+ //! Report whether the two-stage fit is enabled
+ Bool_t twoStageFit() const { return twoStageFit_; }
+
+ //! Mark that the fit is calculating asymmetric errors
+ /*!
+ This is called by the fitter interface to mark when
+ entering and exiting the asymmetric error calculation.
+
+ \param [in] inAsymErrCalc boolean marking that the fit is calculating the asymmetric errors
+ */
+ virtual void withinAsymErrorCalc( const Bool_t inAsymErrCalc )
+ {
+ withinAsymErrorCalc_ = inAsymErrCalc;
+ }
+
+ //! Query whether the fit is calculating the asymmetric errors
+ /*!
+ \return kTRUE if the fit is calculating the asymmetric errors, kFALSE otherwise
+ */
+ Bool_t withinAsymErrorCalc() const { return withinAsymErrorCalc_; }
+
+ //! Set the number of experiments, the first experiment, and whether this is toy
+ /*!
+ The default settings are nExperiments = 1, firstExperiment = 0, toyExpts = kFALSE,
+ i.e. the settings for fitting a single data sample.
+ As such, this function only needs to be called if generating/fitting toy samples.
+
+ \param [in] nExperiments the number of experiments
+ \param [in] firstExperiment the number of the first experiment
+ \param [in] toyExpts whether this is toy - determines whether to generate per-experiment means for each Gaussian constraint, as per arXiv:1210.7141
+ */
+ void setNExpts( UInt_t nExperiments, UInt_t firstExperiment, Bool_t toyExpts );
+
+ //! Obtain the total number of events in the current experiment
+ UInt_t eventsPerExpt() const { return evtsPerExpt_; }
+
+ //! Obtain the number of experiments
+ UInt_t nExpt() const { return nExpt_; }
+
+ //! Obtain the number of the first experiment
+ UInt_t firstExpt() const { return firstExpt_; }
+
+ //! Obtain the number of the current experiment
+ UInt_t iExpt() const { return iExpt_; }
+
+ //! Obtain whether this is toy
+ Bool_t toyExpts() const { return toyExpts_; }
+
+ //! This function sets the parameter values from Minuit
+ /*!
+ This function has to be public since it is called from the global FCN.
+ It should not be called otherwise!
+
+ \param [in] par an array storing the various parameter values
+ \param [in] npar the number of free parameters
+ */
+ virtual void setParsFromMinuit( Double_t* par, Int_t npar ) = 0;
+
+ //! Calculate the new value of the negative log likelihood
+ /*!
+ This function has to be public since it is called from the global FCN.
+ It should not be called otherwise!
+ */
+ virtual Double_t getTotNegLogLikelihood() = 0;
+
+ //! Store constraint information for fit parameters
+ /*!
+ \deprecated Renamed to addFormulaConstraint, please switch to use this. Will be dropped in next major release.
+
+ \param [in] formula the formula to be used in the LauFormulaPar
+ \param [in] pars a vector of LauParameter names to be used in the Formula, in the order specified by the formula
+ \param [in] mean the value of the mean of the Gaussian constraint
+ \param [in] width the value of the width of the Gaussian constraint
+ */
+ void addConstraint( const TString& formula,
+ const std::vector<TString>& pars,
+ const Double_t mean,
+ const Double_t width );
+
+ //! Store constraint information for fit parameters
+ /*!
+ \param [in] formula the formula to be used in the LauFormulaPar
+ \param [in] pars a vector of LauParameter names to be used in the Formula, in the order specified by the formula
+ \param [in] mean the value of the mean of the Gaussian constraint
+ \param [in] width the value of the width of the Gaussian constraint
+ */
+ void addFormulaConstraint( const TString& formula,
+ const std::vector<TString>& pars,
+ const Double_t mean,
+ const Double_t width );
+
+ //! Store n-dimensional constraint information for fit parameters
+ /*!
+ \param [in] pars a vector of LauParameter names to be used in the constraint
+ \param [in] means the values of the means of the Gaussian constraint
+ \param [in] covMat the covariance matrix of the parameters of the Gaussian constraint
+ */
+ void addMultiDimConstraint( const std::vector<TString>& pars,
+ const TVectorD& means,
+ const TMatrixD& covMat );
+
+ protected:
+ //! Constructor
+ LauFitObject();
+
+ /*!
+ \enum ConstraintType
+ \brief Enumeration of the different types of constraint
+ */
+ enum class ConstraintType {
+ Formula, //!< Formula-based constraint on a combination of parameters
+ MultDim //!< Multi-dimensional constraint on several parameters
+ };
+
+ // Setup a struct to store information on constrained fit parameters
+ /*!
+ \struct FormulaConstraint
+ \brief Struct to store formula-based constraint information
+ */
+ struct FormulaConstraint {
+ //! The formula to be used in the LauFormulaPar
+ TString formula_;
+ //! The list of LauParameter names to be used in the LauFormulaPar
+ std::vector<TString> conPars_;
+ //! The mean value of the Gaussian constraint to be applied
+ Double_t mean_;
+ //! The width of the Gaussian constraint to be applied
+ Double_t width_;
+ //! The LauFormulaPar pointer
+ std::unique_ptr<LauFormulaPar> formulaPar_;
+ };
+
+ // Setup a class to store information on n-dimensional constrained fit parameters
+ /*!
+ \class MultiDimConstraint
+ \brief Class to store n-dimensional constraint information
+ */
+ class MultiDimConstraint {
+ public:
+ //! Default constructor
+ MultiDimConstraint() = default;
+
+ //! Constructor
+ MultiDimConstraint( const std::vector<TString>& parNames,
+ const TVectorD& means,
+ const TMatrixD& covMat );
+
+ //! Get the penalty term
+ Double_t constraintPenalty() const;
+
+ //! Generate per-experiment constraint means
+ void generateConstraintMeans();
+
+ //! The list of LauParameter names to be used in the constraint
+ std::vector<TString> conPars_;
+ //! The true mean values of the constraint
+ TVectorD trueMeans_;
+ //! The per-experiment mean values of the constraint
+ TVectorD means_;
+ //! The inverse covariance matrix of the parameters
+ TMatrixD invCovMat_;
+ //! The Cholesky Decomposition of the covariance matrix of the parameters
+ TMatrixD sqrtCovMat_;
+ //! The LauParameters used in the constraints
+ std::vector<LauParameter*> conLauPars_;
+ };
+
+ //! Check if parameters names for constraints have already been used elsewhere
+ /*!
+ Also adds the names to the appropriate set
+
+ \param [in] names a vector of parameter names
+ \param [in] conType the type of constraint being added - determines which set to which to add the parmaeters
+ \return kTRUE if no repetitions found, kFALSE if one or more repetitions found
+ */
+ Bool_t checkRepetition( const std::vector<TString>& names, const ConstraintType conType );
+
+ //! Generate per-experiment mean for each Gaussian constraint
+ /*!
+ Generates a new mean for all Gaussian constraints.
+ The constraints on a single fit parameter and the
+ formula-based constraints are provided as the argument,
+ while the multi-dimensional constraints are already a
+ member variable.
+
+ \param [in,out] conVars the fit parameter and formula-based constraints
+ */
+ void generateConstraintMeans( std::vector<LauAbsRValue*>& conVars );
+
+ //! Const access to the formula constraints store
+ const std::vector<FormulaConstraint>& formulaConstraints() const { return formulaConstraints_; }
+
+ //! Access to the formula constraints store
+ std::vector<FormulaConstraint>& formulaConstraints() { return formulaConstraints_; }
+
+ //! Const access to the ND constraints store
+ const std::vector<MultiDimConstraint>& multiDimConstraints() const
+ {
+ return multiDimConstraints_;
+ }
+
+ //! Access to the ND constraints store
+ std::vector<MultiDimConstraint>& multiDimConstraints() { return multiDimConstraints_; }
+
+ //! Const access to the parameter names used in formula constraints
+ const std::set<TString>& formulaConstrainedPars() const { return formulaConstrainedPars_; }
+
+ //! Access to the parameter names used in formula constraints
+ std::set<TString>& formulaConstrainedPars() { return formulaConstrainedPars_; }
+
+ //! Const access to the parameter names used in ND constraints
+ const std::set<TString>& multiDimConstrainedPars() const { return multiDimConstrainedPars_; }
+
+ //! Access to the parameter names used in ND constraints
+ std::set<TString>& multiDimConstrainedPars() { return multiDimConstrainedPars_; }
+
+ //! Reset the good/bad fit counters
+ void resetFitCounters();
+
+ //! Set the ID of the current experiment
+ /*!
+ \param [in] curExpt the experiment number
+ */
+ void setCurrentExperiment( const UInt_t curExpt ) { iExpt_ = curExpt; }
+
+ //! Indicate the start of a new fit
+ /*!
+ \param [in] nPars the total number of fit parameters
+ \param [in] nFreePars the number of free fit parameters
+ */
+ void startNewFit( const UInt_t nPars, const UInt_t nFreePars );
- //! Set the number of events in the current experiment
- void eventsPerExpt(UInt_t nEvents) {evtsPerExpt_ = nEvents;}
+ //! Set the number of events in the current experiment
+ void eventsPerExpt( UInt_t nEvents ) { evtsPerExpt_ = nEvents; }
- //! Access the worst log likelihood found so far
- Double_t worstLogLike() const {return worstLogLike_;}
+ //! Access the worst log likelihood found so far
+ Double_t worstLogLike() const { return worstLogLike_; }
- //! Set a new value for the worst log likelihood
- /*!
- \param [in] newWorstLogLike the new value of the worst log likelihood
- */
- void worstLogLike( const Double_t newWorstLogLike ) {worstLogLike_ = newWorstLogLike;}
+ //! Set a new value for the worst log likelihood
+ /*!
+ \param [in] newWorstLogLike the new value of the worst log likelihood
+ */
+ void worstLogLike( const Double_t newWorstLogLike ) { worstLogLike_ = newWorstLogLike; }
- //! Store fit status information
- /*!
- \param [in] status the status information of the fit
- \param [in] covMatrix the fit covariance matrix
- */
- void storeFitStatus( const LauAbsFitter::FitStatus& status, const TMatrixD& covMatrix );
+ //! Store fit status information
+ /*!
+ \param [in] status the status information of the fit
+ \param [in] covMatrix the fit covariance matrix
+ */
+ void storeFitStatus( const LauAbsFitter::FitStatus& status, const TMatrixD& covMatrix );
- //! Access the total number of fit parameters
- UInt_t nTotParams() const {return nParams_;}
+ //! Access the total number of fit parameters
+ UInt_t nTotParams() const { return nParams_; }
- //! Access the total number of fit parameters
- UInt_t nFreeParams() const {return nFreeParams_;}
+ //! Access the total number of fit parameters
+ UInt_t nFreeParams() const { return nFreeParams_; }
- //! Access the fit status information
- const LauAbsFitter::FitStatus& fitStatus() const {return fitStatus_;}
+ //! Access the fit status information
+ const LauAbsFitter::FitStatus& fitStatus() const { return fitStatus_; }
- //! Access the current NLL value
- Double_t nll() const {return fitStatus_.NLL;}
+ //! Access the current NLL value
+ Double_t nll() const { return fitStatus_.NLL; }
- //! Access the current EDM value
- Double_t edm() const {return fitStatus_.EDM;}
+ //! Access the current EDM value
+ Double_t edm() const { return fitStatus_.EDM; }
- //! Access the fit status code
- Int_t statusCode() const {return fitStatus_.status;}
+ //! Access the fit status code
+ Int_t statusCode() const { return fitStatus_.status; }
- //! Access the fit covariance matrix
- const TMatrixD& covarianceMatrix() const {return covMatrix_;}
+ //! Access the fit covariance matrix
+ const TMatrixD& covarianceMatrix() const { return covMatrix_; }
- //! Access the number of successful fits
- UInt_t numberOKFits() const {return numberOKFits_;}
+ //! Access the number of successful fits
+ UInt_t numberOKFits() const { return numberOKFits_; }
- //! Access the number of failed fits
- UInt_t numberBadFits() const {return numberBadFits_;}
+ //! Access the number of failed fits
+ UInt_t numberBadFits() const { return numberBadFits_; }
- private:
- //! Copy constructor (not implemented)
- LauFitObject(const LauFitObject& rhs);
+ private:
+ //! Copy constructor (not implemented)
+ LauFitObject( const LauFitObject& rhs );
- //! Copy assignment operator (not implemented)
- LauFitObject& operator=(const LauFitObject& rhs);
+ //! Copy assignment operator (not implemented)
+ LauFitObject& operator=( const LauFitObject& rhs );
- //! Store the constraints for fit parameters until initialisation is complete
- std::vector<FormulaConstraint> formulaConstraints_;
+ //! Store the constraints for fit parameters until initialisation is complete
+ std::vector<FormulaConstraint> formulaConstraints_;
- //! Store the ND constraints for fit parameters until initialisation is complete
- std::vector<MultiDimConstraint> multiDimConstraints_;
+ //! Store the ND constraints for fit parameters until initialisation is complete
+ std::vector<MultiDimConstraint> multiDimConstraints_;
- //! Store the names of all parameters used in all formula constraints
- std::set<TString> formulaConstrainedPars_;
+ //! Store the names of all parameters used in all formula constraints
+ std::set<TString> formulaConstrainedPars_;
- //! Store the names of all parameters used in all multi-dimensional constraints
- std::set<TString> multiDimConstrainedPars_;
+ //! Store the names of all parameters used in all multi-dimensional constraints
+ std::set<TString> multiDimConstrainedPars_;
- //! Option to perform a two stage fit
- Bool_t twoStageFit_;
+ //! Option to perform a two stage fit
+ Bool_t twoStageFit_;
- //! Option to use asymmetric errors
- Bool_t useAsymmFitErrors_;
+ //! Option to use asymmetric errors
+ Bool_t useAsymmFitErrors_;
- //! The number of fit parameters
- UInt_t nParams_;
+ //! The number of fit parameters
+ UInt_t nParams_;
- //! The number of free fit parameters
- UInt_t nFreeParams_;
+ //! The number of free fit parameters
+ UInt_t nFreeParams_;
- //! Flag to indicate if the asymmetric error calculation (e.g. MINOS) is currently running
- Bool_t withinAsymErrorCalc_;
+ //! Flag to indicate if the asymmetric error calculation (e.g. MINOS) is currently running
+ Bool_t withinAsymErrorCalc_;
- //! Flag to indicate whether this is toy
- /*! Determines whether to generate per-experiment means for each Gaussian constraint, as per arXiv:1210.7141 */
- Bool_t toyExpts_;
+ //! Flag to indicate whether this is toy
+ /*! Determines whether to generate per-experiment means for each Gaussian constraint, as per arXiv:1210.7141 */
+ Bool_t toyExpts_;
- //! The number of the first experiment to consider
- UInt_t firstExpt_;
+ //! The number of the first experiment to consider
+ UInt_t firstExpt_;
- //! The number of experiments to consider
- UInt_t nExpt_;
+ //! The number of experiments to consider
+ UInt_t nExpt_;
- //! The current experiment number
- UInt_t iExpt_;
+ //! The current experiment number
+ UInt_t iExpt_;
- //! The number of events in the current experiment
- UInt_t evtsPerExpt_;
+ //! The number of events in the current experiment
+ UInt_t evtsPerExpt_;
- //! The status of the current fit
- LauAbsFitter::FitStatus fitStatus_;
+ //! The status of the current fit
+ LauAbsFitter::FitStatus fitStatus_;
- //! The worst log likelihood value found so far
- Double_t worstLogLike_;
+ //! The worst log likelihood value found so far
+ Double_t worstLogLike_;
- //! The fit covariance matrix
- TMatrixD covMatrix_;
+ //! The fit covariance matrix
+ TMatrixD covMatrix_;
- //! The number of successful fits
- UInt_t numberOKFits_;
+ //! The number of successful fits
+ UInt_t numberOKFits_;
- //! The number of fit failures
- UInt_t numberBadFits_;
+ //! The number of fit failures
+ UInt_t numberBadFits_;
- ClassDef(LauFitObject,0)
+ ClassDef( LauFitObject, 0 )
};
#endif
diff --git a/inc/LauFitter.hh b/inc/LauFitter.hh
index 67edbe0..ab99d53 100644
--- a/inc/LauFitter.hh
+++ b/inc/LauFitter.hh
@@ -1,119 +1,119 @@
/*
Copyright 2005 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauFitter.hh
\brief File containing declaration of LauFitter class.
*/
#ifndef LAU_FITTER
#define LAU_FITTER
#include "LauPrint.hh"
#include "Rtypes.h"
#include "TString.h"
#include <memory>
class LauAbsFitter;
/*! \class LauFitter
\brief Factory class for creating and providing access to the fitter.
The fitter type and verbosity can be set before first access to determine which fitter is used.
*/
class LauFitter final {
- public:
- //! The types of fitter available
- enum class Type {
- Minuit /*!< the Minuit fitter */
- };
-
- //! Set the type of the fitter
- /*!
- \param [in] type the type of the fitter (default set to Minuit)
- */
- static void setFitterType( const Type type );
-
- //! Set the verbosity level of the fitter
- /*!
- \param [in] level the level of verbosity of the fitter (default set to Standard)
- */
- static void setFitterVerbosity( const LauOutputLevel level );
-
- //! Set the maximum number of parameters for the fitter
- /*!
- \param [in] maxPars the maximum number of parameters for the fitter (default set to 100)
- */
- static void setFitterMaxPars( const UInt_t maxPars );
-
- //! Method that provides access to the singleton fitter
- /*!
- \return a reference to a singleton LauAbsFitter object
- */
- static LauAbsFitter& fitter();
-
- //! Destroy the current fitter
- /*!
- A new fitter will be created on the next call to LauFitter::fitter
- */
- static void destroyFitter();
-
- private:
- //! Constructor
- LauFitter() = default;
-
- //! Destructor
- ~LauFitter() = default;
-
- //! Copy constructor (deleted)
- LauFitter( const LauFitter& ) = delete;
-
- //! Move constructor (deleted)
- LauFitter( LauFitter&& ) = delete;
-
- //! Copy assignment operator (deleted)
- LauFitter& operator=( const LauFitter& ) = delete;
-
- //! Move assignment operator (deleted)
- LauFitter& operator=( LauFitter&& ) = delete;
-
- //! Pointer to the singleton fitter instance
- static std::unique_ptr<LauAbsFitter> theInstance_;
-
- //! The fitter type
- static Type fitterType_;
-
- //! The fitter verbosity
- static LauOutputLevel fitterVerbosity_;
-
- //! The maximum number of parameters for the fitter
- static UInt_t fitterMaxPars_;
-
- ClassDef(LauFitter,0);
+ public:
+ //! The types of fitter available
+ enum class Type {
+ Minuit /*!< the Minuit fitter */
+ };
+
+ //! Set the type of the fitter
+ /*!
+ \param [in] type the type of the fitter (default set to Minuit)
+ */
+ static void setFitterType( const Type type );
+
+ //! Set the verbosity level of the fitter
+ /*!
+ \param [in] level the level of verbosity of the fitter (default set to Standard)
+ */
+ static void setFitterVerbosity( const LauOutputLevel level );
+
+ //! Set the maximum number of parameters for the fitter
+ /*!
+ \param [in] maxPars the maximum number of parameters for the fitter (default set to 100)
+ */
+ static void setFitterMaxPars( const UInt_t maxPars );
+
+ //! Method that provides access to the singleton fitter
+ /*!
+ \return a reference to a singleton LauAbsFitter object
+ */
+ static LauAbsFitter& fitter();
+
+ //! Destroy the current fitter
+ /*!
+ A new fitter will be created on the next call to LauFitter::fitter
+ */
+ static void destroyFitter();
+
+ private:
+ //! Constructor
+ LauFitter() = default;
+
+ //! Destructor
+ ~LauFitter() = default;
+
+ //! Copy constructor (deleted)
+ LauFitter( const LauFitter& ) = delete;
+
+ //! Move constructor (deleted)
+ LauFitter( LauFitter&& ) = delete;
+
+ //! Copy assignment operator (deleted)
+ LauFitter& operator=( const LauFitter& ) = delete;
+
+ //! Move assignment operator (deleted)
+ LauFitter& operator=( LauFitter&& ) = delete;
+
+ //! Pointer to the singleton fitter instance
+ static std::unique_ptr<LauAbsFitter> theInstance_;
+
+ //! The fitter type
+ static Type fitterType_;
+
+ //! The fitter verbosity
+ static LauOutputLevel fitterVerbosity_;
+
+ //! The maximum number of parameters for the fitter
+ static UInt_t fitterMaxPars_;
+
+ ClassDef( LauFitter, 0 );
};
#endif
diff --git a/inc/LauFlatNR.hh b/inc/LauFlatNR.hh
index b1ebf69..40833e5 100644
--- a/inc/LauFlatNR.hh
+++ b/inc/LauFlatNR.hh
@@ -1,88 +1,90 @@
/*
Copyright 2014 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauFlatNR.hh
\brief File containing declaration of LauFlatNR class.
*/
/*! \class LauFlatNR
\brief Class for defining a uniform nonresonant amplitude
*/
#ifndef LAU_FLAT_NR
#define LAU_FLAT_NR
-#include "TString.h"
-
#include "LauAbsResonance.hh"
#include "LauComplex.hh"
-class LauKinematics;
+#include "TString.h"
+class LauKinematics;
class LauFlatNR : public LauAbsResonance {
- public:
- //! Constructor
- /*!
- \param [in] resInfo the object containing information on the resonance name, mass, width, spin, charge, etc.
- \param [in] resPairAmpInt the number of the daughter not produced by the resonance
- \param [in] daughters the daughter particles
- */
- LauFlatNR(LauResonanceInfo* resInfo, const Int_t resPairAmpInt, const LauDaughters* daughters);
-
- //! Destructor
- virtual ~LauFlatNR();
-
- //! Initialise the model
- virtual void initialise();
-
- //! Complex resonant amplitude
- /*!
- /param [in] kinematics kinematic parameters of the parent and daughter particles
- /return the complex amplitude
- */
- virtual LauComplex amplitude(const LauKinematics* kinematics);
-
- //! Get the resonance model type
- /*!
- \return the resonance model type
- */
- virtual LauAbsResonance::LauResonanceModel getResonanceModel() const {return LauAbsResonance::FlatNR;}
-
- protected:
- //! This is not meant to be called
- virtual LauComplex resAmp(Double_t mass, Double_t spinTerm);
-
- private:
- //! Copy constructor (not implemented)
- LauFlatNR(const LauFlatNR& rhs);
-
- //! Copy assignment operator (not implemented)
- LauFlatNR& operator=(const LauFlatNR& rhs);
-
- ClassDef(LauFlatNR,0) // Uniform non-resonant model
+ public:
+ //! Constructor
+ /*!
+ \param [in] resInfo the object containing information on the resonance name, mass, width, spin, charge, etc.
+ \param [in] resPairAmpInt the number of the daughter not produced by the resonance
+ \param [in] daughters the daughter particles
+ */
+ LauFlatNR( LauResonanceInfo* resInfo, const Int_t resPairAmpInt, const LauDaughters* daughters );
+
+ //! Destructor
+ virtual ~LauFlatNR();
+
+ //! Initialise the model
+ virtual void initialise();
+
+ //! Complex resonant amplitude
+ /*!
+ \param [in] kinematics kinematic parameters of the parent and daughter particles
+ \return the complex amplitude
+ */
+ virtual LauComplex amplitude( const LauKinematics* kinematics );
+
+ //! Get the resonance model type
+ /*!
+ \return the resonance model type
+ */
+ virtual LauAbsResonance::LauResonanceModel getResonanceModel() const
+ {
+ return LauAbsResonance::FlatNR;
+ }
+
+ protected:
+ //! This is not meant to be called
+ virtual LauComplex resAmp( Double_t mass, Double_t spinTerm );
+
+ private:
+ //! Copy constructor (not implemented)
+ LauFlatNR( const LauFlatNR& rhs );
+
+ //! Copy assignment operator (not implemented)
+ LauFlatNR& operator=( const LauFlatNR& rhs );
+
+ ClassDef( LauFlatNR, 0 ) // Uniform non-resonant model
};
#endif
diff --git a/inc/LauFlatteRes.hh b/inc/LauFlatteRes.hh
index b6c20d0..0875257 100644
--- a/inc/LauFlatteRes.hh
+++ b/inc/LauFlatteRes.hh
@@ -1,171 +1,173 @@
/*
Copyright 2004 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauFlatteRes.hh
\brief File containing declaration of LauFlatteRes class.
*/
/*! \class LauFlatteRes
\brief Class for defining the Flatte resonance model
Class for defining the Flatte resonance model.
For use with the f_0(980) resonance.
*/
#ifndef LAU_FLATTE_RES
#define LAU_FLATTE_RES
-#include "TString.h"
-
-#include "LauComplex.hh"
#include "LauAbsResonance.hh"
+#include "LauComplex.hh"
+#include "TString.h"
class LauFlatteRes : public LauAbsResonance {
- public:
- //! Constructor
- /*!
- \param [in] resInfo the object containing information on the resonance name, mass, width, spin, charge, etc.
- \param [in] resPairAmpInt the number of the daughter not produced by the resonance
- \param [in] daughters the daughter particles
- */
- LauFlatteRes(LauResonanceInfo* resInfo, const Int_t resPairAmpInt, const LauDaughters* daughters);
-
- //! Destructor
- virtual ~LauFlatteRes();
-
- //! Initialise the model
- virtual void initialise();
-
- //! Get the resonance model type
- /*!
- \return the resonance model type
- */
- virtual LauAbsResonance::LauResonanceModel getResonanceModel() const {return LauAbsResonance::Flatte;}
-
- //! Set value of a resonance parameter
- /*!
- \param [in] name the name of the parameter to be changed
- \param [in] value the new parameter value
- */
- virtual void setResonanceParameter(const TString& name, const Double_t value);
-
- //! Allow the various parameters to float in the fit
- /*!
- \param [in] name the name of the parameter to be floated
- */
- virtual void floatResonanceParameter(const TString& name);
-
- //! Access the given resonance parameter
- /*!
- \param [in] name the name of the parameter
- \return the corresponding parameter
- */
- virtual LauParameter* getResonanceParameter(const TString& name);
-
- //! Retrieve the resonance parameters, e.g. so that they can be loaded into a fit
- /*!
- \return floating parameters of the resonance
- */
- virtual const std::vector<LauParameter*>& getFloatingParameters();
-
- protected:
- //! Set the g1 parameter
- /*!
- \param [in] g1 constant factor
- */
- void setg1Parameter(const Double_t g1);
-
- //! Set the g2 parameter
- /*!
- \param [in] g2 constant factor
- */
- void setg2Parameter(const Double_t g2);
-
- //! Get the g1 parameter
- /*!
- \return constant factor g1
- */
- Double_t getg1Parameter() const {return (g1_!=0) ? g1_->unblindValue() : 0.0;}
-
- //! Get the g2 parameter
- /*!
- \return constant factor g2
- */
- Double_t getg2Parameter() const {return (g2_!=0) ? g2_->unblindValue() : 0.0;}
-
- //! See if the g1 parameter is fixed or floating
- /*!
- \return kTRUE if the g1 parameter is fixed, kFALSE otherwise
- */
- Double_t fixg1Parameter() const {return (g1_!=0) ? g1_->fixed() : kTRUE;}
-
- //! See if the g2 parameter is fixed or floating
- /*!
- \return kTRUE if the g2 parameter is fixed, kFALSE otherwise
- */
- Double_t fixg2Parameter() const {return (g2_!=0) ? g2_->fixed() : kTRUE;}
-
- //! Complex resonant amplitude
- /*!
- \param [in] mass appropriate invariant mass for the resonance
- \param [in] spinTerm spin term
- */
- virtual LauComplex resAmp(Double_t mass, Double_t spinTerm);
-
- private:
- //! Copy constructor (not implemented)
- LauFlatteRes(const LauFlatteRes& rhs);
-
- //! Copy assignment operator (not implemented)
- LauFlatteRes& operator=(const LauFlatteRes& rhs);
-
- //! Channel 1 coupling parameter
- LauParameter* g1_;
- //! Channel 1 coupling parameter
- LauParameter* g2_;
-
- //! Channel 1, subchannel 1 invariant mass
- Double_t mSumSq0_;
- //! Channel 1, subchannel 2 invariant mass
- Double_t mSumSq1_;
- //! Channel 2, subchannel 1 invariant mass
- Double_t mSumSq2_;
- //! Channel 2, subchannel 2 invariant mass
- Double_t mSumSq3_;
-
- //! Flag to turn on Adler term in the width
- Bool_t useAdlerTerm_;
-
- //! The Adler zero
- Double_t sA_;
-
- //! Flag to specify whether the couplings absorb the m_0 factor
- Bool_t absorbM0_;
-
- ClassDef(LauFlatteRes,0)
+ public:
+ //! Constructor
+ /*!
+ \param [in] resInfo the object containing information on the resonance name, mass, width, spin, charge, etc.
+ \param [in] resPairAmpInt the number of the daughter not produced by the resonance
+ \param [in] daughters the daughter particles
+ */
+ LauFlatteRes( LauResonanceInfo* resInfo, const Int_t resPairAmpInt, const LauDaughters* daughters );
+
+ //! Destructor
+ virtual ~LauFlatteRes();
+
+ //! Initialise the model
+ virtual void initialise();
+
+ //! Get the resonance model type
+ /*!
+ \return the resonance model type
+ */
+ virtual LauAbsResonance::LauResonanceModel getResonanceModel() const
+ {
+ return LauAbsResonance::Flatte;
+ }
+
+ //! Set value of a resonance parameter
+ /*!
+ \param [in] name the name of the parameter to be changed
+ \param [in] value the new parameter value
+ */
+ virtual void setResonanceParameter( const TString& name, const Double_t value );
+
+ //! Allow the various parameters to float in the fit
+ /*!
+ \param [in] name the name of the parameter to be floated
+ */
+ virtual void floatResonanceParameter( const TString& name );
+
+ //! Access the given resonance parameter
+ /*!
+ \param [in] name the name of the parameter
+ \return the corresponding parameter
+ */
+ virtual LauParameter* getResonanceParameter( const TString& name );
+
+ //! Retrieve the resonance parameters, e.g. so that they can be loaded into a fit
+ /*!
+ \return floating parameters of the resonance
+ */
+ virtual const std::vector<LauParameter*>& getFloatingParameters();
+
+ protected:
+ //! Set the g1 parameter
+ /*!
+ \param [in] g1 constant factor
+ */
+ void setg1Parameter( const Double_t g1 );
+
+ //! Set the g2 parameter
+ /*!
+ \param [in] g2 constant factor
+ */
+ void setg2Parameter( const Double_t g2 );
+
+ //! Get the g1 parameter
+ /*!
+ \return constant factor g1
+ */
+ Double_t getg1Parameter() const { return ( g1_ != 0 ) ? g1_->unblindValue() : 0.0; }
+
+ //! Get the g2 parameter
+ /*!
+ \return constant factor g2
+ */
+ Double_t getg2Parameter() const { return ( g2_ != 0 ) ? g2_->unblindValue() : 0.0; }
+
+ //! See if the g1 parameter is fixed or floating
+ /*!
+ \return kTRUE if the g1 parameter is fixed, kFALSE otherwise
+ */
+ Double_t fixg1Parameter() const { return ( g1_ != 0 ) ? g1_->fixed() : kTRUE; }
+
+ //! See if the g2 parameter is fixed or floating
+ /*!
+ \return kTRUE if the g2 parameter is fixed, kFALSE otherwise
+ */
+ Double_t fixg2Parameter() const { return ( g2_ != 0 ) ? g2_->fixed() : kTRUE; }
+
+ //! Complex resonant amplitude
+ /*!
+ \param [in] mass appropriate invariant mass for the resonance
+ \param [in] spinTerm spin term
+ */
+ virtual LauComplex resAmp( Double_t mass, Double_t spinTerm );
+
+ private:
+ //! Copy constructor (not implemented)
+ LauFlatteRes( const LauFlatteRes& rhs );
+
+ //! Copy assignment operator (not implemented)
+ LauFlatteRes& operator=( const LauFlatteRes& rhs );
+
+ //! Channel 1 coupling parameter
+ LauParameter* g1_;
+ //! Channel 1 coupling parameter
+ LauParameter* g2_;
+
+ //! Channel 1, subchannel 1 invariant mass
+ Double_t mSumSq0_;
+ //! Channel 1, subchannel 2 invariant mass
+ Double_t mSumSq1_;
+ //! Channel 2, subchannel 1 invariant mass
+ Double_t mSumSq2_;
+ //! Channel 2, subchannel 2 invariant mass
+ Double_t mSumSq3_;
+
+ //! Flag to turn on Adler term in the width
+ Bool_t useAdlerTerm_;
+
+ //! The Adler zero
+ Double_t sA_;
+
+ //! Flag to specify whether the couplings absorb the m_0 factor
+ Bool_t absorbM0_;
+
+ ClassDef( LauFlatteRes, 0 )
};
#endif
diff --git a/inc/LauFormulaPar.hh b/inc/LauFormulaPar.hh
index efcba71..d80e4b5 100644
--- a/inc/LauFormulaPar.hh
+++ b/inc/LauFormulaPar.hh
@@ -1,182 +1,183 @@
/*
Copyright 2014 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauFormulaPar.hh
- \brief File containing declaration of LauFormulaPar class.
+ \brief File containing declaration of LauFormulaPar class.
*/
/*! \class LauFormulaPar
- \brief Class for defining combinations of fit parameter objects.
+ \brief Class for defining combinations of fit parameter objects.
- Allows for combinations of LauParameters to be passed to the fit models.
- Equations of the form [0]*2 + 3*[1] are accepted, with a vector of LauParameters to define
- inputs [0] and [1]. The parameter for [0] must be stored first in the vector, and so on.
+ Allows for combinations of LauParameters to be passed to the fit models.
+ Equations of the form [0]*2 + 3*[1] are accepted, with a vector of LauParameters to define
+ inputs [0] and [1]. The parameter for [0] must be stored first in the vector, and so on.
*/
#ifndef LAU_FORMULAPAR
#define LAU_FORMULAPAR
-#include <map>
-#include <vector>
-
-#include "TString.h"
-#include "TFormula.h"
#include "LauAbsRValue.hh"
#include "LauParameter.hh"
+#include "TFormula.h"
+#include "TString.h"
-class LauFormulaPar : public LauAbsRValue {
+#include <map>
+#include <vector>
- public:
- //! Constructor
- /*!
- \param [in] forName the name of the formula
- \param [in] formula the desired expression, using TFormula syntax
- \param [in] params a vector of LauParameters used in the formula
- */
- LauFormulaPar(const TString& forName, const TString& formula, const std::vector<LauParameter*>& params);
-
- // Destructor
- virtual ~LauFormulaPar();
-
- //! Copy constructor
- LauFormulaPar(const LauFormulaPar& rhs);
-
- //! Copy assignment operator
- LauFormulaPar& operator=(const LauFormulaPar& rhs);
-
- //! Return the value of the LauFormalaPar
- /*!
- \return the value of the formula
- */
- Double_t value() const;
-
- //! The unblinded value of the parameter
- /*!
- \return the unblinded value of the parameter
- */
- Double_t unblindValue() const;
-
- //! The value generated for the parameter
- /*!
- \return the value generated for the parameter
- */
- Double_t genValue() const;
-
- //! The initial value of the parameter
- /*!
- \return the initial value of the parameter given to the fitter
- */
- Double_t initValue() const;
-
- //! The parameter name
- /*!
- \return the name of the parameter
- */
- inline const TString& name() const {return name_;}
-
- //! Set the parameter name
- /*!
- \param [in] newName the name of the parameter
- */
- inline void name(const TString& newName) {name_ = newName;};
-
- //! Get the LauParameters used in LauFormulaPar
- /*!
- \return the list of LauParameters
- */
- std::vector<LauParameter*> getPars() {return paramVec_;}
-
- //! Boolean to say it is not an L value
- /*!
- \return kFALSE, LauFormulaPars are not L values
- */
- inline Bool_t isLValue() const {return kFALSE;}
-
- //! Boolean to say if the LauFormulaPar is fixed
- /*!
- \return kFALSE unless all LauParameters in the formula are fixed
- */
- Bool_t fixed() const;
-
- //! The blinding state
- /*!
- \return kTRUE if any of the LauParameters in the formula are blinded, kFALSE otherwise
- */
- Bool_t blind() const;
-
- //! Check whether a Gaussian constraints is applied
- /*!
- \return the boolean flag true/false whether a Gaussian constraint is applied
- */
- inline Bool_t gaussConstraint() const {return gaussConstraint_;}
-
- //! The penalty term from the Gaussian constraint
- /*!
- \return the penalty term from the Gaussian constraint
- */
- Double_t constraintPenalty() const;
-
- //! Add a Gaussian constraint (or modify an existing one)
- /*!
- \param [in] newGaussMean the new value of the Gaussian constraint mean
- \param [in] newGaussWidth the new value of the Gaussian constraint width
- */
- void addGaussianConstraint(Double_t newGaussMean, Double_t newGaussWidth);
-
- //! Remove the Gaussian constraint
- void removeGaussianConstraint();
-
- //! Generate per-experiment constraint mean
- void generateConstraintMean();
-
- protected:
-
- private:
- //! The parameter name
- TString name_;
-
- //! The formula
- mutable TFormula formula_;
-
- //! Vector of LauParameters in the formula
- std::vector<LauParameter*> paramVec_;
-
- //! Array to hold parameter values to pass to formula
- Double_t* paramArray_;
-
- //! Choice to use Gaussian constraint
- Bool_t gaussConstraint_;
- //! True mean of the Gaussian constraint
- Double_t constraintTrueMean_;
- //! Mean value of the Gaussian constraint
- Double_t constraintMean_;
- //! Width of the Gaussian constraint
- Double_t constraintWidth_;
-
- ClassDef(LauFormulaPar, 0)
+class LauFormulaPar : public LauAbsRValue {
+ public:
+ //! Constructor
+ /*!
+ \param [in] forName the name of the formula
+ \param [in] formula the desired expression, using TFormula syntax
+ \param [in] params a vector of LauParameters used in the formula
+ */
+ LauFormulaPar( const TString& forName,
+ const TString& formula,
+ const std::vector<LauParameter*>& params );
+
+ // Destructor
+ virtual ~LauFormulaPar();
+
+ //! Copy constructor
+ LauFormulaPar( const LauFormulaPar& rhs );
+
+ //! Copy assignment operator
+ LauFormulaPar& operator=( const LauFormulaPar& rhs );
+
+ //! Return the value of the LauFormalaPar
+ /*!
+ \return the value of the formula
+ */
+ Double_t value() const;
+
+ //! The unblinded value of the parameter
+ /*!
+ \return the unblinded value of the parameter
+ */
+ Double_t unblindValue() const;
+
+ //! The value generated for the parameter
+ /*!
+ \return the value generated for the parameter
+ */
+ Double_t genValue() const;
+
+ //! The initial value of the parameter
+ /*!
+ \return the initial value of the parameter given to the fitter
+ */
+ Double_t initValue() const;
+
+ //! The parameter name
+ /*!
+ \return the name of the parameter
+ */
+ inline const TString& name() const { return name_; }
+
+ //! Set the parameter name
+ /*!
+ \param [in] newName the name of the parameter
+ */
+ inline void name( const TString& newName ) { name_ = newName; };
+
+ //! Get the LauParameters used in LauFormulaPar
+ /*!
+ \return the list of LauParameters
+ */
+ std::vector<LauParameter*> getPars() { return paramVec_; }
+
+ //! Boolean to say it is not an L value
+ /*!
+ \return kFALSE, LauFormulaPars are not L values
+ */
+ inline Bool_t isLValue() const { return kFALSE; }
+
+ //! Boolean to say if the LauFormulaPar is fixed
+ /*!
+ \return kFALSE unless all LauParameters in the formula are fixed
+ */
+ Bool_t fixed() const;
+
+ //! The blinding state
+ /*!
+ \return kTRUE if any of the LauParameters in the formula are blinded, kFALSE otherwise
+ */
+ Bool_t blind() const;
+
+ //! Check whether a Gaussian constraints is applied
+ /*!
+ \return the boolean flag true/false whether a Gaussian constraint is applied
+ */
+ inline Bool_t gaussConstraint() const { return gaussConstraint_; }
+
+ //! The penalty term from the Gaussian constraint
+ /*!
+ \return the penalty term from the Gaussian constraint
+ */
+ Double_t constraintPenalty() const;
+
+ //! Add a Gaussian constraint (or modify an existing one)
+ /*!
+ \param [in] newGaussMean the new value of the Gaussian constraint mean
+ \param [in] newGaussWidth the new value of the Gaussian constraint width
+ */
+ void addGaussianConstraint( Double_t newGaussMean, Double_t newGaussWidth );
+
+ //! Remove the Gaussian constraint
+ void removeGaussianConstraint();
+
+ //! Generate per-experiment constraint mean
+ void generateConstraintMean();
+
+ protected:
+
+ private:
+ //! The parameter name
+ TString name_;
+
+ //! The formula
+ mutable TFormula formula_;
+
+ //! Vector of LauParameters in the formula
+ std::vector<LauParameter*> paramVec_;
+
+ //! Array to hold parameter values to pass to formula
+ Double_t* paramArray_;
+
+ //! Choice to use Gaussian constraint
+ Bool_t gaussConstraint_;
+ //! True mean of the Gaussian constraint
+ Double_t constraintTrueMean_;
+ //! Mean value of the Gaussian constraint
+ Double_t constraintMean_;
+ //! Width of the Gaussian constraint
+ Double_t constraintWidth_;
+
+ ClassDef( LauFormulaPar, 0 )
};
#endif
diff --git a/inc/LauGaussIncohRes.hh b/inc/LauGaussIncohRes.hh
index 0e2291d..ac1bba8 100644
--- a/inc/LauGaussIncohRes.hh
+++ b/inc/LauGaussIncohRes.hh
@@ -1,92 +1,96 @@
/*
Copyright 2014 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauGaussIncohRes.hh
\brief File containing declaration of LauGaussIncohRes class.
*/
/*! \class LauGaussIncohRes
\brief Class for defining an incoherent resonance with a Gaussian mass dependence
Useful for modelling resolution-dominated sharp structures such as D*(2010)
*/
#ifndef LAU_GAUSS_INCOH_RES
#define LAU_GAUSS_INCOH_RES
-#include "TString.h"
-
#include "LauAbsIncohRes.hh"
#include "LauComplex.hh"
-class LauKinematics;
+#include "TString.h"
+class LauKinematics;
class LauGaussIncohRes : public LauAbsIncohRes {
- public:
- //! Constructor
- /*!
- \param [in] resInfo the object containing information on the resonance name, mass, width, spin, charge, etc.
- \param [in] resPairAmpInt the number of the daughter not produced by the resonance
- \param [in] daughters the daughter particles
- */
- LauGaussIncohRes(LauResonanceInfo* resInfo, const Int_t resPairAmpInt, const LauDaughters* daughters);
-
- //! Destructor
- virtual ~LauGaussIncohRes();
-
- //! Initialise the model
- virtual void initialise();
-
- //! Get intensity factor
- /*!
- /param [in] kinematics kinematic parameters of the parent and daughter particles
- /return the intensity factor
- */
- virtual Double_t intensityFactor(const LauKinematics* kinematics);
-
- //! Get the resonance model type
- /*!
- \return the resonance model type
- */
- virtual LauAbsResonance::LauResonanceModel getResonanceModel() const {return LauAbsResonance::GaussIncoh;}
-
- //! Retrieve the resonance parameters, e.g. so that they can be loaded into a fit
- /*!
- \return floating parameters of the resonance
- */
- virtual const std::vector<LauParameter*>& getFloatingParameters();
-
- private:
- //! Copy constructor (not implemented)
- LauGaussIncohRes(const LauGaussIncohRes& rhs);
-
- //! Copy assignment operator (not implemented)
- LauGaussIncohRes& operator=(const LauGaussIncohRes& rhs);
-
- ClassDef(LauGaussIncohRes,0) // Gaussian incoherent resonance model
+ public:
+ //! Constructor
+ /*!
+ \param [in] resInfo the object containing information on the resonance name, mass, width, spin, charge, etc.
+ \param [in] resPairAmpInt the number of the daughter not produced by the resonance
+ \param [in] daughters the daughter particles
+ */
+ LauGaussIncohRes( LauResonanceInfo* resInfo,
+ const Int_t resPairAmpInt,
+ const LauDaughters* daughters );
+
+ //! Destructor
+ virtual ~LauGaussIncohRes();
+
+ //! Initialise the model
+ virtual void initialise();
+
+ //! Get intensity factor
+ /*!
+ \param [in] kinematics kinematic parameters of the parent and daughter particles
+ \return the intensity factor
+ */
+ virtual Double_t intensityFactor( const LauKinematics* kinematics );
+
+ //! Get the resonance model type
+ /*!
+ \return the resonance model type
+ */
+ virtual LauAbsResonance::LauResonanceModel getResonanceModel() const
+ {
+ return LauAbsResonance::GaussIncoh;
+ }
+
+ //! Retrieve the resonance parameters, e.g. so that they can be loaded into a fit
+ /*!
+ \return floating parameters of the resonance
+ */
+ virtual const std::vector<LauParameter*>& getFloatingParameters();
+
+ private:
+ //! Copy constructor (not implemented)
+ LauGaussIncohRes( const LauGaussIncohRes& rhs );
+
+ //! Copy assignment operator (not implemented)
+ LauGaussIncohRes& operator=( const LauGaussIncohRes& rhs );
+
+ ClassDef( LauGaussIncohRes, 0 ) // Gaussian incoherent resonance model
};
#endif
diff --git a/inc/LauGaussPdf.hh b/inc/LauGaussPdf.hh
index 763c500..7140be0 100644
--- a/inc/LauGaussPdf.hh
+++ b/inc/LauGaussPdf.hh
@@ -1,96 +1,98 @@
/*
Copyright 2006 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauGaussPdf.hh
\brief File containing declaration of LauGaussPdf class.
*/
/*! \class LauGaussPdf
\brief Class for defining a Gaussian PDF.
Class that allows the user to define a Gaussian PDF.
*/
#ifndef LAU_GAUSS_PDF
#define LAU_GAUSS_PDF
-#include <vector>
+#include "LauAbsPdf.hh"
#include "TString.h"
-#include "LauAbsPdf.hh"
+#include <vector>
class LauParameter;
-
class LauGaussPdf : public LauAbsPdf {
- public:
- //! Constructor
- /*!
- \param [in] theVarName the name of the abscissa variable
- \param [in] params the PDF parameters - mean, sigma
- \param [in] minAbscissa the minimum value of the abscissa
- \param [in] maxAbscissa the maximum value of the abscissa
- */
- LauGaussPdf(const TString& theVarName, const std::vector<LauAbsRValue*>& params, Double_t minAbscissa, Double_t maxAbscissa);
-
- //! Destructor
- virtual ~LauGaussPdf();
-
- //! Calculate the likelihood (and intermediate info) for a given abscissa
- /*!
- \param [in] abscissas the values of the abscissa(s)
- */
- virtual void calcLikelihoodInfo(const LauAbscissas& abscissas);
-
- using LauAbsPdf::calcLikelihoodInfo;
-
- //! Calculate the normalisation
- virtual void calcNorm();
-
- //! Calculate the PDF height
- /*!
- \param [in] kinematics the current DP kinematics
- */
- virtual void calcPDFHeight( const LauKinematics* kinematics );
-
- protected:
-
- private:
- //! Copy constructor (not implemented)
- LauGaussPdf(const LauGaussPdf& rhs);
-
- //! Copy assignment operator (not implemented)
- LauGaussPdf& operator=(const LauGaussPdf& rhs);
-
- //! Gaussian mean
- LauAbsRValue* mean_;
- //! Gaussian sigma
- LauAbsRValue* sigma_;
-
- ClassDef(LauGaussPdf,0) // Define the Gaussian PDF
+ public:
+ //! Constructor
+ /*!
+ \param [in] theVarName the name of the abscissa variable
+ \param [in] params the PDF parameters - mean, sigma
+ \param [in] minAbscissa the minimum value of the abscissa
+ \param [in] maxAbscissa the maximum value of the abscissa
+ */
+ LauGaussPdf( const TString& theVarName,
+ const std::vector<LauAbsRValue*>& params,
+ Double_t minAbscissa,
+ Double_t maxAbscissa );
+
+ //! Destructor
+ virtual ~LauGaussPdf();
+
+ //! Calculate the likelihood (and intermediate info) for a given abscissa
+ /*!
+ \param [in] abscissas the values of the abscissa(s)
+ */
+ virtual void calcLikelihoodInfo( const LauAbscissas& abscissas );
+
+ using LauAbsPdf::calcLikelihoodInfo;
+
+ //! Calculate the normalisation
+ virtual void calcNorm();
+
+ //! Calculate the PDF height
+ /*!
+ \param [in] kinematics the current DP kinematics
+ */
+ virtual void calcPDFHeight( const LauKinematics* kinematics );
+
+ protected:
+
+ private:
+ //! Copy constructor (not implemented)
+ LauGaussPdf( const LauGaussPdf& rhs );
+
+ //! Copy assignment operator (not implemented)
+ LauGaussPdf& operator=( const LauGaussPdf& rhs );
+
+ //! Gaussian mean
+ LauAbsRValue* mean_;
+ //! Gaussian sigma
+ LauAbsRValue* sigma_;
+
+ ClassDef( LauGaussPdf, 0 ) // Define the Gaussian PDF
};
#endif
diff --git a/inc/LauGenNtuple.hh b/inc/LauGenNtuple.hh
index 5aa34cb..dad1dda 100644
--- a/inc/LauGenNtuple.hh
+++ b/inc/LauGenNtuple.hh
@@ -1,189 +1,185 @@
/*
Copyright 2006 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauGenNtuple.hh
\brief File containing declaration of LauGenNtuple class.
*/
/*! \class LauGenNtuple
\brief Class to store the results from the toy MC generation into an ntuple
Class to store the results from the toy MC generation into an ntuple
*/
#ifndef LAU_GEN_NTUPLE
#define LAU_GEN_NTUPLE
-#include <map>
-
#include "TString.h"
+#include <map>
+
class TFile;
class TTree;
-
class LauGenNtuple {
- public:
- //! Constructor
- /*!
- \param [in] rootFileName the name for the ntuple
- \param [in] rootTreeName the name for the tree in the ntuple
- */
- LauGenNtuple(const TString& rootFileName, const TString& rootTreeName);
-
- //! Destructor
- virtual ~LauGenNtuple();
-
-
- //! Ntuple file name
- /*!
- \return the name of the ntuple
- */
- const TString& fileName() const {return rootFileName_;}
-
- //! Ntuple tree name
- /*!
- \return the name of the tree
- */
- const TString& treeName() const {return rootTreeName_;}
-
- //! Add integer branch to tree
- /*!
- \param [in] name the name of the branch
- */
- void addIntegerBranch(const TString& name);
-
- //! Add double branch to tree
- /*!
- \param [in] name the name of the branch
- */
- void addDoubleBranch(const TString& name);
-
- //! Set value of an integer branch
- /*!
- \param [in] name the name of the branch
- \param [in] value the value to set the branch
- */
- void setIntegerBranchValue(const TString& name, Int_t value);
-
- //! Set value of a double branch
- /*!
- \param [in] name the name of the branch
- \param [in] value the value to set the branch
- */
- void setDoubleBranchValue(const TString& name, Double_t value);
-
- //! Get value of an integer branch
- /*!
- \param [in] name the name of the branch
- \return the value of the branch
- */
- Int_t getIntegerBranchValue(const TString& name) const;
-
- //! Get value of a double branch
- /*!
- \param [in] name the name of the branch
- \return the value of the branch
- */
- Double_t getDoubleBranchValue(const TString& name) const;
-
- //! Fill branches in the ntuple
- void fillBranches();
-
- //! Delete and recreate tree
- void deleteAndRecreateTree();
-
- //! Create an index table using leaves of the tree
- /*!
- \param [in] majorName the majorname
- \param [in] minorName the minorname
- \return the number of entries in the index (< 0 indicates failure)
- */
- Int_t buildIndex(const TString& majorName, const TString& minorName = "0");
-
- //! Write out the results from the generation
- void writeOutGenResults();
-
-
- //! Add a friend tree
- /*!
- \param [in] rootFileName the name of the root file
- \param [in] rootTreeName the name of the root tree
- */
- void addFriendTree(const TString& rootFileName, const TString& rootTreeName);
-
- protected:
- //! Create ntuple file and the tree
- void createFileAndTree();
-
- //! Define branches of the tree
- void defineBranches();
-
- //! Flags whether branches have been defined
- /*!
- \return boolean to determine whether branches have been defined
- */
- Bool_t definedBranches() const {return definedBranches_;}
-
- //! Flags whether branches have been defined
- /*!
- \param [in] defined boolean to determine whether branches have been defined
- */
- void definedBranches(Bool_t defined) {definedBranches_ = defined;}
-
- private:
- //! Copy constructor (not implemented)
- LauGenNtuple(const LauGenNtuple& rhs);
-
- //! Copy assignment operator (not implemented)
- LauGenNtuple& operator=(const LauGenNtuple& rhs);
-
- //! Name of root file
- TString rootFileName_;
- //! Name of root tree
- TString rootTreeName_;
- //! Root file
- TFile* rootFile_;
- //! Root tree
- TTree* rootTree_;
-
- //! Flags whether branches are defined
- Bool_t definedBranches_;
-
- //! Type to hold integer variables
- typedef std::map<TString, Int_t> IntVarMap;
- //! Type to hold double precision floating point variables
- typedef std::map<TString, Double_t> DoubleVarMap;
-
- //! Integer variables
- IntVarMap intVars_;
- //! Double variables
- DoubleVarMap doubleVars_;
-
- ClassDef(LauGenNtuple,0) // Generated toyMC ntuple
-
+ public:
+ //! Constructor
+ /*!
+ \param [in] rootFileName the name for the ntuple
+ \param [in] rootTreeName the name for the tree in the ntuple
+ */
+ LauGenNtuple( const TString& rootFileName, const TString& rootTreeName );
+
+ //! Destructor
+ virtual ~LauGenNtuple();
+
+ //! Ntuple file name
+ /*!
+ \return the name of the ntuple
+ */
+ const TString& fileName() const { return rootFileName_; }
+
+ //! Ntuple tree name
+ /*!
+ \return the name of the tree
+ */
+ const TString& treeName() const { return rootTreeName_; }
+
+ //! Add integer branch to tree
+ /*!
+ \param [in] name the name of the branch
+ */
+ void addIntegerBranch( const TString& name );
+
+ //! Add double branch to tree
+ /*!
+ \param [in] name the name of the branch
+ */
+ void addDoubleBranch( const TString& name );
+
+ //! Set value of an integer branch
+ /*!
+ \param [in] name the name of the branch
+ \param [in] value the value to set the branch
+ */
+ void setIntegerBranchValue( const TString& name, Int_t value );
+
+ //! Set value of a double branch
+ /*!
+ \param [in] name the name of the branch
+ \param [in] value the value to set the branch
+ */
+ void setDoubleBranchValue( const TString& name, Double_t value );
+
+ //! Get value of an integer branch
+ /*!
+ \param [in] name the name of the branch
+ \return the value of the branch
+ */
+ Int_t getIntegerBranchValue( const TString& name ) const;
+
+ //! Get value of a double branch
+ /*!
+ \param [in] name the name of the branch
+ \return the value of the branch
+ */
+ Double_t getDoubleBranchValue( const TString& name ) const;
+
+ //! Fill branches in the ntuple
+ void fillBranches();
+
+ //! Delete and recreate tree
+ void deleteAndRecreateTree();
+
+ //! Create an index table using leaves of the tree
+ /*!
+ \param [in] majorName the majorname
+ \param [in] minorName the minorname
+ \return the number of entries in the index (< 0 indicates failure)
+ */
+ Int_t buildIndex( const TString& majorName, const TString& minorName = "0" );
+
+ //! Write out the results from the generation
+ void writeOutGenResults();
+
+ //! Add a friend tree
+ /*!
+ \param [in] rootFileName the name of the root file
+ \param [in] rootTreeName the name of the root tree
+ */
+ void addFriendTree( const TString& rootFileName, const TString& rootTreeName );
+
+ protected:
+ //! Create ntuple file and the tree
+ void createFileAndTree();
+
+ //! Define branches of the tree
+ void defineBranches();
+
+ //! Flags whether branches have been defined
+ /*!
+ \return boolean to determine whether branches have been defined
+ */
+ Bool_t definedBranches() const { return definedBranches_; }
+
+ //! Flags whether branches have been defined
+ /*!
+ \param [in] defined boolean to determine whether branches have been defined
+ */
+ void definedBranches( Bool_t defined ) { definedBranches_ = defined; }
+
+ private:
+ //! Copy constructor (not implemented)
+ LauGenNtuple( const LauGenNtuple& rhs );
+
+ //! Copy assignment operator (not implemented)
+ LauGenNtuple& operator=( const LauGenNtuple& rhs );
+
+ //! Name of root file
+ TString rootFileName_;
+ //! Name of root tree
+ TString rootTreeName_;
+ //! Root file
+ TFile* rootFile_;
+ //! Root tree
+ TTree* rootTree_;
+
+ //! Flags whether branches are defined
+ Bool_t definedBranches_;
+
+ //! Type to hold integer variables
+ typedef std::map<TString, Int_t> IntVarMap;
+ //! Type to hold double precision floating point variables
+ typedef std::map<TString, Double_t> DoubleVarMap;
+
+ //! Integer variables
+ IntVarMap intVars_;
+ //! Double variables
+ DoubleVarMap doubleVars_;
+
+ ClassDef( LauGenNtuple, 0 ) // Generated toyMC ntuple
};
#endif
diff --git a/inc/LauGounarisSakuraiRes.hh b/inc/LauGounarisSakuraiRes.hh
index cefa227..debce2c 100644
--- a/inc/LauGounarisSakuraiRes.hh
+++ b/inc/LauGounarisSakuraiRes.hh
@@ -1,126 +1,129 @@
/*
Copyright 2006 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauGounarisSakuraiRes.hh
\brief File containing declaration of LauGounarisSakuraiRes class.
*/
/*! \class LauGounarisSakuraiRes
\brief Class for defininf the Gounaris-Sakurai resonance model
Class for defining the relativistic Gounaris-Sakurai resonance model, which
includes the use of Blatt-Weisskopf barrier factors.
*/
#ifndef LAU_GOUNARIS_SAKURAI_RES
#define LAU_GOUNARIS_SAKURAI_RES
-#include "TString.h"
-
-#include "LauComplex.hh"
#include "LauAbsResonance.hh"
+#include "LauComplex.hh"
+#include "TString.h"
class LauGounarisSakuraiRes : public LauAbsResonance {
- public:
- //! Constructor
- /*!
- \param [in] resInfo the object containing information on the resonance name, mass, width, spin, charge, etc.
- \param [in] resPairAmpInt the number of the daughter not produced by the resonance
- \param [in] daughters the daughter particles
- */
- LauGounarisSakuraiRes(LauResonanceInfo* resInfo, const Int_t resPairAmpInt, const LauDaughters* daughters);
-
- //! Destructor
- virtual ~LauGounarisSakuraiRes();
-
- //! Initialise the model
- virtual void initialise();
-
- //! Get the resonance model type
- /*!
- \return the resonance model type
- */
- virtual LauAbsResonance::LauResonanceModel getResonanceModel() const {return LauAbsResonance::GS;}
-
- //! Retrieve the resonance parameters, e.g. so that they can be loaded into a fit
- /*!
- \return floating parameters of the resonance
- */
- virtual const std::vector<LauParameter*>& getFloatingParameters();
-
- protected:
- //! Complex resonant amplitude
- /*!
- \param [in] mass appropriate invariant mass for the resonance
- \param [in] spinTerm spin term
- */
- virtual LauComplex resAmp(Double_t mass, Double_t spinTerm);
-
- private:
- //! Copy constructor (not implemented)
- LauGounarisSakuraiRes(const LauGounarisSakuraiRes& rhs);
-
- //! Copy assignment operator (not implemented)
- LauGounarisSakuraiRes& operator=(const LauGounarisSakuraiRes& rhs);
-
- //! Momentum of the daughters in the resonance rest frame (at pole mass)
- Double_t q0_;
- //! The resonance mass
- Double_t resMass_;
- //! Square of the resonance mass
- Double_t resMassSq_;
- //! The resonance width
- Double_t resWidth_;
- //! The resonance barrier radius
- Double_t resRadius_;
- //! The parent barrier radius
- Double_t parRadius_;
- //! Sum of the two daughter masses
- Double_t mDaugSum_;
- //! Square of the sum of the two daughter masses
- Double_t mDaugSumSq_;
- //! Difference between the two daughter masses
- Double_t mDaugDiff_;
- //! Square of the difference of the two daughter masses
- Double_t mDaugDiffSq_;
- //! Square of the parent mass
- Double_t mParentSq_;
- //! Square of the bachelor mass
- Double_t mBachSq_;
- //! Extra parameter required by GS shape
- Double_t h0_;
- //! Extra parameter required by GS shape
- Double_t dhdm0_;
- //! Extra parameter required by GS shape
- Double_t d_;
- //! Value of the form factor for resonance decay (at pole mass)
- Double_t FR0_;
-
- ClassDef(LauGounarisSakuraiRes,0) // Gounaris-Sakurai resonance model
-
+ public:
+ //! Constructor
+ /*!
+ \param [in] resInfo the object containing information on the resonance name, mass, width, spin, charge, etc.
+ \param [in] resPairAmpInt the number of the daughter not produced by the resonance
+ \param [in] daughters the daughter particles
+ */
+ LauGounarisSakuraiRes( LauResonanceInfo* resInfo,
+ const Int_t resPairAmpInt,
+ const LauDaughters* daughters );
+
+ //! Destructor
+ virtual ~LauGounarisSakuraiRes();
+
+ //! Initialise the model
+ virtual void initialise();
+
+ //! Get the resonance model type
+ /*!
+ \return the resonance model type
+ */
+ virtual LauAbsResonance::LauResonanceModel getResonanceModel() const
+ {
+ return LauAbsResonance::GS;
+ }
+
+ //! Retrieve the resonance parameters, e.g. so that they can be loaded into a fit
+ /*!
+ \return floating parameters of the resonance
+ */
+ virtual const std::vector<LauParameter*>& getFloatingParameters();
+
+ protected:
+ //! Complex resonant amplitude
+ /*!
+ \param [in] mass appropriate invariant mass for the resonance
+ \param [in] spinTerm spin term
+ */
+ virtual LauComplex resAmp( Double_t mass, Double_t spinTerm );
+
+ private:
+ //! Copy constructor (not implemented)
+ LauGounarisSakuraiRes( const LauGounarisSakuraiRes& rhs );
+
+ //! Copy assignment operator (not implemented)
+ LauGounarisSakuraiRes& operator=( const LauGounarisSakuraiRes& rhs );
+
+ //! Momentum of the daughters in the resonance rest frame (at pole mass)
+ Double_t q0_;
+ //! The resonance mass
+ Double_t resMass_;
+ //! Square of the resonance mass
+ Double_t resMassSq_;
+ //! The resonance width
+ Double_t resWidth_;
+ //! The resonance barrier radius
+ Double_t resRadius_;
+ //! The parent barrier radius
+ Double_t parRadius_;
+ //! Sum of the two daughter masses
+ Double_t mDaugSum_;
+ //! Square of the sum of the two daughter masses
+ Double_t mDaugSumSq_;
+ //! Difference between the two daughter masses
+ Double_t mDaugDiff_;
+ //! Square of the difference of the two daughter masses
+ Double_t mDaugDiffSq_;
+ //! Square of the parent mass
+ Double_t mParentSq_;
+ //! Square of the bachelor mass
+ Double_t mBachSq_;
+ //! Extra parameter required by GS shape
+ Double_t h0_;
+ //! Extra parameter required by GS shape
+ Double_t dhdm0_;
+ //! Extra parameter required by GS shape
+ Double_t d_;
+ //! Value of the form factor for resonance decay (at pole mass)
+ Double_t FR0_;
+
+ ClassDef( LauGounarisSakuraiRes, 0 ) // Gounaris-Sakurai resonance model
};
#endif
diff --git a/inc/LauIntegrals.hh b/inc/LauIntegrals.hh
index 168ba71..12da442 100644
--- a/inc/LauIntegrals.hh
+++ b/inc/LauIntegrals.hh
@@ -1,85 +1,88 @@
/*
Copyright 2004 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauIntegrals.hh
\brief File containing declaration of LauIntegrals class.
*/
/*! \class LauIntegrals
\brief Class for performing numerical integration routines.
Class for calculating the Gauss-Legendre or Gauss-Hermite weights
required for numerical integration of DP and other PDFs.
*/
#ifndef LAU_INTEGRALS
#define LAU_INTEGRALS
-#include <vector>
-
#include "Rtypes.h"
+#include <vector>
class LauIntegrals {
- public:
- //! Constructor
- /*!
- \param [in] weightsPrecision the desired precision to which the weights should be calculated
- */
- LauIntegrals(Double_t weightsPrecision = 1.0e-6);
-
- //! Destructor
- virtual ~LauIntegrals();
-
- //! Copy constructor
- LauIntegrals(const LauIntegrals& rhs);
-
- //! Copy assignment operator
- LauIntegrals& operator=(const LauIntegrals& rhs);
-
- //! Calculate the Gauss-Legendre weights
- /*!
- \param [in] numPoints the number of points in the integration
- \param [out] abscissas the values of the abscissa at each integration point
- \param [out] weights the weight at each integration point
- */
- void calcGaussLegendreWeights(const Int_t numPoints, std::vector<Double_t>& abscissas, std::vector<Double_t>& weights);
-
- //! Calculate the Gauss-Hermite weights
- /*!
- \param [in] numPoints the number of points in the integration
- \param [out] abscissas the values of the abscissa at each integration point
- \param [out] weights the weight at each integration point
- */
- void calcGaussHermiteWeights(const Int_t numPoints, std::vector<Double_t>& abscissas, std::vector<Double_t>& weights);
-
- private:
- //! The precision to which the weights should be calculated
- Double_t weightsPrecision_;
-
- ClassDef(LauIntegrals,0)
+ public:
+ //! Constructor
+ /*!
+ \param [in] weightsPrecision the desired precision to which the weights should be calculated
+ */
+ LauIntegrals( Double_t weightsPrecision = 1.0e-6 );
+
+ //! Destructor
+ virtual ~LauIntegrals();
+
+ //! Copy constructor
+ LauIntegrals( const LauIntegrals& rhs );
+
+ //! Copy assignment operator
+ LauIntegrals& operator=( const LauIntegrals& rhs );
+
+ //! Calculate the Gauss-Legendre weights
+ /*!
+ \param [in] numPoints the number of points in the integration
+ \param [out] abscissas the values of the abscissa at each integration point
+ \param [out] weights the weight at each integration point
+ */
+ void calcGaussLegendreWeights( const Int_t numPoints,
+ std::vector<Double_t>& abscissas,
+ std::vector<Double_t>& weights );
+
+ //! Calculate the Gauss-Hermite weights
+ /*!
+ \param [in] numPoints the number of points in the integration
+ \param [out] abscissas the values of the abscissa at each integration point
+ \param [out] weights the weight at each integration point
+ */
+ void calcGaussHermiteWeights( const Int_t numPoints,
+ std::vector<Double_t>& abscissas,
+ std::vector<Double_t>& weights );
+
+ private:
+ //! The precision to which the weights should be calculated
+ Double_t weightsPrecision_;
+
+ ClassDef( LauIntegrals, 0 )
};
#endif
diff --git a/inc/LauIsobarDynamics.hh b/inc/LauIsobarDynamics.hh
index a64f029..b5c2144 100644
--- a/inc/LauIsobarDynamics.hh
+++ b/inc/LauIsobarDynamics.hh
@@ -1,989 +1,1042 @@
/*
Copyright 2005 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauIsobarDynamics.hh
\brief File containing declaration of LauIsobarDynamics class.
*/
/*! \class LauIsobarDynamics
\brief Class for defining signal dynamics using the isobar model.
*/
#ifndef LAU_ISOBAR_DYNAMICS
#define LAU_ISOBAR_DYNAMICS
-#include <set>
-#include <vector>
+#include "LauAbsResonance.hh"
+#include "LauComplex.hh"
#include "TString.h"
-#include "LauAbsResonance.hh"
-#include "LauComplex.hh"
+#include <set>
+#include <vector>
class LauCacheData;
class LauDaughters;
class LauAbsEffModel;
class LauAbsIncohRes;
class LauFitDataTree;
class LauKMatrixPropagator;
class LauDPPartialIntegralInfo;
class LauKinematics;
class LauIsobarDynamics {
- public:
- //! The type used for containing multiple self cross feed fraction models for different categories (e.g. tagging categories)
- typedef std::map<Int_t,LauAbsEffModel*> LauTagCatScfFractionModelMap;
-
- //! The possible statuses for toy MC generation
- enum ToyMCStatus {
- GenOK, /*!< Generation completed OK */
- MaxIterError, /*!< Maximum allowed number of iterations completed without success (ASqMax is too high) */
- ASqMaxError /*!< An amplitude squared value was returned that was larger than the maximum expected (ASqMax is too low) */
- };
-
- //! Constructor
- /*!
- \param [in] daughters the daughters of the decay
- \param [in] effModel the model to describe the efficiency across the Dalitz plot
- \param [in] scfFractionModel the model to describe the fraction of poorly constructed events (the self cross feed fraction) across the Dalitz plot
- */
- LauIsobarDynamics(LauDaughters* daughters, LauAbsEffModel* effModel, LauAbsEffModel* scfFractionModel = 0);
-
- //! Constructor
- /*!
- \param [in] daughters the daughters of the decay
- \param [in] effModel the model to describe the efficiency across the Dalitz plot
- \param [in] scfFractionModel the models to describe the fraction of poorly constructed events (the self cross feed fraction) across the Dalitz plot for various tagging categories
- */
- LauIsobarDynamics(LauDaughters* daughters, LauAbsEffModel* effModel, LauTagCatScfFractionModelMap scfFractionModel);
-
- //! Destructor
- virtual ~LauIsobarDynamics();
-
- //! Initialise the Dalitz plot dynamics
- /*!
- \param [in] coeffs the complex coefficients for the resonances
- */
- void initialise(const std::vector<LauComplex>& coeffs);
-
- //! recalculate Normalization
- void recalculateNormalisation();
-
- //! Set the name of the file to which to save the results of the integrals
- /*!
- \param [in] fileName the name of the file
- */
- inline void setIntFileName(const TString& fileName) {intFileName_ = fileName;}
-
- // Integration
- //! Set the widths of the bins to use when integrating across the Dalitz plot or square Dalitz plot
- /*!
- Specify the bin widths required when performing the DP integration.
- Note that the integration is not performed in m13^2 vs m23^2 space
- but in either m13 vs m23 space or mPrime vs thetaPrime space,
- with the appropriate Jacobian applied.
- The default bin widths in m13 vs m23 space are 0.005 GeV.
- The default bin widths in mPrime vs thetaPrime space are 0.001.
-
- \param [in] m13BinWidth the bin width to use when integrating over m13
- \param [in] m23BinWidth the bin width to use when integrating over m23
- \param [in] mPrimeBinWidth the bin width to use when integrating over mPrime
- \param [in] thPrimeBinWidth the bin width to use when integrating over thetaPrime
- */
- void setIntegralBinWidths(const Double_t m13BinWidth, const Double_t m23BinWidth,
- const Double_t mPrimeBinWidth = 0.001, const Double_t thPrimeBinWidth = 0.001);
-
- //! Set the value below which a resonance width is considered to be narrow
- /*!
- Narrow resonances trigger different integration behaviour - dividing the DP into regions where a finer binning is used.
- This can cause high memory usage, so use this method and LauIsobarDynamics::setIntegralBinningFactor to tune this behaviour, if needed.
-
- \param [in] narrowWidth the value below which a resonance is considered to be narrow (defaults to 0.02 GeV/c2)
- */
- void setNarrowResonanceThreshold(const Double_t narrowWidth) { narrowWidth_ = narrowWidth; }
-
- //! Set the factor relating the width of a narrow resonance and the binning size in its integration region
- /*!
- Narrow resonances trigger different integration behaviour - dividing the DP into regions where a finer binning is used.
- This can cause high memory usage, so use this method and LauIsobarDynamics::setNarrowResonanceThreshold to tune this behaviour, if needed.
-
- \param [in] binningFactor the factor by which the resonance width is divided to obtain the bin size (defaults to 100)
- */
- void setIntegralBinningFactor(const Double_t binningFactor) { binningFactor_ = binningFactor; }
-
- //! Force the symmetrisation of the integration in m13 <-> m23 for non-symmetric but flavour-conjugate final states
- /*!
- This can be necessary for time-dependent fits (where interference terms between A and Abar need to be integrated)
-
- \param [in] force toggle forcing symmetrisation of the integration for apparently flavour-conjugate final states
- */
- void forceSymmetriseIntegration(const Bool_t force) { forceSymmetriseIntegration_ = force; }
-
- //! Add a resonance to the Dalitz plot
- /*!
- NB the stored order of resonances is:
- - Firstly, all coherent resonances (i.e. those added using addResonance() or addKMatrixProdPole() or addKMatrixProdSVP()) in order of addition
- - Followed by all incoherent resonances (i.e. those added using addIncoherentResonance()) in order of addition
-
- \param [in] resName the name of the resonant particle
- \param [in] resPairAmpInt the index of the daughter not produced by the resonance
- \param [in] resType the model for the resonance dynamics
- \param [in] bwCategory the Blatt-Weisskopf barrier factor category
- \return the newly created resonance
- */
- LauAbsResonance* addResonance(const TString& resName, const Int_t resPairAmpInt, const LauAbsResonance::LauResonanceModel resType, const LauBlattWeisskopfFactor::BlattWeisskopfCategory bwCategory = LauBlattWeisskopfFactor::Default);
-
- //! Add an incoherent resonance to the Dalitz plot
- /*!
- NB the stored order of resonances is:
- - Firstly, all coherent resonances (i.e. those added using addResonance() or addKMatrixProdPole() or addKMatrixProdSVP()) in order of addition
- - Followed by all incoherent resonances (i.e. those added using addIncoherentResonance()) in order of addition
-
- \param [in] resName the name of the resonant particle
- \param [in] resPairAmpInt the index of the daughter not produced by the resonance
- \param [in] resType the model for the resonance dynamics
- \return the newly created resonance
- */
- LauAbsResonance* addIncoherentResonance(const TString& resName, const Int_t resPairAmpInt, const LauAbsResonance::LauResonanceModel resType);
-
- //! Define a new K-matrix Propagator
- /*!
- \param [in] propName the name of the propagator
- \param [in] paramFileName the file that defines the propagator
- \param [in] resPairAmpInt the index of the bachelor
- \param [in] nChannels the number of channels
- \param [in] nPoles the number of poles
- \param [in] rowIndex the index of the row to be used when summing over all amplitude channels: S-wave corresponds to rowIndex = 1.
- */
- LauKMatrixPropagator* defineKMatrixPropagator( const TString& propName, const TString& paramFileName,
- Int_t resPairAmpInt, Int_t nChannels, Int_t nPoles, Int_t rowIndex = 1);
-
- //! Add a K-matrix production pole term to the model
- /*!
- NB the stored order of resonances is:
- - Firstly, all coherent resonances (i.e. those added using addResonance() or addKMatrixProdPole() or addKMatrixProdSVP()) in order of addition
- - Followed by all incoherent resonances (i.e. those added using addIncoherentResonance()) in order of addition
-
- \param [in] poleName the name of the pole
- \param [in] propName the name of the propagator to use
- \param [in] poleIndex the index of the pole within the propagator
- \param [in] useProdAdler boolean to turn on/off the production Adler zero factor (default = off)
- */
- void addKMatrixProdPole(const TString& poleName, const TString& propName, Int_t poleIndex, Bool_t useProdAdler = kFALSE);
-
- //! Add a K-matrix slowly-varying part (SVP) term to the model
- /*!
- NB the stored order of resonances is:
- - Firstly, all coherent resonances (i.e. those added using addResonance() or addKMatrixProdPole() or addKMatrixProdSVP()) in order of addition
- - Followed by all incoherent resonances (i.e. those added using addIncoherentResonance()) in order of addition
-
- \param [in] SVPName the name of the term
- \param [in] propName the name of the propagator to use
- \param [in] channelIndex the index of the channel within the propagator
- \param [in] useProdAdler boolean to turn on/off the production Adler zero factor (default = off)
- */
- void addKMatrixProdSVP(const TString& SVPName, const TString& propName, Int_t channelIndex, Bool_t useProdAdler = kFALSE);
-
- //! Set the maximum value of A squared to be used in the accept/reject
- /*!
- Disables the automatic determination of ASqMax
-
- \param [in] value the new value
- */
- inline void setASqMaxValue(Double_t value) {aSqMaxSet_ = value; aSqMaxAuto_ = kFALSE;}
-
- //! Retrieve the maximum value of A squared to be used in the accept/reject
- /*!
- \return the maximum value of A squared
- */
- inline Double_t getASqMaxSetValue() const { return aSqMaxSet_; }
-
- //! Retrieve the maximum of A squared that has been found while generating
- /*!
- \return the maximum of A squared that has been found
- */
- inline Double_t getASqMaxVarValue() const { return aSqMaxVar_; }
-
- //! Generate a toy MC signal event
- /*!
- \return kTRUE if the event is successfully generated, kFALSE otherwise
- */
- Bool_t generate();
-
- //! Check the status of the toy MC generation
- /*!
- \param [in] printErrorMessages whether error messages should be printed
- \param [in] printInfoMessages whether info messages should be printed
- \return the status of the toy MC generation
- */
- ToyMCStatus checkToyMC(Bool_t printErrorMessages = kTRUE, Bool_t printInfoMessages = kFALSE);
-
- //! Retrieve the maximum number of iterations allowed when generating an event
- /*!
- \return the maximum number of iterations allowed
- */
- inline Int_t maxGenIterations() const {return iterationsMax_;}
-
- //! Calculate the likelihood (and all associated information) for the given event number
- /*!
- \param [in] iEvt the event number
- */
- void calcLikelihoodInfo(const UInt_t iEvt);
-
- //! Calculate the likelihood (and all associated information) given values of the Dalitz plot coordinates
- /*!
- \param [in] m13Sq the invariant mass squared of the first and third daughters
- \param [in] m23Sq the invariant mass squared of the second and third daughters
- */
- void calcLikelihoodInfo(const Double_t m13Sq, const Double_t m23Sq);
-
- //! Calculate the likelihood (and all associated information) given values of the Dalitz plot coordinates and the tagging category
- /*!
- Also obtain the self cross feed fraction to cache with the rest of the Dalitz plot quantities.
- \param [in] m13Sq the invariant mass squared of the first and third daughters
- \param [in] m23Sq the invariant mass squared of the second and third daughters
- \param [in] tagCat the tagging category
- */
- void calcLikelihoodInfo(const Double_t m13Sq, const Double_t m23Sq, const Int_t tagCat);
-
- //! Calculate the fit fractions, mean efficiency and total DP rate
- /*!
- \param [in] init whether the calculated values should be stored as the initial/generated values or the fitted values
- */
- void calcExtraInfo(const Bool_t init = kFALSE);
-
- //! Calculates whether an event with the current kinematics should be accepted in order to produce a distribution of events that matches the model e.g. when reweighting embedded data
- /*!
- Uses the accept/reject method.
- \return kTRUE if the event has been accepted, kFALSE otherwise
- */
- Bool_t gotReweightedEvent();
-
- //! Calculate the acceptance rate, for events with the current kinematics, when generating events according to the model
- /*!
- \return the weight for the current kinematics
- */
- Double_t getEventWeight();
-
- //! Retrieve the total amplitude for the current event
- /*!
- \return the total amplitude
- */
- inline const LauComplex& getEvtDPAmp() const {return totAmp_;}
-
- //! Retrieve the invariant mass squared of the first and third daughters in the current event
- /*!
- \return the invariant mass squared of the first and third daughters in the current event
- */
- inline Double_t getEvtm13Sq() const {return m13Sq_;}
-
- //! Retrieve the invariant mass squared of the second and third daughters in the current event
- /*!
- \return the invariant mass squared of the second and third daughters in the current event
- */
- inline Double_t getEvtm23Sq() const {return m23Sq_;}
-
- //! Retrieve the square Dalitz plot coordinate, m', for the current event
- /*!
- \return the square Dalitz plot coordinate, m', for the current event
- */
- inline Double_t getEvtmPrime() const {return mPrime_;}
-
- //! Retrieve the square Dalitz plot coordinate, theta', for the current event
- /*!
- \return the square Dalitz plot coordinate, theta', for the current event
- */
- inline Double_t getEvtthPrime() const {return thPrime_;}
-
- //! Retrieve the efficiency for the current event
- /*!
- \return the efficiency for the current event
- */
- inline Double_t getEvtEff() const {return eff_;}
-
- //! Retrieve the fraction of events that are poorly reconstructed (the self cross feed fraction) for the current event
- /*!
- \return the self cross feed fraction for the current event
- */
- inline Double_t getEvtScfFraction() const {return scfFraction_;}
-
- //! Retrieve the Jacobian, for the transformation into square DP coordinates, for the current event
- /*!
- \return the Jacobian for the current event
- */
- inline Double_t getEvtJacobian() const {return jacobian_;}
-
- //! Retrieve the total intensity multiplied by the efficiency for the current event
- /*!
- \return the total intensity multiplied by the efficiency for the current event
- */
- inline Double_t getEvtIntensity() const {return ASq_;}
-
- //! Retrieve the likelihood for the current event
- /*!
- The likelihood is the normalised total intensity:
- evtLike_ = ASq_/DPNorm_
-
- \return the likelihood for the current event
- */
- inline Double_t getEvtLikelihood() const {return evtLike_;}
-
- //! Retrieve the normalised dynamic part of the amplitude of the given amplitude component at the current point in the Dalitz plot
- /*!
- \param [in] resID the index of the component within the model
- \return the amplitude of the given component
- */
- inline LauComplex getDynamicAmp(const Int_t resID) const {return ff_[resID].scale(fNorm_[resID]);}
-
- //! Retrieve the Amplitude of resonance resID
- /*!
- \param [in] resID the index of the component within the model
- \return the amplitude of the given component
- */
- inline LauComplex getFullAmplitude(const Int_t resID) const {return Amp_[resID] * this->getDynamicAmp(resID);}
-
- //! Retrieve the event-by-event running totals of amplitude cross terms for all pairs of amplitude components
- /*!
- \return the event-by-event running totals of amplitude cross terms
- */
- inline const std::vector< std::vector<LauComplex> >& getFiFjSum() const {return fifjSum_;}
-
- //! Retrieve the event-by-event running totals of efficiency corrected amplitude cross terms for all pairs of amplitude components
- /*!
- \return the event-by-event running totals of amplitude cross terms with efficiency corrections applied
- */
- inline const std::vector< std::vector<LauComplex> >& getFiFjEffSum() const {return fifjEffSum_;}
-
- //! Retrieve the normalisation factors for the dynamic parts of the amplitudes for all of the amplitude components
- /*!
- \return the normalisation factors
- */
- inline const std::vector<Double_t>& getFNorm() const {return fNorm_;}
-
- //! Fill the internal data structure that caches the resonance dynamics
- /*!
- \param [in] fitDataTree the data source
- */
- void fillDataTree(const LauFitDataTree& fitDataTree);
-
- //! Recache the amplitude values for those that have changed
- void modifyDataTree();
-
- //! Check whether this model includes a named resonance
- /*!
- \param [in] resName the resonance
- \return true if the resonance is present, false otherwise
- */
- Bool_t hasResonance(const TString& resName) const;
-
- //! Retrieve the index for the given resonance
- /*!
- \param [in] resName the resonance
- \return the index of the resonance if it is present, -1 otherwise
- */
- Int_t resonanceIndex(const TString& resName) const;
-
- //! Retrieve the name of the charge conjugate of a named resonance
- /*!
- \param [in] resName the resonance
- \return the name of the charge conjugate
- */
- TString getConjResName(const TString& resName) const;
-
- //! Retrieve the named resonance
- /*!
- \param [in] resName the name of the resonance to retrieve
- \return the requested resonance
- */
- const LauAbsResonance* findResonance(const TString& resName) const;
-
- //! Retrieve a resonance by its index
- /*!
- \param [in] resIndex the index of the resonance to retrieve
- \return the requested resonance
- */
- const LauAbsResonance* getResonance(const UInt_t resIndex) const;
-
- //! Update the complex coefficients for the resonances
- /*!
- \param [in] coeffs the new set of coefficients
- */
- void updateCoeffs(const std::vector<LauComplex>& coeffs);
-
- //! Collate the resonance parameters to initialise (or re-initialise) the model
- /*!
- NB: This has been factored out of the initialise() method to allow for use in the
- importation of parameters in LauAbsFitModel
- */
- void collateResonanceParameters();
-
- //! Set the helicity flip flag for new amplitude components
- /*!
- \param [in] boolean the helicity flip flag
- */
- inline void flipHelicityForCPEigenstates(const Bool_t boolean) {flipHelicity_ = boolean;}
-
- //! Retrieve the mean efficiency across the Dalitz plot
- /*!
- \return the mean efficiency across the Dalitz plot
- */
- inline const LauParameter& getMeanEff() const {return meanDPEff_;}
-
- //! Retrieve the overall Dalitz plot rate
- /*!
- \return the overall Dalitz plot rate
- */
- inline const LauParameter& getDPRate() const {return DPRate_;}
-
- //! Retrieve the fit fractions for the amplitude components
- /*!
- \return the fit fractions
- */
- inline const LauParArray& getFitFractions() const {return fitFrac_;}
-
- //! Retrieve the fit fractions for the amplitude components
- /*!
- \return the fit fractions
- */
- inline const LauParArray& getFitFractionsEfficiencyUncorrected() const {return fitFracEffUnCorr_;}
-
- //! Retrieve the total number of amplitude components
- /*!
- \return the total number of amplitude components
- */
- inline UInt_t getnTotAmp() const {return nAmp_+nIncohAmp_;}
-
- //! Retrieve the number of coherent amplitude components
- /*!
- \return the number of coherent amplitude components
- */
- inline UInt_t getnCohAmp() const {return nAmp_;}
-
- //! Retrieve the number of incoherent amplitude components
- /*!
- \return the number of incoherent amplitude components
- */
- inline UInt_t getnIncohAmp() const {return nIncohAmp_;}
-
- //! Retrieve the normalisation factor for the log-likelihood function
- /*!
- \return the normalisation factor
- */
- inline Double_t getDPNorm() const {return DPNorm_;}
-
- //! Retrieve the daughters
- /*!
- \return the daughters
- */
- inline const LauDaughters* getDaughters() const {return daughters_;}
-
- //! Retrieve the Dalitz plot kinematics
- /*!
- \return the Dalitz plot kinematics
- */
- inline const LauKinematics* getKinematics() const {return kinematics_;}
-
- //! Retrieve the Dalitz plot kinematics
- /*!
- \return the Dalitz plot kinematics
- */
- inline LauKinematics* getKinematics() {return kinematics_;}
-
- //! Retrieve the model for the efficiency across the Dalitz plot
- /*!
- \return the efficiency model
- */
- inline const LauAbsEffModel* getEffModel() const {return effModel_;}
-
- //! Check whether a self cross feed fraction model is being used
- /*!
- \return true if a self cross feed fraction model is being used, false otherwise
- */
- inline Bool_t usingScfModel() const { return ! scfFractionModel_.empty(); }
-
- //! Retrieve any extra parameters/quantities (e.g. K-matrix total fit fractions)
- /*!
- \return any extra parameters
- */
- inline const std::vector<LauParameter>& getExtraParameters() const {return extraParameters_;}
-
- //! Retrieve the floating parameters of the resonance models
- /*!
- \return the list of floating parameters
- */
- inline std::vector<LauParameter*>& getFloatingParameters() {return resonancePars_;}
-
- //! Whether to calculate separate rho and omega fit-fractions from LauRhoOmegaMix
- inline void calculateRhoOmegaFitFractions(const Bool_t calcFF) { calculateRhoOmegaFitFractions_ = calcFF; }
-
- protected:
- //! Print a summary of the model to be used
- void initSummary();
-
- //! Initialise the internal storage for this model
- void initialiseVectors();
-
- //! Zero the various values used to store integrals info
- void resetNormVectors();
-
- //! Calculate the Dalitz plot normalisation integrals across the whole Dalitz plot
- void calcDPNormalisation();
-
- //! Form the regions that are produced by the spaces between narrow resonances
- /*!
- \param [in] regions the regions defined around narrow resonances
- \param [in] min the minimum value of the invariant mass
- \param [in] max the maximum value of the invariant mass
- \return vector of pointers to LauDPPartialIntegralInfo objects that contain the individual coarse regions
- */
- std::vector< std::pair<Double_t,Double_t> > formGapsFromRegions(const std::vector< std::pair<Double_t,Double_t> >& regions, const Double_t min, const Double_t max) const;
-
- //! Removes entries in the vector of LauDPPartialIntegralInfo* that are null
- /*!
- \param [in] regions the list of region pointers
- */
- void cullNullRegions(std::vector<LauDPPartialIntegralInfo*>& regions) const;
-
- //! Wrapper for LauDPPartialIntegralInfo constructor
- /*!
- \param [in] minm13 the minimum of the m13 range
- \param [in] maxm13 the maximum of the m13 range
- \param [in] minm23 the minimum of the m23 range
- \param [in] maxm23 the maximum of the m23 range
- \param [in] m13BinWidth the m13 bin width
- \param [in] m23BinWidth the m23 bin width
- \param [in] precision the precision required for the Gauss-Legendre weights
- \param [in] nAmp the number of coherent amplitude components
- \param [in] nIncohAmp the number of incoherent amplitude components
- \return 0 if the integration region has no internal points, otherwise returns a pointer to the newly constructed LauDPPartialIntegralInfo object
- */
- LauDPPartialIntegralInfo* newDPIntegrationRegion(const Double_t minm13, const Double_t maxm13,
- const Double_t minm23, const Double_t maxm23,
- const Double_t m13BinWidth, const Double_t m23BinWidth,
- const Double_t precision,
- const UInt_t nAmp,
- const UInt_t nIncohAmp) const;
-
- //! Correct regions to ensure that the finest integration grid takes precedence
- /*!
- \param [in] regions the windows in invariant mass
- \param [in] binnings the corresponding binnings for each window
- */
- void correctDPOverlap(std::vector< std::pair<Double_t,Double_t> >& regions, const std::vector<Double_t>& binnings) const;
-
- //! Create the integration grid objects for the m23 narrow resonance regions, including the overlap regions with the m13 narrow resonances
- /*!
- The overlap regions will have an m13Binnings x m23Binnings grid.
- The other regions will have a defaultBinning x m23Binnings grid.
-
- \param [in] m13Regions the limits of each narrow-resonance region in m13
- \param [in] m23Regions the limits of each narrow-resonance region in m23
- \param [in] m13Binnings the binning of each narrow-resonance region in m13
- \param [in] m23Binnings the binning of each narrow-resonance region in m23
- \param [in] precision the precision required for the Gauss-Legendre weights
- \param [in] defaultBinning the binning used in the bulk of the phase space
- \return vector of pointers to LauDPPartialIntegralInfo objects that contain the individual regions
- */
- std::vector<LauDPPartialIntegralInfo*> m23IntegrationRegions(const std::vector< std::pair<Double_t,Double_t> >& m13Regions,
- const std::vector< std::pair<Double_t,Double_t> >& m23Regions,
- const std::vector<Double_t>& m13Binnings,
- const std::vector<Double_t>& m23Binnings,
- const Double_t precision,
- const Double_t defaultBinning) const;
-
- //! Create the integration grid objects for the m13 narrow resonance regions, excluding the overlap regions with the m23 narrow resonances
- /*!
- The regions will have a m13Binnings x defaultBinning grid.
- The overlap regions are created by the m23IntegrationRegions function.
-
- \param [in] m13Regions the limits of each narrow-resonance region in m13
- \param [in] m23Regions the limits of each narrow-resonance region in m23
- \param [in] m13Binnings the binning of each narrow-resonance region in m13
- \param [in] precision the precision required for the Gauss-Legendre weights
- \param [in] defaultBinning the binning used in the bulk of the phase space
- \return vector of pointers to LauDPPartialIntegralInfo objects that contain the individual regions
- */
- std::vector<LauDPPartialIntegralInfo*> m13IntegrationRegions(const std::vector< std::pair<Double_t,Double_t> >& m13Regions,
- const std::vector< std::pair<Double_t,Double_t> >& m23Regions,
- const std::vector<Double_t>& m13Binnings,
- const Double_t precision,
- const Double_t defaultBinning) const;
-
- //! Calculate the Dalitz plot normalisation integrals across the whole Dalitz plot
- void calcDPNormalisationScheme();
-
- //! Determine which amplitudes and integrals need to be recalculated
- void findIntegralsToBeRecalculated();
-
- //! Calculate the Dalitz plot normalisation integrals over a given range
- /*!
- \param [in] intInfo the integration information object
- */
- void calcDPPartialIntegral(LauDPPartialIntegralInfo* intInfo);
-
- //! Write the results of the integrals (and related information) to a file
- void writeIntegralsFile();
-
- //! Set the dynamic part of the amplitude for a given amplitude component at the current point in the Dalitz plot
- /*!
- \param [in] index the index of the amplitude component
- \param [in] realPart the real part of the amplitude
- \param [in] imagPart the imaginary part of the amplitude
- */
- void setFFTerm(const UInt_t index, const Double_t realPart, const Double_t imagPart);
-
- //! Set the dynamic part of the intensity for a given incoherent amplitude component at the current point in the Dalitz plot
- /*!
- \param [in] index the index of the incoherent amplitude component
- \param [in] value the intensity
- */
- void setIncohIntenTerm(const UInt_t index, const Double_t value);
-
- //! Calculate the amplitudes for all resonances for the current kinematics
- void calculateAmplitudes();
-
- //! Calculate or retrieve the cached value of the amplitudes for all resonances at the specified integration grid point
- /*!
- \param [in,out] intInfo the integration information object
- \param [in] m13Point the grid index in m13
- \param [in] m23Point the grid index in m23
- */
- void calculateAmplitudes( LauDPPartialIntegralInfo* intInfo, const UInt_t m13Point, const UInt_t m23Point );
-
- //! Add the amplitude values (with the appropriate weight) at the current grid point to the running integral values
- /*!
- \param [in] weight the weight to apply
- */
- void addGridPointToIntegrals(const Double_t weight);
-
- //! Calculate the total Dalitz plot amplitude at the current point in the Dalitz plot
- /*!
- \param [in] useEff whether to apply efficiency corrections
- */
- void calcTotalAmp(const Bool_t useEff);
-
- //! Obtain the efficiency of the current event from the model
- /*!
- \return the efficiency
- */
- Double_t retrieveEfficiency();
-
- //! Obtain the self cross feed fraction of the current event from the model
- /*!
- \param [in] tagCat the tagging category of the current event
- \return the self cross feed fraction
- */
- Double_t retrieveScfFraction(Int_t tagCat);
-
- //! Set the maximum of A squared that has been found
- /*!
- \param [in] value the new value
- */
- inline void setASqMaxVarValue(Double_t value) {aSqMaxVar_ = value;}
-
- //! Calculate the normalisation factor for the log-likelihood function
- /*!
- \return the normalisation factor
- */
- Double_t calcSigDPNorm();
-
- //! Calculate the dynamic part of the amplitude for a given component at the current point in the Dalitz plot
- /*!
- \param [in] index the index of the amplitude component within the model
- */
- LauComplex resAmp(const UInt_t index);
-
- //! Calculate the dynamic part of the intensity for a given incoherent component at the current point in the Dalitz plot
- /*!
- \param [in] index the index of the incoherent component within the model
- */
- Double_t incohResAmp(const UInt_t index);
-
- //! Load the data for a given event
- /*!
- \param [in] iEvt the number of the event
- */
- void setDataEventNo(UInt_t iEvt);
-
- //! Retrieve the named resonance
- /*!
- \param [in] resName the name of the resonance to retrieve
- \return the requested resonance
- */
- LauAbsResonance* findResonance(const TString& resName);
-
- //! Retrieve a resonance by its index
- /*!
- \param [in] resIndex the index of the resonance to retrieve
- \return the requested resonance
- */
- LauAbsResonance* getResonance(const UInt_t resIndex);
-
- //! Remove the charge from the given particle name
- /*!
- \param [in,out] string the particle name
- */
- void removeCharge(TString& string) const;
-
- //! Check whether a resonance is a K-matrix component of a given propagator
- /*!
- \param [in] resAmpInt the index of the resonance within the model
- \param [in] propName the name of the K-matrix propagator
- \return true if the resonance is a component of the given propagator, otherwise return false
- */
- Bool_t gotKMatrixMatch(UInt_t resAmpInt, const TString& propName) const;
-
- private:
- //! Copy constructor (not implemented)
- LauIsobarDynamics(const LauIsobarDynamics& rhs);
-
- //! Copy assignment operator (not implemented)
- LauIsobarDynamics& operator=(const LauIsobarDynamics& rhs);
-
- //! The type used for containing the K-matrix propagators
- typedef std::map<TString, LauKMatrixPropagator*> KMPropMap;
-
- //! The type used for mapping K-matrix components to their propagators
- typedef std::map<TString, TString> KMStringMap;
-
- //! The daughters of the decay
- LauDaughters* daughters_;
+ public:
+ //! The type used for containing multiple self cross feed fraction models for different categories (e.g. tagging categories)
+ typedef std::map<Int_t, LauAbsEffModel*> LauTagCatScfFractionModelMap;
+
+ //! The possible statuses for toy MC generation
+ enum ToyMCStatus {
+ GenOK, /*!< Generation completed OK */
+ MaxIterError, /*!< Maximum allowed number of iterations completed without success (ASqMax is too high) */
+ ASqMaxError /*!< An amplitude squared value was returned that was larger than the maximum expected (ASqMax is too low) */
+ };
+
+ //! Constructor
+ /*!
+ \param [in] daughters the daughters of the decay
+ \param [in] effModel the model to describe the efficiency across the Dalitz plot
+ \param [in] scfFractionModel the model to describe the fraction of poorly constructed events (the self cross feed fraction) across the Dalitz plot
+ */
+ LauIsobarDynamics( LauDaughters* daughters,
+ LauAbsEffModel* effModel,
+ LauAbsEffModel* scfFractionModel = 0 );
+
+ //! Constructor
+ /*!
+ \param [in] daughters the daughters of the decay
+ \param [in] effModel the model to describe the efficiency across the Dalitz plot
+ \param [in] scfFractionModel the models to describe the fraction of poorly constructed events (the self cross feed fraction) across the Dalitz plot for various tagging categories
+ */
+ LauIsobarDynamics( LauDaughters* daughters,
+ LauAbsEffModel* effModel,
+ LauTagCatScfFractionModelMap scfFractionModel );
+
+ //! Destructor
+ virtual ~LauIsobarDynamics();
+
+ //! Initialise the Dalitz plot dynamics
+ /*!
+ \param [in] coeffs the complex coefficients for the resonances
+ */
+ void initialise( const std::vector<LauComplex>& coeffs );
+
+ //! recalculate Normalization
+ void recalculateNormalisation();
+
+ //! Set the name of the file to which to save the results of the integrals
+ /*!
+ \param [in] fileName the name of the file
+ */
+ inline void setIntFileName( const TString& fileName ) { intFileName_ = fileName; }
+
+ // Integration
+ //! Set the widths of the bins to use when integrating across the Dalitz plot or square Dalitz plot
+ /*!
+ Specify the bin widths required when performing the DP integration.
+ Note that the integration is not performed in m13^2 vs m23^2 space
+ but in either m13 vs m23 space or mPrime vs thetaPrime space,
+ with the appropriate Jacobian applied.
+ The default bin widths in m13 vs m23 space are 0.005 GeV.
+ The default bin widths in mPrime vs thetaPrime space are 0.001.
+
+ \param [in] m13BinWidth the bin width to use when integrating over m13
+ \param [in] m23BinWidth the bin width to use when integrating over m23
+ \param [in] mPrimeBinWidth the bin width to use when integrating over mPrime
+ \param [in] thPrimeBinWidth the bin width to use when integrating over thetaPrime
+ */
+ void setIntegralBinWidths( const Double_t m13BinWidth,
+ const Double_t m23BinWidth,
+ const Double_t mPrimeBinWidth = 0.001,
+ const Double_t thPrimeBinWidth = 0.001 );
+
+ //! Set the value below which a resonance width is considered to be narrow
+ /*!
+ Narrow resonances trigger different integration behaviour - dividing the DP into regions where a finer binning is used.
+ This can cause high memory usage, so use this method and LauIsobarDynamics::setIntegralBinningFactor to tune this behaviour, if needed.
+
+ \param [in] narrowWidth the value below which a resonance is considered to be narrow (defaults to 0.02 GeV/c2)
+ */
+ void setNarrowResonanceThreshold( const Double_t narrowWidth ) { narrowWidth_ = narrowWidth; }
+
+ //! Set the factor relating the width of a narrow resonance and the binning size in its integration region
+ /*!
+ Narrow resonances trigger different integration behaviour - dividing the DP into regions where a finer binning is used.
+ This can cause high memory usage, so use this method and LauIsobarDynamics::setNarrowResonanceThreshold to tune this behaviour, if needed.
+
+ \param [in] binningFactor the factor by which the resonance width is divided to obtain the bin size (defaults to 100)
+ */
+ void setIntegralBinningFactor( const Double_t binningFactor )
+ {
+ binningFactor_ = binningFactor;
+ }
+
+ //! Force the symmetrisation of the integration in m13 <-> m23 for non-symmetric but flavour-conjugate final states
+ /*!
+ This can be necessary for time-dependent fits (where interference terms between A and Abar need to be integrated)
+
+ \param [in] force toggle forcing symmetrisation of the integration for apparently flavour-conjugate final states
+ */
+ void forceSymmetriseIntegration( const Bool_t force ) { forceSymmetriseIntegration_ = force; }
+
+ //! Add a resonance to the Dalitz plot
+ /*!
+ NB the stored order of resonances is:
+ - Firstly, all coherent resonances (i.e. those added using addResonance() or addKMatrixProdPole() or addKMatrixProdSVP()) in order of addition
+ - Followed by all incoherent resonances (i.e. those added using addIncoherentResonance()) in order of addition
+
+ \param [in] resName the name of the resonant particle
+ \param [in] resPairAmpInt the index of the daughter not produced by the resonance
+ \param [in] resType the model for the resonance dynamics
+ \param [in] bwCategory the Blatt-Weisskopf barrier factor category
+ \return the newly created resonance
+ */
+ LauAbsResonance* addResonance( const TString& resName,
+ const Int_t resPairAmpInt,
+ const LauAbsResonance::LauResonanceModel resType,
+ const LauBlattWeisskopfFactor::BlattWeisskopfCategory bwCategory =
+ LauBlattWeisskopfFactor::Default );
+
+ //! Add an incoherent resonance to the Dalitz plot
+ /*!
+ NB the stored order of resonances is:
+ - Firstly, all coherent resonances (i.e. those added using addResonance() or addKMatrixProdPole() or addKMatrixProdSVP()) in order of addition
+ - Followed by all incoherent resonances (i.e. those added using addIncoherentResonance()) in order of addition
+
+ \param [in] resName the name of the resonant particle
+ \param [in] resPairAmpInt the index of the daughter not produced by the resonance
+ \param [in] resType the model for the resonance dynamics
+ \return the newly created resonance
+ */
+ LauAbsResonance* addIncoherentResonance( const TString& resName,
+ const Int_t resPairAmpInt,
+ const LauAbsResonance::LauResonanceModel resType );
+
+ //! Define a new K-matrix Propagator
+ /*!
+ \param [in] propName the name of the propagator
+ \param [in] paramFileName the file that defines the propagator
+ \param [in] resPairAmpInt the index of the bachelor
+ \param [in] nChannels the number of channels
+ \param [in] nPoles the number of poles
+ \param [in] rowIndex the index of the row to be used when summing over all amplitude channels: S-wave corresponds to rowIndex = 1.
+ */
+ LauKMatrixPropagator* defineKMatrixPropagator( const TString& propName,
+ const TString& paramFileName,
+ Int_t resPairAmpInt,
+ Int_t nChannels,
+ Int_t nPoles,
+ Int_t rowIndex = 1 );
+
+ //! Add a K-matrix production pole term to the model
+ /*!
+ NB the stored order of resonances is:
+ - Firstly, all coherent resonances (i.e. those added using addResonance() or addKMatrixProdPole() or addKMatrixProdSVP()) in order of addition
+ - Followed by all incoherent resonances (i.e. those added using addIncoherentResonance()) in order of addition
+
+ \param [in] poleName the name of the pole
+ \param [in] propName the name of the propagator to use
+ \param [in] poleIndex the index of the pole within the propagator
+ \param [in] useProdAdler boolean to turn on/off the production Adler zero factor (default = off)
+ */
+ void addKMatrixProdPole( const TString& poleName,
+ const TString& propName,
+ Int_t poleIndex,
+ Bool_t useProdAdler = kFALSE );
+
+ //! Add a K-matrix slowly-varying part (SVP) term to the model
+ /*!
+ NB the stored order of resonances is:
+ - Firstly, all coherent resonances (i.e. those added using addResonance() or addKMatrixProdPole() or addKMatrixProdSVP()) in order of addition
+ - Followed by all incoherent resonances (i.e. those added using addIncoherentResonance()) in order of addition
+
+ \param [in] SVPName the name of the term
+ \param [in] propName the name of the propagator to use
+ \param [in] channelIndex the index of the channel within the propagator
+ \param [in] useProdAdler boolean to turn on/off the production Adler zero factor (default = off)
+ */
+ void addKMatrixProdSVP( const TString& SVPName,
+ const TString& propName,
+ Int_t channelIndex,
+ Bool_t useProdAdler = kFALSE );
+
+ //! Set the maximum value of A squared to be used in the accept/reject
+ /*!
+ Disables the automatic determination of ASqMax
+
+ \param [in] value the new value
+ */
+ inline void setASqMaxValue( Double_t value )
+ {
+ aSqMaxSet_ = value;
+ aSqMaxAuto_ = kFALSE;
+ }
+
+ //! Retrieve the maximum value of A squared to be used in the accept/reject
+ /*!
+ \return the maximum value of A squared
+ */
+ inline Double_t getASqMaxSetValue() const { return aSqMaxSet_; }
+
+ //! Retrieve the maximum of A squared that has been found while generating
+ /*!
+ \return the maximum of A squared that has been found
+ */
+ inline Double_t getASqMaxVarValue() const { return aSqMaxVar_; }
+
+ //! Generate a toy MC signal event
+ /*!
+ \return kTRUE if the event is successfully generated, kFALSE otherwise
+ */
+ Bool_t generate();
+
+ //! Check the status of the toy MC generation
+ /*!
+ \param [in] printErrorMessages whether error messages should be printed
+ \param [in] printInfoMessages whether info messages should be printed
+ \return the status of the toy MC generation
+ */
+ ToyMCStatus checkToyMC( Bool_t printErrorMessages = kTRUE, Bool_t printInfoMessages = kFALSE );
+
+ //! Retrieve the maximum number of iterations allowed when generating an event
+ /*!
+ \return the maximum number of iterations allowed
+ */
+ inline Int_t maxGenIterations() const { return iterationsMax_; }
+
+ //! Calculate the likelihood (and all associated information) for the given event number
+ /*!
+ \param [in] iEvt the event number
+ */
+ void calcLikelihoodInfo( const UInt_t iEvt );
+
+ //! Calculate the likelihood (and all associated information) given values of the Dalitz plot coordinates
+ /*!
+ \param [in] m13Sq the invariant mass squared of the first and third daughters
+ \param [in] m23Sq the invariant mass squared of the second and third daughters
+ */
+ void calcLikelihoodInfo( const Double_t m13Sq, const Double_t m23Sq );
+
+ //! Calculate the likelihood (and all associated information) given values of the Dalitz plot coordinates and the tagging category
+ /*!
+ Also obtain the self cross feed fraction to cache with the rest of the Dalitz plot quantities.
+
+ \param [in] m13Sq the invariant mass squared of the first and third daughters
+ \param [in] m23Sq the invariant mass squared of the second and third daughters
+ \param [in] tagCat the tagging category
+ */
+ void calcLikelihoodInfo( const Double_t m13Sq, const Double_t m23Sq, const Int_t tagCat );
+
+ //! Calculate the fit fractions, mean efficiency and total DP rate
+ /*!
+ \param [in] init whether the calculated values should be stored as the initial/generated values or the fitted values
+ */
+ void calcExtraInfo( const Bool_t init = kFALSE );
+
+ //! Calculates whether an event with the current kinematics should be accepted in order to produce a distribution of events that matches the model e.g. when reweighting embedded data
+ /*!
+ Uses the accept/reject method.
+
+ \return kTRUE if the event has been accepted, kFALSE otherwise
+ */
+ Bool_t gotReweightedEvent();
+
+ //! Calculate the acceptance rate, for events with the current kinematics, when generating events according to the model
+ /*!
+ \return the weight for the current kinematics
+ */
+ Double_t getEventWeight();
+
+ //! Retrieve the total amplitude for the current event
+ /*!
+ \return the total amplitude
+ */
+ inline const LauComplex& getEvtDPAmp() const { return totAmp_; }
+
+ //! Retrieve the invariant mass squared of the first and third daughters in the current event
+ /*!
+ \return the invariant mass squared of the first and third daughters in the current event
+ */
+ inline Double_t getEvtm13Sq() const { return m13Sq_; }
+
+ //! Retrieve the invariant mass squared of the second and third daughters in the current event
+ /*!
+ \return the invariant mass squared of the second and third daughters in the current event
+ */
+ inline Double_t getEvtm23Sq() const { return m23Sq_; }
+
+ //! Retrieve the square Dalitz plot coordinate, m', for the current event
+ /*!
+ \return the square Dalitz plot coordinate, m', for the current event
+ */
+ inline Double_t getEvtmPrime() const { return mPrime_; }
+
+ //! Retrieve the square Dalitz plot coordinate, theta', for the current event
+ /*!
+ \return the square Dalitz plot coordinate, theta', for the current event
+ */
+ inline Double_t getEvtthPrime() const { return thPrime_; }
+
+ //! Retrieve the efficiency for the current event
+ /*!
+ \return the efficiency for the current event
+ */
+ inline Double_t getEvtEff() const { return eff_; }
+
+ //! Retrieve the fraction of events that are poorly reconstructed (the self cross feed fraction) for the current event
+ /*!
+ \return the self cross feed fraction for the current event
+ */
+ inline Double_t getEvtScfFraction() const { return scfFraction_; }
+
+ //! Retrieve the Jacobian, for the transformation into square DP coordinates, for the current event
+ /*!
+ \return the Jacobian for the current event
+ */
+ inline Double_t getEvtJacobian() const { return jacobian_; }
+
+ //! Retrieve the total intensity multiplied by the efficiency for the current event
+ /*!
+ \return the total intensity multiplied by the efficiency for the current event
+ */
+ inline Double_t getEvtIntensity() const { return ASq_; }
+
+ //! Retrieve the likelihood for the current event
+ /*!
+ The likelihood is the normalised total intensity:
+ evtLike_ = ASq_/DPNorm_
+
+ \return the likelihood for the current event
+ */
+ inline Double_t getEvtLikelihood() const { return evtLike_; }
+
+ //! Retrieve the normalised dynamic part of the amplitude of the given amplitude component at the current point in the Dalitz plot
+ /*!
+ \param [in] resID the index of the component within the model
+ \return the amplitude of the given component
+ */
+ inline LauComplex getDynamicAmp( const Int_t resID ) const
+ {
+ return ff_[resID].scale( fNorm_[resID] );
+ }
+
+ //! Retrieve the Amplitude of resonance resID
+ /*!
+ \param [in] resID the index of the component within the model
+ \return the amplitude of the given component
+ */
+ inline LauComplex getFullAmplitude( const Int_t resID ) const
+ {
+ return Amp_[resID] * this->getDynamicAmp( resID );
+ }
+
+ //! Retrieve the event-by-event running totals of amplitude cross terms for all pairs of amplitude components
+ /*!
+ \return the event-by-event running totals of amplitude cross terms
+ */
+ inline const std::vector<std::vector<LauComplex>>& getFiFjSum() const { return fifjSum_; }
+
+ //! Retrieve the event-by-event running totals of efficiency corrected amplitude cross terms for all pairs of amplitude components
+ /*!
+ \return the event-by-event running totals of amplitude cross terms with efficiency corrections applied
+ */
+ inline const std::vector<std::vector<LauComplex>>& getFiFjEffSum() const { return fifjEffSum_; }
+
+ //! Retrieve the normalisation factors for the dynamic parts of the amplitudes for all of the amplitude components
+ /*!
+ \return the normalisation factors
+ */
+ inline const std::vector<Double_t>& getFNorm() const { return fNorm_; }
+
+ //! Fill the internal data structure that caches the resonance dynamics
+ /*!
+ \param [in] fitDataTree the data source
+ */
+ void fillDataTree( const LauFitDataTree& fitDataTree );
+
+ //! Recache the amplitude values for those that have changed
+ void modifyDataTree();
+
+ //! Check whether this model includes a named resonance
+ /*!
+ \param [in] resName the resonance
+ \return true if the resonance is present, false otherwise
+ */
+ Bool_t hasResonance( const TString& resName ) const;
+
+ //! Retrieve the index for the given resonance
+ /*!
+ \param [in] resName the resonance
+ \return the index of the resonance if it is present, -1 otherwise
+ */
+ Int_t resonanceIndex( const TString& resName ) const;
+
+ //! Retrieve the name of the charge conjugate of a named resonance
+ /*!
+ \param [in] resName the resonance
+ \return the name of the charge conjugate
+ */
+ TString getConjResName( const TString& resName ) const;
+
+ //! Retrieve the named resonance
+ /*!
+ \param [in] resName the name of the resonance to retrieve
+ \return the requested resonance
+ */
+ const LauAbsResonance* findResonance( const TString& resName ) const;
+
+ //! Retrieve a resonance by its index
+ /*!
+ \param [in] resIndex the index of the resonance to retrieve
+ \return the requested resonance
+ */
+ const LauAbsResonance* getResonance( const UInt_t resIndex ) const;
+
+ //! Update the complex coefficients for the resonances
+ /*!
+ \param [in] coeffs the new set of coefficients
+ */
+ void updateCoeffs( const std::vector<LauComplex>& coeffs );
+
+ //! Collate the resonance parameters to initialise (or re-initialise) the model
+ /*!
+ NB: This has been factored out of the initialise() method to allow for use in the
+ importation of parameters in LauAbsFitModel
+ */
+ void collateResonanceParameters();
+
+ //! Set the helicity flip flag for new amplitude components
+ /*!
+ \param [in] boolean the helicity flip flag
+ */
+ inline void flipHelicityForCPEigenstates( const Bool_t boolean ) { flipHelicity_ = boolean; }
+
+ //! Retrieve the mean efficiency across the Dalitz plot
+ /*!
+ \return the mean efficiency across the Dalitz plot
+ */
+ inline const LauParameter& getMeanEff() const { return meanDPEff_; }
+
+ //! Retrieve the overall Dalitz plot rate
+ /*!
+ \return the overall Dalitz plot rate
+ */
+ inline const LauParameter& getDPRate() const { return DPRate_; }
+
+ //! Retrieve the fit fractions for the amplitude components
+ /*!
+ \return the fit fractions
+ */
+ inline const LauParArray& getFitFractions() const { return fitFrac_; }
+
+ //! Retrieve the fit fractions for the amplitude components
+ /*!
+ \return the fit fractions
+ */
+ inline const LauParArray& getFitFractionsEfficiencyUncorrected() const
+ {
+ return fitFracEffUnCorr_;
+ }
+
+ //! Retrieve the total number of amplitude components
+ /*!
+ \return the total number of amplitude components
+ */
+ inline UInt_t getnTotAmp() const { return nAmp_ + nIncohAmp_; }
+
+ //! Retrieve the number of coherent amplitude components
+ /*!
+ \return the number of coherent amplitude components
+ */
+ inline UInt_t getnCohAmp() const { return nAmp_; }
+
+ //! Retrieve the number of incoherent amplitude components
+ /*!
+ \return the number of incoherent amplitude components
+ */
+ inline UInt_t getnIncohAmp() const { return nIncohAmp_; }
+
+ //! Retrieve the normalisation factor for the log-likelihood function
+ /*!
+ \return the normalisation factor
+ */
+ inline Double_t getDPNorm() const { return DPNorm_; }
+
+ //! Retrieve the daughters
+ /*!
+ \return the daughters
+ */
+ inline const LauDaughters* getDaughters() const { return daughters_; }
+
+ //! Retrieve the Dalitz plot kinematics
+ /*!
+ \return the Dalitz plot kinematics
+ */
+ inline const LauKinematics* getKinematics() const { return kinematics_; }
+
+ //! Retrieve the Dalitz plot kinematics
+ /*!
+ \return the Dalitz plot kinematics
+ */
+ inline LauKinematics* getKinematics() { return kinematics_; }
+
+ //! Retrieve the model for the efficiency across the Dalitz plot
+ /*!
+ \return the efficiency model
+ */
+ inline const LauAbsEffModel* getEffModel() const { return effModel_; }
+
+ //! Check whether a self cross feed fraction model is being used
+ /*!
+ \return true if a self cross feed fraction model is being used, false otherwise
+ */
+ inline Bool_t usingScfModel() const { return ! scfFractionModel_.empty(); }
+
+ //! Retrieve any extra parameters/quantities (e.g. K-matrix total fit fractions)
+ /*!
+ \return any extra parameters
+ */
+ inline const std::vector<LauParameter>& getExtraParameters() const { return extraParameters_; }
+
+ //! Retrieve the floating parameters of the resonance models
+ /*!
+ \return the list of floating parameters
+ */
+ inline std::vector<LauParameter*>& getFloatingParameters() { return resonancePars_; }
+
+ //! Whether to calculate separate rho and omega fit-fractions from LauRhoOmegaMix
+ inline void calculateRhoOmegaFitFractions( const Bool_t calcFF )
+ {
+ calculateRhoOmegaFitFractions_ = calcFF;
+ }
+
+ protected:
+ //! Print a summary of the model to be used
+ void initSummary();
+
+ //! Initialise the internal storage for this model
+ void initialiseVectors();
+
+ //! Zero the various values used to store integrals info
+ void resetNormVectors();
+
+ //! Calculate the Dalitz plot normalisation integrals across the whole Dalitz plot
+ void calcDPNormalisation();
+
+ //! Form the regions that are produced by the spaces between narrow resonances
+ /*!
+ \param [in] regions the regions defined around narrow resonances
+ \param [in] min the minimum value of the invariant mass
+ \param [in] max the maximum value of the invariant mass
+ \return vector of pointers to LauDPPartialIntegralInfo objects that contain the individual coarse regions
+ */
+ std::vector<std::pair<Double_t, Double_t>> formGapsFromRegions(
+ const std::vector<std::pair<Double_t, Double_t>>& regions,
+ const Double_t min,
+ const Double_t max ) const;
+
+ //! Removes entries in the vector of LauDPPartialIntegralInfo* that are null
+ /*!
+ \param [in] regions the list of region pointers
+ */
+ void cullNullRegions( std::vector<LauDPPartialIntegralInfo*>& regions ) const;
+
+ //! Wrapper for LauDPPartialIntegralInfo constructor
+ /*!
+ \param [in] minm13 the minimum of the m13 range
+ \param [in] maxm13 the maximum of the m13 range
+ \param [in] minm23 the minimum of the m23 range
+ \param [in] maxm23 the maximum of the m23 range
+ \param [in] m13BinWidth the m13 bin width
+ \param [in] m23BinWidth the m23 bin width
+ \param [in] precision the precision required for the Gauss-Legendre weights
+ \param [in] nAmp the number of coherent amplitude components
+ \param [in] nIncohAmp the number of incoherent amplitude components
+ \return 0 if the integration region has no internal points, otherwise returns a pointer to the newly constructed LauDPPartialIntegralInfo object
+ */
+ LauDPPartialIntegralInfo* newDPIntegrationRegion( const Double_t minm13,
+ const Double_t maxm13,
+ const Double_t minm23,
+ const Double_t maxm23,
+ const Double_t m13BinWidth,
+ const Double_t m23BinWidth,
+ const Double_t precision,
+ const UInt_t nAmp,
+ const UInt_t nIncohAmp ) const;
+
+ //! Correct regions to ensure that the finest integration grid takes precedence
+ /*!
+ \param [in] regions the windows in invariant mass
+ \param [in] binnings the corresponding binnings for each window
+ */
+ void correctDPOverlap( std::vector<std::pair<Double_t, Double_t>>& regions,
+ const std::vector<Double_t>& binnings ) const;
+
+ //! Create the integration grid objects for the m23 narrow resonance regions, including the overlap regions with the m13 narrow resonances
+ /*!
+ The overlap regions will have an m13Binnings x m23Binnings grid.
+ The other regions will have a defaultBinning x m23Binnings grid.
+
+ \param [in] m13Regions the limits of each narrow-resonance region in m13
+ \param [in] m23Regions the limits of each narrow-resonance region in m23
+ \param [in] m13Binnings the binning of each narrow-resonance region in m13
+ \param [in] m23Binnings the binning of each narrow-resonance region in m23
+ \param [in] precision the precision required for the Gauss-Legendre weights
+ \param [in] defaultBinning the binning used in the bulk of the phase space
+ \return vector of pointers to LauDPPartialIntegralInfo objects that contain the individual regions
+ */
+ std::vector<LauDPPartialIntegralInfo*> m23IntegrationRegions(
+ const std::vector<std::pair<Double_t, Double_t>>& m13Regions,
+ const std::vector<std::pair<Double_t, Double_t>>& m23Regions,
+ const std::vector<Double_t>& m13Binnings,
+ const std::vector<Double_t>& m23Binnings,
+ const Double_t precision,
+ const Double_t defaultBinning ) const;
+
+ //! Create the integration grid objects for the m13 narrow resonance regions, excluding the overlap regions with the m23 narrow resonances
+ /*!
+ The regions will have a m13Binnings x defaultBinning grid.
+ The overlap regions are created by the m23IntegrationRegions function.
+
+ \param [in] m13Regions the limits of each narrow-resonance region in m13
+ \param [in] m23Regions the limits of each narrow-resonance region in m23
+ \param [in] m13Binnings the binning of each narrow-resonance region in m13
+ \param [in] precision the precision required for the Gauss-Legendre weights
+ \param [in] defaultBinning the binning used in the bulk of the phase space
+ \return vector of pointers to LauDPPartialIntegralInfo objects that contain the individual regions
+ */
+ std::vector<LauDPPartialIntegralInfo*> m13IntegrationRegions(
+ const std::vector<std::pair<Double_t, Double_t>>& m13Regions,
+ const std::vector<std::pair<Double_t, Double_t>>& m23Regions,
+ const std::vector<Double_t>& m13Binnings,
+ const Double_t precision,
+ const Double_t defaultBinning ) const;
+
+ //! Calculate the Dalitz plot normalisation integrals across the whole Dalitz plot
+ void calcDPNormalisationScheme();
+
+ //! Determine which amplitudes and integrals need to be recalculated
+ void findIntegralsToBeRecalculated();
+
+ //! Calculate the Dalitz plot normalisation integrals over a given range
+ /*!
+ \param [in] intInfo the integration information object
+ */
+ void calcDPPartialIntegral( LauDPPartialIntegralInfo* intInfo );
+
+ //! Write the results of the integrals (and related information) to a file
+ void writeIntegralsFile();
+
+ //! Set the dynamic part of the amplitude for a given amplitude component at the current point in the Dalitz plot
+ /*!
+ \param [in] index the index of the amplitude component
+ \param [in] realPart the real part of the amplitude
+ \param [in] imagPart the imaginary part of the amplitude
+ */
+ void setFFTerm( const UInt_t index, const Double_t realPart, const Double_t imagPart );
+
+ //! Set the dynamic part of the intensity for a given incoherent amplitude component at the current point in the Dalitz plot
+ /*!
+ \param [in] index the index of the incoherent amplitude component
+ \param [in] value the intensity
+ */
+ void setIncohIntenTerm( const UInt_t index, const Double_t value );
+
+ //! Calculate the amplitudes for all resonances for the current kinematics
+ void calculateAmplitudes();
+
+ //! Calculate or retrieve the cached value of the amplitudes for all resonances at the specified integration grid point
+ /*!
+ \param [in,out] intInfo the integration information object
+ \param [in] m13Point the grid index in m13
+ \param [in] m23Point the grid index in m23
+ */
+ void calculateAmplitudes( LauDPPartialIntegralInfo* intInfo,
+ const UInt_t m13Point,
+ const UInt_t m23Point );
+
+ //! Add the amplitude values (with the appropriate weight) at the current grid point to the running integral values
+ /*!
+ \param [in] weight the weight to apply
+ */
+ void addGridPointToIntegrals( const Double_t weight );
+
+ //! Calculate the total Dalitz plot amplitude at the current point in the Dalitz plot
+ /*!
+ \param [in] useEff whether to apply efficiency corrections
+ */
+ void calcTotalAmp( const Bool_t useEff );
+
+ //! Obtain the efficiency of the current event from the model
+ /*!
+ \return the efficiency
+ */
+ Double_t retrieveEfficiency();
+
+ //! Obtain the self cross feed fraction of the current event from the model
+ /*!
+ \param [in] tagCat the tagging category of the current event
+ \return the self cross feed fraction
+ */
+ Double_t retrieveScfFraction( Int_t tagCat );
+
+ //! Set the maximum of A squared that has been found
+ /*!
+ \param [in] value the new value
+ */
+ inline void setASqMaxVarValue( Double_t value ) { aSqMaxVar_ = value; }
+
+ //! Calculate the normalisation factor for the log-likelihood function
+ /*!
+ \return the normalisation factor
+ */
+ Double_t calcSigDPNorm();
+
+ //! Calculate the dynamic part of the amplitude for a given component at the current point in the Dalitz plot
+ /*!
+ \param [in] index the index of the amplitude component within the model
+ */
+ LauComplex resAmp( const UInt_t index );
+
+ //! Calculate the dynamic part of the intensity for a given incoherent component at the current point in the Dalitz plot
+ /*!
+ \param [in] index the index of the incoherent component within the model
+ */
+ Double_t incohResAmp( const UInt_t index );
+
+ //! Load the data for a given event
+ /*!
+ \param [in] iEvt the number of the event
+ */
+ void setDataEventNo( UInt_t iEvt );
+
+ //! Retrieve the named resonance
+ /*!
+ \param [in] resName the name of the resonance to retrieve
+ \return the requested resonance
+ */
+ LauAbsResonance* findResonance( const TString& resName );
+
+ //! Retrieve a resonance by its index
+ /*!
+ \param [in] resIndex the index of the resonance to retrieve
+ \return the requested resonance
+ */
+ LauAbsResonance* getResonance( const UInt_t resIndex );
+
+ //! Remove the charge from the given particle name
+ /*!
+ \param [in,out] string the particle name
+ */
+ void removeCharge( TString& string ) const;
+
+ //! Check whether a resonance is a K-matrix component of a given propagator
+ /*!
+ \param [in] resAmpInt the index of the resonance within the model
+ \param [in] propName the name of the K-matrix propagator
+ \return true if the resonance is a component of the given propagator, otherwise return false
+ */
+ Bool_t gotKMatrixMatch( UInt_t resAmpInt, const TString& propName ) const;
+
+ private:
+ //! Copy constructor (not implemented)
+ LauIsobarDynamics( const LauIsobarDynamics& rhs );
+
+ //! Copy assignment operator (not implemented)
+ LauIsobarDynamics& operator=( const LauIsobarDynamics& rhs );
+
+ //! The type used for containing the K-matrix propagators
+ typedef std::map<TString, LauKMatrixPropagator*> KMPropMap;
+
+ //! The type used for mapping K-matrix components to their propagators
+ typedef std::map<TString, TString> KMStringMap;
- //! The kinematics of the decay
- LauKinematics* kinematics_;
+ //! The daughters of the decay
+ LauDaughters* daughters_;
- //! The efficiency model across the Dalitz plot
- LauAbsEffModel* effModel_;
+ //! The kinematics of the decay
+ LauKinematics* kinematics_;
- //! The self cross feed fraction models across the Dalitz plot
- /*!
- These model the fraction of signal events that are poorly reconstructed (the self cross feed fraction) as a function of Dalitz plot position.
- If the self cross feed is depependent on the tagging category then seperate models can be defined.
- */
- LauTagCatScfFractionModelMap scfFractionModel_;
+ //! The efficiency model across the Dalitz plot
+ LauAbsEffModel* effModel_;
- //! The number of amplitude components
- UInt_t nAmp_;
+ //! The self cross feed fraction models across the Dalitz plot
+ /*!
+ These model the fraction of signal events that are poorly reconstructed (the self cross feed fraction) as a function of Dalitz plot position.
+ If the self cross feed is depependent on the tagging category then seperate models can be defined.
+ */
+ LauTagCatScfFractionModelMap scfFractionModel_;
- //! The number of incoherent amplitude components
- UInt_t nIncohAmp_;
+ //! The number of amplitude components
+ UInt_t nAmp_;
- //! The complex coefficients for the amplitude components
- std::vector<LauComplex> Amp_;
+ //! The number of incoherent amplitude components
+ UInt_t nIncohAmp_;
- //! The normalisation factor for the log-likelihood function
- Double_t DPNorm_;
+ //! The complex coefficients for the amplitude components
+ std::vector<LauComplex> Amp_;
- //! The fit fractions for the amplitude components
- LauParArray fitFrac_;
+ //! The normalisation factor for the log-likelihood function
+ Double_t DPNorm_;
- //! The efficiency-uncorrected fit fractions for the amplitude components
- LauParArray fitFracEffUnCorr_;
+ //! The fit fractions for the amplitude components
+ LauParArray fitFrac_;
- //! The overall Dalitz plot rate
- LauParameter DPRate_;
+ //! The efficiency-uncorrected fit fractions for the amplitude components
+ LauParArray fitFracEffUnCorr_;
- //! The mean efficiency across the Dalitz plot
- LauParameter meanDPEff_;
+ //! The overall Dalitz plot rate
+ LauParameter DPRate_;
- //! The cached data for all events
- std::vector<LauCacheData*> data_;
+ //! The mean efficiency across the Dalitz plot
+ LauParameter meanDPEff_;
- //! The cached data for the current event
- LauCacheData* currentEvent_;
+ //! The cached data for all events
+ std::vector<LauCacheData*> data_;
- //! any extra parameters/quantities (e.g. K-matrix total fit fractions)
- std::vector<LauParameter> extraParameters_;
+ //! The cached data for the current event
+ LauCacheData* currentEvent_;
- //! The resonances in the model
- std::vector<LauAbsResonance*> sigResonances_;
+ //! any extra parameters/quantities (e.g. K-matrix total fit fractions)
+ std::vector<LauParameter> extraParameters_;
- //! The incoherent resonances in the model
- std::vector<LauAbsIncohRes*> sigIncohResonances_;
+ //! The resonances in the model
+ std::vector<LauAbsResonance*> sigResonances_;
- //! The K-matrix propagators
- KMPropMap kMatrixPropagators_;
+ //! The incoherent resonances in the model
+ std::vector<LauAbsIncohRes*> sigIncohResonances_;
- //! The names of the M-matrix components in the model mapped to their propagators
- KMStringMap kMatrixPropSet_;
+ //! The K-matrix propagators
+ KMPropMap kMatrixPropagators_;
- //! The resonance types of all of the amplitude components
- std::vector<TString> resTypAmp_;
+ //! The names of the M-matrix components in the model mapped to their propagators
+ KMStringMap kMatrixPropSet_;
- //! The index of the daughter not produced by the resonance for each amplitude component
- std::vector<Int_t> resPairAmp_;
+ //! The resonance types of all of the amplitude components
+ std::vector<TString> resTypAmp_;
- //! The resonance types of all of the incoherent amplitude components
- std::vector<TString> incohResTypAmp_;
+ //! The index of the daughter not produced by the resonance for each amplitude component
+ std::vector<Int_t> resPairAmp_;
- //! The index of the daughter not produced by the resonance for each incoherent amplitude component
- std::vector<Int_t> incohResPairAmp_;
+ //! The resonance types of all of the incoherent amplitude components
+ std::vector<TString> incohResTypAmp_;
- //! The PDG codes of the daughters
- std::vector<Int_t> typDaug_;
+ //! The index of the daughter not produced by the resonance for each incoherent amplitude component
+ std::vector<Int_t> incohResPairAmp_;
- //! Whether the Dalitz plot is symmetrical
- Bool_t symmetricalDP_;
+ //! The PDG codes of the daughters
+ std::vector<Int_t> typDaug_;
- //! Whether the Dalitz plot is fully symmetric
- Bool_t fullySymmetricDP_;
+ //! Whether the Dalitz plot is symmetrical
+ Bool_t symmetricalDP_;
- //! Whether the Dalitz plot is a flavour-conjugate final state
- Bool_t flavConjDP_;
+ //! Whether the Dalitz plot is fully symmetric
+ Bool_t fullySymmetricDP_;
- //! Whether the integrals have been performed
- Bool_t integralsDone_;
+ //! Whether the Dalitz plot is a flavour-conjugate final state
+ Bool_t flavConjDP_;
- //! Whether the scheme for the integration has been determined
- Bool_t normalizationSchemeDone_;
+ //! Whether the integrals have been performed
+ Bool_t integralsDone_;
- //! Force the symmetrisation of the integration in m13 <-> m23 for non-symmetric but flavour-conjugate final states
- Bool_t forceSymmetriseIntegration_;
+ //! Whether the scheme for the integration has been determined
+ Bool_t normalizationSchemeDone_;
+ //! Force the symmetrisation of the integration in m13 <-> m23 for non-symmetric but flavour-conjugate final states
+ Bool_t forceSymmetriseIntegration_;
- //! The storage of the integration scheme
- std::vector<LauDPPartialIntegralInfo*> dpPartialIntegralInfo_;
+ //! The storage of the integration scheme
+ std::vector<LauDPPartialIntegralInfo*> dpPartialIntegralInfo_;
- //! The name of the file to save integrals to
- TString intFileName_;
+ //! The name of the file to save integrals to
+ TString intFileName_;
- //! The bin width to use when integrating over m13
- Double_t m13BinWidth_;
+ //! The bin width to use when integrating over m13
+ Double_t m13BinWidth_;
- //! The bin width to use when integrating over m23
- Double_t m23BinWidth_;
+ //! The bin width to use when integrating over m23
+ Double_t m23BinWidth_;
- //! The bin width to use when integrating over mPrime
- Double_t mPrimeBinWidth_;
+ //! The bin width to use when integrating over mPrime
+ Double_t mPrimeBinWidth_;
- //! The bin width to use when integrating over thetaPrime
- Double_t thPrimeBinWidth_;
+ //! The bin width to use when integrating over thetaPrime
+ Double_t thPrimeBinWidth_;
- //! The value below which a resonance width is considered to be narrow
- Double_t narrowWidth_;
+ //! The value below which a resonance width is considered to be narrow
+ Double_t narrowWidth_;
- //! The factor relating the width of the narrowest resonance and the binning size
- Double_t binningFactor_;
+ //! The factor relating the width of the narrowest resonance and the binning size
+ Double_t binningFactor_;
- //! The invariant mass squared of the first and third daughters
- Double_t m13Sq_;
+ //! The invariant mass squared of the first and third daughters
+ Double_t m13Sq_;
- //! The invariant mass squared of the second and third daughters
- Double_t m23Sq_;
+ //! The invariant mass squared of the second and third daughters
+ Double_t m23Sq_;
- //! The square Dalitz plot coordinate, m'
- Double_t mPrime_;
+ //! The square Dalitz plot coordinate, m'
+ Double_t mPrime_;
- //! The square Dalitz plot coordinate theta'
- Double_t thPrime_;
+ //! The square Dalitz plot coordinate theta'
+ Double_t thPrime_;
- //! The tagging category
- Int_t tagCat_;
+ //! The tagging category
+ Int_t tagCat_;
- //! The efficiency at the current point in the Dalitz plot
- Double_t eff_;
+ //! The efficiency at the current point in the Dalitz plot
+ Double_t eff_;
- //!The fraction of events that are poorly reconstructed (the self cross feed fraction) at the current point in the Dalitz plot
- Double_t scfFraction_;
+ //!The fraction of events that are poorly reconstructed (the self cross feed fraction) at the current point in the Dalitz plot
+ Double_t scfFraction_;
- //! The Jacobian, for the transformation into square DP coordinates at the current point in the Dalitz plot
- Double_t jacobian_;
+ //! The Jacobian, for the transformation into square DP coordinates at the current point in the Dalitz plot
+ Double_t jacobian_;
- //! The value of A squared for the current event
- Double_t ASq_;
+ //! The value of A squared for the current event
+ Double_t ASq_;
- //! The normalised likelihood for the current event
- Double_t evtLike_;
+ //! The normalised likelihood for the current event
+ Double_t evtLike_;
- //! The total amplitude for the current event
- LauComplex totAmp_;
+ //! The total amplitude for the current event
+ LauComplex totAmp_;
- //! The event-by-event running total of efficiency corrected amplitude cross terms for each pair of amplitude components
- /*!
- Calculated as the sum of ff_[i]*ff_[j]*efficiency for all events
- */
- std::vector< std::vector<LauComplex> > fifjEffSum_;
+ //! The event-by-event running total of efficiency corrected amplitude cross terms for each pair of amplitude components
+ /*!
+ Calculated as the sum of ff_[i]*ff_[j]*efficiency for all events
+ */
+ std::vector<std::vector<LauComplex>> fifjEffSum_;
- //! The event-by-event running total of the amplitude cross terms for each pair of amplitude components
- /*!
- Calculated as the sum of ff_[i]*ff_[j] for all events
- */
- std::vector< std::vector<LauComplex> > fifjSum_;
+ //! The event-by-event running total of the amplitude cross terms for each pair of amplitude components
+ /*!
+ Calculated as the sum of ff_[i]*ff_[j] for all events
+ */
+ std::vector<std::vector<LauComplex>> fifjSum_;
- //! The dynamic part of the amplitude for each amplitude component at the current point in the Dalitz plot
- std::vector<LauComplex> ff_;
+ //! The dynamic part of the amplitude for each amplitude component at the current point in the Dalitz plot
+ std::vector<LauComplex> ff_;
- //! The dynamic part of the intensity for each incoherent amplitude component at the current point in the Dalitz plot
- std::vector<Double_t> incohInten_;
+ //! The dynamic part of the intensity for each incoherent amplitude component at the current point in the Dalitz plot
+ std::vector<Double_t> incohInten_;
- //! The event-by-event running total of the dynamical amplitude squared for each amplitude component
- std::vector<Double_t> fSqSum_;
+ //! The event-by-event running total of the dynamical amplitude squared for each amplitude component
+ std::vector<Double_t> fSqSum_;
- //! The event-by-event running total of the dynamical amplitude squared for each amplitude component
- std::vector<Double_t> fSqEffSum_;
+ //! The event-by-event running total of the dynamical amplitude squared for each amplitude component
+ std::vector<Double_t> fSqEffSum_;
- //! The normalisation factors for the dynamic parts of the amplitude for each amplitude component
- std::vector<Double_t> fNorm_;
+ //! The normalisation factors for the dynamic parts of the amplitude for each amplitude component
+ std::vector<Double_t> fNorm_;
- //! The maximum allowed number of attempts when generating an event
- Int_t iterationsMax_;
+ //! The maximum allowed number of attempts when generating an event
+ Int_t iterationsMax_;
- //! The number of unsucessful attempts to generate an event so far
- Int_t nSigGenLoop_;
+ //! The number of unsucessful attempts to generate an event so far
+ Int_t nSigGenLoop_;
- //! The maximum allowed value of A squared
- Double_t aSqMaxSet_;
+ //! The maximum allowed value of A squared
+ Double_t aSqMaxSet_;
- //! The maximum value of A squared that has been seen so far while generating
- Double_t aSqMaxVar_;
+ //! The maximum value of A squared that has been seen so far while generating
+ Double_t aSqMaxVar_;
- //! Flag to generate aSqMaxSet_ once generate is called
- Bool_t aSqMaxAuto_{kTRUE};
+ //! Flag to generate aSqMaxSet_ once generate is called
+ Bool_t aSqMaxAuto_ { kTRUE };
- //! The helicity flip flag for new amplitude components
- Bool_t flipHelicity_;
+ //! The helicity flip flag for new amplitude components
+ Bool_t flipHelicity_;
- //! Flag to recalculate the normalisation
- Bool_t recalcNormalisation_;
+ //! Flag to recalculate the normalisation
+ Bool_t recalcNormalisation_;
- //! List of floating resonance parameters
- std::vector<LauParameter*> resonancePars_;
+ //! List of floating resonance parameters
+ std::vector<LauParameter*> resonancePars_;
- //! List of floating resonance parameter values from previous calculation
- std::vector<Double_t> resonanceParValues_;
+ //! List of floating resonance parameter values from previous calculation
+ std::vector<Double_t> resonanceParValues_;
- //! Indices in sigResonances_ to point to the corresponding signal resonance(s) for each floating parameter
- std::vector< std::vector<UInt_t> > resonanceParResIndex_;
+ //! Indices in sigResonances_ to point to the corresponding signal resonance(s) for each floating parameter
+ std::vector<std::vector<UInt_t>> resonanceParResIndex_;
- //! Resonance indices for which the amplitudes and integrals should be recalculated
- std::set<UInt_t> integralsToBeCalculated_;
+ //! Resonance indices for which the amplitudes and integrals should be recalculated
+ std::set<UInt_t> integralsToBeCalculated_;
- //! Whether to calculate separate rho and omega fit fractions from the LauRhoOmegaMix model
- Bool_t calculateRhoOmegaFitFractions_;
+ //! Whether to calculate separate rho and omega fit fractions from the LauRhoOmegaMix model
+ Bool_t calculateRhoOmegaFitFractions_;
- ClassDef(LauIsobarDynamics,0)
+ ClassDef( LauIsobarDynamics, 0 )
};
#endif
diff --git a/inc/LauKMatrixProdPole.hh b/inc/LauKMatrixProdPole.hh
index 25c7bee..96e8517 100644
--- a/inc/LauKMatrixProdPole.hh
+++ b/inc/LauKMatrixProdPole.hh
@@ -1,107 +1,113 @@
/*
Copyright 2008 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauKMatrixProdPole.hh
\brief File containing declaration of LauKMatrixProdPole class.
*/
/*! \class LauKMatrixProdPole
\brief Class for defining a K-matrix production pole amplitude term.
Class for defining a K-matrix production pole amplitude term
*/
#ifndef LAU_KMATRIX_PROD_POLE
#define LAU_KMATRIX_PROD_POLE
#include "LauAbsResonance.hh"
+
#include "TString.h"
class LauKMatrixPropagator;
class LauDaughters;
class LauKinematics;
class LauKMatrixProdPole : public LauAbsResonance {
- public:
- //! Constructor
- /*!
- \param [in] poleName name of the pole
- \param [in] poleIndex number of pole
- \param [in] resPairAmpInt the number of the daughter not produced by the resonance
- \param [in] propagator a K-matrix propagator
- \param [in] daughters the daughter particles
- \param [in] useProdAdler boolean to turn on/off the production Adler zero factor
- */
- LauKMatrixProdPole( const TString& poleName, Int_t poleIndex, Int_t resPairAmpInt,
- LauKMatrixPropagator* propagator, const LauDaughters* daughters,
- Bool_t useProdAdler = kFALSE);
-
- //! Destructor
- virtual ~LauKMatrixProdPole();
-
- // Initialise the model
- virtual void initialise() {return;}
-
- //! Get the resonance model type
- /*!
- \return the resonance model type
- */
- virtual LauAbsResonance::LauResonanceModel getResonanceModel() const {return LauAbsResonance::KMatrix;}
-
- //! Retrieve the resonance parameters, e.g. so that they can be loaded into a fit
- /*!
- \return floating parameters of the resonance
- */
- virtual const std::vector<LauParameter*>& getFloatingParameters();
-
- protected:
- //! The amplitude calculation
- /*!
- \param [in] mass the invariant-mass for the channel
- \param [in] spinTerm the spin-term for the final channel
- \return the complex amplitude
- */
- virtual LauComplex resAmp(const Double_t mass, const Double_t spinTerm);
-
- private:
- //! Copy constructor (not implemented)
- LauKMatrixProdPole(const LauKMatrixProdPole& rhs);
-
- //! Copy assignment operator (not implemented)
- LauKMatrixProdPole& operator=(const LauKMatrixProdPole& rhs);
-
- //! The K-matrix propagator
- LauKMatrixPropagator* thePropagator_;
- //! The number of the pole
- Int_t poleIndex_;
-
- //! Boolean to turn on/off the production Adler zero factor
- Bool_t useProdAdler_;
-
- ClassDef(LauKMatrixProdPole, 0) // K-matrix production pole
-
+ public:
+ //! Constructor
+ /*!
+ \param [in] poleName name of the pole
+ \param [in] poleIndex number of pole
+ \param [in] resPairAmpInt the number of the daughter not produced by the resonance
+ \param [in] propagator a K-matrix propagator
+ \param [in] daughters the daughter particles
+ \param [in] useProdAdler boolean to turn on/off the production Adler zero factor
+ */
+ LauKMatrixProdPole( const TString& poleName,
+ Int_t poleIndex,
+ Int_t resPairAmpInt,
+ LauKMatrixPropagator* propagator,
+ const LauDaughters* daughters,
+ Bool_t useProdAdler = kFALSE );
+
+ //! Destructor
+ virtual ~LauKMatrixProdPole();
+
+ // Initialise the model
+ virtual void initialise() { return; }
+
+ //! Get the resonance model type
+ /*!
+ \return the resonance model type
+ */
+ virtual LauAbsResonance::LauResonanceModel getResonanceModel() const
+ {
+ return LauAbsResonance::KMatrix;
+ }
+
+ //! Retrieve the resonance parameters, e.g. so that they can be loaded into a fit
+ /*!
+ \return floating parameters of the resonance
+ */
+ virtual const std::vector<LauParameter*>& getFloatingParameters();
+
+ protected:
+ //! The amplitude calculation
+ /*!
+ \param [in] mass the invariant-mass for the channel
+ \param [in] spinTerm the spin-term for the final channel
+ \return the complex amplitude
+ */
+ virtual LauComplex resAmp( const Double_t mass, const Double_t spinTerm );
+
+ private:
+ //! Copy constructor (not implemented)
+ LauKMatrixProdPole( const LauKMatrixProdPole& rhs );
+
+ //! Copy assignment operator (not implemented)
+ LauKMatrixProdPole& operator=( const LauKMatrixProdPole& rhs );
+
+ //! The K-matrix propagator
+ LauKMatrixPropagator* thePropagator_;
+ //! The number of the pole
+ Int_t poleIndex_;
+
+ //! Boolean to turn on/off the production Adler zero factor
+ Bool_t useProdAdler_;
+
+ ClassDef( LauKMatrixProdPole, 0 ) // K-matrix production pole
};
#endif
diff --git a/inc/LauKMatrixProdSVP.hh b/inc/LauKMatrixProdSVP.hh
index 50f8f53..c5e0363 100644
--- a/inc/LauKMatrixProdSVP.hh
+++ b/inc/LauKMatrixProdSVP.hh
@@ -1,107 +1,113 @@
/*
Copyright 2008 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauKMatrixProdSVP.hh
\brief File containing declaration of LauKMatrixProdSVP class.
*/
/*! \class LauKMatrixProdSVP
\brief Class for defining a K-matrix production "slowly-varying part" (SVP) amplitude
Class for defining a K-matrix production "slowly-varying part" (SVP) amplitude
*/
#ifndef LAU_KMATRIX_PROD_SVP
#define LAU_KMATRIX_PROD_SVP
#include "LauAbsResonance.hh"
+
#include "TString.h"
class LauKMatrixPropagator;
class LauDaughters;
class LauKinematics;
class LauKMatrixProdSVP : public LauAbsResonance {
- public:
- //! Constructor
- /*!
- \param [in] SVPName name of the slowly varying part (SVP)
- \param [in] channelIndex the channel number
- \param [in] resPairAmpInt the number of the daughter not produced by the resonance
- \param [in] propagator a K-matrix propagator
- \param [in] daughters the daughter particles
- \param [in] useProdAdler boolean to turn on/off the production Adler zero factor
- */
- LauKMatrixProdSVP( const TString& SVPName, Int_t channelIndex, Int_t resPairAmpInt,
- LauKMatrixPropagator* propagator, const LauDaughters* daughters,
- Bool_t useProdAdler = kFALSE);
-
- //! Destructor
- virtual ~LauKMatrixProdSVP();
-
- //! Initialise the model
- virtual void initialise() {return;}
-
- //! Get the resonance model type
- /*!
- \return the resonance model type
- */
- virtual LauAbsResonance::LauResonanceModel getResonanceModel() const {return LauAbsResonance::KMatrix;}
-
- //! Retrieve the resonance parameters, e.g. so that they can be loaded into a fit
- /*!
- \return floating parameters of the resonance
- */
- const std::vector<LauParameter*>& getFloatingParameters();
-
- protected:
- //! The amplitude calculation
- /*!
- \param [in] mass the invariant-mass for the channel
- \param [in] spinTerm the spin-term for the final channel
- \return the complex amplitude
- */
- virtual LauComplex resAmp(const Double_t mass, const Double_t spinTerm);
-
- private:
- //! Copy constructor (not implemented)
- LauKMatrixProdSVP(const LauKMatrixProdSVP& rhs);
-
- //! Copy assignment operator (not implemented)
- LauKMatrixProdSVP& operator=(const LauKMatrixProdSVP& rhs);
-
- //! The K-matrix propagator
- LauKMatrixPropagator* thePropagator_;
- //! The number of the channel
- Int_t channelIndex_;
-
- //! Boolean to turn on/off the production Adler zero factor
- Bool_t useProdAdler_;
-
- ClassDef(LauKMatrixProdSVP, 0) // K-matrix production SVP term
-
+ public:
+ //! Constructor
+ /*!
+ \param [in] SVPName name of the slowly varying part (SVP)
+ \param [in] channelIndex the channel number
+ \param [in] resPairAmpInt the number of the daughter not produced by the resonance
+ \param [in] propagator a K-matrix propagator
+ \param [in] daughters the daughter particles
+ \param [in] useProdAdler boolean to turn on/off the production Adler zero factor
+ */
+ LauKMatrixProdSVP( const TString& SVPName,
+ Int_t channelIndex,
+ Int_t resPairAmpInt,
+ LauKMatrixPropagator* propagator,
+ const LauDaughters* daughters,
+ Bool_t useProdAdler = kFALSE );
+
+ //! Destructor
+ virtual ~LauKMatrixProdSVP();
+
+ //! Initialise the model
+ virtual void initialise() { return; }
+
+ //! Get the resonance model type
+ /*!
+ \return the resonance model type
+ */
+ virtual LauAbsResonance::LauResonanceModel getResonanceModel() const
+ {
+ return LauAbsResonance::KMatrix;
+ }
+
+ //! Retrieve the resonance parameters, e.g. so that they can be loaded into a fit
+ /*!
+ \return floating parameters of the resonance
+ */
+ const std::vector<LauParameter*>& getFloatingParameters();
+
+ protected:
+ //! The amplitude calculation
+ /*!
+ \param [in] mass the invariant-mass for the channel
+ \param [in] spinTerm the spin-term for the final channel
+ \return the complex amplitude
+ */
+ virtual LauComplex resAmp( const Double_t mass, const Double_t spinTerm );
+
+ private:
+ //! Copy constructor (not implemented)
+ LauKMatrixProdSVP( const LauKMatrixProdSVP& rhs );
+
+ //! Copy assignment operator (not implemented)
+ LauKMatrixProdSVP& operator=( const LauKMatrixProdSVP& rhs );
+
+ //! The K-matrix propagator
+ LauKMatrixPropagator* thePropagator_;
+ //! The number of the channel
+ Int_t channelIndex_;
+
+ //! Boolean to turn on/off the production Adler zero factor
+ Bool_t useProdAdler_;
+
+ ClassDef( LauKMatrixProdSVP, 0 ) // K-matrix production SVP term
};
-#endif
\ No newline at end of file
+#endif
diff --git a/inc/LauKMatrixPropFactory.hh b/inc/LauKMatrixPropFactory.hh
index 3af5191..5369985 100644
--- a/inc/LauKMatrixPropFactory.hh
+++ b/inc/LauKMatrixPropFactory.hh
@@ -1,91 +1,94 @@
/*
Copyright 2008 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauKMatrixPropFactory.hh
\brief File containing declaration of LauKMatrixPropFactory class.
*/
/*! \class LauKMatrixPropFactory
\brief Factory class for the K-matrix propagators.
Factory class for creating and storing K-matrix propagator objects.
*/
#ifndef LAU_KMATRIX_PROP_FACTORY
#define LAU_KMATRIX_PROP_FACTORY
class LauKMatrixPropagator;
#include "TString.h"
+
#include <map>
class LauKMatrixPropFactory {
- public:
- //! Destructor
- virtual ~LauKMatrixPropFactory();
-
- //! Get a static instance of this factory class. Only one is created per application.
- static LauKMatrixPropFactory* getInstance();
+ public:
+ //! Destructor
+ virtual ~LauKMatrixPropFactory();
- //! Retrieve the propagator if it already exists, otherwise create one.
- /*!
- \param [in] name name of the propagator
- \param [in] paramFileName the parameter file
- \param [in] resPairAmpInt the number of the daughter not produced by the resonance
- \param [in] nChannels the number of channels
- \param [in] nPoles the number of poles
- \param [in] rowIndex this specifies which row of the propagator should be used when summing over the amplitude channels
+ //! Get a static instance of this factory class. Only one is created per application.
+ static LauKMatrixPropFactory* getInstance();
- \return the propagator
- */
- LauKMatrixPropagator* getPropagator(const TString& name, const TString& paramFileName,
- Int_t resPairAmpInt, Int_t nChannels,
- Int_t nPoles, Int_t rowIndex);
+ //! Retrieve the propagator if it already exists, otherwise create one.
+ /*!
+ \param [in] name name of the propagator
+ \param [in] paramFileName the parameter file
+ \param [in] resPairAmpInt the number of the daughter not produced by the resonance
+ \param [in] nChannels the number of channels
+ \param [in] nPoles the number of poles
+ \param [in] rowIndex this specifies which row of the propagator should be used when summing over the amplitude channels
- protected:
+ \return the propagator
+ */
+ LauKMatrixPropagator* getPropagator( const TString& name,
+ const TString& paramFileName,
+ Int_t resPairAmpInt,
+ Int_t nChannels,
+ Int_t nPoles,
+ Int_t rowIndex );
- //! A typedef to define a map used to keep track of which propagators have been created.
- typedef std::map<TString, LauKMatrixPropagator*> KMatrixPropMap;
+ protected:
+ //! A typedef to define a map used to keep track of which propagators have been created.
+ typedef std::map<TString, LauKMatrixPropagator*> KMatrixPropMap;
- private:
- //! Private constructor (to ensure the singleton nature of this class)
- LauKMatrixPropFactory();
+ private:
+ //! Private constructor (to ensure the singleton nature of this class)
+ LauKMatrixPropFactory();
- //! Copy constructor (not implemented)
- LauKMatrixPropFactory(const LauKMatrixPropFactory& rhs);
+ //! Copy constructor (not implemented)
+ LauKMatrixPropFactory( const LauKMatrixPropFactory& rhs );
- //! Copy assignment operator (not implemented)
- LauKMatrixPropFactory& operator=(const LauKMatrixPropFactory& rhs);
+ //! Copy assignment operator (not implemented)
+ LauKMatrixPropFactory& operator=( const LauKMatrixPropFactory& rhs );
- //! The singleton instance
- static LauKMatrixPropFactory* theFactory_;
+ //! The singleton instance
+ static LauKMatrixPropFactory* theFactory_;
- //! The map used to store the propagator information
- KMatrixPropMap map_;
+ //! The map used to store the propagator information
+ KMatrixPropMap map_;
- ClassDef(LauKMatrixPropFactory,0)
+ ClassDef( LauKMatrixPropFactory, 0 )
};
#endif
diff --git a/inc/LauKMatrixPropagator.hh b/inc/LauKMatrixPropagator.hh
index 3c11acd..64d83de 100644
--- a/inc/LauKMatrixPropagator.hh
+++ b/inc/LauKMatrixPropagator.hh
@@ -1,637 +1,662 @@
/*
Copyright 2008 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
+ http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauKMatrixPropagator.hh
- \brief File containing declaration of LauKMatrixPropagator class.
+ \brief File containing declaration of LauKMatrixPropagator class.
*/
/*! \class LauKMatrixPropagator
- \brief Class for defining a K-matrix propagator.
+ \brief Class for defining a K-matrix propagator.
- Class used to define a K-matrix propagator.
- See the following papers for info:
- hep-ph/0204328, hep-ex/0312040, [hep-ex]0804.2089 and hep-ph/9705401.
+ Class used to define a K-matrix propagator.
+ See the following papers for info:
+ hep-ph/0204328, hep-ex/0312040, [hep-ex]0804.2089 and hep-ph/9705401.
*/
#ifndef LAU_KMATRIX_PROPAGATOR
#define LAU_KMATRIX_PROPAGATOR
#include "LauConstants.hh"
-#include "LauResonanceMaker.hh"
#include "LauResonanceInfo.hh"
+#include "LauResonanceMaker.hh"
#include "TMatrixD.h"
#include "TString.h"
#include <map>
#include <vector>
class LauParameter;
class LauKinematics;
class LauComplex;
class LauKMatrixPropagator {
- public:
- //! Constructor
- /*!
- \param [in] name name of the propagator
- \param [in] paramFileName the parameter file name
- \param [in] resPairAmpInt the number of the daughter not produced by the resonance
- \param [in] nChannels the number of channels
- \param [in] nPoles the number of poles
- \param [in] rowIndex this specifies which row of the propagator should be used when summing over the amplitude channels
- */
- LauKMatrixPropagator( const TString& name, const TString& paramFileName,
- const Int_t resPairAmpInt, const Int_t nChannels, const Int_t nPoles,
- const Int_t rowIndex = 1 );
-
- //! Destructor
- virtual ~LauKMatrixPropagator();
-
- //! Calculate the K-matrix propagator for the given s value
- /*!
- \param [in] s the invariant mass squared
- */
- void updatePropagator(const Double_t s);
-
- //! Read an input file to set parameters
- /*!
- \param [in] inputFile name of the input file
- */
- void setParameters(const TString& inputFile);
-
- //! Set flag to ignore Blatt-Weisskopf-like barrier factor
- void ignoreBWBarrierFactor() {includeBWBarrierFactor_=kFALSE;}
-
- //! Get the scattering K matrix
- /*!
- \return the real, symmetric scattering K matrix
- */
- TMatrixD getKMatrix() const {return ScattKMatrix_;}
-
- //! Get the real part of the propagator full matrix
- /*!
- \return the real part of the propagator full matrix
- */
- TMatrixD getRealPropMatrix() const {return realProp_;}
-
- //! Get the negative imaginary part of the full propagator matrix
- /*!
- \return the negative imaginary part of the full propagator matrix
- */
- TMatrixD getNegImagPropMatrix() const {return negImagProp_;}
-
- //! Get the real part of the term of the propagator
- /*!
- \param [in] channelIndex the channel number
- \return the real part of the propagator term
- */
- Double_t getRealPropTerm(const Int_t channelIndex) const;
-
- //! Get the imaginary part of the term of the propagator
- /*!
- \param [in] channelIndex the channel number
- \return the imaginiary part of the propagator term
- */
- Double_t getImagPropTerm(const Int_t channelIndex) const;
-
- //! Get the 1/(m_pole^2 -s) terms for the scattering and production K-matrix formulae
- /*!
- \param [in] poleIndex the number of the pole required
- \return the value of 1/(m_pole^2 -s)
- */
- Double_t getPoleDenomTerm(const Int_t poleIndex) const;
-
- //! Get spin of K-matrix
- /*!
- \param [in] iChannel the index of the channel
- \return the value of the orbital angular momentum, L_, for this channel
- */
- Int_t getL(const Int_t iChannel) const {return L_[iChannel];}
-
- //! Get index of final channel
- /*!
- \return the index of the channel into which the scattering happens
- */
- Int_t getIndex() const {return index_;};
-
- //! Get pole mass parameters, set according to the input file
- /*!
- \param [in] poleIndex number of the required pole
- \return the parameter of the pole mass
- */
- LauParameter& getPoleMassSqParameter(const Int_t poleIndex);
-
- //! Get coupling constants that were loaded from the input file
- /*!
- \param [in] poleIndex number of the required pole
- \param [in] channelIndex number of the required channel
- \return the value of the coupling constant
- */
- Double_t getCouplingConstant(const Int_t poleIndex, const Int_t channelIndex) const;
-
- //! Get coupling parameters, set according to the input file
- /*!
- \param [in] poleIndex number of the required pole
- \param [in] channelIndex number of the required channel
- \return the parameter of the coupling constant
- */
- LauParameter& getCouplingParameter(const Int_t poleIndex, const Int_t channelIndex);
-
- //! Get scattering constants that were loaded from the input file
- /*!
- \param [in] channel1Index number of the first channel index
- \param [in] channel2Index number of the second channel index
- \return the value of the scattering constant
- */
- Double_t getScatteringConstant(const Int_t channel1Index, const Int_t channel2Index) const;
-
- //! Get scattering parameters, set according to the input file
- /*!
- \param [in] channel1Index number of the first channel index
- \param [in] channel2Index number of the second channel index
- \return the parameter of the scattering constant
- */
- LauParameter& getScatteringParameter(const Int_t channel1Index, const Int_t channel2Index);
-
- //! Get mSq0 production parameter
- /*!
- \return the mSq0 parameter
- */
- LauParameter& getmSq0() {return mSq0_;}
-
- //! Get s0Scatt production parameter
- /*!
- \return the s0Scatt parameter
- */
- LauParameter& gets0Scatt() {return s0Scatt_;}
-
- //! Get s0 production parameter
- /*!
- \return the s0Prod parameter
- */
- LauParameter& gets0Prod() {return s0Prod_;}
-
- //! Get sA production parameter
- /*!
- \return the sA parameter
- */
- LauParameter& getsA() {return sA_;}
-
- //! Get sA0 production parameter
- /*!
- \return the sA0 parameter
- */
- LauParameter& getsA0() {return sA0_;}
-
- //! Get the "slowly-varying part" term of the amplitude
- /*!
- \return the svp term
- */
- Double_t getProdSVPTerm() const {return prodSVP_;}
-
- //! Get the full complex propagator term for a given channel
- /*!
- \param [in] channelIndex the number of the required channel
- \return the complex propagator term
- */
- LauComplex getPropTerm(const Int_t channelIndex) const;
-
- //! Get the DP axis identifier
- /*!
- \return the value to identify the DP axis in question
- */
- Int_t getResPairAmpInt() const {return resPairAmpInt_;}
-
- //! Get the number of channels
- /*!
- \return the number of channels
- */
- Int_t getNChannels() const {return nChannels_;}
-
- //! Get the number of poles
- /*!
- \return the number of poles
- */
- Int_t getNPoles() const {return nPoles_;}
-
- //! Get the propagator name
- /*!
- \return the name of the propagator
- */
- TString getName() const {return name_;}
-
- //! Get the unitary transition amplitude for the given channel
- /*!
- \param [in] s The invariant mass squared
- \param [in] channel The index number of the channel process
- \return the complex amplitude T
- */
- LauComplex getTransitionAmp(const Double_t s, const Int_t channel);
-
- //! Get the complex phase space term for the given channel and invariant mass squared
- /*!
- \param [in] s The invariant mass squared
- \param [in] channel The index number of the channel process
- \return the complex phase space term rho(channel, channel)
- */
- LauComplex getPhaseSpaceTerm(const Double_t s, const Int_t channel);
-
- //! Get the Adler zero factor, which is set when updatePropagator is called
- /*!
- \return the Adler zero factor
- */
- Double_t getAdlerZero() const {return adlerZeroFactor_;}
-
- //! Get the THat amplitude for the given s and channel number
- /*!
- \param [in] s The invariant mass squared
- \param [in] channel The index number of the channel process
- \return the complex THat amplitude
- */
- LauComplex getTHat(const Double_t s, const Int_t channel);
-
- protected:
- // Integers to specify the allowed channels for the phase space calculations.
- // Please keep Zero at the start and leave TotChannels at the end
- // whenever more channels are added to this.
- //! Integers to specify the allowed channels for the phase space calculations
- enum class KMatrixChannels {Zero, PiPi, KK, FourPi, EtaEta, EtaEtaP,
- KPi, KEtaP, KThreePi, D0K, Dstar0K, TotChannels};
-
- //! Calculate the scattering K-matrix for the given value of s
- /*!
- \param [in] s the invariant mass squared
- */
- void calcScattKMatrix(const Double_t s);
-
- //! Calculate the real and imaginary part of the phase space density diagonal matrix
- /*!
- \param [in] s the invariant mass squared
- */
- void calcRhoMatrix(const Double_t s);
-
- //! Retrieve the complex phasespace density for a given channel
- /*!
- \param [in] s the invariant mass squared
- \param [in] phaseSpaceIndex the phasespace index of the channel
- \return the complex phasespace density
- */
- LauComplex getRho(const Double_t s, const LauKMatrixPropagator::KMatrixChannels) const;
-
- //! Calculate the (real) gamma angular-momentum barrier matrix
- /*!
- \param [in] s the invariant mass squared
- */
- void calcGammaMatrix(const Double_t s);
-
- //! Calculate the gamma angular-momentum barrier
- /*!
- \param [in] iCh the channel index
- \param [in] s the invariant mass squared
- \return the centrifugal barrier factor for L=0,1, or 2
- */
- Double_t calcGamma(const Int_t iCh, const Double_t s) const;
-
- //! Calulate the term 1/(m_pole^2 - s) for the scattering and production K-matrix formulae
- /*!
- \param [in] s the invariant mass squared
- */
- void calcPoleDenomVect(const Double_t s);
-
- //! Calculate the D0K+ phase space factor
- /*!
- \param [in] s the invariant mass squared
- \return the complex phase space factor
- */
- LauComplex calcD0KRho(const Double_t s) const;
-
- //! Calculate the D*0K+ phase space factor
- /*!
- \param [in] s the invariant mass squared
- \return the complex phase space factor
- */
- LauComplex calcDstar0KRho(const Double_t s) const;
-
- //! Calculate the pipi phase space factor
- /*!
- \param [in] s the invariant mass squared
- \return the complex phase space factor
- */
- LauComplex calcPiPiRho(const Double_t s) const;
-
- //! Calculate the KK phase space factor
- /*!
- \param [in] s the invariant mass squared
- \return the complex phase space factor
- */
- LauComplex calcKKRho(const Double_t s) const;
-
- //! Calculate the 4 pi phase space factor
- /*!
- \param [in] s the invariant mass squared
- \return the complex phase space factor
- */
- LauComplex calcFourPiRho(const Double_t s) const;
-
- //! Calculate the eta-eta phase space factor
- /*!
- \param [in] s the invariant mass squared
- \return the complex phase space factor
- */
- LauComplex calcEtaEtaRho(const Double_t s) const;
-
- //! Calculate the eta-eta' phase space factor
- /*!
- \param [in] s the invariant mass squared
- \return the complex phase space factor
- */
- LauComplex calcEtaEtaPRho(const Double_t s) const;
-
- //! Calculate the Kpi phase space factor
- /*!
- \param [in] s the invariant mass squared
- \return the complex phase space factor
- */
- LauComplex calcKPiRho(const Double_t s) const;
-
- //! Calculate the K-eta' phase space factor
- /*!
- \param [in] s the invariant mass squared
- \return the complex phase space factor
- */
- LauComplex calcKEtaPRho(const Double_t s) const;
-
- //! Calculate the Kpipipi phase space factor
- /*!
- \param [in] s the invariant mass squared
- \return the complex phase space factor
- */
- LauComplex calcKThreePiRho(const Double_t s) const;
-
- //! Calculate the "slow-varying part"
- /*!
- \param [in] s the invariant mass squared
- \param [in] s0 the invariant mass squared at the Adler zero
- \return the SVP term
- */
- Double_t calcSVPTerm(const Double_t s, const Double_t s0) const;
-
- //! Update the scattering "slowly-varying part"
- /*!
- \param [in] s the invariant mass squared
- */
- void updateScattSVPTerm(const Double_t s);
-
- //! Update the production "slowly-varying part"
- /*!
- \param [in] s the invariant mass squared
- */
- void updateProdSVPTerm(const Double_t s);
-
- //! Calculate the multiplicative factor containing severa Adler zero constants
- /*!
- \param [in] s the invariant mass squared
- */
- void updateAdlerZeroFactor(const Double_t s);
-
- //! Check the phase space factors that need to be used
- /*!
- \param [in] phaseSpaceInt phase space types
- \return true of false
- */
- Bool_t checkPhaseSpaceType(const Int_t phaseSpaceInt) const;
-
-
- //! Get the unitary transition amplitude matrix for the given kinematics
- /*!
- \param [in] kinematics The pointer to the constant kinematics
- */
- void getTMatrix(const LauKinematics* kinematics);
-
- //! Get the unitary transition amplitude matrix for the given kinematics
- /*!
- \param [in] s The invariant mass squared of the system
- */
- void getTMatrix(const Double_t s);
-
- //! Get the square root of the phase space matrix
- void getSqrtRhoMatrix();
-
- private:
- //! Copy constructor (not implemented)
- LauKMatrixPropagator(const LauKMatrixPropagator& rhs)=delete;
-
- //! Copy assignment operator (not implemented)
- LauKMatrixPropagator& operator=(const LauKMatrixPropagator& rhs)=delete;
-
- //! Initialise and set the dimensions for the internal matrices and parameter arrays
- void initialiseMatrices();
-
- //! Store the (phase space) channel indices from a line in the parameter file
- /*!
- \param [in] theLine Vector of strings corresponding to the line from the parameter file
- */
- void storeChannels(const std::vector<std::string>& theLine);
-
- //! Store the pole mass and couplings from a line in the parameter file
- /*!
- \param [in] theLine Vector of strings corresponding to the line from the parameter file
- */
- void storePole(const std::vector<std::string>& theLine);
-
- //! Store the scattering coefficients from a line in the parameter file
- /*!
- \param [in] theLine Vector of strings corresponding to the line from the parameter file
- */
- void storeScattering(const std::vector<std::string>& theLine);
-
- //! Store the channels' characteristic radii from a line in the parameter file
- /*!
- \param [in] theLine Vector of strings corresponding to the line from the parameter file
- */
- void storeRadii(const std::vector<std::string>& theLine);
-
- //! Store the channels' angular momenta from a line in the parameter file
- /*!
- \param [in] theLine Vector of strings corresponding to the line from the parameter file
- \param [in] a Vector of integers corresponding to parameter in the propagator denominator
- */
- void storeOrbitalAngularMomenta(const std::vector<std::string>& theLine, std::vector<Int_t>& a);
-
- //! Store the barrier-factor parameter from a line in the parameter file
- /*!
- \param [in] theLine Vector of strings corresponding to the line from the parameter file
- \param [in] a Vector of integers corresponding to parameter in the propagator denominator
- */
- void storeBarrierFactorParameter(const std::vector<std::string>& theLine, std::vector<Int_t>& a);
-
-
- //! Store miscelleanous parameters from a line in the parameter file
- /*!
- \param [in] keyword the name of the parameter to be set
- \param [in] parString the string containing the value of the parameter
- */
- void storeParameter(const TString& keyword, const TString& parString);
-
-
- //! String to store the propagator name
- TString name_;
- //! Name of the input parameter file
- TString paramFileName_;
- //! Number to identify the DP axis in question
- Int_t resPairAmpInt_;
- //! Row index - 1
- Int_t index_;
-
- //! s value of the previous pole
- Double_t previousS_{0.0};
- //! "slowly-varying part" for the scattering K-matrix
- Double_t scattSVP_{0.0};
- //! "slowly-varying part" for the production K-matrix
- Double_t prodSVP_{0.0};
- //! Real part of the propagator matrix
- TMatrixD realProp_;
- //! Imaginary part of the propagator matrix
- TMatrixD negImagProp_;
-
- //! Scattering K-matrix
- TMatrixD ScattKMatrix_;
- //! Real part of the phase space density diagonal matrix
- TMatrixD ReRhoMatrix_;
- //! Imaginary part of the phase space density diagonal matrix
- TMatrixD ImRhoMatrix_;
- //! Gamma angular-momentum barrier matrix
- TMatrixD GammaMatrix_;
- //! Identity matrix
- TMatrixD IMatrix_;
- //! Null matrix
- TMatrixD zeroMatrix_;
-
- //! Real part of the square root of the phase space density diagonal matrix
- TMatrixD ReSqrtRhoMatrix_;
- //! Imaginary part of the square root of the phase space density diagonal matrix
- TMatrixD ImSqrtRhoMatrix_;
- //! Real part of the unitary T matrix
- TMatrixD ReTMatrix_;
- //! Imaginary part of the unitary T matrix
- TMatrixD ImTMatrix_;
-
- //! Number of channels
- Int_t nChannels_;
- //! Number of poles
- Int_t nPoles_;
- //! Vector of orbital angular momenta
- std::vector<Int_t> L_;
- //! Boolean to indicate whether storeBarrierFactorParameter has been called
- Bool_t haveCalled_storeBarrierFactorParameter{kFALSE};
- //! Boolean to dictate whether to include Blatt-Weisskopf-like denominator in K-matrix centrifugal barrier factor
- Bool_t includeBWBarrierFactor_{kTRUE};
-
- //! Vector of squared pole masses
- std::vector<LauParameter> mSqPoles_;
-
- //! Array of coupling constants
- LauParArray gCouplings_;
- //! Array of scattering SVP values
- LauParArray fScattering_;
- //! Vector of characteristic radii
- std::vector<Double_t> radii_;
- //! Vector of ratio a/R^2
- std::vector<Double_t> gamAInvRadSq_;
-
- //! Vector of phase space types
- std::vector<KMatrixChannels> phaseSpaceTypes_;
- //! Vector of squared masses
- std::vector<Double_t> mSumSq_;
- //! Vector of mass differences
- std::vector<Double_t> mDiffSq_;
- //! Vector of 1/(m_pole^2 - s) terms for scattering and production K-matrix formulae
- std::vector<Double_t> poleDenomVect_;
-
- //! Constant from input file
- LauParameter mSq0_;
- //! Constant from input file
- LauParameter s0Scatt_;
- //! Constant from input file
- LauParameter s0Prod_;
- //! Constant from input file
- LauParameter sA_;
- //! Constant from input file
- LauParameter sA0_;
-
- //! Defined as 0.5*sA*mPi*mPi
- Double_t sAConst_{0.0};
-
- //! Defined as 4*mPi*mPi
- const Double_t m2piSq_{4.0*LauConstants::mPiSq};
- //! Defined as 4*mK*mK
- const Double_t m2KSq_{4.0*LauConstants::mKSq};
- //! Defined as 4*mEta*mEta
- const Double_t m2EtaSq_{4.0*LauConstants::mEtaSq};
- //! Defined as (mEta+mEta')^2
- const Double_t mEtaEtaPSumSq_{(LauConstants::mEta + LauConstants::mEtaPrime)*(LauConstants::mEta + LauConstants::mEtaPrime)};
- //! Defined as (mEta-mEta')^2
- const Double_t mEtaEtaPDiffSq_{(LauConstants::mEta - LauConstants::mEtaPrime)*(LauConstants::mEta - LauConstants::mEtaPrime)};
- //! Defined as (mK+mPi)^2
- const Double_t mKpiSumSq_{(LauConstants::mK + LauConstants::mPi)*(LauConstants::mK + LauConstants::mPi)};
- //! Defined as (mK-mPi)^2
- const Double_t mKpiDiffSq_{(LauConstants::mK - LauConstants::mPi)*(LauConstants::mK - LauConstants::mPi)};
- //! Defined as (mK+mEta')^2
- const Double_t mKEtaPSumSq_{(LauConstants::mK + LauConstants::mEtaPrime)*(LauConstants::mK + LauConstants::mEtaPrime)};
- //! Defined as (mK-mEta')^2
- const Double_t mKEtaPDiffSq_{(LauConstants::mK - LauConstants::mEtaPrime)*(LauConstants::mK - LauConstants::mEtaPrime)};
- //! Defined as (mK-3*mPi)^2
- const Double_t mK3piDiffSq_{(LauConstants::mK - 3.0*LauConstants::mPi)*(LauConstants::mK - 3.0*LauConstants::mPi)};
- //! Factor used to calculate the Kpipipi phase space term
- const Double_t k3piFactor_{TMath::Power((1.44 - mK3piDiffSq_)/1.44, -2.5)};
- //! Factor used to calculate the pipipipi phase space term
- const Double_t fourPiFactor1_{16.0*LauConstants::mPiSq};
- //! Factor used to calculate the pipipipi phase space term
- const Double_t fourPiFactor2_{TMath::Sqrt(1.0 - fourPiFactor1_)};
- //! Defined as (mD0+mK)^2
- const Double_t mD0KSumSq_{(LauConstants::mD0 + LauConstants::mK)*(LauConstants::mD0 + LauConstants::mK)};
- //! Defined as (mD0-mK)^2
- const Double_t mD0KDiffSq_{(LauConstants::mD0 - LauConstants::mK)*(LauConstants::mD0 - LauConstants::mK)};
- //! Defined as (mD*0+mK)^2
- const Double_t mDstar0KSumSq_{(LauResonanceMaker::get().getResInfo("D*0")->getMass()->value() + LauConstants::mK)*(LauResonanceMaker::get().getResInfo("D*0")->getMass()->value() + LauConstants::mK)};
- //! Defined as (mD*0-mK)^2
- const Double_t mDstar0KDiffSq_{(LauResonanceMaker::get().getResInfo("D*0")->getMass()->value() - LauConstants::mK)*(LauResonanceMaker::get().getResInfo("D*0")->getMass()->value() - LauConstants::mK)};
-
- //! Multiplicative factor containing various Adler zero constants
- Double_t adlerZeroFactor_{0.0};
- //! Tracks if all params have been set
- Bool_t parametersSet_{kFALSE};
-
- //! Control the output of the functions
- static constexpr Bool_t verbose_{kFALSE};
-
- //! Control if scattering constants are channel symmetric: f_ji = f_ij
- Bool_t scattSymmetry_{kFALSE};
-
- ClassDef(LauKMatrixPropagator,0) // K-matrix amplitude model
+ public:
+ //! Constructor
+ /*!
+ \param [in] name name of the propagator
+ \param [in] paramFileName the parameter file name
+ \param [in] resPairAmpInt the number of the daughter not produced by the resonance
+ \param [in] nChannels the number of channels
+ \param [in] nPoles the number of poles
+ \param [in] rowIndex this specifies which row of the propagator should be used when summing over the amplitude channels
+ */
+ LauKMatrixPropagator( const TString& name,
+ const TString& paramFileName,
+ const Int_t resPairAmpInt,
+ const Int_t nChannels,
+ const Int_t nPoles,
+ const Int_t rowIndex = 1 );
+
+ //! Destructor
+ virtual ~LauKMatrixPropagator();
+
+ //! Calculate the K-matrix propagator for the given s value
+ /*!
+ \param [in] s the invariant mass squared
+ */
+ void updatePropagator( const Double_t s );
+
+ //! Read an input file to set parameters
+ /*!
+ \param [in] inputFile name of the input file
+ */
+ void setParameters( const TString& inputFile );
+
+ //! Set flag to ignore Blatt-Weisskopf-like barrier factor
+ void ignoreBWBarrierFactor() { includeBWBarrierFactor_ = kFALSE; }
+
+ //! Get the scattering K matrix
+ /*!
+ \return the real, symmetric scattering K matrix
+ */
+ TMatrixD getKMatrix() const { return ScattKMatrix_; }
+
+ //! Get the real part of the propagator full matrix
+ /*!
+ \return the real part of the propagator full matrix
+ */
+ TMatrixD getRealPropMatrix() const { return realProp_; }
+
+ //! Get the negative imaginary part of the full propagator matrix
+ /*!
+ \return the negative imaginary part of the full propagator matrix
+ */
+ TMatrixD getNegImagPropMatrix() const { return negImagProp_; }
+
+ //! Get the real part of the term of the propagator
+ /*!
+ \param [in] channelIndex the channel number
+ \return the real part of the propagator term
+ */
+ Double_t getRealPropTerm( const Int_t channelIndex ) const;
+
+ //! Get the imaginary part of the term of the propagator
+ /*!
+ \param [in] channelIndex the channel number
+ \return the imaginiary part of the propagator term
+ */
+ Double_t getImagPropTerm( const Int_t channelIndex ) const;
+
+ //! Get the 1/(m_pole^2 -s) terms for the scattering and production K-matrix formulae
+ /*!
+ \param [in] poleIndex the number of the pole required
+ \return the value of 1/(m_pole^2 -s)
+ */
+ Double_t getPoleDenomTerm( const Int_t poleIndex ) const;
+
+ //! Get spin of K-matrix
+ /*!
+ \param [in] iChannel the index of the channel
+ \return the value of the orbital angular momentum, L_, for this channel
+ */
+ Int_t getL( const Int_t iChannel ) const { return L_[iChannel]; }
+
+ //! Get index of final channel
+ /*!
+ \return the index of the channel into which the scattering happens
+ */
+ Int_t getIndex() const { return index_; };
+
+ //! Get pole mass parameters, set according to the input file
+ /*!
+ \param [in] poleIndex number of the required pole
+ \return the parameter of the pole mass
+ */
+ LauParameter& getPoleMassSqParameter( const Int_t poleIndex );
+
+ //! Get coupling constants that were loaded from the input file
+ /*!
+ \param [in] poleIndex number of the required pole
+ \param [in] channelIndex number of the required channel
+ \return the value of the coupling constant
+ */
+ Double_t getCouplingConstant( const Int_t poleIndex, const Int_t channelIndex ) const;
+
+ //! Get coupling parameters, set according to the input file
+ /*!
+ \param [in] poleIndex number of the required pole
+ \param [in] channelIndex number of the required channel
+ \return the parameter of the coupling constant
+ */
+ LauParameter& getCouplingParameter( const Int_t poleIndex, const Int_t channelIndex );
+
+ //! Get scattering constants that were loaded from the input file
+ /*!
+ \param [in] channel1Index number of the first channel index
+ \param [in] channel2Index number of the second channel index
+ \return the value of the scattering constant
+ */
+ Double_t getScatteringConstant( const Int_t channel1Index, const Int_t channel2Index ) const;
+
+ //! Get scattering parameters, set according to the input file
+ /*!
+ \param [in] channel1Index number of the first channel index
+ \param [in] channel2Index number of the second channel index
+ \return the parameter of the scattering constant
+ */
+ LauParameter& getScatteringParameter( const Int_t channel1Index, const Int_t channel2Index );
+
+ //! Get mSq0 production parameter
+ /*!
+ \return the mSq0 parameter
+ */
+ LauParameter& getmSq0() { return mSq0_; }
+
+ //! Get s0Scatt production parameter
+ /*!
+ \return the s0Scatt parameter
+ */
+ LauParameter& gets0Scatt() { return s0Scatt_; }
+
+ //! Get s0 production parameter
+ /*!
+ \return the s0Prod parameter
+ */
+ LauParameter& gets0Prod() { return s0Prod_; }
+
+ //! Get sA production parameter
+ /*!
+ \return the sA parameter
+ */
+ LauParameter& getsA() { return sA_; }
+
+ //! Get sA0 production parameter
+ /*!
+ \return the sA0 parameter
+ */
+ LauParameter& getsA0() { return sA0_; }
+
+ //! Get the "slowly-varying part" term of the amplitude
+ /*!
+ \return the svp term
+ */
+ Double_t getProdSVPTerm() const { return prodSVP_; }
+
+ //! Get the full complex propagator term for a given channel
+ /*!
+ \param [in] channelIndex the number of the required channel
+ \return the complex propagator term
+ */
+ LauComplex getPropTerm( const Int_t channelIndex ) const;
+
+ //! Get the DP axis identifier
+ /*!
+ \return the value to identify the DP axis in question
+ */
+ Int_t getResPairAmpInt() const { return resPairAmpInt_; }
+
+ //! Get the number of channels
+ /*!
+ \return the number of channels
+ */
+ Int_t getNChannels() const { return nChannels_; }
+
+ //! Get the number of poles
+ /*!
+ \return the number of poles
+ */
+ Int_t getNPoles() const { return nPoles_; }
+
+ //! Get the propagator name
+ /*!
+ \return the name of the propagator
+ */
+ TString getName() const { return name_; }
+
+ //! Get the unitary transition amplitude for the given channel
+ /*!
+ \param [in] s The invariant mass squared
+ \param [in] channel The index number of the channel process
+ \return the complex amplitude T
+ */
+ LauComplex getTransitionAmp( const Double_t s, const Int_t channel );
+
+ //! Get the complex phase space term for the given channel and invariant mass squared
+ /*!
+ \param [in] s The invariant mass squared
+ \param [in] channel The index number of the channel process
+ \return the complex phase space term rho(channel, channel)
+ */
+ LauComplex getPhaseSpaceTerm( const Double_t s, const Int_t channel );
+
+ //! Get the Adler zero factor, which is set when updatePropagator is called
+ /*!
+ \return the Adler zero factor
+ */
+ Double_t getAdlerZero() const { return adlerZeroFactor_; }
+
+ //! Get the THat amplitude for the given s and channel number
+ /*!
+ \param [in] s The invariant mass squared
+ \param [in] channel The index number of the channel process
+ \return the complex THat amplitude
+ */
+ LauComplex getTHat( const Double_t s, const Int_t channel );
+
+ protected:
+ // Integers to specify the allowed channels for the phase space calculations.
+ // Please keep Zero at the start and leave TotChannels at the end
+ // whenever more channels are added to this.
+ //! Integers to specify the allowed channels for the phase space calculations
+ enum class KMatrixChannels {
+ Zero,
+ PiPi,
+ KK,
+ FourPi,
+ EtaEta,
+ EtaEtaP,
+ KPi,
+ KEtaP,
+ KThreePi,
+ D0K,
+ Dstar0K,
+ TotChannels
+ };
+
+ //! Calculate the scattering K-matrix for the given value of s
+ /*!
+ \param [in] s the invariant mass squared
+ */
+ void calcScattKMatrix( const Double_t s );
+
+ //! Calculate the real and imaginary part of the phase space density diagonal matrix
+ /*!
+ \param [in] s the invariant mass squared
+ */
+ void calcRhoMatrix( const Double_t s );
+
+ //! Retrieve the complex phasespace density for a given channel
+ /*!
+ \param [in] s the invariant mass squared
+ \param [in] phaseSpaceIndex the phasespace index of the channel
+ \return the complex phasespace density
+ */
+ LauComplex getRho( const Double_t s, const LauKMatrixPropagator::KMatrixChannels ) const;
+
+ //! Calculate the (real) gamma angular-momentum barrier matrix
+ /*!
+ \param [in] s the invariant mass squared
+ */
+ void calcGammaMatrix( const Double_t s );
+
+ //! Calculate the gamma angular-momentum barrier
+ /*!
+ \param [in] iCh the channel index
+ \param [in] s the invariant mass squared
+ \return the centrifugal barrier factor for L=0,1, or 2
+ */
+ Double_t calcGamma( const Int_t iCh, const Double_t s ) const;
+
+ //! Calulate the term 1/(m_pole^2 - s) for the scattering and production K-matrix formulae
+ /*!
+ \param [in] s the invariant mass squared
+ */
+ void calcPoleDenomVect( const Double_t s );
+
+ //! Calculate the D0K+ phase space factor
+ /*!
+ \param [in] s the invariant mass squared
+ \return the complex phase space factor
+ */
+ LauComplex calcD0KRho( const Double_t s ) const;
+
+ //! Calculate the D*0K+ phase space factor
+ /*!
+ \param [in] s the invariant mass squared
+ \return the complex phase space factor
+ */
+ LauComplex calcDstar0KRho( const Double_t s ) const;
+
+ //! Calculate the pipi phase space factor
+ /*!
+ \param [in] s the invariant mass squared
+ \return the complex phase space factor
+ */
+ LauComplex calcPiPiRho( const Double_t s ) const;
+
+ //! Calculate the KK phase space factor
+ /*!
+ \param [in] s the invariant mass squared
+ \return the complex phase space factor
+ */
+ LauComplex calcKKRho( const Double_t s ) const;
+
+ //! Calculate the 4 pi phase space factor
+ /*!
+ \param [in] s the invariant mass squared
+ \return the complex phase space factor
+ */
+ LauComplex calcFourPiRho( const Double_t s ) const;
+
+ //! Calculate the eta-eta phase space factor
+ /*!
+ \param [in] s the invariant mass squared
+ \return the complex phase space factor
+ */
+ LauComplex calcEtaEtaRho( const Double_t s ) const;
+
+ //! Calculate the eta-eta' phase space factor
+ /*!
+ \param [in] s the invariant mass squared
+ \return the complex phase space factor
+ */
+ LauComplex calcEtaEtaPRho( const Double_t s ) const;
+
+ //! Calculate the Kpi phase space factor
+ /*!
+ \param [in] s the invariant mass squared
+ \return the complex phase space factor
+ */
+ LauComplex calcKPiRho( const Double_t s ) const;
+
+ //! Calculate the K-eta' phase space factor
+ /*!
+ \param [in] s the invariant mass squared
+ \return the complex phase space factor
+ */
+ LauComplex calcKEtaPRho( const Double_t s ) const;
+
+ //! Calculate the Kpipipi phase space factor
+ /*!
+ \param [in] s the invariant mass squared
+ \return the complex phase space factor
+ */
+ LauComplex calcKThreePiRho( const Double_t s ) const;
+
+ //! Calculate the "slow-varying part"
+ /*!
+ \param [in] s the invariant mass squared
+ \param [in] s0 the invariant mass squared at the Adler zero
+ \return the SVP term
+ */
+ Double_t calcSVPTerm( const Double_t s, const Double_t s0 ) const;
+
+ //! Update the scattering "slowly-varying part"
+ /*!
+ \param [in] s the invariant mass squared
+ */
+ void updateScattSVPTerm( const Double_t s );
+
+ //! Update the production "slowly-varying part"
+ /*!
+ \param [in] s the invariant mass squared
+ */
+ void updateProdSVPTerm( const Double_t s );
+
+ //! Calculate the multiplicative factor containing severa Adler zero constants
+ /*!
+ \param [in] s the invariant mass squared
+ */
+ void updateAdlerZeroFactor( const Double_t s );
+
+ //! Check the phase space factors that need to be used
+ /*!
+ \param [in] phaseSpaceInt phase space types
+ \return true of false
+ */
+ Bool_t checkPhaseSpaceType( const Int_t phaseSpaceInt ) const;
+
+ //! Get the unitary transition amplitude matrix for the given kinematics
+ /*!
+ \param [in] kinematics The pointer to the constant kinematics
+ */
+ void getTMatrix( const LauKinematics* kinematics );
+
+ //! Get the unitary transition amplitude matrix for the given kinematics
+ /*!
+ \param [in] s The invariant mass squared of the system
+ */
+ void getTMatrix( const Double_t s );
+
+ //! Get the square root of the phase space matrix
+ void getSqrtRhoMatrix();
+
+ private:
+ //! Copy constructor (not implemented)
+ LauKMatrixPropagator( const LauKMatrixPropagator& rhs ) = delete;
+
+ //! Copy assignment operator (not implemented)
+ LauKMatrixPropagator& operator=( const LauKMatrixPropagator& rhs ) = delete;
+
+ //! Initialise and set the dimensions for the internal matrices and parameter arrays
+ void initialiseMatrices();
+
+ //! Store the (phase space) channel indices from a line in the parameter file
+ /*!
+ \param [in] theLine Vector of strings corresponding to the line from the parameter file
+ */
+ void storeChannels( const std::vector<std::string>& theLine );
+
+ //! Store the pole mass and couplings from a line in the parameter file
+ /*!
+ \param [in] theLine Vector of strings corresponding to the line from the parameter file
+ */
+ void storePole( const std::vector<std::string>& theLine );
+
+ //! Store the scattering coefficients from a line in the parameter file
+ /*!
+ \param [in] theLine Vector of strings corresponding to the line from the parameter file
+ */
+ void storeScattering( const std::vector<std::string>& theLine );
+
+ //! Store the channels' characteristic radii from a line in the parameter file
+ /*!
+ \param [in] theLine Vector of strings corresponding to the line from the parameter file
+ */
+ void storeRadii( const std::vector<std::string>& theLine );
+
+ //! Store the channels' angular momenta from a line in the parameter file
+ /*!
+ \param [in] theLine Vector of strings corresponding to the line from the parameter file
+ \param [in] a Vector of integers corresponding to parameter in the propagator denominator
+ */
+ void storeOrbitalAngularMomenta( const std::vector<std::string>& theLine, std::vector<Int_t>& a );
+
+ //! Store the barrier-factor parameter from a line in the parameter file
+ /*!
+ \param [in] theLine Vector of strings corresponding to the line from the parameter file
+ \param [in] a Vector of integers corresponding to parameter in the propagator denominator
+ */
+ void storeBarrierFactorParameter( const std::vector<std::string>& theLine, std::vector<Int_t>& a );
+
+ //! Store miscelleanous parameters from a line in the parameter file
+ /*!
+ \param [in] keyword the name of the parameter to be set
+ \param [in] parString the string containing the value of the parameter
+ */
+ void storeParameter( const TString& keyword, const TString& parString );
+
+ //! String to store the propagator name
+ TString name_;
+ //! Name of the input parameter file
+ TString paramFileName_;
+ //! Number to identify the DP axis in question
+ Int_t resPairAmpInt_;
+ //! Row index - 1
+ Int_t index_;
+
+ //! s value of the previous pole
+ Double_t previousS_ { 0.0 };
+ //! "slowly-varying part" for the scattering K-matrix
+ Double_t scattSVP_ { 0.0 };
+ //! "slowly-varying part" for the production K-matrix
+ Double_t prodSVP_ { 0.0 };
+ //! Real part of the propagator matrix
+ TMatrixD realProp_;
+ //! Imaginary part of the propagator matrix
+ TMatrixD negImagProp_;
+
+ //! Scattering K-matrix
+ TMatrixD ScattKMatrix_;
+ //! Real part of the phase space density diagonal matrix
+ TMatrixD ReRhoMatrix_;
+ //! Imaginary part of the phase space density diagonal matrix
+ TMatrixD ImRhoMatrix_;
+ //! Gamma angular-momentum barrier matrix
+ TMatrixD GammaMatrix_;
+ //! Identity matrix
+ TMatrixD IMatrix_;
+ //! Null matrix
+ TMatrixD zeroMatrix_;
+
+ //! Real part of the square root of the phase space density diagonal matrix
+ TMatrixD ReSqrtRhoMatrix_;
+ //! Imaginary part of the square root of the phase space density diagonal matrix
+ TMatrixD ImSqrtRhoMatrix_;
+ //! Real part of the unitary T matrix
+ TMatrixD ReTMatrix_;
+ //! Imaginary part of the unitary T matrix
+ TMatrixD ImTMatrix_;
+
+ //! Number of channels
+ Int_t nChannels_;
+ //! Number of poles
+ Int_t nPoles_;
+ //! Vector of orbital angular momenta
+ std::vector<Int_t> L_;
+ //! Boolean to indicate whether storeBarrierFactorParameter has been called
+ Bool_t haveCalled_storeBarrierFactorParameter { kFALSE };
+ //! Boolean to dictate whether to include Blatt-Weisskopf-like denominator in K-matrix centrifugal barrier factor
+ Bool_t includeBWBarrierFactor_ { kTRUE };
+
+ //! Vector of squared pole masses
+ std::vector<LauParameter> mSqPoles_;
+
+ //! Array of coupling constants
+ LauParArray gCouplings_;
+ //! Array of scattering SVP values
+ LauParArray fScattering_;
+ //! Vector of characteristic radii
+ std::vector<Double_t> radii_;
+ //! Vector of ratio a/R^2
+ std::vector<Double_t> gamAInvRadSq_;
+
+ //! Vector of phase space types
+ std::vector<KMatrixChannels> phaseSpaceTypes_;
+ //! Vector of squared masses
+ std::vector<Double_t> mSumSq_;
+ //! Vector of mass differences
+ std::vector<Double_t> mDiffSq_;
+ //! Vector of 1/(m_pole^2 - s) terms for scattering and production K-matrix formulae
+ std::vector<Double_t> poleDenomVect_;
+
+ //! Constant from input file
+ LauParameter mSq0_;
+ //! Constant from input file
+ LauParameter s0Scatt_;
+ //! Constant from input file
+ LauParameter s0Prod_;
+ //! Constant from input file
+ LauParameter sA_;
+ //! Constant from input file
+ LauParameter sA0_;
+
+ //! Defined as 0.5*sA*mPi*mPi
+ Double_t sAConst_ { 0.0 };
+
+ //! Defined as 4*mPi*mPi
+ const Double_t m2piSq_ { 4.0 * LauConstants::mPiSq };
+ //! Defined as 4*mK*mK
+ const Double_t m2KSq_ { 4.0 * LauConstants::mKSq };
+ //! Defined as 4*mEta*mEta
+ const Double_t m2EtaSq_ { 4.0 * LauConstants::mEtaSq };
+ //! Defined as (mEta+mEta')^2
+ const Double_t mEtaEtaPSumSq_ { ( LauConstants::mEta + LauConstants::mEtaPrime ) *
+ ( LauConstants::mEta + LauConstants::mEtaPrime ) };
+ //! Defined as (mEta-mEta')^2
+ const Double_t mEtaEtaPDiffSq_ { ( LauConstants::mEta - LauConstants::mEtaPrime ) *
+ ( LauConstants::mEta - LauConstants::mEtaPrime ) };
+ //! Defined as (mK+mPi)^2
+ const Double_t mKpiSumSq_ { ( LauConstants::mK + LauConstants::mPi ) *
+ ( LauConstants::mK + LauConstants::mPi ) };
+ //! Defined as (mK-mPi)^2
+ const Double_t mKpiDiffSq_ { ( LauConstants::mK - LauConstants::mPi ) *
+ ( LauConstants::mK - LauConstants::mPi ) };
+ //! Defined as (mK+mEta')^2
+ const Double_t mKEtaPSumSq_ { ( LauConstants::mK + LauConstants::mEtaPrime ) *
+ ( LauConstants::mK + LauConstants::mEtaPrime ) };
+ //! Defined as (mK-mEta')^2
+ const Double_t mKEtaPDiffSq_ { ( LauConstants::mK - LauConstants::mEtaPrime ) *
+ ( LauConstants::mK - LauConstants::mEtaPrime ) };
+ //! Defined as (mK-3*mPi)^2
+ const Double_t mK3piDiffSq_ { ( LauConstants::mK - 3.0 * LauConstants::mPi ) *
+ ( LauConstants::mK - 3.0 * LauConstants::mPi ) };
+ //! Factor used to calculate the Kpipipi phase space term
+ const Double_t k3piFactor_ { TMath::Power( ( 1.44 - mK3piDiffSq_ ) / 1.44, -2.5 ) };
+ //! Factor used to calculate the pipipipi phase space term
+ const Double_t fourPiFactor1_ { 16.0 * LauConstants::mPiSq };
+ //! Factor used to calculate the pipipipi phase space term
+ const Double_t fourPiFactor2_ { TMath::Sqrt( 1.0 - fourPiFactor1_ ) };
+ //! Defined as (mD0+mK)^2
+ const Double_t mD0KSumSq_ { ( LauConstants::mD0 + LauConstants::mK ) *
+ ( LauConstants::mD0 + LauConstants::mK ) };
+ //! Defined as (mD0-mK)^2
+ const Double_t mD0KDiffSq_ { ( LauConstants::mD0 - LauConstants::mK ) *
+ ( LauConstants::mD0 - LauConstants::mK ) };
+ //! Defined as (mD*0+mK)^2
+ const Double_t mDstar0KSumSq_ {
+ ( LauResonanceMaker::get().getResInfo( "D*0" )->getMass()->value() + LauConstants::mK ) *
+ ( LauResonanceMaker::get().getResInfo( "D*0" )->getMass()->value() + LauConstants::mK ) };
+ //! Defined as (mD*0-mK)^2
+ const Double_t mDstar0KDiffSq_ {
+ ( LauResonanceMaker::get().getResInfo( "D*0" )->getMass()->value() - LauConstants::mK ) *
+ ( LauResonanceMaker::get().getResInfo( "D*0" )->getMass()->value() - LauConstants::mK ) };
+
+ //! Multiplicative factor containing various Adler zero constants
+ Double_t adlerZeroFactor_ { 0.0 };
+ //! Tracks if all params have been set
+ Bool_t parametersSet_ { kFALSE };
+
+ //! Control the output of the functions
+ static constexpr Bool_t verbose_ { kFALSE };
+
+ //! Control if scattering constants are channel symmetric: f_ji = f_ij
+ Bool_t scattSymmetry_ { kFALSE };
+
+ ClassDef( LauKMatrixPropagator, 0 ) // K-matrix amplitude model
};
#endif
diff --git a/inc/LauKappaRes.hh b/inc/LauKappaRes.hh
index 5a9bc5d..ed12e4c 100644
--- a/inc/LauKappaRes.hh
+++ b/inc/LauKappaRes.hh
@@ -1,203 +1,204 @@
/*
Copyright 2004 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauKappaRes.hh
\brief File containing declaration of LauKappaRes class.
*/
/*! \class LauKappaRes
\brief Class for defining the Kappa resonance model
Class for defining the Kappa resonance model.
Formulae and data values from
Phys.Lett.B 572, 1 (2003) - author D.V.Bugg
*/
#ifndef LAU_KAPPA_RES
#define LAU_KAPPA_RES
-#include "TString.h"
-
-#include "LauComplex.hh"
#include "LauAbsResonance.hh"
+#include "LauComplex.hh"
+#include "TString.h"
class LauKappaRes : public LauAbsResonance {
- public:
- //! Constructor
- /*!
- \param [in] resInfo the object containing information on the resonance name, mass, width, spin, charge, etc.
- \param [in] resPairAmpInt the number of the daughter not produced by the resonance
- \param [in] daughters the daughter particles
- */
- LauKappaRes(LauResonanceInfo* resInfo, const Int_t resPairAmpInt, const LauDaughters* daughters);
-
- //! Destructor
- virtual ~LauKappaRes();
-
- //! Initialise the model
- virtual void initialise();
-
- //! Get the resonance model type
- /*!
- \return the resonance model type
- */
- virtual LauAbsResonance::LauResonanceModel getResonanceModel() const {return LauAbsResonance::Kappa;}
-
- //! Set value of the various parameters
- /*!
- \param [in] name the name of the parameter to be changed
- \param [in] value the new parameter value
- */
- virtual void setResonanceParameter(const TString& name, const Double_t value);
-
- //! Allow the various parameters to float in the fit
- /*!
- \param [in] name the name of the parameter to be floated
- */
- virtual void floatResonanceParameter(const TString& name);
-
- //! Access the given resonance parameter
- /*!
- \param [in] name the name of the parameter
- \return the corresponding parameter
- */
- virtual LauParameter* getResonanceParameter(const TString& name);
-
- //! Retrieve the resonance parameters, e.g. so that they can be loaded into a fit
- /*!
- \return floating parameters of the resonance
- */
- virtual const std::vector<LauParameter*>& getFloatingParameters();
-
- protected:
- //! Set the b1 parameter
- /*!
- \param [in] b1 new value for b1 parameter
- */
- void setB1Value(const Double_t b1);
-
- //! Set the b2 parameter
- /*!
- \param [in] b2 new value for b2 parameter
- */
- void setB2Value(const Double_t b2);
-
- //! Set the A parameter
- /*!
- \param [in] A new value for A parameter
- */
- void setAValue(const Double_t A);
-
- //! Set the m0 parameter
- /*!
- \param [in] m0 new value for m0 parameter
- */
- void setM0Value(const Double_t m0);
-
- //! Get the b1 parameter value
- /*!
- \return value of the b1 parameter
- */
- Double_t getB1Value() const { return (b1_!=0) ? b1_->unblindValue() : 0.0; }
-
- //! Get the b2 parameter value
- /*!
- \return value of the b2 parameter
- */
- Double_t getB2Value() const { return (b2_!=0) ? b2_->unblindValue() : 0.0; }
-
- //! Get the A parameter value
- /*!
- \return value of the A parameter
- */
- Double_t getAValue() const { return (a_!=0) ? a_->unblindValue() : 0.0; }
-
- //! Get the m0 parameter value
- /*!
- \return value of the m0 parameter
- */
- Double_t getM0Value() const { return (m0_!=0) ? m0_->unblindValue() : 0.0; }
-
- //! Fix the b1 parameter value
- /*!
- \return kTRUE if the b1 parameter is fixed, kFALSE otherwise
- */
- Bool_t fixB1Value() const { return (b1_!=0) ? b1_->fixed() : 0.0; }
-
- //! Fix the b2 parameter value
- /*!
- \return kTRUE if the b2 parameter is fixed, kFALSE otherwise
- */
- Bool_t fixB2Value() const { return (b2_!=0) ? b2_->fixed() : 0.0; }
-
- //! Fix the A parameter value
- /*!
- \return kTRUE if the A parameter is fixed, kFALSE otherwise
- */
- Bool_t fixAValue() const { return (a_!=0) ? a_->fixed() : 0.0; }
-
- //! Fix the m0 parameter value
- /*!
- \return kTRUE if the m0 parameter is fixed, kFALSE otherwise
- */
- Bool_t fixM0Value() const { return (m0_!=0) ? m0_->fixed() : 0.0; }
-
- //! Complex resonant amplitude
- /*!
- \param [in] mass appropriate invariant mass for the resonance
- \param [in] spinTerm spin term
- */
- virtual LauComplex resAmp(Double_t mass, Double_t spinTerm);
-
- //! Check that Kappa daughters are K and pi
- void checkDaughterTypes() const;
-
- private:
- //! Copy constructor (not implemented)
- LauKappaRes(const LauKappaRes& rhs);
-
- //! Copy assignment operator (not implemented)
- LauKappaRes& operator=(const LauKappaRes& rhs);
-
- //! Square of (mK + mPi)
- const Double_t mSumSq_;
- //! Defined as mK*mK - 0.5*mPi*mPi
- const Double_t sAdler_;
-
- //! Factor from BES data
- LauParameter* b1_;
- //! Factor from BES data
- LauParameter* b2_;
- //! Factor from BES data
- LauParameter* a_;
- //! Factor from BES data
- LauParameter* m0_;
-
- ClassDef(LauKappaRes,0) // Kappa resonance model
-
+ public:
+ //! Constructor
+ /*!
+ \param [in] resInfo the object containing information on the resonance name, mass, width, spin, charge, etc.
+ \param [in] resPairAmpInt the number of the daughter not produced by the resonance
+ \param [in] daughters the daughter particles
+ */
+ LauKappaRes( LauResonanceInfo* resInfo, const Int_t resPairAmpInt, const LauDaughters* daughters );
+
+ //! Destructor
+ virtual ~LauKappaRes();
+
+ //! Initialise the model
+ virtual void initialise();
+
+ //! Get the resonance model type
+ /*!
+ \return the resonance model type
+ */
+ virtual LauAbsResonance::LauResonanceModel getResonanceModel() const
+ {
+ return LauAbsResonance::Kappa;
+ }
+
+ //! Set value of the various parameters
+ /*!
+ \param [in] name the name of the parameter to be changed
+ \param [in] value the new parameter value
+ */
+ virtual void setResonanceParameter( const TString& name, const Double_t value );
+
+ //! Allow the various parameters to float in the fit
+ /*!
+ \param [in] name the name of the parameter to be floated
+ */
+ virtual void floatResonanceParameter( const TString& name );
+
+ //! Access the given resonance parameter
+ /*!
+ \param [in] name the name of the parameter
+ \return the corresponding parameter
+ */
+ virtual LauParameter* getResonanceParameter( const TString& name );
+
+ //! Retrieve the resonance parameters, e.g. so that they can be loaded into a fit
+ /*!
+ \return floating parameters of the resonance
+ */
+ virtual const std::vector<LauParameter*>& getFloatingParameters();
+
+ protected:
+ //! Set the b1 parameter
+ /*!
+ \param [in] b1 new value for b1 parameter
+ */
+ void setB1Value( const Double_t b1 );
+
+ //! Set the b2 parameter
+ /*!
+ \param [in] b2 new value for b2 parameter
+ */
+ void setB2Value( const Double_t b2 );
+
+ //! Set the A parameter
+ /*!
+ \param [in] A new value for A parameter
+ */
+ void setAValue( const Double_t A );
+
+ //! Set the m0 parameter
+ /*!
+ \param [in] m0 new value for m0 parameter
+ */
+ void setM0Value( const Double_t m0 );
+
+ //! Get the b1 parameter value
+ /*!
+ \return value of the b1 parameter
+ */
+ Double_t getB1Value() const { return ( b1_ != 0 ) ? b1_->unblindValue() : 0.0; }
+
+ //! Get the b2 parameter value
+ /*!
+ \return value of the b2 parameter
+ */
+ Double_t getB2Value() const { return ( b2_ != 0 ) ? b2_->unblindValue() : 0.0; }
+
+ //! Get the A parameter value
+ /*!
+ \return value of the A parameter
+ */
+ Double_t getAValue() const { return ( a_ != 0 ) ? a_->unblindValue() : 0.0; }
+
+ //! Get the m0 parameter value
+ /*!
+ \return value of the m0 parameter
+ */
+ Double_t getM0Value() const { return ( m0_ != 0 ) ? m0_->unblindValue() : 0.0; }
+
+ //! Fix the b1 parameter value
+ /*!
+ \return kTRUE if the b1 parameter is fixed, kFALSE otherwise
+ */
+ Bool_t fixB1Value() const { return ( b1_ != 0 ) ? b1_->fixed() : 0.0; }
+
+ //! Fix the b2 parameter value
+ /*!
+ \return kTRUE if the b2 parameter is fixed, kFALSE otherwise
+ */
+ Bool_t fixB2Value() const { return ( b2_ != 0 ) ? b2_->fixed() : 0.0; }
+
+ //! Fix the A parameter value
+ /*!
+ \return kTRUE if the A parameter is fixed, kFALSE otherwise
+ */
+ Bool_t fixAValue() const { return ( a_ != 0 ) ? a_->fixed() : 0.0; }
+
+ //! Fix the m0 parameter value
+ /*!
+ \return kTRUE if the m0 parameter is fixed, kFALSE otherwise
+ */
+ Bool_t fixM0Value() const { return ( m0_ != 0 ) ? m0_->fixed() : 0.0; }
+
+ //! Complex resonant amplitude
+ /*!
+ \param [in] mass appropriate invariant mass for the resonance
+ \param [in] spinTerm spin term
+ */
+ virtual LauComplex resAmp( Double_t mass, Double_t spinTerm );
+
+ //! Check that Kappa daughters are K and pi
+ void checkDaughterTypes() const;
+
+ private:
+ //! Copy constructor (not implemented)
+ LauKappaRes( const LauKappaRes& rhs );
+
+ //! Copy assignment operator (not implemented)
+ LauKappaRes& operator=( const LauKappaRes& rhs );
+
+ //! Square of (mK + mPi)
+ const Double_t mSumSq_;
+ //! Defined as mK*mK - 0.5*mPi*mPi
+ const Double_t sAdler_;
+
+ //! Factor from BES data
+ LauParameter* b1_;
+ //! Factor from BES data
+ LauParameter* b2_;
+ //! Factor from BES data
+ LauParameter* a_;
+ //! Factor from BES data
+ LauParameter* m0_;
+
+ ClassDef( LauKappaRes, 0 ) // Kappa resonance model
};
#endif
diff --git a/inc/LauKinematics.hh b/inc/LauKinematics.hh
index aad5d56..7a8c30c 100644
--- a/inc/LauKinematics.hh
+++ b/inc/LauKinematics.hh
@@ -1,673 +1,727 @@
/*
Copyright 2004 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauKinematics.hh
\brief File containing declaration of LauKinematics class.
*/
/*! \class LauKinematics
\brief Class for calculating 3-body kinematic quantities.
Class for defining the many routines related to the three body kinematics.
Given the two DP co-ordinates, all other useful quantities e.g. the helicity angles are calculated.
Optionally, the so-called ``square Dalitz plot'' quantities can also be calculated.
*/
#ifndef LAU_KINEMATICS
#define LAU_KINEMATICS
-#include <vector>
-
#include "Rtypes.h"
#include "TMath.h"
+#include <vector>
class LauKinematics {
- public:
- //! Constructor
- /*!
- \param [in] m1 the first daughter mass
- \param [in] m2 the second daughter mass
- \param [in] m3 the third daughter mass
- \param [in] mParent the parent particle mass
- \param [in] calcSquareDPCoords boolean flag to enable/disable calculation of the square Dalitz plot co-ordinates
- \param [in] symmetricalDP boolean flag to indicate whether the DP is symmetric (i.e. two identical particle in final state)
- \param [in] fullySymmetricDP boolean flag to indicate whether the DP is fully symmetric (i.e. all three final-state particles are identical)
- */
- LauKinematics(const Double_t m1, const Double_t m2, const Double_t m3, const Double_t mParent,
- const Bool_t calcSquareDPCoords = kFALSE, const Bool_t symmetricalDP = kFALSE, const Bool_t fullySymmetricDP = kFALSE);
-
- //! Destructor
- virtual ~LauKinematics();
-
- //! Enable/disable the calculation of square Dalitz plot co-ordinates
- /*!
- \param [in] calcSquareDPCoords kTRUE/kFALSE to enable/disable calculation of the square DP co-ordinates
- */
- inline void squareDP( const Bool_t calcSquareDPCoords ) { squareDP_ = calcSquareDPCoords; }
-
- //! Are the square Dalitz plot co-ordinates being calculated?
- /*!
- \return kTRUE if the square Dalitz plot co-ordinates are being calculated, kFALSE otherwise
- */
- inline Bool_t squareDP() const { return squareDP_; }
-
- //! Is the DP symmetric?
- /*!
- \return kTRUE if the DP is symmetric (i.e. daughters 1 and 2 are identical), kFALSE otherwise
- */
- inline Bool_t gotSymmetricalDP() const { return (symmetricalDP_ && ! fullySymmetricDP_); }
-
- //! Is the DP fully symmetric?
- /*!
- \return kTRUE if the DP is fully symmetric (i.e. daughters 1, 2 and 3 are identical), kFALSE otherwise
- */
- inline Bool_t gotFullySymmetricDP() const { return fullySymmetricDP_; }
-
- //! Enable/disable warning messages
- inline void warningMessages(const Bool_t boolean) { warnings_ = boolean; }
-
- //! Update all kinematic quantities based on the DP co-ordinates m13Sq and m23Sq
- /*!
- It can be useful to first check that the point is within the kinematic boundary (using LauKinematics::withinDPLimits) before calling this method.
-
- \param [in] m13Sq the invariant mass squared of daughters 1 and 3
- \param [in] m23Sq the invariant mass squared of daughters 2 and 3
- */
- void updateKinematics(const Double_t m13Sq, const Double_t m23Sq);
-
- //! Update all kinematic quantities based on the square DP co-ordinates m' and theta'
- /*!
- It can be useful to first check that the point is within the kinematic boundary (using LauKinematics::withinSqDPLimits) before calling this method.
-
- \param [in] mPrime the m' co-ordinate
- \param [in] thetaPrime the theta' co-ordinate
- */
- void updateSqDPKinematics(const Double_t mPrime, const Double_t thetaPrime);
-
- //! Update all kinematic quantities based on m23 and cos(theta23)
- /*!
- \param [in] m23 the invariant mass of daughters 2 and 3
- \param [in] c23 the cosine of the helicity angle theta23, \see getc23
- */
- void updateKinematicsFrom23(const Double_t m23, const Double_t c23);
-
- //! Update all kinematic quantities based on m13 and cos(theta13)
- /*!
- \param [in] m13 the invariant mass of daughters 1 and 3
- \param [in] c13 the cosine of the helicity angle theta13, \see getc13
- */
- void updateKinematicsFrom13(const Double_t m13, const Double_t c13);
-
- //! Update all kinematic quantities based on m12 and cos(theta12)
- /*!
- \param [in] m12 the invariant mass of daughters 1 and 2
- \param [in] c12 the cosine of the helicity angle theta12, \see getc12
- */
- void updateKinematicsFrom12(const Double_t m12, const Double_t c12);
-
- //! Calculate the Jacobian for the transformation m23^2, m13^2 -> m', theta' (square DP) at the given point in the square DP
- /*!
- \param [in] mPrime the m' co-ordinate
- \param [in] thPrime the theta' co-ordinate
- \return the jacobian of the transformation
- */
- Double_t calcSqDPJacobian(const Double_t mPrime, const Double_t thPrime) const;
-
- //! Calculate the Jacobian for the transformation m23^2, m13^2 -> m', theta' (square DP) at the currently stored point in the square DP
- /*!
- \return the jacobian of the transformation
- */
- Double_t calcSqDPJacobian() const;
-
- //! Routine to generate events flat in phase-space
- /*!
- \param [out] m13Sq the invariant mass squared of daughters 1 and 3
- \param [out] m23Sq the invariant mass squared of daughters 2 and 3
- */
- void genFlatPhaseSpace(Double_t& m13Sq, Double_t& m23Sq) const;
-
- //! Routine to generate events flat in the square Dalitz plot
- /*!
- \param [out] mPrime the m' variable
- \param [out] thetaPrime the theta' variable
- */
- void genFlatSqDP(Double_t& mPrime, Double_t& thetaPrime) const;
-
- //! Check whether a given (m13Sq,m23Sq) point is within the kinematic limits of the Dalitz plot
- /*!
- This method first checks that m13Sq is within its absolute
- min and max and then for the given m13Sq calculates the
- local min and max of m23Sq and checks whether the given
- m23Sq satisfies these bounds.
-
- \param [in] m13Sq the invariant mass squared of daughters 1 and 3
- \param [in] m23Sq the invariant mass squared of daughters 2 and 3
- \return kTRUE if the event is inside the kinematic limit, kFALSE otherwise
- */
- Bool_t withinDPLimits(const Double_t m13Sq, const Double_t m23Sq) const;
-
- //! Check whether a given (m13Sq,m23Sq) point is within the kinematic limits of the Dalitz plot (alternate method)
- /*!
- This method first checks that m23Sq is within its absolute
- min and max and then for the given m23Sq calculates the
- local min and max of m13Sq and checks whether the given
- m13Sq satisfies these bounds.
-
- \param [in] m13Sq the m13 invariant mass pair squared
- \param [in] m23Sq the m23 invariant mass pair squared
- \return kTRUE if the event is inside the kinematic limit, kFALSE otherwise
- */
- Bool_t withinDPLimits2(const Double_t m13Sq, const Double_t m23Sq) const;
-
- //! Check whether a given (m',theta') point is within the kinematic limits of the Dalitz plot
- /*!
- \param [in] mPrime the m' co-ordinate
- \param [in] thetaPrime the theta' co-ordinate
- \return kTRUE if the event is inside the kinematic limit, kFALSE otherwise
- */
- Bool_t withinSqDPLimits(const Double_t mPrime, const Double_t thetaPrime) const;
-
- //! Calculate the third invariant mass square from the two provided (e.g. mjkSq from mijSq and mikSq)
- /*!
- \param [in] firstMassSq the first invariant mass squared
- \param [in] secondMassSq the second invariant mass squared
- \return the third invariant mass square
- */
- Double_t calcThirdMassSq(const Double_t firstMassSq, const Double_t secondMassSq) const;
-
- //! Calculate the distance from the currently set (m13Sq, m23Sq) point to the centre of the Dalitz plot (which is defined as the point where m12=m13=m23)
- /*!
- \return the distance to the DP centre
- */
- Double_t distanceFromDPCentre() const;
-
- //! Calculate the distance from a given (m13Sq, m23Sq) point to the centre of the Dalitz plot (which is defined as the point where m12=m13=m23)
- /*!
- \return the distance to the DP centre
- */
- Double_t distanceFromDPCentre(const Double_t m13Sq, const Double_t m23Sq) const;
-
- //! Get the m12 invariant mass
- /*!
- \return the m12 invariant mass
- */
- inline Double_t getm12() const {return m12_;}
- //! Get the m23 invariant mass
- /*!
- \return the m23 invariant mass
- */
- inline Double_t getm23() const {return m23_;}
- //! Get the m13 invariant mass
- /*!
- \return the m13 invariant mass
- */
- inline Double_t getm13() const {return m13_;}
-
- //! Get the m12 invariant mass square
- /*!
- \return the m12 invariant mass square
- */
- inline Double_t getm12Sq() const {return m12Sq_;}
- //! Get the m23 invariant mass square
- /*!
- \return the m23 invariant mass square
- */
- inline Double_t getm23Sq() const {return m23Sq_;}
- //! Get the m13 invariant mass square
- /*!
- \return the m13 invariant mass square
- */
- inline Double_t getm13Sq() const {return m13Sq_;}
-
- //! Get the cosine of the helicity angle theta12
- /*!
- theta12 is defined as the angle between 1&3 in the rest frame of 1&2
- \return the cosine of the helicity angle theta12
- */
- inline Double_t getc12() const {return c12_;}
- //! Get the cosine of the helicity angle theta23
- /*!
- theta23 is defined as the angle between 3&1 in the rest frame of 2&3
- \return the cosine of the helicity angle theta23
- */
- inline Double_t getc23() const {return c23_;}
- //! Get the cosine of the helicity angle theta13
- /*!
- theta13 is defined as the angle between 3&2 in the rest frame of 1&3
- \return the cosine of the helicity angle theta13
- */
- inline Double_t getc13() const {return c13_;}
-
- //! Get m' value
- /*!
- \return m' value
- */
- inline Double_t getmPrime() const {return mPrime_;}
- //! Get theta' value
- /*!
- \return theta' value
- */
- inline Double_t getThetaPrime() const {return thetaPrime_;}
-
- //! Get parent mass
- /*!
- \return parent mass
- */
- inline Double_t getmParent() const {return mParent_;}
- //! Get parent mass squared
- /*!
- \return parent mass squared
- */
- inline Double_t getmParentSq() const {return mParentSq_;}
-
- //! Get the box area defined from the kinematic bounds
- /*!
- The box area is defined as:\n
- [(M-m3)^2 - (m1+m2)^2]*[(M-m2)^2 - (m1+m3)^2] .:. (m13SqMax - m13SqMin)*(m23SqMax - m23SqMin)
-
- \return the Dalitz plot box area
- */
- inline Double_t getDPBoxArea() const {return (mSqMax_[1] - mSqMin_[1])*(mSqMax_[0] - mSqMin_[0]);}
-
- //! Flips the DP variables m13^2 <-> m23^2 and recalculates all kinematic quantities
- /*!
- Useful in the case of symmetrical Dalitz plots, i.e. when two final state particles are identical
- */
- void flipAndUpdateKinematics();
-
- //! Cyclically rotates the DP variables (m12 -> m23, m23 -> m13, m13 -> m12) and recalculates all kinematic quantities
- /*!
- Useful in the case of a fully symmetric Dalitz plot, i.e. when all three final state particles are identical
- */
- void rotateAndUpdateKinematics();
-
- //! Get the m1 mass
- /*!
- \return the m1 mass
- */
- inline Double_t getm1() const {return m1_;}
- //! Get the m2 mass
- /*!
- \return the m2 mass
- */
- inline Double_t getm2() const {return m2_;}
- //! Get the m3 mass
- /*!
- \return the m3 mass
- */
- inline Double_t getm3() const {return m3_;}
-
- //! Get the m23 minimum defined as (m2 + m3)
- /*!
- \return the minimum value for m23
- */
- inline Double_t getm23Min() const {return TMath::Sqrt(mSqMin_[0]);}
- //! Get the m13 minimum defined as (m1 + m3)
- /*!
- \return the minimum value for m13
- */
- inline Double_t getm13Min() const {return TMath::Sqrt(mSqMin_[1]);}
- //! Get the m12 minimum defined as (m1 + m2)
- /*!
- \return the minimum value for m12
- */
- inline Double_t getm12Min() const {return TMath::Sqrt(mSqMin_[2]);}
-
- //! Get the m23 maximum defined as (mParent - m1)
- /*!
- \return the maximum value for m23
- */
- inline Double_t getm23Max() const {return TMath::Sqrt(mSqMax_[0]);}
- //! Get the m13 maximum defined as (mParent - m2)
- /*!
- \return the maximum value for m13
- */
- inline Double_t getm13Max() const {return TMath::Sqrt(mSqMax_[1]);}
- //! Get the m12 maximum defined as (mParent - m3)
- /*!
- \return the maximum value for m12
- */
- inline Double_t getm12Max() const {return TMath::Sqrt(mSqMax_[2]);}
-
- //! Get the m23Sq minimum, (m2 + m3)^2
- /*!
- \return the minimum value for m23Sq
- */
- inline Double_t getm23SqMin() const {return mSqMin_[0];}
- //! Get the m13Sq minimum, (m1 + m3)^2
- /*!
- \return the minimum value for m13Sq
- */
- inline Double_t getm13SqMin() const {return mSqMin_[1];}
- //! Get the m12Sq minimum, (m1 + m2)^2
- /*!
- \return the minimum value for m12Sq
- */
- inline Double_t getm12SqMin() const {return mSqMin_[2];}
-
- //! Get the m23Sq maximum, (mParent - m1)^2
- /*!
- \return the maximum value for m23Sq
- */
- inline Double_t getm23SqMax() const {return mSqMax_[0];}
- //! Get the m13Sq maximum, (mParent - m2)^2
- /*!
- \return the maximum value for m13Sq
- */
- inline Double_t getm13SqMax() const {return mSqMax_[1];}
- //! Get the m12Sq maximum, (mParent - m3)^2
- /*!
- \return the maximum value for m12Sq
- */
- inline Double_t getm12SqMax() const {return mSqMax_[2];}
-
- //! Get the momentum of the track 1 in 12 rest frame
- /*!
- \return the momentum of track 1 in 12 rest frame
- */
- inline Double_t getp1_12() const {return p1_12_;}
- //! Get the momentum of the track 3 in 12 rest frame
- /*!
- \return the momentum of track 3 in 12 rest frame
- */
- inline Double_t getp3_12() const {return p3_12_;}
- //! Get the momentum of the track 2 in 23 rest frame
- /*!
- \return the momentum of track 2 in 23 rest frame
- */
- inline Double_t getp2_23() const {return p2_23_;}
- //! Get the momentum of the track 1 in 23 rest frame
- /*!
- \return the momentum of track 1 in 23 rest frame
- */
- inline Double_t getp1_23() const {return p1_23_;}
- //! Get the momentum of the track 1 in 13 rest frame
- /*!
- \return the momentum of track 1 in 13 rest frame
- */
- inline Double_t getp1_13() const {return p1_13_;}
- //! Get the momentum of the track 2 in 13 rest frame
- /*!
- \return the momentum of track 2 in 13 rest frame
- */
- inline Double_t getp2_13() const {return p2_13_;}
-
- //! Get the momentum of the track 1 in parent rest frame
- /*!
- \return the momentum of track 1 in parent rest frame
- */
- inline Double_t getp1_Parent() const {return p1_Parent_;}
- //! Get the momentum of the track 2 in parent rest frame
- /*!
- \return the momentum of track 2 in parent rest frame
- */
- inline Double_t getp2_Parent() const {return p2_Parent_;}
- //! Get the momentum of the track 3 in parent rest frame
- /*!
- \return the momentum of track 3 in parent rest frame
- */
- inline Double_t getp3_Parent() const {return p3_Parent_;}
-
- //! Method to draw the Dalitz plot contours on the top of the histo previously drawn
- /*!
- \param [in] orientation orientation used for the draw, with default set to 1323 that corresponds x = m13, y = m23
- \param [in] nbins number of bins for the contour to be sampled over (default = 100)
- */
- void drawDPContour(const Int_t orientation = 1323, const Int_t nbins = 100);
-
- //! Get covariant factor in 12 axis
- /*!
- \return covariant factor in 12 axis
- */
- inline Double_t getcov12() const {return (mParentSq_ + m12Sq_ - m3Sq_)/(2.*mParent_*m12_);}
-
- //! Get covariant factor in 13 axis
- /*!
- \return covariant factor in 13 axis
- */
- inline Double_t getcov13() const {return (mParentSq_ + m13Sq_ - m2Sq_)/(2.*mParent_*m13_);}
-
- //! Get covariant factor in 23 axis
- /*!
- \return covariant factor in 23 axis
- */
- inline Double_t getcov23() const {return (mParentSq_ + m23Sq_ - m1Sq_)/(2.*mParent_*m23_);}
-
- protected:
- //! Update the variables m23Sq_ and m13Sq_ given the invariant mass m12 and the cosine of the helicity angle c12
- /*!
- \param [in] m12 the invariant mass m12
- \param [in] c12 the cosine of the helicity angle c12
- */
- void updateMassSq_m12(const Double_t m12, const Double_t c12);
-
- //! Update the variables m12Sq_ and m13Sq_ given the invariant mass m23 and the cosine of the helicity angle c23
- /*!
- \param [in] m23 the invariant mass m12
- \param [in] c23 the cosine of the helicity angle c23
- */
- void updateMassSq_m23(const Double_t m23, const Double_t c23);
-
- //! Update the variables m12Sq_ and m23Sq_ given the invariant mass m13 and the cosine of the helicity angle c13
- /*!
- \param [in] m13 the invariant mass m13
- \param [in] c13 the cosine of the helicity angle c13
- */
- void updateMassSq_m13(const Double_t m13, const Double_t c13);
-
- //! Update some kinematic quantities based on the DP co-ordinates m13Sq and m23Sq
- /*!
- Only the three invariant masses and their squares, plus the parent rest-frame momenta are updated.
-
- \param [in] m13Sq the invariant mass squared of daughters 1 and 3
- \param [in] m23Sq the invariant mass squared of daughters 2 and 3
- */
- void updateMassSquares(const Double_t m13Sq, const Double_t m23Sq);
-
- //! Update some kinematic quantities based on the square DP co-ordinates m' and theta'
- /*!
- Only m', theta', the three invariant masses and their squares, plus the parent rest-frame momenta are updated.
-
- \param [in] mPrime the m' co-ordinate
- \param [in] thetaPrime the theta' co-ordinate
- */
- void updateSqDPMassSquares(const Double_t mPrime, const Double_t thetaPrime);
-
- //! General method to calculate the cos(helicity) variables from the masses of the particles
- /*!
- \param [in] mijSq the mij invariant mass square
- \param [in] mikSq the mik invariant mass square
- \param [in] mij the mij invariant mass
- \param [in] i the index for the first track
- \param [in] j the index for the second track
- \param [in] k the index for the third track
- \return helicity angle in the ij rest frame
- */
- Double_t cFromM(const Double_t mijSq, const Double_t mikSq, const Double_t mij, const Int_t i, const Int_t j, const Int_t k) const;
-
- //! General method to calculate mikSq given mijSq and cosHel_ij
- /*!
- \param [in] mijSq the mij invariant mass square
- \param [in] cij the helicity angle for the pair which is made from tracks i and j
- \param [in] mij the mij invariant mass
- \param [in] i the index for the first track
- \param [in] j the index for the second track
- \param [in] k the index for the third track
- \return the invariant mass square mikSq
- */
- Double_t mFromC(const Double_t mijSq, const Double_t cij, const Double_t mij, const Int_t i, const Int_t j, const Int_t k) const;
-
- //! General method to calculate the momentum of a particle, given its energy and invariant mass squared.
- /*!
- \param [in] energy the energy of the particle
- \param [in] massSq the invariant mass squared of the particle
- \return the momentum of the particle
- */
- Double_t pCalc(const Double_t energy, const Double_t massSq) const;
-
- //! Randomly generate the invariant mass squared m13Sq
- /*!
- \return the invariant mass squared m13Sq
- */
- Double_t genm13Sq() const;
- //! Randomly generate the invariant mass squared m23Sq
- /*!
- \return the invariant mass squared m23Sq
- */
- Double_t genm23Sq() const;
- //! Randomly generate the invariant mass squared m12Sq
- /*!
- \return the invariant mass squared m12Sq
- */
- Double_t genm12Sq() const;
-
- //! Calculate m12Sq from m13Sq and m23Sq
- void calcm12Sq();
-
- //! Calculate cosines of the helicity angles, momenta of daughters and bachelor in various ij rest frames
- void calcHelicities();
-
- //! Calculate the m' and theta' variables for the square Dalitz plot
- void calcSqDPVars();
-
- //! Calculate the momenta of each daughter in the parent rest frame
- void calcParentFrameMomenta();
-
- private:
- //! Copy constructor (not implemented)
- LauKinematics(const LauKinematics& rhs);
-
- //! Copy assignment operator (not implemented)
- LauKinematics& operator=(const LauKinematics& rhs);
-
- //! Symmetrical DP
- const Bool_t symmetricalDP_;
- //! Fully-symmetrical DP
- const Bool_t fullySymmetricDP_;
-
- //! Mass of particle 1
- const Double_t m1_;
- //! Mass of particle 2
- const Double_t m2_;
- //! Mass of particle 3
- const Double_t m3_;
- //! Mass of parent particle
- const Double_t mParent_;
-
- //! Mass of particle 1 squared
- const Double_t m1Sq_;
- //! Mass of particle 2 squared
- const Double_t m2Sq_;
- //! Mass of particle 3 squared
- const Double_t m3Sq_;
- //! Mass of parent particle squared
- const Double_t mParentSq_;
-
- //! Vector of daughter particles masses
- std::vector<Double_t> mass_;
- //! Vector of the minimum mij values
- std::vector<Double_t> mMin_;
- //! Vector of the maximum mij values
- std::vector<Double_t> mMax_;
- //! Vector of the difference between the mMax and mMin
- std::vector<Double_t> mDiff_;
-
- //! Vector of daughter particles masses squared
- std::vector<Double_t> mSq_;
- //! Vector of the minimum mijSq values
- std::vector<Double_t> mSqMin_;
- //! Vector of the maximum mijSq values
- std::vector<Double_t> mSqMax_;
- //! Vector of the difference between the mSqMax and mSqMin
- std::vector<Double_t> mSqDiff_;
-
- //! Sum of the daughter masses
- const Double_t mDTot_;
- //! Mass difference between the parent particle and the sum of the daughter particles
- const Double_t massInt_;
- //! Sum of the squares of the daughter masses
- const Double_t mSqDTot_;
-
- //! Invariant mass m12
- Double_t m12_;
- //! Invariant mass m23
- Double_t m23_;
- //! Invariant mass m13
- Double_t m13_;
-
- //! Invariant mass m12 squared
- Double_t m12Sq_;
- //! Invariant mass m23 squared
- Double_t m23Sq_;
- //! Invariant mass m13 squared
- Double_t m13Sq_;
-
- //! Cosine of the helicity angle theta12, which is defined as the angle between 1&3 in the rest frame of 1&2
- Double_t c12_;
- //! Cosine of the helicity angle theta23, which is defined as the angle between 1&2 in the rest frame of 2&3
- Double_t c23_;
- //! Cosine of the helicity angle theta13, which is defined as the angle between 1&2 in the rest frame of 1&3
- Double_t c13_;
-
- //! m' co-ordinate
- Double_t mPrime_;
- //! theta' co-ordinate
- Double_t thetaPrime_;
-
- //! Momentum q of particle i
- mutable Double_t qi_;
- //! Momentum q of particle k
- mutable Double_t qk_;
-
- //! Momentum of track 1 in 1-2 rest frame
- Double_t p1_12_;
- //! Momentum of track 3 in 1-2 rest frame
- Double_t p3_12_;
- //! Momentum of track 2 in 2-3 rest frame
- Double_t p2_23_;
- //! Momentum of track 1 in 2-3 rest frame
- Double_t p1_23_;
- //! Momentum of track 1 in 1-3 rest frame
- Double_t p1_13_;
- //! Momentum of track 2 in 1-3 rest frame
- Double_t p2_13_;
-
- //! Momentum of track 1 in parent rest frame
- Double_t p1_Parent_;
- //! Momentum of track 2 in parent rest frame
- Double_t p2_Parent_;
- //! Momentum of track 3 in parent rest frame
- Double_t p3_Parent_;
-
- //! Should we calculate the square DP co-ordinates or not?
- Bool_t squareDP_;
- //! Enable/disable warning messages
- Bool_t warnings_;
-
- ClassDef(LauKinematics,0)
+ public:
+ //! Constructor
+ /*!
+ \param [in] m1 the first daughter mass
+ \param [in] m2 the second daughter mass
+ \param [in] m3 the third daughter mass
+ \param [in] mParent the parent particle mass
+ \param [in] calcSquareDPCoords boolean flag to enable/disable calculation of the square Dalitz plot co-ordinates
+ \param [in] symmetricalDP boolean flag to indicate whether the DP is symmetric (i.e. two identical particle in final state)
+ \param [in] fullySymmetricDP boolean flag to indicate whether the DP is fully symmetric (i.e. all three final-state particles are identical)
+ */
+ LauKinematics( const Double_t m1,
+ const Double_t m2,
+ const Double_t m3,
+ const Double_t mParent,
+ const Bool_t calcSquareDPCoords = kFALSE,
+ const Bool_t symmetricalDP = kFALSE,
+ const Bool_t fullySymmetricDP = kFALSE );
+
+ //! Destructor
+ virtual ~LauKinematics();
+
+ //! Enable/disable the calculation of square Dalitz plot co-ordinates
+ /*!
+ \param [in] calcSquareDPCoords kTRUE/kFALSE to enable/disable calculation of the square DP co-ordinates
+ */
+ inline void squareDP( const Bool_t calcSquareDPCoords ) { squareDP_ = calcSquareDPCoords; }
+
+ //! Are the square Dalitz plot co-ordinates being calculated?
+ /*!
+ \return kTRUE if the square Dalitz plot co-ordinates are being calculated, kFALSE otherwise
+ */
+ inline Bool_t squareDP() const { return squareDP_; }
+
+ //! Is the DP symmetric?
+ /*!
+ \return kTRUE if the DP is symmetric (i.e. daughters 1 and 2 are identical), kFALSE otherwise
+ */
+ inline Bool_t gotSymmetricalDP() const { return ( symmetricalDP_ && ! fullySymmetricDP_ ); }
+
+ //! Is the DP fully symmetric?
+ /*!
+ \return kTRUE if the DP is fully symmetric (i.e. daughters 1, 2 and 3 are identical), kFALSE otherwise
+ */
+ inline Bool_t gotFullySymmetricDP() const { return fullySymmetricDP_; }
+
+ //! Enable/disable warning messages
+ inline void warningMessages( const Bool_t boolean ) { warnings_ = boolean; }
+
+ //! Update all kinematic quantities based on the DP co-ordinates m13Sq and m23Sq
+ /*!
+ It can be useful to first check that the point is within the kinematic boundary (using LauKinematics::withinDPLimits) before calling this method.
+
+ \param [in] m13Sq the invariant mass squared of daughters 1 and 3
+ \param [in] m23Sq the invariant mass squared of daughters 2 and 3
+ */
+ void updateKinematics( const Double_t m13Sq, const Double_t m23Sq );
+
+ //! Update all kinematic quantities based on the square DP co-ordinates m' and theta'
+ /*!
+ It can be useful to first check that the point is within the kinematic boundary (using LauKinematics::withinSqDPLimits) before calling this method.
+
+ \param [in] mPrime the m' co-ordinate
+ \param [in] thetaPrime the theta' co-ordinate
+ */
+ void updateSqDPKinematics( const Double_t mPrime, const Double_t thetaPrime );
+
+ //! Update all kinematic quantities based on m23 and cos(theta23)
+ /*!
+ \param [in] m23 the invariant mass of daughters 2 and 3
+ \param [in] c23 the cosine of the helicity angle theta23, \see getc23
+ */
+ void updateKinematicsFrom23( const Double_t m23, const Double_t c23 );
+
+ //! Update all kinematic quantities based on m13 and cos(theta13)
+ /*!
+ \param [in] m13 the invariant mass of daughters 1 and 3
+ \param [in] c13 the cosine of the helicity angle theta13, \see getc13
+ */
+ void updateKinematicsFrom13( const Double_t m13, const Double_t c13 );
+
+ //! Update all kinematic quantities based on m12 and cos(theta12)
+ /*!
+ \param [in] m12 the invariant mass of daughters 1 and 2
+ \param [in] c12 the cosine of the helicity angle theta12, \see getc12
+ */
+ void updateKinematicsFrom12( const Double_t m12, const Double_t c12 );
+
+ //! Calculate the Jacobian for the transformation m23^2, m13^2 -> m', theta' (square DP) at the given point in the square DP
+ /*!
+ \param [in] mPrime the m' co-ordinate
+ \param [in] thPrime the theta' co-ordinate
+ \return the jacobian of the transformation
+ */
+ Double_t calcSqDPJacobian( const Double_t mPrime, const Double_t thPrime ) const;
+
+ //! Calculate the Jacobian for the transformation m23^2, m13^2 -> m', theta' (square DP) at the currently stored point in the square DP
+ /*!
+ \return the jacobian of the transformation
+ */
+ Double_t calcSqDPJacobian() const;
+
+ //! Routine to generate events flat in phase-space
+ /*!
+ \param [out] m13Sq the invariant mass squared of daughters 1 and 3
+ \param [out] m23Sq the invariant mass squared of daughters 2 and 3
+ */
+ void genFlatPhaseSpace( Double_t& m13Sq, Double_t& m23Sq ) const;
+
+ //! Routine to generate events flat in the square Dalitz plot
+ /*!
+ \param [out] mPrime the m' variable
+ \param [out] thetaPrime the theta' variable
+ */
+ void genFlatSqDP( Double_t& mPrime, Double_t& thetaPrime ) const;
+
+ //! Check whether a given (m13Sq,m23Sq) point is within the kinematic limits of the Dalitz plot
+ /*!
+ This method first checks that m13Sq is within its absolute
+ min and max and then for the given m13Sq calculates the
+ local min and max of m23Sq and checks whether the given
+ m23Sq satisfies these bounds.
+
+ \param [in] m13Sq the invariant mass squared of daughters 1 and 3
+ \param [in] m23Sq the invariant mass squared of daughters 2 and 3
+ \return kTRUE if the event is inside the kinematic limit, kFALSE otherwise
+ */
+ Bool_t withinDPLimits( const Double_t m13Sq, const Double_t m23Sq ) const;
+
+ //! Check whether a given (m13Sq,m23Sq) point is within the kinematic limits of the Dalitz plot (alternate method)
+ /*!
+ This method first checks that m23Sq is within its absolute
+ min and max and then for the given m23Sq calculates the
+ local min and max of m13Sq and checks whether the given
+ m13Sq satisfies these bounds.
+
+ \param [in] m13Sq the m13 invariant mass pair squared
+ \param [in] m23Sq the m23 invariant mass pair squared
+ \return kTRUE if the event is inside the kinematic limit, kFALSE otherwise
+ */
+ Bool_t withinDPLimits2( const Double_t m13Sq, const Double_t m23Sq ) const;
+
+ //! Check whether a given (m',theta') point is within the kinematic limits of the Dalitz plot
+ /*!
+ \param [in] mPrime the m' co-ordinate
+ \param [in] thetaPrime the theta' co-ordinate
+ \return kTRUE if the event is inside the kinematic limit, kFALSE otherwise
+ */
+ Bool_t withinSqDPLimits( const Double_t mPrime, const Double_t thetaPrime ) const;
+
+ //! Calculate the third invariant mass square from the two provided (e.g. mjkSq from mijSq and mikSq)
+ /*!
+ \param [in] firstMassSq the first invariant mass squared
+ \param [in] secondMassSq the second invariant mass squared
+ \return the third invariant mass square
+ */
+ Double_t calcThirdMassSq( const Double_t firstMassSq, const Double_t secondMassSq ) const;
+
+ //! Calculate the distance from the currently set (m13Sq, m23Sq) point to the centre of the Dalitz plot (which is defined as the point where m12=m13=m23)
+ /*!
+ \return the distance to the DP centre
+ */
+ Double_t distanceFromDPCentre() const;
+
+ //! Calculate the distance from a given (m13Sq, m23Sq) point to the centre of the Dalitz plot (which is defined as the point where m12=m13=m23)
+ /*!
+ \return the distance to the DP centre
+ */
+ Double_t distanceFromDPCentre( const Double_t m13Sq, const Double_t m23Sq ) const;
+
+ //! Get the m12 invariant mass
+ /*!
+ \return the m12 invariant mass
+ */
+ inline Double_t getm12() const { return m12_; }
+
+ //! Get the m23 invariant mass
+ /*!
+ \return the m23 invariant mass
+ */
+ inline Double_t getm23() const { return m23_; }
+
+ //! Get the m13 invariant mass
+ /*!
+ \return the m13 invariant mass
+ */
+ inline Double_t getm13() const { return m13_; }
+
+ //! Get the m12 invariant mass square
+ /*!
+ \return the m12 invariant mass square
+ */
+ inline Double_t getm12Sq() const { return m12Sq_; }
+
+ //! Get the m23 invariant mass square
+ /*!
+ \return the m23 invariant mass square
+ */
+ inline Double_t getm23Sq() const { return m23Sq_; }
+
+ //! Get the m13 invariant mass square
+ /*!
+ \return the m13 invariant mass square
+ */
+ inline Double_t getm13Sq() const { return m13Sq_; }
+
+ //! Get the cosine of the helicity angle theta12
+ /*!
+ theta12 is defined as the angle between 1&3 in the rest frame of 1&2
+
+ \return the cosine of the helicity angle theta12
+ */
+ inline Double_t getc12() const { return c12_; }
+
+ //! Get the cosine of the helicity angle theta23
+ /*!
+ theta23 is defined as the angle between 3&1 in the rest frame of 2&3
+
+ \return the cosine of the helicity angle theta23
+ */
+ inline Double_t getc23() const { return c23_; }
+
+ //! Get the cosine of the helicity angle theta13
+ /*!
+ theta13 is defined as the angle between 3&2 in the rest frame of 1&3
+
+ \return the cosine of the helicity angle theta13
+ */
+ inline Double_t getc13() const { return c13_; }
+
+ //! Get m' value
+ /*!
+ \return m' value
+ */
+ inline Double_t getmPrime() const { return mPrime_; }
+
+ //! Get theta' value
+ /*!
+ \return theta' value
+ */
+ inline Double_t getThetaPrime() const { return thetaPrime_; }
+
+ //! Get parent mass
+ /*!
+ \return parent mass
+ */
+ inline Double_t getmParent() const { return mParent_; }
+
+ //! Get parent mass squared
+ /*!
+ \return parent mass squared
+ */
+ inline Double_t getmParentSq() const { return mParentSq_; }
+
+ //! Get the box area defined from the kinematic bounds
+ /*!
+ The box area is defined as:\n
+ [(M-m3)^2 - (m1+m2)^2]*[(M-m2)^2 - (m1+m3)^2] .:. (m13SqMax - m13SqMin)*(m23SqMax - m23SqMin)
+
+ \return the Dalitz plot box area
+ */
+ inline Double_t getDPBoxArea() const
+ {
+ return ( mSqMax_[1] - mSqMin_[1] ) * ( mSqMax_[0] - mSqMin_[0] );
+ }
+
+ //! Flips the DP variables m13^2 <-> m23^2 and recalculates all kinematic quantities
+ /*!
+ Useful in the case of symmetrical Dalitz plots, i.e. when two final state particles are identical
+ */
+ void flipAndUpdateKinematics();
+
+ //! Cyclically rotates the DP variables (m12 -> m23, m23 -> m13, m13 -> m12) and recalculates all kinematic quantities
+ /*!
+ Useful in the case of a fully symmetric Dalitz plot, i.e. when all three final state particles are identical
+ */
+ void rotateAndUpdateKinematics();
+
+ //! Get the m1 mass
+ /*!
+ \return the m1 mass
+ */
+ inline Double_t getm1() const { return m1_; }
+
+ //! Get the m2 mass
+ /*!
+ \return the m2 mass
+ */
+ inline Double_t getm2() const { return m2_; }
+
+ //! Get the m3 mass
+ /*!
+ \return the m3 mass
+ */
+ inline Double_t getm3() const { return m3_; }
+
+ //! Get the m23 minimum defined as (m2 + m3)
+ /*!
+ \return the minimum value for m23
+ */
+ inline Double_t getm23Min() const { return TMath::Sqrt( mSqMin_[0] ); }
+
+ //! Get the m13 minimum defined as (m1 + m3)
+ /*!
+ \return the minimum value for m13
+ */
+ inline Double_t getm13Min() const { return TMath::Sqrt( mSqMin_[1] ); }
+
+ //! Get the m12 minimum defined as (m1 + m2)
+ /*!
+ \return the minimum value for m12
+ */
+ inline Double_t getm12Min() const { return TMath::Sqrt( mSqMin_[2] ); }
+
+ //! Get the m23 maximum defined as (mParent - m1)
+ /*!
+ \return the maximum value for m23
+ */
+ inline Double_t getm23Max() const { return TMath::Sqrt( mSqMax_[0] ); }
+
+ //! Get the m13 maximum defined as (mParent - m2)
+ /*!
+ \return the maximum value for m13
+ */
+ inline Double_t getm13Max() const { return TMath::Sqrt( mSqMax_[1] ); }
+
+ //! Get the m12 maximum defined as (mParent - m3)
+ /*!
+ \return the maximum value for m12
+ */
+ inline Double_t getm12Max() const { return TMath::Sqrt( mSqMax_[2] ); }
+
+ //! Get the m23Sq minimum, (m2 + m3)^2
+ /*!
+ \return the minimum value for m23Sq
+ */
+ inline Double_t getm23SqMin() const { return mSqMin_[0]; }
+
+ //! Get the m13Sq minimum, (m1 + m3)^2
+ /*!
+ \return the minimum value for m13Sq
+ */
+ inline Double_t getm13SqMin() const { return mSqMin_[1]; }
+
+ //! Get the m12Sq minimum, (m1 + m2)^2
+ /*!
+ \return the minimum value for m12Sq
+ */
+ inline Double_t getm12SqMin() const { return mSqMin_[2]; }
+
+ //! Get the m23Sq maximum, (mParent - m1)^2
+ /*!
+ \return the maximum value for m23Sq
+ */
+ inline Double_t getm23SqMax() const { return mSqMax_[0]; }
+
+ //! Get the m13Sq maximum, (mParent - m2)^2
+ /*!
+ \return the maximum value for m13Sq
+ */
+ inline Double_t getm13SqMax() const { return mSqMax_[1]; }
+
+ //! Get the m12Sq maximum, (mParent - m3)^2
+ /*!
+ \return the maximum value for m12Sq
+ */
+ inline Double_t getm12SqMax() const { return mSqMax_[2]; }
+
+ //! Get the momentum of the track 1 in 12 rest frame
+ /*!
+ \return the momentum of track 1 in 12 rest frame
+ */
+ inline Double_t getp1_12() const { return p1_12_; }
+
+ //! Get the momentum of the track 3 in 12 rest frame
+ /*!
+ \return the momentum of track 3 in 12 rest frame
+ */
+ inline Double_t getp3_12() const { return p3_12_; }
+
+ //! Get the momentum of the track 2 in 23 rest frame
+ /*!
+ \return the momentum of track 2 in 23 rest frame
+ */
+ inline Double_t getp2_23() const { return p2_23_; }
+
+ //! Get the momentum of the track 1 in 23 rest frame
+ /*!
+ \return the momentum of track 1 in 23 rest frame
+ */
+ inline Double_t getp1_23() const { return p1_23_; }
+
+ //! Get the momentum of the track 1 in 13 rest frame
+ /*!
+ \return the momentum of track 1 in 13 rest frame
+ */
+ inline Double_t getp1_13() const { return p1_13_; }
+
+ //! Get the momentum of the track 2 in 13 rest frame
+ /*!
+ \return the momentum of track 2 in 13 rest frame
+ */
+ inline Double_t getp2_13() const { return p2_13_; }
+
+ //! Get the momentum of the track 1 in parent rest frame
+ /*!
+ \return the momentum of track 1 in parent rest frame
+ */
+ inline Double_t getp1_Parent() const { return p1_Parent_; }
+
+ //! Get the momentum of the track 2 in parent rest frame
+ /*!
+ \return the momentum of track 2 in parent rest frame
+ */
+ inline Double_t getp2_Parent() const { return p2_Parent_; }
+
+ //! Get the momentum of the track 3 in parent rest frame
+ /*!
+ \return the momentum of track 3 in parent rest frame
+ */
+ inline Double_t getp3_Parent() const { return p3_Parent_; }
+
+ //! Method to draw the Dalitz plot contours on the top of the histo previously drawn
+ /*!
+ \param [in] orientation orientation used for the draw, with default set to 1323 that corresponds x = m13, y = m23
+ \param [in] nbins number of bins for the contour to be sampled over (default = 100)
+ */
+ void drawDPContour( const Int_t orientation = 1323, const Int_t nbins = 100 );
+
+ //! Get covariant factor in 12 axis
+ /*!
+ \return covariant factor in 12 axis
+ */
+ inline Double_t getcov12() const
+ {
+ return ( mParentSq_ + m12Sq_ - m3Sq_ ) / ( 2. * mParent_ * m12_ );
+ }
+
+ //! Get covariant factor in 13 axis
+ /*!
+ \return covariant factor in 13 axis
+ */
+ inline Double_t getcov13() const
+ {
+ return ( mParentSq_ + m13Sq_ - m2Sq_ ) / ( 2. * mParent_ * m13_ );
+ }
+
+ //! Get covariant factor in 23 axis
+ /*!
+ \return covariant factor in 23 axis
+ */
+ inline Double_t getcov23() const
+ {
+ return ( mParentSq_ + m23Sq_ - m1Sq_ ) / ( 2. * mParent_ * m23_ );
+ }
+
+ protected:
+ //! Update the variables m23Sq_ and m13Sq_ given the invariant mass m12 and the cosine of the helicity angle c12
+ /*!
+ \param [in] m12 the invariant mass m12
+ \param [in] c12 the cosine of the helicity angle c12
+ */
+ void updateMassSq_m12( const Double_t m12, const Double_t c12 );
+
+ //! Update the variables m12Sq_ and m13Sq_ given the invariant mass m23 and the cosine of the helicity angle c23
+ /*!
+ \param [in] m23 the invariant mass m12
+ \param [in] c23 the cosine of the helicity angle c23
+ */
+ void updateMassSq_m23( const Double_t m23, const Double_t c23 );
+
+ //! Update the variables m12Sq_ and m23Sq_ given the invariant mass m13 and the cosine of the helicity angle c13
+ /*!
+ \param [in] m13 the invariant mass m13
+ \param [in] c13 the cosine of the helicity angle c13
+ */
+ void updateMassSq_m13( const Double_t m13, const Double_t c13 );
+
+ //! Update some kinematic quantities based on the DP co-ordinates m13Sq and m23Sq
+ /*!
+ Only the three invariant masses and their squares, plus the parent rest-frame momenta are updated.
+
+ \param [in] m13Sq the invariant mass squared of daughters 1 and 3
+ \param [in] m23Sq the invariant mass squared of daughters 2 and 3
+ */
+ void updateMassSquares( const Double_t m13Sq, const Double_t m23Sq );
+
+ //! Update some kinematic quantities based on the square DP co-ordinates m' and theta'
+ /*!
+ Only m', theta', the three invariant masses and their squares, plus the parent rest-frame momenta are updated.
+
+ \param [in] mPrime the m' co-ordinate
+ \param [in] thetaPrime the theta' co-ordinate
+ */
+ void updateSqDPMassSquares( const Double_t mPrime, const Double_t thetaPrime );
+
+ //! General method to calculate the cos(helicity) variables from the masses of the particles
+ /*!
+ \param [in] mijSq the mij invariant mass square
+ \param [in] mikSq the mik invariant mass square
+ \param [in] mij the mij invariant mass
+ \param [in] i the index for the first track
+ \param [in] j the index for the second track
+ \param [in] k the index for the third track
+ \return helicity angle in the ij rest frame
+ */
+ Double_t cFromM( const Double_t mijSq,
+ const Double_t mikSq,
+ const Double_t mij,
+ const Int_t i,
+ const Int_t j,
+ const Int_t k ) const;
+
+ //! General method to calculate mikSq given mijSq and cosHel_ij
+ /*!
+ \param [in] mijSq the mij invariant mass square
+ \param [in] cij the helicity angle for the pair which is made from tracks i and j
+ \param [in] mij the mij invariant mass
+ \param [in] i the index for the first track
+ \param [in] j the index for the second track
+ \param [in] k the index for the third track
+ \return the invariant mass square mikSq
+ */
+ Double_t mFromC( const Double_t mijSq,
+ const Double_t cij,
+ const Double_t mij,
+ const Int_t i,
+ const Int_t j,
+ const Int_t k ) const;
+
+ //! General method to calculate the momentum of a particle, given its energy and invariant mass squared.
+ /*!
+ \param [in] energy the energy of the particle
+ \param [in] massSq the invariant mass squared of the particle
+ \return the momentum of the particle
+ */
+ Double_t pCalc( const Double_t energy, const Double_t massSq ) const;
+
+ //! Randomly generate the invariant mass squared m13Sq
+ /*!
+ \return the invariant mass squared m13Sq
+ */
+ Double_t genm13Sq() const;
+ //! Randomly generate the invariant mass squared m23Sq
+ /*!
+ \return the invariant mass squared m23Sq
+ */
+ Double_t genm23Sq() const;
+ //! Randomly generate the invariant mass squared m12Sq
+ /*!
+ \return the invariant mass squared m12Sq
+ */
+ Double_t genm12Sq() const;
+
+ //! Calculate m12Sq from m13Sq and m23Sq
+ void calcm12Sq();
+
+ //! Calculate cosines of the helicity angles, momenta of daughters and bachelor in various ij rest frames
+ void calcHelicities();
+
+ //! Calculate the m' and theta' variables for the square Dalitz plot
+ void calcSqDPVars();
+
+ //! Calculate the momenta of each daughter in the parent rest frame
+ void calcParentFrameMomenta();
+
+ private:
+ //! Copy constructor (not implemented)
+ LauKinematics( const LauKinematics& rhs );
+
+ //! Copy assignment operator (not implemented)
+ LauKinematics& operator=( const LauKinematics& rhs );
+
+ //! Symmetrical DP
+ const Bool_t symmetricalDP_;
+ //! Fully-symmetrical DP
+ const Bool_t fullySymmetricDP_;
+
+ //! Mass of particle 1
+ const Double_t m1_;
+ //! Mass of particle 2
+ const Double_t m2_;
+ //! Mass of particle 3
+ const Double_t m3_;
+ //! Mass of parent particle
+ const Double_t mParent_;
+
+ //! Mass of particle 1 squared
+ const Double_t m1Sq_;
+ //! Mass of particle 2 squared
+ const Double_t m2Sq_;
+ //! Mass of particle 3 squared
+ const Double_t m3Sq_;
+ //! Mass of parent particle squared
+ const Double_t mParentSq_;
+
+ //! Vector of daughter particles masses
+ std::vector<Double_t> mass_;
+ //! Vector of the minimum mij values
+ std::vector<Double_t> mMin_;
+ //! Vector of the maximum mij values
+ std::vector<Double_t> mMax_;
+ //! Vector of the difference between the mMax and mMin
+ std::vector<Double_t> mDiff_;
+
+ //! Vector of daughter particles masses squared
+ std::vector<Double_t> mSq_;
+ //! Vector of the minimum mijSq values
+ std::vector<Double_t> mSqMin_;
+ //! Vector of the maximum mijSq values
+ std::vector<Double_t> mSqMax_;
+ //! Vector of the difference between the mSqMax and mSqMin
+ std::vector<Double_t> mSqDiff_;
+
+ //! Sum of the daughter masses
+ const Double_t mDTot_;
+ //! Mass difference between the parent particle and the sum of the daughter particles
+ const Double_t massInt_;
+ //! Sum of the squares of the daughter masses
+ const Double_t mSqDTot_;
+
+ //! Invariant mass m12
+ Double_t m12_;
+ //! Invariant mass m23
+ Double_t m23_;
+ //! Invariant mass m13
+ Double_t m13_;
+
+ //! Invariant mass m12 squared
+ Double_t m12Sq_;
+ //! Invariant mass m23 squared
+ Double_t m23Sq_;
+ //! Invariant mass m13 squared
+ Double_t m13Sq_;
+
+ //! Cosine of the helicity angle theta12, which is defined as the angle between 1&3 in the rest frame of 1&2
+ Double_t c12_;
+ //! Cosine of the helicity angle theta23, which is defined as the angle between 1&2 in the rest frame of 2&3
+ Double_t c23_;
+ //! Cosine of the helicity angle theta13, which is defined as the angle between 1&2 in the rest frame of 1&3
+ Double_t c13_;
+
+ //! m' co-ordinate
+ Double_t mPrime_;
+ //! theta' co-ordinate
+ Double_t thetaPrime_;
+
+ //! Momentum q of particle i
+ mutable Double_t qi_;
+ //! Momentum q of particle k
+ mutable Double_t qk_;
+
+ //! Momentum of track 1 in 1-2 rest frame
+ Double_t p1_12_;
+ //! Momentum of track 3 in 1-2 rest frame
+ Double_t p3_12_;
+ //! Momentum of track 2 in 2-3 rest frame
+ Double_t p2_23_;
+ //! Momentum of track 1 in 2-3 rest frame
+ Double_t p1_23_;
+ //! Momentum of track 1 in 1-3 rest frame
+ Double_t p1_13_;
+ //! Momentum of track 2 in 1-3 rest frame
+ Double_t p2_13_;
+
+ //! Momentum of track 1 in parent rest frame
+ Double_t p1_Parent_;
+ //! Momentum of track 2 in parent rest frame
+ Double_t p2_Parent_;
+ //! Momentum of track 3 in parent rest frame
+ Double_t p3_Parent_;
+
+ //! Should we calculate the square DP co-ordinates or not?
+ Bool_t squareDP_;
+ //! Enable/disable warning messages
+ Bool_t warnings_;
+
+ ClassDef( LauKinematics, 0 )
};
#endif
diff --git a/inc/LauLASSBWRes.hh b/inc/LauLASSBWRes.hh
index 6467ee8..df8bf7b 100644
--- a/inc/LauLASSBWRes.hh
+++ b/inc/LauLASSBWRes.hh
@@ -1,171 +1,173 @@
/*
Copyright 2008 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauLASSBWRes.hh
\brief File containing declaration of LauLASSBWRes class.
*/
/*! \class LauLASSBWRes
\brief Class for defining the resonant part of the LASS model.
Class for defining the LASS resonance model, which includes a resonant
part, plus an effective range term. This class is the resonant part only.
*/
#ifndef LAU_LASS_BW_RES
#define LAU_LASS_BW_RES
-#include "TString.h"
-
-#include "LauComplex.hh"
#include "LauAbsResonance.hh"
+#include "LauComplex.hh"
+#include "TString.h"
class LauLASSBWRes : public LauAbsResonance {
- public:
- //! Constructor
- /*!
- \param [in] resInfo the object containing information on the resonance name, mass, width, spin, charge, etc.
- \param [in] resPairAmpInt the number of the daughter not produced by the resonance
- \param [in] daughters the daughter particles
- */
- LauLASSBWRes(LauResonanceInfo* resInfo, const Int_t resPairAmpInt, const LauDaughters* daughters);
-
- // Destructor
- virtual ~LauLASSBWRes();
-
- //! Initialise the model
- virtual void initialise();
-
- //! Get the resonance model type
- /*!
- \return the resonance model type
- */
- virtual LauAbsResonance::LauResonanceModel getResonanceModel() const {return LauAbsResonance::LASS_BW;}
-
- //! Set value of a resonance parameter
- /*!
- \param [in] name the name of the parameter to be changed
- \param [in] value the new parameter value
- */
- virtual void setResonanceParameter(const TString& name, const Double_t value);
-
- //! Allow the various parameters to float in the fit
- /*!
- \param [in] name the name of the parameter to be floated
- */
- virtual void floatResonanceParameter(const TString& name);
-
- //! Access the given resonance parameter
- /*!
- \param [in] name the name of the parameter
- \return the corresponding parameter
- */
- virtual LauParameter* getResonanceParameter(const TString& name);
-
- //! Retrieve the resonance parameters, e.g. so that they can be loaded into a fit
- /*!
- \return floating parameters of the resonance
- */
- virtual const std::vector<LauParameter*>& getFloatingParameters();
-
- protected:
- //! Set the effective range parameter value
- /*!
- \param [in] r the new effective range parameter value
- */
- void setEffectiveRange(const Double_t r);
-
- //! Set the scattering length parameter value
- /*!
- \param [in] a the new scattering length parameter value
- */
- void setScatteringLength(const Double_t a);
-
- //! Get the effective range parameter
- /*!
- \return the effective range parameter
- */
- Double_t getEffectiveRange() const {return (r_!=0) ? r_->unblindValue() : 0.0;}
-
- //! Get the scattering length range parameter
- /*!
- \return the scattering length parameter
- */
- Double_t getScatteringLength() const {return (a_!=0) ? a_->unblindValue() : 0.0;}
-
- //! See if the effective range parameter is fixed or floating
- /*!
- \return kTRUE if the effective range parameter is fixed, kFALSE otherwise
- */
- Bool_t fixEffectiveRange() const {return (r_!=0) ? r_->fixed() : kTRUE;}
-
- //! See if the scattering length parameter is fixed or floating
- /*!
- \return kTRUE if the scattering length parameter is fixed, kFALSE otherwise
- */
- Bool_t fixScatteringLength() const {return (a_!=0) ? a_->fixed() : kTRUE;}
-
- //! Utility function to calculate the q0 value
- void calcQ0();
-
- //! Complex resonant amplitude
- /*!
- \param [in] mass appropriate invariant mass for the resonance
- \param [in] spinTerm spin term
- */
- virtual LauComplex resAmp(Double_t mass, Double_t spinTerm);
-
- private:
- //! Copy constructor (not implemented)
- LauLASSBWRes(const LauLASSBWRes& rhs);
-
- //! Copy assignment operator (not implemented)
- LauLASSBWRes& operator=(const LauLASSBWRes& rhs);
-
- //! Decay momentum of either daughter in the resonance rest frame
- Double_t q0_;
- //! Sum of the daughter masses
- Double_t mDaugSum_;
- //! Square of mDaugSum
- Double_t mDaugSumSq_;
- //! Difference between the daughter masses
- Double_t mDaugDiff_;
- //! Square of mDaugDiff
- Double_t mDaugDiffSq_;
- //! The resonance mass
- Double_t resMass_;
- //! Square of the resonance mass
- Double_t resMassSq_;
-
- //! LASS effective range parameter
- LauParameter* r_;
- //! LASS scattering length parameter
- LauParameter* a_;
-
- ClassDef(LauLASSBWRes,0)
+ public:
+ //! Constructor
+ /*!
+ \param [in] resInfo the object containing information on the resonance name, mass, width, spin, charge, etc.
+ \param [in] resPairAmpInt the number of the daughter not produced by the resonance
+ \param [in] daughters the daughter particles
+ */
+ LauLASSBWRes( LauResonanceInfo* resInfo, const Int_t resPairAmpInt, const LauDaughters* daughters );
+
+ // Destructor
+ virtual ~LauLASSBWRes();
+
+ //! Initialise the model
+ virtual void initialise();
+
+ //! Get the resonance model type
+ /*!
+ \return the resonance model type
+ */
+ virtual LauAbsResonance::LauResonanceModel getResonanceModel() const
+ {
+ return LauAbsResonance::LASS_BW;
+ }
+
+ //! Set value of a resonance parameter
+ /*!
+ \param [in] name the name of the parameter to be changed
+ \param [in] value the new parameter value
+ */
+ virtual void setResonanceParameter( const TString& name, const Double_t value );
+
+ //! Allow the various parameters to float in the fit
+ /*!
+ \param [in] name the name of the parameter to be floated
+ */
+ virtual void floatResonanceParameter( const TString& name );
+
+ //! Access the given resonance parameter
+ /*!
+ \param [in] name the name of the parameter
+ \return the corresponding parameter
+ */
+ virtual LauParameter* getResonanceParameter( const TString& name );
+
+ //! Retrieve the resonance parameters, e.g. so that they can be loaded into a fit
+ /*!
+ \return floating parameters of the resonance
+ */
+ virtual const std::vector<LauParameter*>& getFloatingParameters();
+
+ protected:
+ //! Set the effective range parameter value
+ /*!
+ \param [in] r the new effective range parameter value
+ */
+ void setEffectiveRange( const Double_t r );
+
+ //! Set the scattering length parameter value
+ /*!
+ \param [in] a the new scattering length parameter value
+ */
+ void setScatteringLength( const Double_t a );
+
+ //! Get the effective range parameter
+ /*!
+ \return the effective range parameter
+ */
+ Double_t getEffectiveRange() const { return ( r_ != 0 ) ? r_->unblindValue() : 0.0; }
+
+ //! Get the scattering length range parameter
+ /*!
+ \return the scattering length parameter
+ */
+ Double_t getScatteringLength() const { return ( a_ != 0 ) ? a_->unblindValue() : 0.0; }
+
+ //! See if the effective range parameter is fixed or floating
+ /*!
+ \return kTRUE if the effective range parameter is fixed, kFALSE otherwise
+ */
+ Bool_t fixEffectiveRange() const { return ( r_ != 0 ) ? r_->fixed() : kTRUE; }
+
+ //! See if the scattering length parameter is fixed or floating
+ /*!
+ \return kTRUE if the scattering length parameter is fixed, kFALSE otherwise
+ */
+ Bool_t fixScatteringLength() const { return ( a_ != 0 ) ? a_->fixed() : kTRUE; }
+
+ //! Utility function to calculate the q0 value
+ void calcQ0();
+
+ //! Complex resonant amplitude
+ /*!
+ \param [in] mass appropriate invariant mass for the resonance
+ \param [in] spinTerm spin term
+ */
+ virtual LauComplex resAmp( Double_t mass, Double_t spinTerm );
+
+ private:
+ //! Copy constructor (not implemented)
+ LauLASSBWRes( const LauLASSBWRes& rhs );
+
+ //! Copy assignment operator (not implemented)
+ LauLASSBWRes& operator=( const LauLASSBWRes& rhs );
+
+ //! Decay momentum of either daughter in the resonance rest frame
+ Double_t q0_;
+ //! Sum of the daughter masses
+ Double_t mDaugSum_;
+ //! Square of mDaugSum
+ Double_t mDaugSumSq_;
+ //! Difference between the daughter masses
+ Double_t mDaugDiff_;
+ //! Square of mDaugDiff
+ Double_t mDaugDiffSq_;
+ //! The resonance mass
+ Double_t resMass_;
+ //! Square of the resonance mass
+ Double_t resMassSq_;
+
+ //! LASS effective range parameter
+ LauParameter* r_;
+ //! LASS scattering length parameter
+ LauParameter* a_;
+
+ ClassDef( LauLASSBWRes, 0 )
};
#endif
diff --git a/inc/LauLASSNRRes.hh b/inc/LauLASSNRRes.hh
index bd1a7c7..f0fe30c 100644
--- a/inc/LauLASSNRRes.hh
+++ b/inc/LauLASSNRRes.hh
@@ -1,168 +1,170 @@
/*
Copyright 2008 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauLASSNRRes.hh
\brief File containing declaration of LauLASSNRRes class.
*/
/*! \class LauLASSNRRes
\brief Class for defining the non resonant part of the LASS model
Class for defining the LASS resonance model, which includes a resonant
part, plus an effective range term. This class is the nonresonant part only.
*/
#ifndef LAU_LASS_NR_RES
#define LAU_LASS_NR_RES
-#include "TString.h"
-
-#include "LauComplex.hh"
#include "LauAbsResonance.hh"
+#include "LauComplex.hh"
+#include "TString.h"
class LauLASSNRRes : public LauAbsResonance {
- public:
- //! Constructor
- /*!
- \param [in] resInfo the object containing information on the resonance name, mass, width, spin, charge, etc.
- \param [in] resPairAmpInt the number of the daughter not produced by the resonance
- \param [in] daughters the daughter particles
- */
- LauLASSNRRes(LauResonanceInfo* resInfo, const Int_t resPairAmpInt, const LauDaughters* daughters);
-
- //! Destructor
- virtual ~LauLASSNRRes();
-
- //! Initialise the model
- virtual void initialise();
-
- //! Get the resonance model type
- /*!
- \return the resonance model type
- */
- virtual LauAbsResonance::LauResonanceModel getResonanceModel() const {return LauAbsResonance::LASS_NR;}
-
- //! Get the cut off parameter
- /*!
- \return the cut off parameter
- */
- Double_t getCutOff() const {return cutOff_;}
-
- //! Set the cut off parameter
- /*!
- \param [in] cutOff the cut off parameter
- */
- void setCutOff(const Double_t cutOff) {cutOff_ = cutOff;}
-
- //! Set value of a resonance parameter
- /*!
- \param [in] name the name of the parameter to be changed
- \param [in] value the new parameter value
- */
- virtual void setResonanceParameter(const TString& name, const Double_t value);
-
- //! Allow the various parameters to float in the fit
- /*!
- \param [in] name the name of the parameter to be floated
- */
- virtual void floatResonanceParameter(const TString& name);
-
- //! Access the given resonance parameter
- /*!
- \param [in] name the name of the parameter
- \return the corresponding parameter
- */
- virtual LauParameter* getResonanceParameter(const TString& name);
-
- //! Retrieve the resonance parameters, e.g. so that they can be loaded into a fit
- /*!
- \return floating parameters of the resonance
- */
- virtual const std::vector<LauParameter*>& getFloatingParameters();
-
- protected:
- //! Set the effective range parameter value
- /*!
- \param [in] r the new effective range parameter value
- */
- void setEffectiveRange(const Double_t r);
-
- //! Set the scattering length parameter value
- /*!
- \param [in] a the new scattering length parameter value
- */
- void setScatteringLength(const Double_t a);
-
- //! Get the effective range parameter
- /*!
- \return the effective range parameter
- */
- Double_t getEffectiveRange() const {return (r_!=0) ? r_->unblindValue() : 0.0;}
-
- //! Get the scattering length range parameter
- /*!
- \return the scattering length parameter
- */
- Double_t getScatteringLength() const {return (a_!=0) ? a_->unblindValue() : 0.0;}
-
- //! See if the effective range parameter is fixed or floating
- /*!
- \return kTRUE if the effective range parameter is fixed, kFALSE otherwise
- */
- Bool_t fixEffectiveRange() const {return (r_!=0) ? r_->fixed() : kTRUE;}
-
- //! See if the scattering length parameter is fixed or floating
- /*!
- \return kTRUE if the scattering length parameter is fixed, kFALSE otherwise
- */
- Bool_t fixScatteringLength() const {return (a_!=0) ? a_->fixed() : kTRUE;}
-
- //! Complex resonant amplitude
- /*!
- \param [in] mass appropriate invariant mass for the resonance
- \param [in] spinTerm spin term
- */
- virtual LauComplex resAmp(Double_t mass, Double_t spinTerm);
-
- private:
- //! Copy constructor (not implemented)
- LauLASSNRRes(const LauLASSNRRes& rhs);
-
- //! Copy assignment operator (not implemented)
- LauLASSNRRes& operator=(const LauLASSNRRes& rhs);
-
- //! LASS effective range parameter
- LauParameter* r_;
- //! LASS scattering length parameter
- LauParameter* a_;
-
- //! LASS cut off
- Double_t cutOff_;
-
- ClassDef(LauLASSNRRes,0)
+ public:
+ //! Constructor
+ /*!
+ \param [in] resInfo the object containing information on the resonance name, mass, width, spin, charge, etc.
+ \param [in] resPairAmpInt the number of the daughter not produced by the resonance
+ \param [in] daughters the daughter particles
+ */
+ LauLASSNRRes( LauResonanceInfo* resInfo, const Int_t resPairAmpInt, const LauDaughters* daughters );
+
+ //! Destructor
+ virtual ~LauLASSNRRes();
+
+ //! Initialise the model
+ virtual void initialise();
+
+ //! Get the resonance model type
+ /*!
+ \return the resonance model type
+ */
+ virtual LauAbsResonance::LauResonanceModel getResonanceModel() const
+ {
+ return LauAbsResonance::LASS_NR;
+ }
+
+ //! Get the cut off parameter
+ /*!
+ \return the cut off parameter
+ */
+ Double_t getCutOff() const { return cutOff_; }
+
+ //! Set the cut off parameter
+ /*!
+ \param [in] cutOff the cut off parameter
+ */
+ void setCutOff( const Double_t cutOff ) { cutOff_ = cutOff; }
+
+ //! Set value of a resonance parameter
+ /*!
+ \param [in] name the name of the parameter to be changed
+ \param [in] value the new parameter value
+ */
+ virtual void setResonanceParameter( const TString& name, const Double_t value );
+
+ //! Allow the various parameters to float in the fit
+ /*!
+ \param [in] name the name of the parameter to be floated
+ */
+ virtual void floatResonanceParameter( const TString& name );
+
+ //! Access the given resonance parameter
+ /*!
+ \param [in] name the name of the parameter
+ \return the corresponding parameter
+ */
+ virtual LauParameter* getResonanceParameter( const TString& name );
+
+ //! Retrieve the resonance parameters, e.g. so that they can be loaded into a fit
+ /*!
+ \return floating parameters of the resonance
+ */
+ virtual const std::vector<LauParameter*>& getFloatingParameters();
+
+ protected:
+ //! Set the effective range parameter value
+ /*!
+ \param [in] r the new effective range parameter value
+ */
+ void setEffectiveRange( const Double_t r );
+
+ //! Set the scattering length parameter value
+ /*!
+ \param [in] a the new scattering length parameter value
+ */
+ void setScatteringLength( const Double_t a );
+
+ //! Get the effective range parameter
+ /*!
+ \return the effective range parameter
+ */
+ Double_t getEffectiveRange() const { return ( r_ != 0 ) ? r_->unblindValue() : 0.0; }
+
+ //! Get the scattering length range parameter
+ /*!
+ \return the scattering length parameter
+ */
+ Double_t getScatteringLength() const { return ( a_ != 0 ) ? a_->unblindValue() : 0.0; }
+
+ //! See if the effective range parameter is fixed or floating
+ /*!
+ \return kTRUE if the effective range parameter is fixed, kFALSE otherwise
+ */
+ Bool_t fixEffectiveRange() const { return ( r_ != 0 ) ? r_->fixed() : kTRUE; }
+
+ //! See if the scattering length parameter is fixed or floating
+ /*!
+ \return kTRUE if the scattering length parameter is fixed, kFALSE otherwise
+ */
+ Bool_t fixScatteringLength() const { return ( a_ != 0 ) ? a_->fixed() : kTRUE; }
+
+ //! Complex resonant amplitude
+ /*!
+ \param [in] mass appropriate invariant mass for the resonance
+ \param [in] spinTerm spin term
+ */
+ virtual LauComplex resAmp( Double_t mass, Double_t spinTerm );
+
+ private:
+ //! Copy constructor (not implemented)
+ LauLASSNRRes( const LauLASSNRRes& rhs );
+
+ //! Copy assignment operator (not implemented)
+ LauLASSNRRes& operator=( const LauLASSNRRes& rhs );
+
+ //! LASS effective range parameter
+ LauParameter* r_;
+ //! LASS scattering length parameter
+ LauParameter* a_;
+
+ //! LASS cut off
+ Double_t cutOff_;
+
+ ClassDef( LauLASSNRRes, 0 )
};
#endif
diff --git a/inc/LauLASSRes.hh b/inc/LauLASSRes.hh
index 3214b94..f6576b0 100644
--- a/inc/LauLASSRes.hh
+++ b/inc/LauLASSRes.hh
@@ -1,186 +1,188 @@
/*
Copyright 2004 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauLASSRes.hh
\brief File containing declaration of LauLASSRes class.
*/
/*! \class LauLASSRes
\brief Class for defining the LASS resonance model.
Class for defining the LASS resonance model, which includes a resonant
part, plus an effective range term. This class is the coherent sum of the two.
*/
#ifndef LAU_LASS_RES
#define LAU_LASS_RES
-#include "TString.h"
-
-#include "LauComplex.hh"
#include "LauAbsResonance.hh"
+#include "LauComplex.hh"
+#include "TString.h"
class LauLASSRes : public LauAbsResonance {
- public:
- //! Constructor
- /*!
- \param [in] resInfo the object containing information on the resonance name, mass, width, spin, charge, etc.
- \param [in] resPairAmpInt the number of the daughter not produced by the resonance
- \param [in] daughters the daughter particles
- */
- LauLASSRes(LauResonanceInfo* resInfo, const Int_t resPairAmpInt, const LauDaughters* daughters);
-
- //! Destructor
- virtual ~LauLASSRes();
-
- //! Initialise the model
- virtual void initialise();
-
- //! Get the resonance model type
- /*!
- \return the resonance model type
- */
- virtual LauAbsResonance::LauResonanceModel getResonanceModel() const {return LauAbsResonance::LASS;}
-
- //! Get the cut off parameter
- /*!
- \return the cut off parameter
- */
- Double_t getCutOff() const {return cutOff_;}
-
- //! Set the cut off parameter
- /*!
- \param [in] cutOff the cut off parameter
- */
- void setCutOff(const Double_t cutOff) {cutOff_ = cutOff;}
-
- //! Set value of a resonance parameter
- /*!
- \param [in] name the name of the parameter to be changed
- \param [in] value the new parameter value
- */
- virtual void setResonanceParameter(const TString& name, const Double_t value);
-
- //! Allow the various parameters to float in the fit
- /*!
- \param [in] name the name of the parameter to be floated
- */
- virtual void floatResonanceParameter(const TString& name);
-
- //! Access the given resonance parameter
- /*!
- \param [in] name the name of the parameter
- \return the corresponding parameter
- */
- virtual LauParameter* getResonanceParameter(const TString& name);
-
- //! Retrieve the resonance parameters, e.g. so that they can be loaded into a fit
- /*!
- \return floating parameters of the resonance
- */
- virtual const std::vector<LauParameter*>& getFloatingParameters();
-
- protected:
- //! Set the effective range parameter value
- /*!
- \param [in] r the new effective range parameter value
- */
- void setEffectiveRange(const Double_t r);
-
- //! Set the scattering length parameter value
- /*!
- \param [in] a the new scattering length parameter value
- */
- void setScatteringLength(const Double_t a);
-
- //! Get the effective range parameter
- /*!
- \return the effective range parameter
- */
- Double_t getEffectiveRange() const {return (r_!=0) ? r_->unblindValue() : 0.0;}
-
- //! Get the scattering length range parameter
- /*!
- \return the scattering length parameter
- */
- Double_t getScatteringLength() const {return (a_!=0) ? a_->unblindValue() : 0.0;}
-
- //! See if the effective range parameter is fixed or floating
- /*!
- \return kTRUE if the effective range parameter is fixed, kFALSE otherwise
- */
- Bool_t fixEffectiveRange() const {return (r_!=0) ? r_->fixed() : kTRUE;}
-
- //! See if the scattering length parameter is fixed or floating
- /*!
- \return kTRUE if the scattering length parameter is fixed, kFALSE otherwise
- */
- Bool_t fixScatteringLength() const {return (a_!=0) ? a_->fixed() : kTRUE;}
-
- //! Utility function to calculate the q0 value
- void calcQ0();
-
- //! Complex resonant amplitude
- /*!
- \param [in] mass appropriate invariant mass for the resonance
- \param [in] spinTerm spin term
- */
- virtual LauComplex resAmp(Double_t mass, Double_t spinTerm);
-
- private:
- //! Copy constructor (not implemented)
- LauLASSRes(const LauLASSRes& rhs);
-
- //! Copy assignment operator (not implemented)
- LauLASSRes& operator=(const LauLASSRes& rhs);
-
- //! Decay momentum of either daughter in the resonance rest frame
- Double_t q0_;
- //! Sum of the daughter masses
- Double_t mDaugSum_;
- //! Square of mDaugSum
- Double_t mDaugSumSq_;
- //! Difference between the daughter masses
- Double_t mDaugDiff_;
- //! Square of mDaugDiff
- Double_t mDaugDiffSq_;
- //! The resonance mass
- Double_t resMass_;
- //! Square of the resonance mass
- Double_t resMassSq_;
-
- //! LASS effective range parameter
- LauParameter* r_;
- //! LASS scattering length parameter
- LauParameter* a_;
-
- //! LASS cut off
- Double_t cutOff_;
-
- ClassDef(LauLASSRes,0)
+ public:
+ //! Constructor
+ /*!
+ \param [in] resInfo the object containing information on the resonance name, mass, width, spin, charge, etc.
+ \param [in] resPairAmpInt the number of the daughter not produced by the resonance
+ \param [in] daughters the daughter particles
+ */
+ LauLASSRes( LauResonanceInfo* resInfo, const Int_t resPairAmpInt, const LauDaughters* daughters );
+
+ //! Destructor
+ virtual ~LauLASSRes();
+
+ //! Initialise the model
+ virtual void initialise();
+
+ //! Get the resonance model type
+ /*!
+ \return the resonance model type
+ */
+ virtual LauAbsResonance::LauResonanceModel getResonanceModel() const
+ {
+ return LauAbsResonance::LASS;
+ }
+
+ //! Get the cut off parameter
+ /*!
+ \return the cut off parameter
+ */
+ Double_t getCutOff() const { return cutOff_; }
+
+ //! Set the cut off parameter
+ /*!
+ \param [in] cutOff the cut off parameter
+ */
+ void setCutOff( const Double_t cutOff ) { cutOff_ = cutOff; }
+
+ //! Set value of a resonance parameter
+ /*!
+ \param [in] name the name of the parameter to be changed
+ \param [in] value the new parameter value
+ */
+ virtual void setResonanceParameter( const TString& name, const Double_t value );
+
+ //! Allow the various parameters to float in the fit
+ /*!
+ \param [in] name the name of the parameter to be floated
+ */
+ virtual void floatResonanceParameter( const TString& name );
+
+ //! Access the given resonance parameter
+ /*!
+ \param [in] name the name of the parameter
+ \return the corresponding parameter
+ */
+ virtual LauParameter* getResonanceParameter( const TString& name );
+
+ //! Retrieve the resonance parameters, e.g. so that they can be loaded into a fit
+ /*!
+ \return floating parameters of the resonance
+ */
+ virtual const std::vector<LauParameter*>& getFloatingParameters();
+
+ protected:
+ //! Set the effective range parameter value
+ /*!
+ \param [in] r the new effective range parameter value
+ */
+ void setEffectiveRange( const Double_t r );
+
+ //! Set the scattering length parameter value
+ /*!
+ \param [in] a the new scattering length parameter value
+ */
+ void setScatteringLength( const Double_t a );
+
+ //! Get the effective range parameter
+ /*!
+ \return the effective range parameter
+ */
+ Double_t getEffectiveRange() const { return ( r_ != 0 ) ? r_->unblindValue() : 0.0; }
+
+ //! Get the scattering length range parameter
+ /*!
+ \return the scattering length parameter
+ */
+ Double_t getScatteringLength() const { return ( a_ != 0 ) ? a_->unblindValue() : 0.0; }
+
+ //! See if the effective range parameter is fixed or floating
+ /*!
+ \return kTRUE if the effective range parameter is fixed, kFALSE otherwise
+ */
+ Bool_t fixEffectiveRange() const { return ( r_ != 0 ) ? r_->fixed() : kTRUE; }
+
+ //! See if the scattering length parameter is fixed or floating
+ /*!
+ \return kTRUE if the scattering length parameter is fixed, kFALSE otherwise
+ */
+ Bool_t fixScatteringLength() const { return ( a_ != 0 ) ? a_->fixed() : kTRUE; }
+
+ //! Utility function to calculate the q0 value
+ void calcQ0();
+
+ //! Complex resonant amplitude
+ /*!
+ \param [in] mass appropriate invariant mass for the resonance
+ \param [in] spinTerm spin term
+ */
+ virtual LauComplex resAmp( Double_t mass, Double_t spinTerm );
+
+ private:
+ //! Copy constructor (not implemented)
+ LauLASSRes( const LauLASSRes& rhs );
+
+ //! Copy assignment operator (not implemented)
+ LauLASSRes& operator=( const LauLASSRes& rhs );
+
+ //! Decay momentum of either daughter in the resonance rest frame
+ Double_t q0_;
+ //! Sum of the daughter masses
+ Double_t mDaugSum_;
+ //! Square of mDaugSum
+ Double_t mDaugSumSq_;
+ //! Difference between the daughter masses
+ Double_t mDaugDiff_;
+ //! Square of mDaugDiff
+ Double_t mDaugDiffSq_;
+ //! The resonance mass
+ Double_t resMass_;
+ //! Square of the resonance mass
+ Double_t resMassSq_;
+
+ //! LASS effective range parameter
+ LauParameter* r_;
+ //! LASS scattering length parameter
+ LauParameter* a_;
+
+ //! LASS cut off
+ Double_t cutOff_;
+
+ ClassDef( LauLASSRes, 0 )
};
#endif
diff --git a/inc/LauLinearPdf.hh b/inc/LauLinearPdf.hh
index 5f3a1e6..53db05e 100644
--- a/inc/LauLinearPdf.hh
+++ b/inc/LauLinearPdf.hh
@@ -1,95 +1,97 @@
/*
Copyright 2006 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauLinearPdf.hh
\brief File containing declaration of LauLinearPdf class.
*/
/*! \class LauLinearPdf
\brief Class for defining a straight line PDF.
Class that allows the user to define a straight line PDF.
*/
#ifndef LAU_LINEAR_PDF
#define LAU_LINEAR_PDF
-#include <vector>
+#include "LauAbsPdf.hh"
#include "TString.h"
-#include "LauAbsPdf.hh"
+#include <vector>
class LauLinearPdf : public LauAbsPdf {
- public:
- //! Constructor
- /*!
- \param [in] theVarName the name of the abscissa variable
- \param [in] params the PDF parameter - slope
- \param [in] minAbscissa the minimum value of the abscissa
- \param [in] maxAbscissa the maximum value of the abscissa
- */
- LauLinearPdf(const TString& theVarName, const std::vector<LauAbsRValue*>& params, Double_t minAbscissa, Double_t maxAbscissa);
-
- //! Destructor
- virtual ~LauLinearPdf();
-
- //! Calculate the likelihood (and intermediate info) for a given abscissa
- /*!
- \param [in] abscissas the values of the abscissa(s)
- */
- virtual void calcLikelihoodInfo(const LauAbscissas& abscissas);
-
- using LauAbsPdf::calcLikelihoodInfo;
-
- //! Calculate the normalisation
- virtual void calcNorm();
-
- //! Calculate the PDF height
- /*!
- \param [in] kinematics the current DP kinematics
- */
- virtual void calcPDFHeight( const LauKinematics* kinematics );
-
-
- protected:
-
- private:
- //! Copy constructor (not implemented)
- LauLinearPdf(const LauLinearPdf& rhs);
-
- //! Copy assignment operator (not implemented)
- LauLinearPdf& operator=(const LauLinearPdf& rhs);
-
- //! Line slope
- LauAbsRValue* slope_;
-
- //! Flag to control printing of warnings about the PDF going negative
- Bool_t posflag_;
-
- ClassDef(LauLinearPdf,0) // Define the Linear PDF
+ public:
+ //! Constructor
+ /*!
+ \param [in] theVarName the name of the abscissa variable
+ \param [in] params the PDF parameter - slope
+ \param [in] minAbscissa the minimum value of the abscissa
+ \param [in] maxAbscissa the maximum value of the abscissa
+ */
+ LauLinearPdf( const TString& theVarName,
+ const std::vector<LauAbsRValue*>& params,
+ Double_t minAbscissa,
+ Double_t maxAbscissa );
+
+ //! Destructor
+ virtual ~LauLinearPdf();
+
+ //! Calculate the likelihood (and intermediate info) for a given abscissa
+ /*!
+ \param [in] abscissas the values of the abscissa(s)
+ */
+ virtual void calcLikelihoodInfo( const LauAbscissas& abscissas );
+
+ using LauAbsPdf::calcLikelihoodInfo;
+
+ //! Calculate the normalisation
+ virtual void calcNorm();
+
+ //! Calculate the PDF height
+ /*!
+ \param [in] kinematics the current DP kinematics
+ */
+ virtual void calcPDFHeight( const LauKinematics* kinematics );
+
+ protected:
+
+ private:
+ //! Copy constructor (not implemented)
+ LauLinearPdf( const LauLinearPdf& rhs );
+
+ //! Copy assignment operator (not implemented)
+ LauLinearPdf& operator=( const LauLinearPdf& rhs );
+
+ //! Line slope
+ LauAbsRValue* slope_;
+
+ //! Flag to control printing of warnings about the PDF going negative
+ Bool_t posflag_;
+
+ ClassDef( LauLinearPdf, 0 ) // Define the Linear PDF
};
#endif
diff --git a/inc/LauMagPhaseCPCoeffSet.hh b/inc/LauMagPhaseCPCoeffSet.hh
index 9c0739f..3a39895 100644
--- a/inc/LauMagPhaseCPCoeffSet.hh
+++ b/inc/LauMagPhaseCPCoeffSet.hh
@@ -1,174 +1,185 @@
/*
Copyright 2011 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauMagPhaseCPCoeffSet.hh
\brief File containing declaration of LauMagPhaseCPCoeffSet class.
*/
/*! \class LauMagPhaseCPCoeffSet
\brief Class for defining a complex coefficient using seperate magnitudes and phases for particles and antiparticles.
Holds a set of real values that define the complex coefficient of an amplitude component.
The amplitudes have the form:
c = mag * exp(i*phase)
cBar = magBar * exp(i*phaseBar)
where mag and magBar are the magnitudes for particle and antiparticle and
phase and phaseBar are the phases for particle and antiparticle.
*/
#ifndef LAU_MAGPHASECP_COEFF_SET
#define LAU_MAGPHASECP_COEFF_SET
-#include <iosfwd>
-#include <vector>
-
-#include "Rtypes.h"
-
#include "LauAbsCoeffSet.hh"
#include "LauComplex.hh"
#include "LauParameter.hh"
+#include "Rtypes.h"
+
+#include <iosfwd>
+#include <vector>
class LauMagPhaseCPCoeffSet : public LauAbsCoeffSet {
- public:
- //! Constructor
- /*!
- \param [in] compName the name of the coefficient set
- \param [in] mag the magnitude for particles
- \param [in] phase the phase for particles
- \param [in] magBar the magnitude for antiparticles
- \param [in] phaseBar the phase for antiparticles
- \param [in] magFixed whether mag is fixed
- \param [in] phaseFixed whether phase is fixed
- \param [in] magBarFixed whether magBar is fixed
- \param [in] phaseBarFixed whether phaseBar is fixed
- */
- LauMagPhaseCPCoeffSet(const TString& compName, Double_t mag, Double_t phase, Double_t magBar, Double_t phaseBar,
- Bool_t magFixed, Bool_t phaseFixed, Bool_t magBarFixed, Bool_t phaseBarFixed);
-
- //! Destructor
- virtual ~LauMagPhaseCPCoeffSet(){}
-
- //! Retrieve the parameters of the coefficient, e.g. so that they can be loaded into a fit
- /*!
- \return the parameters of the coefficient
- */
- virtual std::vector<LauParameter*> getParameters();
-
- //! Print the current values of the parameters
- virtual void printParValues() const;
-
- //! Print the column headings for a results table
- /*!
- \param [out] stream the stream to print to
- */
- virtual void printTableHeading(std::ostream& stream) const;
-
- //! Print the parameters of the complex coefficient as a row in the results table
- /*!
- \param [out] stream the stream to print to
- */
- virtual void printTableRow(std::ostream& stream) const;
-
- //! Randomise the starting values of the parameters for a fit
- virtual void randomiseInitValues();
-
- //! Make sure values are in "standard" ranges, e.g. phases should be between -pi and pi
- virtual void finaliseValues();
-
- //! Retrieve the complex coefficient for a particle
- /*!
- \return the complex coefficient for a particle
- */
- virtual const LauComplex& particleCoeff();
-
- //! Retrieve the complex coefficient for an antiparticle
- /*!
- \return the complex coefficient for an antiparticle
- */
- virtual const LauComplex& antiparticleCoeff();
-
- //! Set the parameters based on the complex coefficients for particles and antiparticles
- /*!
- \param [in] coeff the complex coefficient for a particle
- \param [in] coeffBar the complex coefficient for an antiparticle
- \param [in] init whether or not the initial and generated values should also be adjusted
- */
- virtual void setCoeffValues( const LauComplex& coeff, const LauComplex& coeffBar, Bool_t init );
-
- //! Calculate the CP asymmetry
- /*!
- \return the CP asymmetry
- */
- virtual LauParameter acp();
-
- //! Create a clone of the coefficient set
- /*!
- \param [in] newName the clone's name
- \param [in] cloneOption special option for the cloning operation
- \param [in] constFactor a constant factor to multiply the clone's parameters by
- \return a clone of the coefficient set
- */
- virtual LauAbsCoeffSet* createClone(const TString& newName, CloneOption cloneOption = All, Double_t constFactor = 1.0);
-
- private:
- //! Copy constructor
- /*!
- This creates cloned parameters, not copies.
- \param [in] rhs the coefficient to clone
- \param [in] cloneOption special option for the cloning operation
- \param [in] constFactor a constant factor to multiply the clone's parameters by
- */
- LauMagPhaseCPCoeffSet(const LauMagPhaseCPCoeffSet& rhs, CloneOption cloneOption = All, Double_t constFactor = 1.0);
-
- //! Copy assignment operator (not implemented)
- /*!
- \param [in] rhs the coefficient to clone
- */
- LauMagPhaseCPCoeffSet& operator=(const LauMagPhaseCPCoeffSet& rhs);
-
- // the actual fit parameters
- // (need to be pointers so they can be cloned)
- //! The magnitude for particles
- LauParameter* mag_;
- //! The phase for particles
- LauParameter* phase_;
- //! The magnitude for antiparticles
- LauParameter* magBar_;
- //! The phase for antiparticles
- LauParameter* phaseBar_;
-
- //! The particle complex coefficient
- LauComplex particleCoeff_;
- //! The antiparticle complex coefficient
- LauComplex antiparticleCoeff_;
-
- //! The CP asymmetry
- LauParameter acp_;
-
- ClassDef(LauMagPhaseCPCoeffSet, 0)
+ public:
+ //! Constructor
+ /*!
+ \param [in] compName the name of the coefficient set
+ \param [in] mag the magnitude for particles
+ \param [in] phase the phase for particles
+ \param [in] magBar the magnitude for antiparticles
+ \param [in] phaseBar the phase for antiparticles
+ \param [in] magFixed whether mag is fixed
+ \param [in] phaseFixed whether phase is fixed
+ \param [in] magBarFixed whether magBar is fixed
+ \param [in] phaseBarFixed whether phaseBar is fixed
+ */
+ LauMagPhaseCPCoeffSet( const TString& compName,
+ Double_t mag,
+ Double_t phase,
+ Double_t magBar,
+ Double_t phaseBar,
+ Bool_t magFixed,
+ Bool_t phaseFixed,
+ Bool_t magBarFixed,
+ Bool_t phaseBarFixed );
+
+ //! Destructor
+ virtual ~LauMagPhaseCPCoeffSet() {}
+
+ //! Retrieve the parameters of the coefficient, e.g. so that they can be loaded into a fit
+ /*!
+ \return the parameters of the coefficient
+ */
+ virtual std::vector<LauParameter*> getParameters();
+
+ //! Print the current values of the parameters
+ virtual void printParValues() const;
+
+ //! Print the column headings for a results table
+ /*!
+ \param [out] stream the stream to print to
+ */
+ virtual void printTableHeading( std::ostream& stream ) const;
+
+ //! Print the parameters of the complex coefficient as a row in the results table
+ /*!
+ \param [out] stream the stream to print to
+ */
+ virtual void printTableRow( std::ostream& stream ) const;
+
+ //! Randomise the starting values of the parameters for a fit
+ virtual void randomiseInitValues();
+
+ //! Make sure values are in "standard" ranges, e.g. phases should be between -pi and pi
+ virtual void finaliseValues();
+
+ //! Retrieve the complex coefficient for a particle
+ /*!
+ \return the complex coefficient for a particle
+ */
+ virtual const LauComplex& particleCoeff();
+
+ //! Retrieve the complex coefficient for an antiparticle
+ /*!
+ \return the complex coefficient for an antiparticle
+ */
+ virtual const LauComplex& antiparticleCoeff();
+
+ //! Set the parameters based on the complex coefficients for particles and antiparticles
+ /*!
+ \param [in] coeff the complex coefficient for a particle
+ \param [in] coeffBar the complex coefficient for an antiparticle
+ \param [in] init whether or not the initial and generated values should also be adjusted
+ */
+ virtual void setCoeffValues( const LauComplex& coeff, const LauComplex& coeffBar, Bool_t init );
+
+ //! Calculate the CP asymmetry
+ /*!
+ \return the CP asymmetry
+ */
+ virtual LauParameter acp();
+
+ //! Create a clone of the coefficient set
+ /*!
+ \param [in] newName the clone's name
+ \param [in] cloneOption special option for the cloning operation
+ \param [in] constFactor a constant factor to multiply the clone's parameters by
+ \return a clone of the coefficient set
+ */
+ virtual LauAbsCoeffSet* createClone( const TString& newName,
+ CloneOption cloneOption = All,
+ Double_t constFactor = 1.0 );
+
+ private:
+ //! Copy constructor
+ /*!
+ This creates cloned parameters, not copies.
+
+ \param [in] rhs the coefficient to clone
+ \param [in] cloneOption special option for the cloning operation
+ \param [in] constFactor a constant factor to multiply the clone's parameters by
+ */
+ LauMagPhaseCPCoeffSet( const LauMagPhaseCPCoeffSet& rhs,
+ CloneOption cloneOption = All,
+ Double_t constFactor = 1.0 );
+
+ //! Copy assignment operator (not implemented)
+ /*!
+ \param [in] rhs the coefficient to clone
+ */
+ LauMagPhaseCPCoeffSet& operator=( const LauMagPhaseCPCoeffSet& rhs );
+
+ // the actual fit parameters
+ // (need to be pointers so they can be cloned)
+ //! The magnitude for particles
+ LauParameter* mag_;
+ //! The phase for particles
+ LauParameter* phase_;
+ //! The magnitude for antiparticles
+ LauParameter* magBar_;
+ //! The phase for antiparticles
+ LauParameter* phaseBar_;
+
+ //! The particle complex coefficient
+ LauComplex particleCoeff_;
+ //! The antiparticle complex coefficient
+ LauComplex antiparticleCoeff_;
+
+ //! The CP asymmetry
+ LauParameter acp_;
+
+ ClassDef( LauMagPhaseCPCoeffSet, 0 )
};
#endif
diff --git a/inc/LauMagPhaseCoeffSet.hh b/inc/LauMagPhaseCoeffSet.hh
index 391b08f..77a8de1 100644
--- a/inc/LauMagPhaseCoeffSet.hh
+++ b/inc/LauMagPhaseCoeffSet.hh
@@ -1,157 +1,166 @@
/*
Copyright 2006 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauMagPhaseCoeffSet.hh
\brief File containing declaration of LauMagPhaseCoeffSet class.
*/
/*! \class LauMagPhaseCoeffSet
\brief Class for defining a complex coefficient using a magnitude and a phase.
Holds a set of real values that define the complex coefficient of an amplitude component.
The amplitude has the form mag*exp(i*phase).
*/
#ifndef LAU_MAGPHASE_COEFF_SET
#define LAU_MAGPHASE_COEFF_SET
-#include <iosfwd>
-#include <vector>
-
-#include "Rtypes.h"
-
#include "LauAbsCoeffSet.hh"
#include "LauComplex.hh"
#include "LauParameter.hh"
+#include "Rtypes.h"
+
+#include <iosfwd>
+#include <vector>
class LauMagPhaseCoeffSet : public LauAbsCoeffSet {
- public:
- //! Constructor
- /*!
- \param [in] compName the name of the coefficient set
- \param [in] magnitude the magnitude
- \param [in] phase the phase
- \param [in] magFixed whether mag is fixed
- \param [in] phaseFixed whether phase is fixed
- */
- LauMagPhaseCoeffSet(const TString& compName, Double_t magnitude, Double_t phase, Bool_t magFixed, Bool_t phaseFixed);
-
- //! Destructor
- virtual ~LauMagPhaseCoeffSet(){}
-
- //! Retrieve the parameters of the coefficient, e.g. so that they can be loaded into a fit
- /*!
- \return the parameters of the coefficient
- */
- virtual std::vector<LauParameter*> getParameters();
-
- //! Print the current values of the parameters
- virtual void printParValues() const;
-
- //! Print the column headings for a results table
- /*!
- \param [out] stream the stream to print to
- */
- virtual void printTableHeading(std::ostream& stream) const;
-
- //! Print the parameters of the complex coefficient as a row in the results table
- /*!
- \param [out] stream the stream to print to
- */
- virtual void printTableRow(std::ostream& stream) const;
-
- //! Randomise the starting values of the parameters for a fit
- virtual void randomiseInitValues();
-
- //! Make sure values are in "standard" ranges, e.g. phases should be between -pi and pi
- virtual void finaliseValues();
-
- //! Retrieve the complex coefficient for a particle
- /*!
- \return the complex coefficient for a particle
- */
- virtual const LauComplex& particleCoeff();
-
- //! Retrieve the complex coefficient for an antiparticle
- /*!
- \return the complex coefficient for an antiparticle
- */
- virtual const LauComplex& antiparticleCoeff();
-
- //! Set the parameters based on the complex coefficients for particles and antiparticles
- /*!
- This class does not support CP violation so this method takes the average of the two inputs.
- \param [in] coeff the complex coefficient for a particle
- \param [in] coeffBar the complex coefficient for an antiparticle
- \param [in] init whether or not the initial and generated values should also be adjusted
- */
- virtual void setCoeffValues( const LauComplex& coeff, const LauComplex& coeffBar, Bool_t init );
-
- //! Calculate the CP asymmetry
- /*!
- \return the CP asymmetry (zero by design)
- */
- virtual LauParameter acp();
-
- //! Create a clone of the coefficient set
- /*!
- \param [in] newName the clone's name
- \param [in] cloneOption special option for the cloning operation
- \param [in] constFactor a constant factor to multiply the clone's parameters by
- \return a clone of the coefficient set
- */
- virtual LauAbsCoeffSet* createClone(const TString& newName, CloneOption cloneOption = All, Double_t constFactor = 1.0);
-
- private:
- //! Copy constructor
- /*!
- This creates cloned parameters, not copies.
- \param [in] rhs the coefficient to clone
- \param [in] cloneOption special option for the cloning operation
- \param [in] constFactor a constant factor to multiply the clone's parameters by
- */
- LauMagPhaseCoeffSet(const LauMagPhaseCoeffSet& rhs, CloneOption cloneOption = All, Double_t constFactor = 1.0);
-
- //! Copy assignment operator (not implemented)
- /*!
- \param [in] rhs the coefficient to clone
- */
- LauMagPhaseCoeffSet& operator=(const LauMagPhaseCoeffSet& rhs);
-
- // the actual fit parameters
- // (need to be pointers so they can be cloned)
- //! The magnitude
- LauParameter* magnitude_;
- //! The phase
- LauParameter* phase_;
-
- //! The complex coefficient
- LauComplex coeff_;
-
- ClassDef(LauMagPhaseCoeffSet, 0)
+ public:
+ //! Constructor
+ /*!
+ \param [in] compName the name of the coefficient set
+ \param [in] magnitude the magnitude
+ \param [in] phase the phase
+ \param [in] magFixed whether mag is fixed
+ \param [in] phaseFixed whether phase is fixed
+ */
+ LauMagPhaseCoeffSet( const TString& compName,
+ Double_t magnitude,
+ Double_t phase,
+ Bool_t magFixed,
+ Bool_t phaseFixed );
+
+ //! Destructor
+ virtual ~LauMagPhaseCoeffSet() {}
+
+ //! Retrieve the parameters of the coefficient, e.g. so that they can be loaded into a fit
+ /*!
+ \return the parameters of the coefficient
+ */
+ virtual std::vector<LauParameter*> getParameters();
+
+ //! Print the current values of the parameters
+ virtual void printParValues() const;
+
+ //! Print the column headings for a results table
+ /*!
+ \param [out] stream the stream to print to
+ */
+ virtual void printTableHeading( std::ostream& stream ) const;
+
+ //! Print the parameters of the complex coefficient as a row in the results table
+ /*!
+ \param [out] stream the stream to print to
+ */
+ virtual void printTableRow( std::ostream& stream ) const;
+
+ //! Randomise the starting values of the parameters for a fit
+ virtual void randomiseInitValues();
+
+ //! Make sure values are in "standard" ranges, e.g. phases should be between -pi and pi
+ virtual void finaliseValues();
+
+ //! Retrieve the complex coefficient for a particle
+ /*!
+ \return the complex coefficient for a particle
+ */
+ virtual const LauComplex& particleCoeff();
+
+ //! Retrieve the complex coefficient for an antiparticle
+ /*!
+ \return the complex coefficient for an antiparticle
+ */
+ virtual const LauComplex& antiparticleCoeff();
+
+ //! Set the parameters based on the complex coefficients for particles and antiparticles
+ /*!
+ This class does not support CP violation so this method takes the average of the two inputs.
+
+ \param [in] coeff the complex coefficient for a particle
+ \param [in] coeffBar the complex coefficient for an antiparticle
+ \param [in] init whether or not the initial and generated values should also be adjusted
+ */
+ virtual void setCoeffValues( const LauComplex& coeff, const LauComplex& coeffBar, Bool_t init );
+
+ //! Calculate the CP asymmetry
+ /*!
+ \return the CP asymmetry (zero by design)
+ */
+ virtual LauParameter acp();
+
+ //! Create a clone of the coefficient set
+ /*!
+ \param [in] newName the clone's name
+ \param [in] cloneOption special option for the cloning operation
+ \param [in] constFactor a constant factor to multiply the clone's parameters by
+ \return a clone of the coefficient set
+ */
+ virtual LauAbsCoeffSet* createClone( const TString& newName,
+ CloneOption cloneOption = All,
+ Double_t constFactor = 1.0 );
+
+ private:
+ //! Copy constructor
+ /*!
+ This creates cloned parameters, not copies.
+
+ \param [in] rhs the coefficient to clone
+ \param [in] cloneOption special option for the cloning operation
+ \param [in] constFactor a constant factor to multiply the clone's parameters by
+ */
+ LauMagPhaseCoeffSet( const LauMagPhaseCoeffSet& rhs,
+ CloneOption cloneOption = All,
+ Double_t constFactor = 1.0 );
+
+ //! Copy assignment operator (not implemented)
+ /*!
+ \param [in] rhs the coefficient to clone
+ */
+ LauMagPhaseCoeffSet& operator=( const LauMagPhaseCoeffSet& rhs );
+
+ // the actual fit parameters
+ // (need to be pointers so they can be cloned)
+ //! The magnitude
+ LauParameter* magnitude_;
+ //! The phase
+ LauParameter* phase_;
+
+ //! The complex coefficient
+ LauComplex coeff_;
+
+ ClassDef( LauMagPhaseCoeffSet, 0 )
};
#endif
diff --git a/inc/LauMergeDataFiles.hh b/inc/LauMergeDataFiles.hh
index 6c49f20..301544e 100644
--- a/inc/LauMergeDataFiles.hh
+++ b/inc/LauMergeDataFiles.hh
@@ -1,127 +1,125 @@
/*
Copyright 2008 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
-#include <map>
-#include <cstdlib>
-
#include "TFile.h"
#include "TString.h"
#include "TTree.h"
+#include <cstdlib>
+#include <map>
+
/*! \file LauMergeDataFiles.hh
\brief File containing declaration of LauMergeDataFiles class.
*/
/*! \class LauMergeDataFiles
- \brief Utility class to allow the merging of data files on a expt-by-expt basis
+ \brief Utility class to allow the merging of data files on a expt-by-expt basis
- The files are merged such that events for expt 0 from tree 1 will be followed
- by events for expt 0 from tree 2, then expt 1 from tree1, expt 1 from tree 2, etc.
+ The files are merged such that events for expt 0 from tree 1 will be followed
+ by events for expt 0 from tree 2, then expt 1 from tree1, expt 1 from tree 2, etc.
*/
-class LauMergeDataFiles
-{
- public:
- //! Constructor
- /*!
- \param [in] fileName1 name of first file to be merged
- \param [in] fileName2 name of second file to be merged
- \param [in] treeName name of the tree to read from the input files
- */
- LauMergeDataFiles(const TString& fileName1, const TString& fileName2, const TString& treeName);
-
- //! Destructor
- virtual ~LauMergeDataFiles();
-
- //! Do the merge
- /*!
- \param [in] fileName name of file to which to write the merged tree
- */
- void process(const TString& fileName);
-
- protected:
- //! Type to relate leaf names with their double-precision value
- typedef std::map<TString,Double_t> LeafDoubleMap;
- //! Type to relate leaf names with their integer value
- typedef std::map<TString,Int_t> LeafIntegerMap;
- //! Type to hold for each experiment the first and last entry numbers in a tree
- typedef std::map< Int_t,std::pair<Int_t,Int_t> > ExptsMap;
-
- //! Open the specified input files and check that the trees can be read
- void openInputFiles();
- //! Read the structure of the input trees, create appropriate storage and set the branch addresses
- void setupInputTrees();
- //! Create the structure of the output tree
- void setupOutputTree();
- //! Determine the experiments stored a given tree
- void findExperiments(TTree* tree, ExptsMap& exptsMap);
- //! Check that the experiments in each tree match
- Bool_t checkExperimentMaps() const;
- //! Read the entries for a given experiment from the given tree and store in the output tree
- void readExperiment(TTree* tree, const ExptsMap::const_iterator& exptsMap, Int_t offset);
- //! Write the output file
- void writeFile();
-
- private:
- //! Name of file 1
- TString fileName1_;
- //! Name of file 2
- TString fileName2_;
- //! Name of the tree
- TString treeName_;
-
- //! Input file 1
- TFile * inputFile1_;
- //! Input file 2
- TFile * inputFile2_;
-
- //! Input tree 1
- TTree * inputTree1_;
- //! Input tree 2
- TTree * inputTree2_;
-
- //! Output file
- TFile * outputFile_;
- //! Output tree
- TTree * outputTree_;
-
- // Tree variables
- //! Storage for the experiment index variable
- Int_t iExpt_;
- //! Storage for the event-within-experiment index variable
- Int_t iEvtWithinExpt_;
-
- //! Storage for double-precision leaves
- LeafDoubleMap doubleVars_;
- //! Storage for integer leaves
- LeafIntegerMap integerVars_;
-
- //! Experiment -> first and last tree entry for tree 1
- ExptsMap tree1Expts_;
- //! Experiment -> first and last tree entry for tree 2
- ExptsMap tree2Expts_;
-
- ClassDef(LauMergeDataFiles,0)
+class LauMergeDataFiles {
+ public:
+ //! Constructor
+ /*!
+ \param [in] fileName1 name of first file to be merged
+ \param [in] fileName2 name of second file to be merged
+ \param [in] treeName name of the tree to read from the input files
+ */
+ LauMergeDataFiles( const TString& fileName1, const TString& fileName2, const TString& treeName );
+
+ //! Destructor
+ virtual ~LauMergeDataFiles();
+
+ //! Do the merge
+ /*!
+ \param [in] fileName name of file to which to write the merged tree
+ */
+ void process( const TString& fileName );
+
+ protected:
+ //! Type to relate leaf names with their double-precision value
+ typedef std::map<TString, Double_t> LeafDoubleMap;
+ //! Type to relate leaf names with their integer value
+ typedef std::map<TString, Int_t> LeafIntegerMap;
+ //! Type to hold for each experiment the first and last entry numbers in a tree
+ typedef std::map<Int_t, std::pair<Int_t, Int_t>> ExptsMap;
+
+ //! Open the specified input files and check that the trees can be read
+ void openInputFiles();
+ //! Read the structure of the input trees, create appropriate storage and set the branch addresses
+ void setupInputTrees();
+ //! Create the structure of the output tree
+ void setupOutputTree();
+ //! Determine the experiments stored a given tree
+ void findExperiments( TTree* tree, ExptsMap& exptsMap );
+ //! Check that the experiments in each tree match
+ Bool_t checkExperimentMaps() const;
+ //! Read the entries for a given experiment from the given tree and store in the output tree
+ void readExperiment( TTree* tree, const ExptsMap::const_iterator& exptsMap, Int_t offset );
+ //! Write the output file
+ void writeFile();
+
+ private:
+ //! Name of file 1
+ TString fileName1_;
+ //! Name of file 2
+ TString fileName2_;
+ //! Name of the tree
+ TString treeName_;
+
+ //! Input file 1
+ TFile* inputFile1_;
+ //! Input file 2
+ TFile* inputFile2_;
+
+ //! Input tree 1
+ TTree* inputTree1_;
+ //! Input tree 2
+ TTree* inputTree2_;
+
+ //! Output file
+ TFile* outputFile_;
+ //! Output tree
+ TTree* outputTree_;
+
+ // Tree variables
+ //! Storage for the experiment index variable
+ Int_t iExpt_;
+ //! Storage for the event-within-experiment index variable
+ Int_t iEvtWithinExpt_;
+
+ //! Storage for double-precision leaves
+ LeafDoubleMap doubleVars_;
+ //! Storage for integer leaves
+ LeafIntegerMap integerVars_;
+
+ //! Experiment -> first and last tree entry for tree 1
+ ExptsMap tree1Expts_;
+ //! Experiment -> first and last tree entry for tree 2
+ ExptsMap tree2Expts_;
+
+ ClassDef( LauMergeDataFiles, 0 )
};
-
diff --git a/inc/LauMinuit.hh b/inc/LauMinuit.hh
index e24ae86..97a3876 100644
--- a/inc/LauMinuit.hh
+++ b/inc/LauMinuit.hh
@@ -1,169 +1,167 @@
/*
Copyright 2013 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauMinuit.hh
\brief File containing declaration of LauMinuit class.
*/
/*! \class LauMinuit
\brief The interface to the Minuit fitter.
The singleton interface to the Minuit fitter.
*/
#ifndef LAU_MINUIT
#define LAU_MINUIT
#include "LauAbsFitter.hh"
#include "LauPrint.hh"
#include "Rtypes.h"
#include "TMatrixD.h"
#include <utility>
#include <vector>
class LauParameter;
class TVirtualFitter;
-
class LauMinuit : public LauAbsFitter {
- public:
- //! Destructor
- virtual ~LauMinuit() = default;
-
- //! Initialise the fitter, setting the information on the parameters
- /*!
- \param [in] fitObj the object that controls the likelihood calculation
- \param [in] parameters the list of parameters of the fit
- */
- virtual void initialise( LauFitObject* fitObj, const std::vector<LauParameter*>& parameters );
+ public:
+ //! Destructor
+ virtual ~LauMinuit() = default;
- //! Get the object that controls the calculation of the likelihood
- virtual LauFitObject* getFitObject();
+ //! Initialise the fitter, setting the information on the parameters
+ /*!
+ \param [in] fitObj the object that controls the likelihood calculation
+ \param [in] parameters the list of parameters of the fit
+ */
+ virtual void initialise( LauFitObject* fitObj, const std::vector<LauParameter*>& parameters );
- //! Get the total number of fit parameters
- virtual UInt_t nParameters() const { return nParams_; }
+ //! Get the object that controls the calculation of the likelihood
+ virtual LauFitObject* getFitObject();
- //! Get the number of floating fit parameters
- virtual UInt_t nFreeParameters() const { return nFreeParams_; }
+ //! Get the total number of fit parameters
+ virtual UInt_t nParameters() const { return nParams_; }
- //! Determine whether the two-stage fit is enabled
- virtual Bool_t twoStageFit() const {return twoStageFit_;}
+ //! Get the number of floating fit parameters
+ virtual UInt_t nFreeParameters() const { return nFreeParams_; }
- //! Turn on or off the two stage fit
- /*!
- The two-stage fit allows certain parameters to be fixed
- in one stage and floated in another stage of the fit.
- Can be used, for example, in a CP fit where the
- CP-parameters are fixed to zero in the first stage
- (while the CP-average parameters are determined), then
- floated in the second.
+ //! Determine whether the two-stage fit is enabled
+ virtual Bool_t twoStageFit() const { return twoStageFit_; }
- \param [in] doTwoStageFit boolean specifying whether or not the two-stage fit should be enabled
- */
- virtual void twoStageFit(Bool_t doTwoStageFit) {twoStageFit_ = doTwoStageFit;}
+ //! Turn on or off the two stage fit
+ /*!
+ The two-stage fit allows certain parameters to be fixed
+ in one stage and floated in another stage of the fit.
+ Can be used, for example, in a CP fit where the
+ CP-parameters are fixed to zero in the first stage
+ (while the CP-average parameters are determined), then
+ floated in the second.
- //! Determine whether calculation of asymmetric errors is enabled
- virtual Bool_t useAsymmFitErrors() const {return useAsymmFitErrors_;}
+ \param [in] doTwoStageFit boolean specifying whether or not the two-stage fit should be enabled
+ */
+ virtual void twoStageFit( Bool_t doTwoStageFit ) { twoStageFit_ = doTwoStageFit; }
- //! Turn on or off the computation of asymmetric errors (i.e. the MINOS routine)
- /*!
- \param [in] useAsymmErrors boolean specifying whether or not the computation of asymmetric errors is enabled
- */
- virtual void useAsymmFitErrors(Bool_t useAsymmErrors) {useAsymmFitErrors_ = useAsymmErrors;}
+ //! Determine whether calculation of asymmetric errors is enabled
+ virtual Bool_t useAsymmFitErrors() const { return useAsymmFitErrors_; }
- //! Perform the minimisation of the fit function
- /*!
- \return the status code of the fit and the minimised value
- */
- virtual const FitStatus& minimise();
+ //! Turn on or off the computation of asymmetric errors (i.e. the MINOS routine)
+ /*!
+ \param [in] useAsymmErrors boolean specifying whether or not the computation of asymmetric errors is enabled
+ */
+ virtual void useAsymmFitErrors( Bool_t useAsymmErrors ) { useAsymmFitErrors_ = useAsymmErrors; }
- //! Fix parameters marked as "second stage"
- virtual void fixSecondStageParameters();
+ //! Perform the minimisation of the fit function
+ /*!
+ \return the status code of the fit and the minimised value
+ */
+ virtual const FitStatus& minimise();
- //! Release parameters marked as "second stage"
- virtual void releaseSecondStageParameters();
+ //! Fix parameters marked as "second stage"
+ virtual void fixSecondStageParameters();
- //! Update the values and errors of the parameters based on the fit minimum
- virtual void updateParameters();
+ //! Release parameters marked as "second stage"
+ virtual void releaseSecondStageParameters();
- //! Retrieve the fit covariance matrix
- virtual const TMatrixD& covarianceMatrix() const { return covMatrix_; }
+ //! Update the values and errors of the parameters based on the fit minimum
+ virtual void updateParameters();
+ //! Retrieve the fit covariance matrix
+ virtual const TMatrixD& covarianceMatrix() const { return covMatrix_; }
- private:
- //! Allow the factory class to access private methods
- friend class LauFitter;
+ private:
+ //! Allow the factory class to access private methods
+ friend class LauFitter;
- //! Constructor
- LauMinuit( const UInt_t maxPar = 100, const LauOutputLevel verbosity = LauOutputLevel::Standard );
+ //! Constructor
+ LauMinuit( const UInt_t maxPar = 100, const LauOutputLevel verbosity = LauOutputLevel::Standard );
- //! Copy constructor - private and not implemented
- LauMinuit( const LauMinuit& ) = delete;
+ //! Copy constructor - private and not implemented
+ LauMinuit( const LauMinuit& ) = delete;
- //! Move constructor - private and not implemented
- LauMinuit( LauMinuit&& ) = delete;
+ //! Move constructor - private and not implemented
+ LauMinuit( LauMinuit&& ) = delete;
- //! Copy assignment operator - private and not implemented
- LauMinuit& operator=( const LauMinuit& ) = delete;
+ //! Copy assignment operator - private and not implemented
+ LauMinuit& operator=( const LauMinuit& ) = delete;
- //! Move assignment operator - private and not implemented
- LauMinuit& operator=( LauMinuit&& ) = delete;
+ //! Move assignment operator - private and not implemented
+ LauMinuit& operator=( LauMinuit&& ) = delete;
- //! The interface to Minuit
- TVirtualFitter* minuit_{nullptr};
+ //! The interface to Minuit
+ TVirtualFitter* minuit_ { nullptr };
- //! The maximum number of parameters
- const UInt_t maxPar_{100};
+ //! The maximum number of parameters
+ const UInt_t maxPar_ { 100 };
- //! The verbosity level of the fitter
- const LauOutputLevel outputLevel_{LauOutputLevel::Standard};
+ //! The verbosity level of the fitter
+ const LauOutputLevel outputLevel_ { LauOutputLevel::Standard };
- //! The fit parameters
- std::vector<LauParameter*> params_;
+ //! The fit parameters
+ std::vector<LauParameter*> params_;
- //! The total number of parameters
- UInt_t nParams_{0};
+ //! The total number of parameters
+ UInt_t nParams_ { 0 };
- //! The number of free parameters
- UInt_t nFreeParams_{0};
+ //! The number of free parameters
+ UInt_t nFreeParams_ { 0 };
- //! Option to perform a two stage fit
- Bool_t twoStageFit_{kFALSE};
+ //! Option to perform a two stage fit
+ Bool_t twoStageFit_ { kFALSE };
- //! Option to use asymmetric errors
- Bool_t useAsymmFitErrors_{kFALSE};
+ //! Option to use asymmetric errors
+ Bool_t useAsymmFitErrors_ { kFALSE };
- //! The status of the fit
- FitStatus fitStatus_{-1,0.0,0.0};
+ //! The status of the fit
+ FitStatus fitStatus_ { -1, 0.0, 0.0 };
- //! The covariance matrix
- TMatrixD covMatrix_;
+ //! The covariance matrix
+ TMatrixD covMatrix_;
- ClassDef(LauMinuit,0);
+ ClassDef( LauMinuit, 0 );
};
#endif
diff --git a/inc/LauModIndPartWaveMagPhase.hh b/inc/LauModIndPartWaveMagPhase.hh
index 2149bd2..100175c 100644
--- a/inc/LauModIndPartWaveMagPhase.hh
+++ b/inc/LauModIndPartWaveMagPhase.hh
@@ -1,125 +1,140 @@
/*
Copyright 2015 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauModIndPartWaveMagPhase.hh
\brief File containing declaration of LauModIndPartWaveMagPhase class.
- */
+*/
/*! \class LauModIndPartWaveMagPhase
\brief Class for defining a model independent partial wave component where the amplitudes are parameterised in terms of magnitude and phase
This model uses splines to produce a partial wave from the magnitude and phase values of the amplitude at a series of points in the phase space.
The magnitude and phase at each point can be floated in the fit.
- */
+*/
#ifndef LAU_MODINDPARTWAVE_MAGPHASE
#define LAU_MODINDPARTWAVE_MAGPHASE
-#include "LauComplex.hh"
#include "LauAbsModIndPartWave.hh"
+#include "LauComplex.hh"
class TSpline3;
-
class LauModIndPartWaveMagPhase : public LauAbsModIndPartWave {
- public:
- //! Constructor
- /*!
- \param [in] resInfo the object containing information on the resonance name, mass, width, spin, charge, etc.
- \param [in] resPairAmpInt the number of the daughter not produced by the resonance
- \param [in] daughters the daughter particles
- */
- LauModIndPartWaveMagPhase(LauResonanceInfo* resInfo, Int_t resPairAmpInt, const LauDaughters* daughters);
-
- //! Destructor
- virtual ~LauModIndPartWaveMagPhase();
-
- //! Set the values of the two real parameters that define the amplitude at a given knot
- /*!
- \param [in] knot the knot to be updated
- \param [in] magVal the value of the magnitude at the knot
- \param [in] phaseVal the value of the phase at the knot
- \param [in] fixMagnitude whether the magnitude should be fixed
- \param [in] fixPhase whether the phase should be fixed
- */
- virtual void setKnotAmp(const UInt_t knot, const Double_t magVal, const Double_t phaseVal, const Bool_t fixMagnitude, const Bool_t fixPhase);
-
- //! Method to set the type of interpolation used for the splines
- /*!
- \param [in] magType the type of interpolation for the magnitude spline
- \param [in] phaseType the type of interpolation for the phase spline
- */
- void setType(Lau1DCubicSpline::LauSplineType magType, Lau1DCubicSpline::LauSplineType phaseType) {
- this->setSplineType(magType,phaseType);
- }
-
- //! Method to set the boundary conditions of the splines
- /*!
- \param [in] magLeftBound the type of boundary condition for the left edge of the magnitude spline
- \param [in] magRightBound the type of boundary condition for the right edge of the magnitude spline
- \param [in] phaseLeftBound the type of boundary condition for the left edge of the phase spline
- \param [in] phaseRightBound the type of boundary condition for the right edge of the phase spline
- \param [in] magLeftGrad the gradient at the left edge of the magnitude spline if clamped
- \param [in] magRightGrad the gradient at the right edge of the magnitude spline if clamped
- \param [in] phaseLeftGrad the gradient at the left edge of the phase spline if clamped
- \param [in] phaseRightGrad the gradient at the right edge of the phase spline if clamped
- */
- void setBoundaryConditions(Lau1DCubicSpline::LauSplineBoundaryType magLeftBound,
- Lau1DCubicSpline::LauSplineBoundaryType magRightBound,
- Lau1DCubicSpline::LauSplineBoundaryType phaseLeftBound,
- Lau1DCubicSpline::LauSplineBoundaryType phaseRightBound,
- Double_t magLeftGrad = 0.0,
- Double_t magRightGrad = 0.0,
- Double_t phaseLeftGrad = 0.0,
- Double_t phaseRightGrad = 0.0)
- {
- this->setSplineBoundaryConditions(magLeftBound,magRightBound,phaseLeftBound,phaseRightBound,magLeftGrad,magRightGrad,phaseLeftGrad,phaseRightGrad);
- }
-
- //! Get the resonance model type
- /*!
- \return the resonance model type
- */
- virtual LauAbsResonance::LauResonanceModel getResonanceModel() const {return LauAbsResonance::MIPW_MagPhase;}
-
- protected:
- //! Evaluate the amplitude at the given point from the splines
- /*!
- \param [in] mass appropriate invariant mass for the resonance
- */
- virtual void evaluateAmplitude(const Double_t mass);
-
- //! Method to create the parameter objects for the given knot
- /*!
- \param [in] iKnot the index of the knot
- */
- virtual void createAmpParameters(const UInt_t iKnot);
-
- private:
- ClassDef(LauModIndPartWaveMagPhase,0) // model independent partial wave
-
+ public:
+ //! Constructor
+ /*!
+ \param [in] resInfo the object containing information on the resonance name, mass, width, spin, charge, etc.
+ \param [in] resPairAmpInt the number of the daughter not produced by the resonance
+ \param [in] daughters the daughter particles
+ */
+ LauModIndPartWaveMagPhase( LauResonanceInfo* resInfo,
+ Int_t resPairAmpInt,
+ const LauDaughters* daughters );
+
+ //! Destructor
+ virtual ~LauModIndPartWaveMagPhase();
+
+ //! Set the values of the two real parameters that define the amplitude at a given knot
+ /*!
+ \param [in] knot the knot to be updated
+ \param [in] magVal the value of the magnitude at the knot
+ \param [in] phaseVal the value of the phase at the knot
+ \param [in] fixMagnitude whether the magnitude should be fixed
+ \param [in] fixPhase whether the phase should be fixed
+ */
+ virtual void setKnotAmp( const UInt_t knot,
+ const Double_t magVal,
+ const Double_t phaseVal,
+ const Bool_t fixMagnitude,
+ const Bool_t fixPhase );
+
+ //! Method to set the type of interpolation used for the splines
+ /*!
+ \param [in] magType the type of interpolation for the magnitude spline
+ \param [in] phaseType the type of interpolation for the phase spline
+ */
+ void setType( Lau1DCubicSpline::LauSplineType magType, Lau1DCubicSpline::LauSplineType phaseType )
+ {
+ this->setSplineType( magType, phaseType );
+ }
+
+ //! Method to set the boundary conditions of the splines
+ /*!
+ \param [in] magLeftBound the type of boundary condition for the left edge of the magnitude spline
+ \param [in] magRightBound the type of boundary condition for the right edge of the magnitude spline
+ \param [in] phaseLeftBound the type of boundary condition for the left edge of the phase spline
+ \param [in] phaseRightBound the type of boundary condition for the right edge of the phase spline
+ \param [in] magLeftGrad the gradient at the left edge of the magnitude spline if clamped
+ \param [in] magRightGrad the gradient at the right edge of the magnitude spline if clamped
+ \param [in] phaseLeftGrad the gradient at the left edge of the phase spline if clamped
+ \param [in] phaseRightGrad the gradient at the right edge of the phase spline if clamped
+ */
+ void setBoundaryConditions( Lau1DCubicSpline::LauSplineBoundaryType magLeftBound,
+ Lau1DCubicSpline::LauSplineBoundaryType magRightBound,
+ Lau1DCubicSpline::LauSplineBoundaryType phaseLeftBound,
+ Lau1DCubicSpline::LauSplineBoundaryType phaseRightBound,
+ Double_t magLeftGrad = 0.0,
+ Double_t magRightGrad = 0.0,
+ Double_t phaseLeftGrad = 0.0,
+ Double_t phaseRightGrad = 0.0 )
+ {
+ this->setSplineBoundaryConditions( magLeftBound,
+ magRightBound,
+ phaseLeftBound,
+ phaseRightBound,
+ magLeftGrad,
+ magRightGrad,
+ phaseLeftGrad,
+ phaseRightGrad );
+ }
+
+ //! Get the resonance model type
+ /*!
+ \return the resonance model type
+ */
+ virtual LauAbsResonance::LauResonanceModel getResonanceModel() const
+ {
+ return LauAbsResonance::MIPW_MagPhase;
+ }
+
+ protected:
+ //! Evaluate the amplitude at the given point from the splines
+ /*!
+ \param [in] mass appropriate invariant mass for the resonance
+ */
+ virtual void evaluateAmplitude( const Double_t mass );
+
+ //! Method to create the parameter objects for the given knot
+ /*!
+ \param [in] iKnot the index of the knot
+ */
+ virtual void createAmpParameters( const UInt_t iKnot );
+
+ private:
+ ClassDef( LauModIndPartWaveMagPhase, 0 ) // model independent partial wave
};
#endif
diff --git a/inc/LauModIndPartWaveRealImag.hh b/inc/LauModIndPartWaveRealImag.hh
index e8da06d..fc253d2 100644
--- a/inc/LauModIndPartWaveRealImag.hh
+++ b/inc/LauModIndPartWaveRealImag.hh
@@ -1,125 +1,140 @@
/*
Copyright 2015 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauModIndPartWaveRealImag.hh
\brief File containing declaration of LauModIndPartWaveRealImag class.
- */
+*/
/*! \class LauModIndPartWaveRealImag
\brief Class for defining a model independent partial wave component where the amplitudes are parameterised in terms of real and imaginary parts
This model uses splines to produce a partial wave from the values of the real and imaginary parts of the amplitude at a series of points in the phase space.
The values at each point can be floated in the fit.
- */
+*/
#ifndef LAU_MODINDPARTWAVE_REALIMAG
#define LAU_MODINDPARTWAVE_REALIMAG
-#include "LauComplex.hh"
#include "LauAbsModIndPartWave.hh"
+#include "LauComplex.hh"
class TSpline3;
-
class LauModIndPartWaveRealImag : public LauAbsModIndPartWave {
- public:
- //! Constructor
- /*!
- \param [in] resInfo the object containing information on the resonance name, mass, width, spin, charge, etc.
- \param [in] resPairAmpInt the number of the daughter not produced by the resonance
- \param [in] daughters the daughter particles
- */
- LauModIndPartWaveRealImag(LauResonanceInfo* resInfo, Int_t resPairAmpInt, const LauDaughters* daughters);
-
- //! Destructor
- virtual ~LauModIndPartWaveRealImag();
-
- //! Set the values of the two real parameters that define the amplitude at a given knot
- /*!
- \param [in] knot the knot to be updated
- \param [in] realVal the value of the real part at the knot
- \param [in] imagVal the value of the imaginary part at the knot
- \param [in] fixRealPart whether the real part should be fixed
- \param [in] fixImagPart whether the imaginary part should be fixed
- */
- virtual void setKnotAmp(const UInt_t knot, const Double_t realVal, const Double_t imagVal, const Bool_t fixRealPart, const Bool_t fixImagPart);
-
- //! Method to set the type of interpolation used for the splines
- /*!
- \param [in] realType the type of interpolation for the real part spline
- \param [in] imagType the type of interpolation for the imaginary part spline
- */
- void setType(Lau1DCubicSpline::LauSplineType realType, Lau1DCubicSpline::LauSplineType imagType) {
- this->setSplineType(realType,imagType);
- }
-
- //! Method to set the boundary conditions of the splines
- /*!
- \param [in] realLeftBound the type of boundary condition for the left edge of the real part spline
- \param [in] realRightBound the type of boundary condition for the right edge of the real part spline
- \param [in] imagLeftBound the type of boundary condition for the left edge of the imaginary part spline
- \param [in] imagRightBound the type of boundary condition for the right edge of the imaginary part spline
- \param [in] realLeftGrad the gradient at the left edge of the real part spline if clamped
- \param [in] realRightGrad the gradient at the right edge of the real part spline if clamped
- \param [in] imagLeftGrad the gradient at the left edge of the imaginary part spline if clamped
- \param [in] imagRightGrad the gradient at the right edge of the imaginary part spline if clamped
- */
- void setBoundaryConditions(Lau1DCubicSpline::LauSplineBoundaryType realLeftBound,
- Lau1DCubicSpline::LauSplineBoundaryType realRightBound,
- Lau1DCubicSpline::LauSplineBoundaryType imagLeftBound,
- Lau1DCubicSpline::LauSplineBoundaryType imagRightBound,
- Double_t realLeftGrad = 0.0,
- Double_t realRightGrad = 0.0,
- Double_t imagLeftGrad = 0.0,
- Double_t imagRightGrad = 0.0)
- {
- this->setSplineBoundaryConditions(realLeftBound,realRightBound,imagLeftBound,imagRightBound,realLeftGrad,realRightGrad,imagLeftGrad,imagRightGrad);
- }
-
- //! Get the resonance model type
- /*!
- \return the resonance model type
- */
- virtual LauAbsResonance::LauResonanceModel getResonanceModel() const {return LauAbsResonance::MIPW_RealImag;}
-
- protected:
- //! Evaluate the amplitude at the given point from the splines
- /*!
- \param [in] mass appropriate invariant mass for the resonance
- */
- virtual void evaluateAmplitude(const Double_t mass);
-
- //! Method to create the parameter objects for the given knot
- /*!
- \param [in] iKnot the index of the knot
- */
- virtual void createAmpParameters(const UInt_t iKnot);
-
- private:
- ClassDef(LauModIndPartWaveRealImag,0) // model independent partial wave
-
+ public:
+ //! Constructor
+ /*!
+ \param [in] resInfo the object containing information on the resonance name, mass, width, spin, charge, etc.
+ \param [in] resPairAmpInt the number of the daughter not produced by the resonance
+ \param [in] daughters the daughter particles
+ */
+ LauModIndPartWaveRealImag( LauResonanceInfo* resInfo,
+ Int_t resPairAmpInt,
+ const LauDaughters* daughters );
+
+ //! Destructor
+ virtual ~LauModIndPartWaveRealImag();
+
+ //! Set the values of the two real parameters that define the amplitude at a given knot
+ /*!
+ \param [in] knot the knot to be updated
+ \param [in] realVal the value of the real part at the knot
+ \param [in] imagVal the value of the imaginary part at the knot
+ \param [in] fixRealPart whether the real part should be fixed
+ \param [in] fixImagPart whether the imaginary part should be fixed
+ */
+ virtual void setKnotAmp( const UInt_t knot,
+ const Double_t realVal,
+ const Double_t imagVal,
+ const Bool_t fixRealPart,
+ const Bool_t fixImagPart );
+
+ //! Method to set the type of interpolation used for the splines
+ /*!
+ \param [in] realType the type of interpolation for the real part spline
+ \param [in] imagType the type of interpolation for the imaginary part spline
+ */
+ void setType( Lau1DCubicSpline::LauSplineType realType, Lau1DCubicSpline::LauSplineType imagType )
+ {
+ this->setSplineType( realType, imagType );
+ }
+
+ //! Method to set the boundary conditions of the splines
+ /*!
+ \param [in] realLeftBound the type of boundary condition for the left edge of the real part spline
+ \param [in] realRightBound the type of boundary condition for the right edge of the real part spline
+ \param [in] imagLeftBound the type of boundary condition for the left edge of the imaginary part spline
+ \param [in] imagRightBound the type of boundary condition for the right edge of the imaginary part spline
+ \param [in] realLeftGrad the gradient at the left edge of the real part spline if clamped
+ \param [in] realRightGrad the gradient at the right edge of the real part spline if clamped
+ \param [in] imagLeftGrad the gradient at the left edge of the imaginary part spline if clamped
+ \param [in] imagRightGrad the gradient at the right edge of the imaginary part spline if clamped
+ */
+ void setBoundaryConditions( Lau1DCubicSpline::LauSplineBoundaryType realLeftBound,
+ Lau1DCubicSpline::LauSplineBoundaryType realRightBound,
+ Lau1DCubicSpline::LauSplineBoundaryType imagLeftBound,
+ Lau1DCubicSpline::LauSplineBoundaryType imagRightBound,
+ Double_t realLeftGrad = 0.0,
+ Double_t realRightGrad = 0.0,
+ Double_t imagLeftGrad = 0.0,
+ Double_t imagRightGrad = 0.0 )
+ {
+ this->setSplineBoundaryConditions( realLeftBound,
+ realRightBound,
+ imagLeftBound,
+ imagRightBound,
+ realLeftGrad,
+ realRightGrad,
+ imagLeftGrad,
+ imagRightGrad );
+ }
+
+ //! Get the resonance model type
+ /*!
+ \return the resonance model type
+ */
+ virtual LauAbsResonance::LauResonanceModel getResonanceModel() const
+ {
+ return LauAbsResonance::MIPW_RealImag;
+ }
+
+ protected:
+ //! Evaluate the amplitude at the given point from the splines
+ /*!
+ \param [in] mass appropriate invariant mass for the resonance
+ */
+ virtual void evaluateAmplitude( const Double_t mass );
+
+ //! Method to create the parameter objects for the given knot
+ /*!
+ \param [in] iKnot the index of the knot
+ */
+ virtual void createAmpParameters( const UInt_t iKnot );
+
+ private:
+ ClassDef( LauModIndPartWaveRealImag, 0 ) // model independent partial wave
};
#endif
diff --git a/inc/LauNRAmplitude.hh b/inc/LauNRAmplitude.hh
index 27a59df..95a016a 100644
--- a/inc/LauNRAmplitude.hh
+++ b/inc/LauNRAmplitude.hh
@@ -1,227 +1,231 @@
/*
Copyright 2004 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauNRAmplitude.hh
\brief File containing declaration of LauNRAmplitude class.
*/
/*! \class LauNRAmplitude
\brief Class for defining the NR amplitude model.
- Class for defining the NR amplitude model.
+ Class for defining the NR amplitude model.
Formulae and data values from arXiv:0709.0075v1 [hep-ph].
*/
#ifndef LAU_NR_AMPLITUDE
#define LAU_NR_AMPLITUDE
-#include "TString.h"
-
#include "LauAbsResonance.hh"
#include "LauComplex.hh"
-class LauKinematics;
+#include "TString.h"
+class LauKinematics;
class LauNRAmplitude : public LauAbsResonance {
- public:
- //! Constructor
- /*!
- \param [in] resInfo the object containing information on the resonance name, mass, width, spin, charge, etc.
- \param [in] resPairAmpInt the number of the daughter not produced by the resonance
- \param [in] daughters the daughter particles
- */
- LauNRAmplitude(LauResonanceInfo* resInfo, const Int_t resPairAmpInt, const LauDaughters* daughters);
-
- //! Destructor
- virtual ~LauNRAmplitude();
-
- //! Initialise the model
- virtual void initialise();
-
- //! Complex resonant amplitude
- /*!
- /param [in] kinematics kinematic parameters of the parent and daughter particles
- /return the complex amplitude
- */
- virtual LauComplex amplitude(const LauKinematics* kinematics);
-
- //! Get the resonance model type
- /*!
- \return the resonance model type
- */
- virtual LauAbsResonance::LauResonanceModel getResonanceModel() const {return LauAbsResonance::NRModel;}
-
- //! Set value of a resonance parameter
- /*!
- \param [in] name the name of the parameter to be changed
- \param [in] value the new parameter value
- */
- virtual void setResonanceParameter(const TString& name, const Double_t value);
-
- //! Allow the various parameters to float in the fit
- /*!
- \param [in] name the name of the parameter to be floated
- */
- virtual void floatResonanceParameter(const TString& name);
-
- //! Access the given resonance parameter
- /*!
- \param [in] name the name of the parameter
- \return the corresponding parameter
- */
- virtual LauParameter* getResonanceParameter(const TString& name);
-
- //! Retrieve the resonance parameters, e.g. so that they can be loaded into a fit
- /*!
- \return floating parameters of the resonance
- */
- virtual const std::vector<LauParameter*>& getFloatingParameters();
-
- protected:
- //! This is not meant to be called
- virtual LauComplex resAmp(Double_t mass, Double_t spinTerm);
-
- //! Evaluate the expression 1.0 / (1.0 + TMath::Exp( c * (s-p) ))
- /*!
- \param [in] s invariant mass squared
- \param [in] c parameter from arXiv:0709.0075v1 [hep-ph]
- \param [in] p parameter from arXiv:0709.0075v1 [hep-ph]
- \return the value of the expression 1.0 / (1.0 + TMath::Exp( c * (s-p) ))
- */
- Double_t f(const Double_t s, const Double_t c, const Double_t p) const;
-
- //! Set the d parameter value
- /*!
- \param [in] d the new d parameter value
- */
- void setdParameter(const Double_t d);
-
- //! Set the c1 parameter value
- /*!
- \param [in] c1 the new c1 parameter value
- */
- void setc1Parameter(const Double_t c1);
-
- //! Set the c2 parameter value
- /*!
- \param [in] c2 the new c2 parameter value
- */
- void setc2Parameter(const Double_t c2);
-
- //! Set the p1 parameter value
- /*!
- \param [in] p1 the new p1 parameter value
- */
- void setp1Parameter(const Double_t p1);
-
- //! Set the p2 parameter value
- /*!
- \param [in] p2 the new p2 parameter value
- */
- void setp2Parameter(const Double_t p2);
-
- //! Get the d parameter value
- /*!
- \return the new d parameter value
- */
- Double_t getdParameter() const {return (d_!=0) ? d_->unblindValue() : 0.0;}
-
- //! Get the c1 parameter value
- /*!
- \return the new c1 parameter value
- */
- Double_t getc1Parameter() const {return (c1_!=0) ? c1_->unblindValue() : 0.0;}
-
- //! Get the c2 parameter value
- /*!
- \return the new c2 parameter value
- */
- Double_t getc2Parameter() const {return (c2_!=0) ? c2_->unblindValue() : 0.0;}
-
- //! Get the p1 parameter value
- /*!
- \return the new p1 parameter value
- */
- Double_t getp1Parameter() const {return (p1_!=0) ? p1_->unblindValue() : 0.0;}
-
- //! Get the p2 parameter value
- /*!
- \return the new p2 parameter value
- */
- Double_t getp2Parameter() const {return (p2_!=0) ? p2_->unblindValue() : 0.0;}
-
- //! See if the d parameter is fixed or floating
- /*!
- \return kTRUE if the d parameter is fixed, kFALSE otherwise
- */
- Bool_t fixdParameter() const {return (d_!=0) ? d_->fixed() : kTRUE;}
-
- //! See if the c1 parameter is fixed or floating
- /*!
- \return kTRUE if the c1 parameter is fixed, kFALSE otherwise
- */
- Bool_t fixc1Parameter() const {return (c1_!=0) ? c1_->fixed() : kTRUE;}
-
- //! See if the c2 parameter is fixed or floating
- /*!
- \return kTRUE if the c2 parameter is fixed, kFALSE otherwise
- */
- Bool_t fixc2Parameter() const {return (c2_!=0) ? c2_->fixed() : kTRUE;}
-
- //! See if the p1 parameter is fixed or floating
- /*!
- \return kTRUE if the p1 parameter is fixed, kFALSE otherwise
- */
- Bool_t fixp1Parameter() const {return (p1_!=0) ? p1_->fixed() : kTRUE;}
-
- //! See if the p2 parameter is fixed or floating
- /*!
- \return kTRUE if the p2 parameter is fixed, kFALSE otherwise
- */
- Bool_t fixp2Parameter() const {return (p2_!=0) ? p2_->fixed() : kTRUE;}
-
- private:
- //! Copy constructor (not implemented)
- LauNRAmplitude(const LauNRAmplitude& rhs);
-
- //! Copy assignment operator (not implemented)
- LauNRAmplitude& operator=(const LauNRAmplitude& rhs);
-
- //! Parameter from arXiv:0709.0075v1 [hep-ph]
- LauParameter* d_;
- //! Parameter from arXiv:0709.0075v1 [hep-ph]
- LauParameter* c1_;
- //! Parameter from arXiv:0709.0075v1 [hep-ph]
- LauParameter* c2_;
- //! Parameter from arXiv:0709.0075v1 [hep-ph]
- LauParameter* p1_;
- //! Parameter from arXiv:0709.0075v1 [hep-ph]
- LauParameter* p2_;
-
- ClassDef(LauNRAmplitude,0) // Non-resonant amplitude model
+ public:
+ //! Constructor
+ /*!
+ \param [in] resInfo the object containing information on the resonance name, mass, width, spin, charge, etc.
+ \param [in] resPairAmpInt the number of the daughter not produced by the resonance
+ \param [in] daughters the daughter particles
+ */
+ LauNRAmplitude( LauResonanceInfo* resInfo,
+ const Int_t resPairAmpInt,
+ const LauDaughters* daughters );
+
+ //! Destructor
+ virtual ~LauNRAmplitude();
+
+ //! Initialise the model
+ virtual void initialise();
+
+ //! Complex resonant amplitude
+ /*!
+ \param [in] kinematics kinematic parameters of the parent and daughter particles
+ \return the complex amplitude
+ */
+ virtual LauComplex amplitude( const LauKinematics* kinematics );
+
+ //! Get the resonance model type
+ /*!
+ \return the resonance model type
+ */
+ virtual LauAbsResonance::LauResonanceModel getResonanceModel() const
+ {
+ return LauAbsResonance::NRModel;
+ }
+
+ //! Set value of a resonance parameter
+ /*!
+ \param [in] name the name of the parameter to be changed
+ \param [in] value the new parameter value
+ */
+ virtual void setResonanceParameter( const TString& name, const Double_t value );
+
+ //! Allow the various parameters to float in the fit
+ /*!
+ \param [in] name the name of the parameter to be floated
+ */
+ virtual void floatResonanceParameter( const TString& name );
+
+ //! Access the given resonance parameter
+ /*!
+ \param [in] name the name of the parameter
+ \return the corresponding parameter
+ */
+ virtual LauParameter* getResonanceParameter( const TString& name );
+
+ //! Retrieve the resonance parameters, e.g. so that they can be loaded into a fit
+ /*!
+ \return floating parameters of the resonance
+ */
+ virtual const std::vector<LauParameter*>& getFloatingParameters();
+
+ protected:
+ //! This is not meant to be called
+ virtual LauComplex resAmp( Double_t mass, Double_t spinTerm );
+
+ //! Evaluate the expression 1.0 / (1.0 + TMath::Exp( c * (s-p) ))
+ /*!
+ \param [in] s invariant mass squared
+ \param [in] c parameter from arXiv:0709.0075v1 [hep-ph]
+ \param [in] p parameter from arXiv:0709.0075v1 [hep-ph]
+ \return the value of the expression 1.0 / (1.0 + TMath::Exp( c * (s-p) ))
+ */
+ Double_t f( const Double_t s, const Double_t c, const Double_t p ) const;
+
+ //! Set the d parameter value
+ /*!
+ \param [in] d the new d parameter value
+ */
+ void setdParameter( const Double_t d );
+
+ //! Set the c1 parameter value
+ /*!
+ \param [in] c1 the new c1 parameter value
+ */
+ void setc1Parameter( const Double_t c1 );
+
+ //! Set the c2 parameter value
+ /*!
+ \param [in] c2 the new c2 parameter value
+ */
+ void setc2Parameter( const Double_t c2 );
+
+ //! Set the p1 parameter value
+ /*!
+ \param [in] p1 the new p1 parameter value
+ */
+ void setp1Parameter( const Double_t p1 );
+
+ //! Set the p2 parameter value
+ /*!
+ \param [in] p2 the new p2 parameter value
+ */
+ void setp2Parameter( const Double_t p2 );
+
+ //! Get the d parameter value
+ /*!
+ \return the new d parameter value
+ */
+ Double_t getdParameter() const { return ( d_ != 0 ) ? d_->unblindValue() : 0.0; }
+
+ //! Get the c1 parameter value
+ /*!
+ \return the new c1 parameter value
+ */
+ Double_t getc1Parameter() const { return ( c1_ != 0 ) ? c1_->unblindValue() : 0.0; }
+
+ //! Get the c2 parameter value
+ /*!
+ \return the new c2 parameter value
+ */
+ Double_t getc2Parameter() const { return ( c2_ != 0 ) ? c2_->unblindValue() : 0.0; }
+
+ //! Get the p1 parameter value
+ /*!
+ \return the new p1 parameter value
+ */
+ Double_t getp1Parameter() const { return ( p1_ != 0 ) ? p1_->unblindValue() : 0.0; }
+
+ //! Get the p2 parameter value
+ /*!
+ \return the new p2 parameter value
+ */
+ Double_t getp2Parameter() const { return ( p2_ != 0 ) ? p2_->unblindValue() : 0.0; }
+
+ //! See if the d parameter is fixed or floating
+ /*!
+ \return kTRUE if the d parameter is fixed, kFALSE otherwise
+ */
+ Bool_t fixdParameter() const { return ( d_ != 0 ) ? d_->fixed() : kTRUE; }
+
+ //! See if the c1 parameter is fixed or floating
+ /*!
+ \return kTRUE if the c1 parameter is fixed, kFALSE otherwise
+ */
+ Bool_t fixc1Parameter() const { return ( c1_ != 0 ) ? c1_->fixed() : kTRUE; }
+
+ //! See if the c2 parameter is fixed or floating
+ /*!
+ \return kTRUE if the c2 parameter is fixed, kFALSE otherwise
+ */
+ Bool_t fixc2Parameter() const { return ( c2_ != 0 ) ? c2_->fixed() : kTRUE; }
+
+ //! See if the p1 parameter is fixed or floating
+ /*!
+ \return kTRUE if the p1 parameter is fixed, kFALSE otherwise
+ */
+ Bool_t fixp1Parameter() const { return ( p1_ != 0 ) ? p1_->fixed() : kTRUE; }
+
+ //! See if the p2 parameter is fixed or floating
+ /*!
+ \return kTRUE if the p2 parameter is fixed, kFALSE otherwise
+ */
+ Bool_t fixp2Parameter() const { return ( p2_ != 0 ) ? p2_->fixed() : kTRUE; }
+
+ private:
+ //! Copy constructor (not implemented)
+ LauNRAmplitude( const LauNRAmplitude& rhs );
+
+ //! Copy assignment operator (not implemented)
+ LauNRAmplitude& operator=( const LauNRAmplitude& rhs );
+
+ //! Parameter from arXiv:0709.0075v1 [hep-ph]
+ LauParameter* d_;
+ //! Parameter from arXiv:0709.0075v1 [hep-ph]
+ LauParameter* c1_;
+ //! Parameter from arXiv:0709.0075v1 [hep-ph]
+ LauParameter* c2_;
+ //! Parameter from arXiv:0709.0075v1 [hep-ph]
+ LauParameter* p1_;
+ //! Parameter from arXiv:0709.0075v1 [hep-ph]
+ LauParameter* p2_;
+
+ ClassDef( LauNRAmplitude, 0 ) // Non-resonant amplitude model
};
#endif
diff --git a/inc/LauNovosibirskPdf.hh b/inc/LauNovosibirskPdf.hh
index 6ed8649..12dfe41 100644
--- a/inc/LauNovosibirskPdf.hh
+++ b/inc/LauNovosibirskPdf.hh
@@ -1,93 +1,97 @@
/*
Copyright 2008 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauNovosibirskPdf.hh
\brief File containing declaration of LauNovosibirskPdf class.
*/
/*! \class LauNovosibirskPdf
\brief Class for defining a Novosibirsk function PDF.
Class that allows the user to define a Novosibirsk function PDF.
*/
#ifndef LAU_NOVOSIBIRSK_PDF
#define LAU_NOVOSIBIRSK_PDF
-#include "TString.h"
-#include "TRandom.h"
#include "LauAbsPdf.hh"
#include "LauParameter.hh"
+#include "TRandom.h"
+#include "TString.h"
+
#include <vector>
class LauNovosibirskPdf : public LauAbsPdf {
- public:
- //! Constructor
- /*!
- \param [in] theVarName the name of the abscissa variable
- \param [in] params the PDF parameters - mean, sigma and tail
- \param [in] minAbscissa the minimum value of the abscissa
- \param [in] maxAbscissa the maximum value of the abscissa
- */
- LauNovosibirskPdf(const TString& theVarName, const std::vector<LauAbsRValue*>& params, Double_t minAbscissa, Double_t maxAbscissa);
-
- //! Destructor
- virtual ~LauNovosibirskPdf();
-
- //! Calculate the likelihood (and intermediate info) for a given abscissa
- /*!
- \param [in] abscissas the values of the abscissa(s)
- */
- virtual void calcLikelihoodInfo(const LauAbscissas& abscissas);
-
- using LauAbsPdf::calcLikelihoodInfo;
-
- //! Calculate the PDF height
- /*!
- \param [in] kinematics the current DP kinematics
- */
- virtual void calcPDFHeight( const LauKinematics* kinematics );
-
- protected:
-
- private:
- //! Copy constructor (not implemented)
- LauNovosibirskPdf(const LauNovosibirskPdf& rhs);
-
- //! Copy assignment operator (not implemented)
- LauNovosibirskPdf& operator=(const LauNovosibirskPdf& rhs);
-
- //! Gaussian mean
- LauAbsRValue* mean_;
- //! Gaussian sigma
- LauAbsRValue* sigma_;
- //! Gaussian tail
- LauAbsRValue* tail_;
-
- ClassDef(LauNovosibirskPdf,0) // Define the Novosibirsk PDF
+ public:
+ //! Constructor
+ /*!
+ \param [in] theVarName the name of the abscissa variable
+ \param [in] params the PDF parameters - mean, sigma and tail
+ \param [in] minAbscissa the minimum value of the abscissa
+ \param [in] maxAbscissa the maximum value of the abscissa
+ */
+ LauNovosibirskPdf( const TString& theVarName,
+ const std::vector<LauAbsRValue*>& params,
+ Double_t minAbscissa,
+ Double_t maxAbscissa );
+
+ //! Destructor
+ virtual ~LauNovosibirskPdf();
+
+ //! Calculate the likelihood (and intermediate info) for a given abscissa
+ /*!
+ \param [in] abscissas the values of the abscissa(s)
+ */
+ virtual void calcLikelihoodInfo( const LauAbscissas& abscissas );
+
+ using LauAbsPdf::calcLikelihoodInfo;
+
+ //! Calculate the PDF height
+ /*!
+ \param [in] kinematics the current DP kinematics
+ */
+ virtual void calcPDFHeight( const LauKinematics* kinematics );
+
+ protected:
+
+ private:
+ //! Copy constructor (not implemented)
+ LauNovosibirskPdf( const LauNovosibirskPdf& rhs );
+
+ //! Copy assignment operator (not implemented)
+ LauNovosibirskPdf& operator=( const LauNovosibirskPdf& rhs );
+
+ //! Gaussian mean
+ LauAbsRValue* mean_;
+ //! Gaussian sigma
+ LauAbsRValue* sigma_;
+ //! Gaussian tail
+ LauAbsRValue* tail_;
+
+ ClassDef( LauNovosibirskPdf, 0 ) // Define the Novosibirsk PDF
};
#endif
diff --git a/inc/LauParamFixed.hh b/inc/LauParamFixed.hh
index 1f412fa..58aea59 100644
--- a/inc/LauParamFixed.hh
+++ b/inc/LauParamFixed.hh
@@ -1,50 +1,48 @@
/*
Copyright 2006 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauParamFixed.hh
\brief File containing declaration of LauParamFixed class.
*/
/*! \class LauParamFixed
\brief Predicate to allow counting of the number of fixed parameters
*/
#ifndef LAU_PARAM_FIXED
#define LAU_PARAM_FIXED
#include "LauAbsRValue.hh"
class LauParamFixed {
- public:
- //! Predicate that check whether the parameter is fixed
- /*!
- \param [in] par the LauParameter that holds the information about the parameter
- \return whether or not the parameter is fixed
- */
- inline bool operator() (const LauAbsRValue* par) const {
- return par->fixed();
- }
+ public:
+ //! Predicate that check whether the parameter is fixed
+ /*!
+ \param [in] par the LauParameter that holds the information about the parameter
+ \return whether or not the parameter is fixed
+ */
+ inline bool operator()( const LauAbsRValue* par ) const { return par->fixed(); }
};
#endif
diff --git a/inc/LauParameter.hh b/inc/LauParameter.hh
index 3aeecd9..bc7d206 100644
--- a/inc/LauParameter.hh
+++ b/inc/LauParameter.hh
@@ -1,562 +1,572 @@
/*
Copyright 2006 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauParameter.hh
\brief File containing declaration of LauParameter class.
*/
/*! \class LauParameter
\brief Class for defining the fit parameter objects.
Holds all relevant information for the parameters for both generation and fitting step:
current, initial and generated value, maximum and minimum range, error, asymmetric error, fix and float and etc.
*/
#ifndef LAU_PARAMETER
#define LAU_PARAMETER
-#include <iosfwd>
-#include <map>
-#include <vector>
+#include "LauAbsRValue.hh"
+#include "LauBlind.hh"
#include "TObject.h"
#include "TString.h"
-#include "LauAbsRValue.hh"
-#include "LauBlind.hh"
+#include <iosfwd>
+#include <map>
+#include <vector>
class LauParameter : public TObject, public LauAbsRValue {
- public:
- //! Default constructor
- LauParameter();
-
- //! Constructor for named parameter
- /*!
- \param [in] parName the parameter name
- */
- explicit LauParameter(const TString& parName);
-
- //! Constructor for parameter value
- /*!
- \param [in] parValue the parameter value
- */
- explicit LauParameter(Double_t parValue);
-
- //! Constructor double limit parameter
- /*!
- \param [in] parValue the parameter value
- \param [in] min the minimum value of the parameter
- \param [in] max the maximum value of the parameter
- */
- LauParameter(Double_t parValue, Double_t min, Double_t max);
-
- //! Constructor double limit fixed parameter
- /*!
- \param [in] parValue the parameter value
- \param [in] min the minimum value of the parameter
- \param [in] max the maximum value of the parameter
- \param [in] parFixed boolean flag to fix or float parameter
- */
- LauParameter(Double_t parValue, Double_t min, Double_t max, Bool_t parFixed);
-
- //! Constructor for double error and limit parameter
- /*!
- \param [in] parValue the parameter value
- \param [in] parError the parameter error
- \param [in] min the minimum value of the parameter
- \param [in] max the maximum value of the parameter
- */
- LauParameter(Double_t parValue, Double_t parError, Double_t min, Double_t max);
-
- //! Constructor for parameter value and name
- /*!
- \param [in] parName the parameter name
- \param [in] parValue the parameter value
- */
- LauParameter(const TString& parName, Double_t parValue);
-
- //! Constructor double limit parameter and name
- /*!
- \param [in] parName the parameter name
- \param [in] parValue the parameter value
- \param [in] min the minimum value of the parameter
- \param [in] max the maximum value of the parameter
- */
- LauParameter(const TString& parName, Double_t parValue, Double_t min, Double_t max);
-
- //! Constructor double limit fixed parameter and name
- /*!
- \param [in] parName the parameter name
- \param [in] parValue the parameter value
- \param [in] min the minimum value of the parameter
- \param [in] max the maximum value of the parameter
- \param [in] parFixed boolean flag to fix (kTRUE) or float (kFALSE) the parameter
- */
- LauParameter(const TString& parName, Double_t parValue, Double_t min, Double_t max, Bool_t parFixed);
-
- //! Constructor double error and limit parameter and name
- /*!
- \param [in] parName the parameter name
- \param [in] parValue the parameter value
- \param [in] parError the parameter error
- \param [in] min the minimum value of the parameter
- \param [in] max the maximum value of the parameter
- */
- LauParameter(const TString& parName, Double_t parValue, Double_t parError, Double_t min, Double_t max);
-
- // Destructor
- virtual ~LauParameter();
-
- //! Copy constructor
- /*!
- \param [in] rhs the parameter to be copied
- */
- LauParameter(const LauParameter& rhs);
-
- //! Copy assignment operator
- /*!
- \param [in] rhs the parameter to be copied
- */
- LauParameter& operator=(const LauParameter& rhs);
-
- // the simple accessor functions
-
- //! The parameter name
- /*!
- \return the name of the parameter
- */
- inline const TString& name() const {return name_;}
-
- //! The blinding state
- /*!
- \return the blinding state: kTRUE means that it is blinded, kFALSE that it is not blinded
- */
- inline Bool_t blind() const {return (blinder_ != 0);}
-
- //! Access the blinder object
- /*!
- \return the blinder
- */
- inline const LauBlind* blinder() const {return blinder_;}
-
- //! The value of the parameter
- /*!
- \return the value of the parameter
- */
- inline Double_t value() const {return value_;}
-
- //! The unblinded value of the parameter
- /*!
- \return the unblinded value of the parameter
- */
- inline Double_t unblindValue() const {return (blinder_==0) ? value_ : blinder_->unblind(value_);}
-
- //! The error on the parameter
- /*!
- \return the error on the parameter
- */
- inline Double_t error() const {return error_;}
-
- //! The lower error on the parameter
- /*!
- \return the lower error on the parameter
- */
- inline Double_t negError() const {return negError_;}
-
- //! The upper error on the parameter
- /*!
- \return the upper error on the parameter
- */
- inline Double_t posError() const {return posError_;}
-
- //! The value generated for the parameter
- /*!
- \return the value generated for the parameter
- */
- inline Double_t genValue() const {return genValue_;}
-
- //! The initial value of the parameter
- /*!
- \return the initial value of the parameter given to the fitter
- */
- inline Double_t initValue() const {return initValue_;}
-
- //! The minimum value allowed for the parameter
- /*!
- \return the minimum value allowed for the parameter
- */
- inline Double_t minValue() const {return minValue_;}
-
- //! The maximum value allowed for the parameter
- /*!
- \return the maximum value allowed for the parameter
- */
- inline Double_t maxValue() const {return maxValue_;}
-
- //! The range allowed for the parameter
- /*!
- \return the range allowed for the parameters, defined as the difference between the max and min value
- */
- inline Double_t range() const {return this->maxValue() - this->minValue();}
-
- //! Check whether the parameter is fixed or floated
- /*!
- \return the boolean flag true/false whether the parameter is fixed
- */
- inline Bool_t fixed() const {return fixed_;}
-
- //! Check whether the parameter should be floated only in the second stage of a two stage fit
- /*!
- \return the boolean flag true/false whether it floats only in the second stage
- */
- inline Bool_t secondStage() const {return secondStage_;}
-
- //! Check whether a Gaussian constraints is applied
- /*!
- \return the boolean flag true/false whether a Gaussian constraint is applied
- */
- inline Bool_t gaussConstraint() const {return gaussConstraint_;}
-
- //! The penalty term from the Gaussian constraint
- /*!
- \return the penalty term from the Gaussian constraint
- */
- Double_t constraintPenalty() const;
-
- //! The parameter global correlation coefficient
- /*!
- \return the global correlation coefficient
- */
- inline Double_t globalCorrelationCoeff() const {return gcc_;}
-
- //! The bias in the parameter
- /*!
- \return the bias in the parameter, defined as the difference between the value and the generated value
- */
- inline Double_t bias() const {return bias_;}
-
- //! The pull value for the parameter
- /*!
- \return the pull value for the parameter, defined as the bias divided by the error
- */
- inline Double_t pull() const {return pull_;}
-
- //! Boolean to say it is an L value
- /*!
- \return kTRUE, LauParameters are L values
- */
- inline Bool_t isLValue() const {return kTRUE;}
-
- //! Get the LauParameter itself
- /*!
- \return a vector of the LauParameter
- */
- std::vector<LauParameter*> getPars();
-
- // the simple "setter" functions
-
- //! Set the parameter name
- /*!
- \param [in] newName the name of the parameter
- */
- void name(const TString& newName);
-
- //! Set the value of the parameter
- /*!
- \param [in] newValue the value of the parameter
- */
- void value(Double_t newValue);
-
- //! Set the error on the parameter
- /*!
- \param [in] newError the error on the parameter
- */
- void error(Double_t newError);
-
- //! Set the lower error on the parameter
- /*!
- \param [in] newNegError the lower error on the parameter
- */
- void negError(Double_t newNegError);
-
- //! Set the upper error on the parameter
- /*!
- \param [in] newPosError the upper error on the parameter
- */
- void posError(Double_t newPosError);
-
- //! Set the error values on the parameter
- /*!
- \param [in] newError the error on the parameter
- \param [in] newNegError the lower error on the parameter
- \param [in] newPosError the upper error on the parameter
- */
- void errors(Double_t newError, Double_t newNegError, Double_t newPosError);
-
- //! Set the value and errors on the parameter
- /*!
- \param [in] newValue the value of the parameter
- \param [in] newError the error on the parameter
- \param [in] newNegError the lower error on the parameter (default set to zero)
- \param [in] newPosError the upper error on the parameter (default set to zero)
- */
- void valueAndErrors(Double_t newValue, Double_t newError, Double_t newNegError = 0.0, Double_t newPosError = 0.0);
-
- //! Set the global correlation coefficient
- /*!
- \param [in] newGCCValue the value of the coefficient
- */
- void globalCorrelationCoeff(Double_t newGCCValue);
-
- //! Set the generated value for the parameter
- /*!
- \param [in] newGenValue the generated value for the parameter
- */
- void genValue(Double_t newGenValue);
-
- //! Set the inital value for the parameter
- /*!
- \param [in] newInitValue the initial value for the parameter
- */
- void initValue(Double_t newInitValue);
-
- //! Set the minimum value for the parameter
- /*!
- \param [in] newMinValue the minimum value for the parameter
- */
- void minValue(Double_t newMinValue);
-
- //! Set the maximum value for the parameter
- /*!
- \param [in] newMaxValue the maximum value for the parameter
- */
- void maxValue(Double_t newMaxValue);
-
- //! Set the range for the parameter
- /*!
- \param [in] newMinValue the minimum value for the parameter
- \param [in] newMaxValue the maximum value for the parameter
- */
- void range(Double_t newMinValue, Double_t newMaxValue);
-
- //! Set the value and range for the parameter
- /*!
- \param [in] newValue the value of the parameter
- \param [in] newMinValue the minimum value for the parameter
- \param [in] newMaxValue the maximum value for the parameter
- */
- void valueAndRange(Double_t newValue, Double_t newMinValue, Double_t newMaxValue);
-
- //! Fix or float the given parameter
- /*!
- \param [in] parFixed boolean flag to fix or float the parameter
- */
- void fixed(Bool_t parFixed);
-
- //! Set parameter as second-stage or not of the fit
- /*!
- \param [in] secondStagePar boolean flag to check whether is a second-stage parameter
- */
- void secondStage(Bool_t secondStagePar);
-
- //! Add a Gaussian constraint (or modify an existing one)
- /*!
- \param [in] newGaussMean the new value of the Gaussian constraint mean
- \param [in] newGaussWidth the new value of the Gaussian constraint width
- */
- void addGaussianConstraint(Double_t newGaussMean, Double_t newGaussWidth);
-
- //! Remove the Gaussian constraint
- void removeGaussianConstraint();
-
- //! Generate per-experiment constraint mean
- void generateConstraintMean();
-
- //! Blind the parameter
- /*!
- See LauBlind documentation for details of blinding procedure
-
- \param [in] blindingString the unique blinding string used to seed the random number generator
- \param [in] width the width of the Gaussian from which the offset should be sampled
- */
- void blindParameter(const TString& blindingString, const Double_t width);
-
- // functions for the cloning mechanism
-
- //! Check whether is a clone or not
- /*!
- \return true/false whether is a clone
- */
- inline Bool_t clone() const {return clone_;}
-
- //! Method to create a clone from the parent parameter using the copy constructor
- /*!
- \param [in] constFactor the optional constant factor by which the clone shold be multiplied
- \return the cloned parameter
- */
- LauParameter* createClone(Double_t constFactor = 1.0);
-
- //! Method to create a clone from the parent parameter using the copy constructor and setting a new name
- /*!
- \param [in] newName the new name of the cloned parameter
- \param [in] constFactor the optional constant factor by which the clone shold be multiplied
- \return the cloned parameter
- */
- LauParameter* createClone(const TString& newName, Double_t constFactor = 1.0);
-
- //! The parent parameter
- /*!
- \return the parent parameter
- */
- inline LauParameter* parent() const {return parent_;}
-
- //! Call to update the bias and pull values
- void updatePull();
-
- //! Randomise the value of the parameter (if it is floating).
- /*!
- The pre-defined parameter range is used as the randomisation range.
- */
- void randomiseValue();
-
- //! Randomise the value of the parameter (if it is floating).
- /*!
- Use the given range unless either of the given values are
- outside the range of the parameter, in which case that value
- will be altered to the current max or min.
-
- \param [in] minVal the minimum value for the parameter
- \param [in] maxVal the maximum value for the parameter
- */
- void randomiseValue(Double_t minVal, Double_t maxVal);
-
- protected:
- //! Method to check whether value provided is within the range and that the minimum and maximum limits make sense
- /*!
- \param [in] val the value of the parameter
- \param [in] minVal the minimum value allowed
- \param [in] maxVal the maximum value allowed
- */
- void checkRange(Double_t val, Double_t minVal, Double_t maxVal);
-
- //! Method to check whether value provided is whithin the range and that the minimum and maximum limits make sense
- inline void checkRange()
- {
- this->checkRange(this->value(),this->minValue(),this->maxValue());
- }
-
- //! Mark this as a clone of the given parent
- /*!
- \param theparent the parent parameter
- */
- inline void clone(LauParameter* theparent) {
- parent_ = theparent;
- clone_ = (parent_==0) ? kFALSE : kTRUE;
- }
-
- //! Method to clear the clone parameters
- inline void wipeClones() {clones_.clear();}
-
- //! Method to update clone values
- /*!
- \param [in] justValue boolean flag to determine whether it is necessary to update all the parameter settings or only its value.
- */
- void updateClones(Bool_t justValue);
-
- private:
- //! LauFitNtuple is a friend class
- friend class LauFitNtuple;
-
- //! LauFitObject is a friend class
- friend class LauFitObject;
-
- //! The parameter name
- TString name_;
-
- //! The parameter value
- Double_t value_;
-
- //! The error on the parameter
- Double_t error_;
- //! The lower error on the parameter
- Double_t negError_;
- //! The upper error on the parameter
- Double_t posError_;
-
- //! Toy generation value
- Double_t genValue_;
-
- //! Initial fit value
- Double_t initValue_;
- //! Minimum value for the parameter
- Double_t minValue_;
- //! Maximum value for the parameter
- Double_t maxValue_;
-
- //! Fix/float option for parameter
- Bool_t fixed_;
- //! Flag whether it is floated only in the second stage of the fit
- Bool_t secondStage_;
-
- //! Choice to use Gaussian constraint
- Bool_t gaussConstraint_;
- //! True mean of the Gaussian constraint
- Double_t constraintTrueMean_;
- //! Mean value of the Gaussian constraint
- Double_t constraintMean_;
- //! Width of the Gaussian constraint
- Double_t constraintWidth_;
-
- //! Global correlation coefficient
- Double_t gcc_;
-
- //! Parameter bias
- Double_t bias_;
- //! Parameter pull
- Double_t pull_;
-
- //! Flag whether the parameter is a clone
- Bool_t clone_;
-
- //! The parent parameter
- LauParameter* parent_;
-
- //! The clones of this parameter
- std::map<LauParameter*, Double_t> clones_;
-
- //! The blinding engine
- LauBlind* blinder_;
-
- ClassDef(LauParameter, 4)
-
+ public:
+ //! Default constructor
+ LauParameter();
+
+ //! Constructor for named parameter
+ /*!
+ \param [in] parName the parameter name
+ */
+ explicit LauParameter( const TString& parName );
+
+ //! Constructor for parameter value
+ /*!
+ \param [in] parValue the parameter value
+ */
+ explicit LauParameter( Double_t parValue );
+
+ //! Constructor double limit parameter
+ /*!
+ \param [in] parValue the parameter value
+ \param [in] min the minimum value of the parameter
+ \param [in] max the maximum value of the parameter
+ */
+ LauParameter( Double_t parValue, Double_t min, Double_t max );
+
+ //! Constructor double limit fixed parameter
+ /*!
+ \param [in] parValue the parameter value
+ \param [in] min the minimum value of the parameter
+ \param [in] max the maximum value of the parameter
+ \param [in] parFixed boolean flag to fix or float parameter
+ */
+ LauParameter( Double_t parValue, Double_t min, Double_t max, Bool_t parFixed );
+
+ //! Constructor for double error and limit parameter
+ /*!
+ \param [in] parValue the parameter value
+ \param [in] parError the parameter error
+ \param [in] min the minimum value of the parameter
+ \param [in] max the maximum value of the parameter
+ */
+ LauParameter( Double_t parValue, Double_t parError, Double_t min, Double_t max );
+
+ //! Constructor for parameter value and name
+ /*!
+ \param [in] parName the parameter name
+ \param [in] parValue the parameter value
+ */
+ LauParameter( const TString& parName, Double_t parValue );
+
+ //! Constructor double limit parameter and name
+ /*!
+ \param [in] parName the parameter name
+ \param [in] parValue the parameter value
+ \param [in] min the minimum value of the parameter
+ \param [in] max the maximum value of the parameter
+ */
+ LauParameter( const TString& parName, Double_t parValue, Double_t min, Double_t max );
+
+ //! Constructor double limit fixed parameter and name
+ /*!
+ \param [in] parName the parameter name
+ \param [in] parValue the parameter value
+ \param [in] min the minimum value of the parameter
+ \param [in] max the maximum value of the parameter
+ \param [in] parFixed boolean flag to fix (kTRUE) or float (kFALSE) the parameter
+ */
+ LauParameter( const TString& parName, Double_t parValue, Double_t min, Double_t max, Bool_t parFixed );
+
+ //! Constructor double error and limit parameter and name
+ /*!
+ \param [in] parName the parameter name
+ \param [in] parValue the parameter value
+ \param [in] parError the parameter error
+ \param [in] min the minimum value of the parameter
+ \param [in] max the maximum value of the parameter
+ */
+ LauParameter( const TString& parName,
+ Double_t parValue,
+ Double_t parError,
+ Double_t min,
+ Double_t max );
+
+ // Destructor
+ virtual ~LauParameter();
+
+ //! Copy constructor
+ /*!
+ \param [in] rhs the parameter to be copied
+ */
+ LauParameter( const LauParameter& rhs );
+
+ //! Copy assignment operator
+ /*!
+ \param [in] rhs the parameter to be copied
+ */
+ LauParameter& operator=( const LauParameter& rhs );
+
+ // the simple accessor functions
+
+ //! The parameter name
+ /*!
+ \return the name of the parameter
+ */
+ inline const TString& name() const { return name_; }
+
+ //! The blinding state
+ /*!
+ \return the blinding state: kTRUE means that it is blinded, kFALSE that it is not blinded
+ */
+ inline Bool_t blind() const { return ( blinder_ != 0 ); }
+
+ //! Access the blinder object
+ /*!
+ \return the blinder
+ */
+ inline const LauBlind* blinder() const { return blinder_; }
+
+ //! The value of the parameter
+ /*!
+ \return the value of the parameter
+ */
+ inline Double_t value() const { return value_; }
+
+ //! The unblinded value of the parameter
+ /*!
+ \return the unblinded value of the parameter
+ */
+ inline Double_t unblindValue() const
+ {
+ return ( blinder_ == 0 ) ? value_ : blinder_->unblind( value_ );
+ }
+
+ //! The error on the parameter
+ /*!
+ \return the error on the parameter
+ */
+ inline Double_t error() const { return error_; }
+
+ //! The lower error on the parameter
+ /*!
+ \return the lower error on the parameter
+ */
+ inline Double_t negError() const { return negError_; }
+
+ //! The upper error on the parameter
+ /*!
+ \return the upper error on the parameter
+ */
+ inline Double_t posError() const { return posError_; }
+
+ //! The value generated for the parameter
+ /*!
+ \return the value generated for the parameter
+ */
+ inline Double_t genValue() const { return genValue_; }
+
+ //! The initial value of the parameter
+ /*!
+ \return the initial value of the parameter given to the fitter
+ */
+ inline Double_t initValue() const { return initValue_; }
+
+ //! The minimum value allowed for the parameter
+ /*!
+ \return the minimum value allowed for the parameter
+ */
+ inline Double_t minValue() const { return minValue_; }
+
+ //! The maximum value allowed for the parameter
+ /*!
+ \return the maximum value allowed for the parameter
+ */
+ inline Double_t maxValue() const { return maxValue_; }
+
+ //! The range allowed for the parameter
+ /*!
+ \return the range allowed for the parameters, defined as the difference between the max and min value
+ */
+ inline Double_t range() const { return this->maxValue() - this->minValue(); }
+
+ //! Check whether the parameter is fixed or floated
+ /*!
+ \return the boolean flag true/false whether the parameter is fixed
+ */
+ inline Bool_t fixed() const { return fixed_; }
+
+ //! Check whether the parameter should be floated only in the second stage of a two stage fit
+ /*!
+ \return the boolean flag true/false whether it floats only in the second stage
+ */
+ inline Bool_t secondStage() const { return secondStage_; }
+
+ //! Check whether a Gaussian constraints is applied
+ /*!
+ \return the boolean flag true/false whether a Gaussian constraint is applied
+ */
+ inline Bool_t gaussConstraint() const { return gaussConstraint_; }
+
+ //! The penalty term from the Gaussian constraint
+ /*!
+ \return the penalty term from the Gaussian constraint
+ */
+ Double_t constraintPenalty() const;
+
+ //! The parameter global correlation coefficient
+ /*!
+ \return the global correlation coefficient
+ */
+ inline Double_t globalCorrelationCoeff() const { return gcc_; }
+
+ //! The bias in the parameter
+ /*!
+ \return the bias in the parameter, defined as the difference between the value and the generated value
+ */
+ inline Double_t bias() const { return bias_; }
+
+ //! The pull value for the parameter
+ /*!
+ \return the pull value for the parameter, defined as the bias divided by the error
+ */
+ inline Double_t pull() const { return pull_; }
+
+ //! Boolean to say it is an L value
+ /*!
+ \return kTRUE, LauParameters are L values
+ */
+ inline Bool_t isLValue() const { return kTRUE; }
+
+ //! Get the LauParameter itself
+ /*!
+ \return a vector of the LauParameter
+ */
+ std::vector<LauParameter*> getPars();
+
+ // the simple "setter" functions
+
+ //! Set the parameter name
+ /*!
+ \param [in] newName the name of the parameter
+ */
+ void name( const TString& newName );
+
+ //! Set the value of the parameter
+ /*!
+ \param [in] newValue the value of the parameter
+ */
+ void value( Double_t newValue );
+
+ //! Set the error on the parameter
+ /*!
+ \param [in] newError the error on the parameter
+ */
+ void error( Double_t newError );
+
+ //! Set the lower error on the parameter
+ /*!
+ \param [in] newNegError the lower error on the parameter
+ */
+ void negError( Double_t newNegError );
+
+ //! Set the upper error on the parameter
+ /*!
+ \param [in] newPosError the upper error on the parameter
+ */
+ void posError( Double_t newPosError );
+
+ //! Set the error values on the parameter
+ /*!
+ \param [in] newError the error on the parameter
+ \param [in] newNegError the lower error on the parameter
+ \param [in] newPosError the upper error on the parameter
+ */
+ void errors( Double_t newError, Double_t newNegError, Double_t newPosError );
+
+ //! Set the value and errors on the parameter
+ /*!
+ \param [in] newValue the value of the parameter
+ \param [in] newError the error on the parameter
+ \param [in] newNegError the lower error on the parameter (default set to zero)
+ \param [in] newPosError the upper error on the parameter (default set to zero)
+ */
+ void valueAndErrors( Double_t newValue,
+ Double_t newError,
+ Double_t newNegError = 0.0,
+ Double_t newPosError = 0.0 );
+
+ //! Set the global correlation coefficient
+ /*!
+ \param [in] newGCCValue the value of the coefficient
+ */
+ void globalCorrelationCoeff( Double_t newGCCValue );
+
+ //! Set the generated value for the parameter
+ /*!
+ \param [in] newGenValue the generated value for the parameter
+ */
+ void genValue( Double_t newGenValue );
+
+ //! Set the inital value for the parameter
+ /*!
+ \param [in] newInitValue the initial value for the parameter
+ */
+ void initValue( Double_t newInitValue );
+
+ //! Set the minimum value for the parameter
+ /*!
+ \param [in] newMinValue the minimum value for the parameter
+ */
+ void minValue( Double_t newMinValue );
+
+ //! Set the maximum value for the parameter
+ /*!
+ \param [in] newMaxValue the maximum value for the parameter
+ */
+ void maxValue( Double_t newMaxValue );
+
+ //! Set the range for the parameter
+ /*!
+ \param [in] newMinValue the minimum value for the parameter
+ \param [in] newMaxValue the maximum value for the parameter
+ */
+ void range( Double_t newMinValue, Double_t newMaxValue );
+
+ //! Set the value and range for the parameter
+ /*!
+ \param [in] newValue the value of the parameter
+ \param [in] newMinValue the minimum value for the parameter
+ \param [in] newMaxValue the maximum value for the parameter
+ */
+ void valueAndRange( Double_t newValue, Double_t newMinValue, Double_t newMaxValue );
+
+ //! Fix or float the given parameter
+ /*!
+ \param [in] parFixed boolean flag to fix or float the parameter
+ */
+ void fixed( Bool_t parFixed );
+
+ //! Set parameter as second-stage or not of the fit
+ /*!
+ \param [in] secondStagePar boolean flag to check whether is a second-stage parameter
+ */
+ void secondStage( Bool_t secondStagePar );
+
+ //! Add a Gaussian constraint (or modify an existing one)
+ /*!
+ \param [in] newGaussMean the new value of the Gaussian constraint mean
+ \param [in] newGaussWidth the new value of the Gaussian constraint width
+ */
+ void addGaussianConstraint( Double_t newGaussMean, Double_t newGaussWidth );
+
+ //! Remove the Gaussian constraint
+ void removeGaussianConstraint();
+
+ //! Generate per-experiment constraint mean
+ void generateConstraintMean();
+
+ //! Blind the parameter
+ /*!
+ See LauBlind documentation for details of blinding procedure
+
+ \param [in] blindingString the unique blinding string used to seed the random number generator
+ \param [in] width the width of the Gaussian from which the offset should be sampled
+ */
+ void blindParameter( const TString& blindingString, const Double_t width );
+
+ // functions for the cloning mechanism
+
+ //! Check whether is a clone or not
+ /*!
+ \return true/false whether is a clone
+ */
+ inline Bool_t clone() const { return clone_; }
+
+ //! Method to create a clone from the parent parameter using the copy constructor
+ /*!
+ \param [in] constFactor the optional constant factor by which the clone shold be multiplied
+ \return the cloned parameter
+ */
+ LauParameter* createClone( Double_t constFactor = 1.0 );
+
+ //! Method to create a clone from the parent parameter using the copy constructor and setting a new name
+ /*!
+ \param [in] newName the new name of the cloned parameter
+ \param [in] constFactor the optional constant factor by which the clone shold be multiplied
+ \return the cloned parameter
+ */
+ LauParameter* createClone( const TString& newName, Double_t constFactor = 1.0 );
+
+ //! The parent parameter
+ /*!
+ \return the parent parameter
+ */
+ inline LauParameter* parent() const { return parent_; }
+
+ //! Call to update the bias and pull values
+ void updatePull();
+
+ //! Randomise the value of the parameter (if it is floating).
+ /*!
+ The pre-defined parameter range is used as the randomisation range.
+ */
+ void randomiseValue();
+
+ //! Randomise the value of the parameter (if it is floating).
+ /*!
+ Use the given range unless either of the given values are
+ outside the range of the parameter, in which case that value
+ will be altered to the current max or min.
+
+ \param [in] minVal the minimum value for the parameter
+ \param [in] maxVal the maximum value for the parameter
+ */
+ void randomiseValue( Double_t minVal, Double_t maxVal );
+
+ protected:
+ //! Method to check whether value provided is within the range and that the minimum and maximum limits make sense
+ /*!
+ \param [in] val the value of the parameter
+ \param [in] minVal the minimum value allowed
+ \param [in] maxVal the maximum value allowed
+ */
+ void checkRange( Double_t val, Double_t minVal, Double_t maxVal );
+
+ //! Method to check whether value provided is whithin the range and that the minimum and maximum limits make sense
+ inline void checkRange()
+ {
+ this->checkRange( this->value(), this->minValue(), this->maxValue() );
+ }
+
+ //! Mark this as a clone of the given parent
+ /*!
+ \param theparent the parent parameter
+ */
+ inline void clone( LauParameter* theparent )
+ {
+ parent_ = theparent;
+ clone_ = ( parent_ == 0 ) ? kFALSE : kTRUE;
+ }
+
+ //! Method to clear the clone parameters
+ inline void wipeClones() { clones_.clear(); }
+
+ //! Method to update clone values
+ /*!
+ \param [in] justValue boolean flag to determine whether it is necessary to update all the parameter settings or only its value.
+ */
+ void updateClones( Bool_t justValue );
+
+ private:
+ //! LauFitNtuple is a friend class
+ friend class LauFitNtuple;
+
+ //! LauFitObject is a friend class
+ friend class LauFitObject;
+
+ //! The parameter name
+ TString name_;
+
+ //! The parameter value
+ Double_t value_;
+
+ //! The error on the parameter
+ Double_t error_;
+ //! The lower error on the parameter
+ Double_t negError_;
+ //! The upper error on the parameter
+ Double_t posError_;
+
+ //! Toy generation value
+ Double_t genValue_;
+
+ //! Initial fit value
+ Double_t initValue_;
+ //! Minimum value for the parameter
+ Double_t minValue_;
+ //! Maximum value for the parameter
+ Double_t maxValue_;
+
+ //! Fix/float option for parameter
+ Bool_t fixed_;
+ //! Flag whether it is floated only in the second stage of the fit
+ Bool_t secondStage_;
+
+ //! Choice to use Gaussian constraint
+ Bool_t gaussConstraint_;
+ //! True mean of the Gaussian constraint
+ Double_t constraintTrueMean_;
+ //! Mean value of the Gaussian constraint
+ Double_t constraintMean_;
+ //! Width of the Gaussian constraint
+ Double_t constraintWidth_;
+
+ //! Global correlation coefficient
+ Double_t gcc_;
+
+ //! Parameter bias
+ Double_t bias_;
+ //! Parameter pull
+ Double_t pull_;
+
+ //! Flag whether the parameter is a clone
+ Bool_t clone_;
+
+ //! The parent parameter
+ LauParameter* parent_;
+
+ //! The clones of this parameter
+ std::map<LauParameter*, Double_t> clones_;
+
+ //! The blinding engine
+ LauBlind* blinder_;
+
+ ClassDef( LauParameter, 4 )
};
//! Output stream operator
-std::ostream& operator << (std::ostream& stream, const LauParameter& par);
+std::ostream& operator<<( std::ostream& stream, const LauParameter& par );
//! Type to define an array of parameters
-typedef std::vector< std::vector<LauParameter> > LauParArray;
+typedef std::vector<std::vector<LauParameter>> LauParArray;
#endif
diff --git a/inc/LauParametricStepFuncPdf.hh b/inc/LauParametricStepFuncPdf.hh
index 2243240..655a7ba 100644
--- a/inc/LauParametricStepFuncPdf.hh
+++ b/inc/LauParametricStepFuncPdf.hh
@@ -1,131 +1,132 @@
/*
Copyright 2008 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauParametricStepFuncPdf.hh
\brief File containing declaration of LauParametricStepFuncPdf class.
*/
/*! \class LauParametricStepFuncPdf
\brief Class for defining a Parametric Step Function PDF.
Class that allows the user to define a Parametric Step Function PDF.
Code mostly copied from RooFit/RooParametricStepFunction.
*/
/*****************************************************************************
* Class based on RooFit/RooParametricStepFunction. *
* Original copyright given below. *
*****************************************************************************
* Authors: *
* WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
* DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
* *
* Copyright (c) 2000-2005, Regents of the University of California *
* and Stanford University. All rights reserved. *
* *
* Redistribution and use in source and binary forms, *
* with or without modification, are permitted according to the terms *
* listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
*****************************************************************************/
-
#ifndef LAU_PAR_STEP_FUNC_PDF
#define LAU_PAR_STEP_FUNC_PDF
-#include <vector>
+#include "LauAbsPdf.hh"
#include "TString.h"
-#include "LauAbsPdf.hh"
+#include <vector>
class LauParameter;
-
class LauParametricStepFuncPdf : public LauAbsPdf {
- public:
- //! Define the allowed options for the normalisation bin
- enum NormBin {
- First, /*!< The height of the first bin is determined from the rest to satisfy the normalisation */
- Last /*!< The height of the last bin is determined from the rest to satisfy the normalisation */
- };
-
- //! Constructor
- /*!
- \param [in] theVarName the name of the abscissa variable
- \param [in] params the bin contents of all the but the normalisation bin, so (N_bins - 1 entries)
- \param [in] limits the limits of the bins (lower limit of all bins and upper limit of the last), so (N_bins + 1) entries
- \param [in] normalisationBin the normalisation bin
- */
- LauParametricStepFuncPdf(const TString& theVarName, const std::vector<LauAbsRValue*>& params, const std::vector<Double_t>& limits, NormBin normalisationBin = Last);
-
- //! Destructor
- virtual ~LauParametricStepFuncPdf();
-
- //! Calculate the likelihood (and intermediate info) for a given abscissa
- /*!
- \param [in] abscissas the values of the abscissa(s)
- */
- virtual void calcLikelihoodInfo(const LauAbscissas& abscissas);
-
- using LauAbsPdf::calcLikelihoodInfo;
-
- //! Calculate the normalisation
- virtual void calcNorm();
-
- //! Calculate the PDF height
- /*!
- \param [in] kinematics the current DP kinematics
- */
- virtual void calcPDFHeight( const LauKinematics* kinematics );
-
- protected:
- //! Number of bins
- /*!
- \return the number of bins
- */
- UInt_t nBins() const {return limits_.size()-1;}
-
- //! Normalisation bin
- /*!
- \return the normalisation bin
- */
- NormBin normBin() const {return normBin_;}
-
- private:
- //! Copy constructor (not implemented)
- LauParametricStepFuncPdf(const LauParametricStepFuncPdf& rhs);
-
- //! Copy assignment operator (not implemented)
- LauParametricStepFuncPdf& operator=(const LauParametricStepFuncPdf& rhs);
-
- //! normalisation bin
- NormBin normBin_;
- //! limits of the bins
- std::vector<Double_t> limits_;
-
- ClassDef(LauParametricStepFuncPdf,0) // Define the PSF PDF
+ public:
+ //! Define the allowed options for the normalisation bin
+ enum NormBin {
+ First, /*!< The height of the first bin is determined from the rest to satisfy the normalisation */
+ Last /*!< The height of the last bin is determined from the rest to satisfy the normalisation */
+ };
+
+ //! Constructor
+ /*!
+ \param [in] theVarName the name of the abscissa variable
+ \param [in] params the bin contents of all the but the normalisation bin, so (N_bins - 1 entries)
+ \param [in] limits the limits of the bins (lower limit of all bins and upper limit of the last), so (N_bins + 1) entries
+ \param [in] normalisationBin the normalisation bin
+ */
+ LauParametricStepFuncPdf( const TString& theVarName,
+ const std::vector<LauAbsRValue*>& params,
+ const std::vector<Double_t>& limits,
+ NormBin normalisationBin = Last );
+
+ //! Destructor
+ virtual ~LauParametricStepFuncPdf();
+
+ //! Calculate the likelihood (and intermediate info) for a given abscissa
+ /*!
+ \param [in] abscissas the values of the abscissa(s)
+ */
+ virtual void calcLikelihoodInfo( const LauAbscissas& abscissas );
+
+ using LauAbsPdf::calcLikelihoodInfo;
+
+ //! Calculate the normalisation
+ virtual void calcNorm();
+
+ //! Calculate the PDF height
+ /*!
+ \param [in] kinematics the current DP kinematics
+ */
+ virtual void calcPDFHeight( const LauKinematics* kinematics );
+
+ protected:
+ //! Number of bins
+ /*!
+ \return the number of bins
+ */
+ UInt_t nBins() const { return limits_.size() - 1; }
+
+ //! Normalisation bin
+ /*!
+ \return the normalisation bin
+ */
+ NormBin normBin() const { return normBin_; }
+
+ private:
+ //! Copy constructor (not implemented)
+ LauParametricStepFuncPdf( const LauParametricStepFuncPdf& rhs );
+
+ //! Copy assignment operator (not implemented)
+ LauParametricStepFuncPdf& operator=( const LauParametricStepFuncPdf& rhs );
+
+ //! normalisation bin
+ NormBin normBin_;
+ //! limits of the bins
+ std::vector<Double_t> limits_;
+
+ ClassDef( LauParametricStepFuncPdf, 0 ) // Define the PSF PDF
};
#endif
diff --git a/inc/LauParticlePDG.hh b/inc/LauParticlePDG.hh
index b1c47e5..216e35e 100644
--- a/inc/LauParticlePDG.hh
+++ b/inc/LauParticlePDG.hh
@@ -1,189 +1,188 @@
/*
Copyright 2008 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauParticlePDG.hh
\brief File containing declaration of LauParticlePDG class.
*/
/*! \class LauParticlePDG
\brief Class for storing particle properties
Class that provides the properties of particles, including mapping particles and their anti-particles.
*/
#ifndef LAU_PARTICLE_PDG
#define LAU_PARTICLE_PDG
#include "TMath.h"
#include "TString.h"
class TParticlePDG;
class LauParticlePDG {
- public:
- //! Destructor
- virtual ~LauParticlePDG();
-
- //! Method to access the record for the charge conjugate of this particle
- /*!
- \return pointer to the anti-particle
- */
- const LauParticlePDG* antiParticle() const { return antiParticle_; }
-
- //! The particle PDG code
- /*!
- \return the PDG code of the particle
- */
- Int_t code() const;
-
- //! The anti-particle PDG code
- /*!
- \return the PDG code of the charge conjugate of the particle
- */
- Int_t conjugateCode() const;
-
- //! The PDG code for the particle/antiparticle
- /*!
- \return the modulus of the PDG code of the particle
- */
- Int_t type() const { return TMath::Abs( this->code() ); }
-
- //! The charge of the particle
- /*!
- \return the charge of the particle
- */
- Int_t charge() const;
-
- //! The mass of the particle
- /*!
- \return the mass of the particle
- */
- Double_t mass() const { return mass_; }
-
- //! The mass square of the particle
- /*!
- \return the mass square of the particle
- */
- Double_t massSq() const { return mass_*mass_; }
-
- //! Check whether the particle is a kaon (K+, K-, K0, K0bar, KS or KL)
- /*!
- \return true if the particle is a kaon, false otherwise
- */
- Bool_t isKaon() const { return kaon_; }
-
- //! Check whether the particle is a pion (pi+, pi- or pi0)
- /*!
- \return true if the particle is a pion, false otherwise
- */
- Bool_t isPion() const { return pion_; }
-
- //! Check whether the particle is a KS
- /*!
- \return true if the particle is a KS, false otherwise
- */
- Bool_t isKs() const { return ks_; }
-
- //! Check whether the particle is a pi0
- /*!
- \return true if the particle is a pi0, false otherwise
- */
- Bool_t isPi0() const { return pi0_; }
-
- //! Check whether the particle is a D
- /*!
- \return true if the particle is a D, false otherwise
- */
- Bool_t isD() const { return D_; }
-
- //! Check whether the particle is a B
- /*!
- \return true if the particle is a B, false otherwise
- */
- Bool_t isB() const { return B_; }
-
- //! Particle name
- /*!
- \return the name of the particle
- */
- TString string() const;
-
- //! Particle name, containing only alphanumeric characters
- /*!
- \return the name of the particle, removing all non-alphanumeric characters
- */
- TString stringAlphaNum() const;
-
- protected:
-
- private:
- //! LauDataBasePDG is a friend class
- friend class LauDatabasePDG;
-
- //! Constructor
- /*!
- \param [in] particle the particle
- */
- explicit LauParticlePDG(const TParticlePDG* particle);
-
- //! Copy constructor (not implemented)
- LauParticlePDG(const LauParticlePDG& rhs);
-
- //! Copy assignment operator (not implemented)
- LauParticlePDG& operator=(const LauParticlePDG& rhs);
-
- //! Set the antiparticle
- /*!
- \param [in] antiPart the antiparticle
- */
- void setAntiParticle( const LauParticlePDG* antiPart ) { antiParticle_ = antiPart; }
-
- //! The particle
- const TParticlePDG* theParticle_;
-
- //!The antiparticle
- const LauParticlePDG* antiParticle_;
-
- //! The mass of the particle
- Double_t mass_;
-
- //! Flag whether the particle is a kaon
- Bool_t kaon_;
- //! Flag whether the particle is a pion
- Bool_t pion_;
- //! Flag whether the particle is a KS
- Bool_t ks_;
- //! Flag whether the particle is a pi0
- Bool_t pi0_;
- //! Flag whether the particle is a D
- Bool_t D_;
- //! Flag whether the particle is a B
- Bool_t B_;
-
- ClassDef(LauParticlePDG,0)
-
+ public:
+ //! Destructor
+ virtual ~LauParticlePDG();
+
+ //! Method to access the record for the charge conjugate of this particle
+ /*!
+ \return pointer to the anti-particle
+ */
+ const LauParticlePDG* antiParticle() const { return antiParticle_; }
+
+ //! The particle PDG code
+ /*!
+ \return the PDG code of the particle
+ */
+ Int_t code() const;
+
+ //! The anti-particle PDG code
+ /*!
+ \return the PDG code of the charge conjugate of the particle
+ */
+ Int_t conjugateCode() const;
+
+ //! The PDG code for the particle/antiparticle
+ /*!
+ \return the modulus of the PDG code of the particle
+ */
+ Int_t type() const { return TMath::Abs( this->code() ); }
+
+ //! The charge of the particle
+ /*!
+ \return the charge of the particle
+ */
+ Int_t charge() const;
+
+ //! The mass of the particle
+ /*!
+ \return the mass of the particle
+ */
+ Double_t mass() const { return mass_; }
+
+ //! The mass square of the particle
+ /*!
+ \return the mass square of the particle
+ */
+ Double_t massSq() const { return mass_ * mass_; }
+
+ //! Check whether the particle is a kaon (K+, K-, K0, K0bar, KS or KL)
+ /*!
+ \return true if the particle is a kaon, false otherwise
+ */
+ Bool_t isKaon() const { return kaon_; }
+
+ //! Check whether the particle is a pion (pi+, pi- or pi0)
+ /*!
+ \return true if the particle is a pion, false otherwise
+ */
+ Bool_t isPion() const { return pion_; }
+
+ //! Check whether the particle is a KS
+ /*!
+ \return true if the particle is a KS, false otherwise
+ */
+ Bool_t isKs() const { return ks_; }
+
+ //! Check whether the particle is a pi0
+ /*!
+ \return true if the particle is a pi0, false otherwise
+ */
+ Bool_t isPi0() const { return pi0_; }
+
+ //! Check whether the particle is a D
+ /*!
+ \return true if the particle is a D, false otherwise
+ */
+ Bool_t isD() const { return D_; }
+
+ //! Check whether the particle is a B
+ /*!
+ \return true if the particle is a B, false otherwise
+ */
+ Bool_t isB() const { return B_; }
+
+ //! Particle name
+ /*!
+ \return the name of the particle
+ */
+ TString string() const;
+
+ //! Particle name, containing only alphanumeric characters
+ /*!
+ \return the name of the particle, removing all non-alphanumeric characters
+ */
+ TString stringAlphaNum() const;
+
+ protected:
+
+ private:
+ //! LauDataBasePDG is a friend class
+ friend class LauDatabasePDG;
+
+ //! Constructor
+ /*!
+ \param [in] particle the particle
+ */
+ explicit LauParticlePDG( const TParticlePDG* particle );
+
+ //! Copy constructor (not implemented)
+ LauParticlePDG( const LauParticlePDG& rhs );
+
+ //! Copy assignment operator (not implemented)
+ LauParticlePDG& operator=( const LauParticlePDG& rhs );
+
+ //! Set the antiparticle
+ /*!
+ \param [in] antiPart the antiparticle
+ */
+ void setAntiParticle( const LauParticlePDG* antiPart ) { antiParticle_ = antiPart; }
+
+ //! The particle
+ const TParticlePDG* theParticle_;
+
+ //!The antiparticle
+ const LauParticlePDG* antiParticle_;
+
+ //! The mass of the particle
+ Double_t mass_;
+
+ //! Flag whether the particle is a kaon
+ Bool_t kaon_;
+ //! Flag whether the particle is a pion
+ Bool_t pion_;
+ //! Flag whether the particle is a KS
+ Bool_t ks_;
+ //! Flag whether the particle is a pi0
+ Bool_t pi0_;
+ //! Flag whether the particle is a D
+ Bool_t D_;
+ //! Flag whether the particle is a B
+ Bool_t B_;
+
+ ClassDef( LauParticlePDG, 0 )
};
#endif
diff --git a/inc/LauPolNR.hh b/inc/LauPolNR.hh
index 714104d..321abc6 100644
--- a/inc/LauPolNR.hh
+++ b/inc/LauPolNR.hh
@@ -1,106 +1,108 @@
/*
Copyright 2014 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauPolNR.hh
\brief File containing declaration of LauPolNR class.
*/
/*! \class LauPolNR
\brief Class for defining the terms of Babar nonresonant model.
Defines the nonresonant model from the Babar collaboration.
arXiv:1201.5897
*/
#ifndef LAU_POL_NR
#define LAU_POL_NR
-#include "TString.h"
-
-#include "LauComplex.hh"
#include "LauAbsResonance.hh"
+#include "LauComplex.hh"
-class LauKinematics;
+#include "TString.h"
+class LauKinematics;
class LauPolNR : public LauAbsResonance {
- public:
- //! Constructor
- /*!
- \param [in] resInfo the object containing information on the resonance name, mass, width, spin, charge, etc.
- \param [in] resPairAmpInt the number of the daughter not produced by the resonance
- \param [in] daughters the daughter particles
- */
- LauPolNR(LauResonanceInfo* resInfo, const Int_t resPairAmpInt, const LauDaughters* daughters);
-
- //! Destructor
- virtual ~LauPolNR();
-
- //! Initialise the model
- virtual void initialise();
-
- //! Get the resonance model type
- /*!
- \return the resonance model type
- */
- virtual LauAbsResonance::LauResonanceModel getResonanceModel() const {return LauAbsResonance::PolNR;}
-
- //! Set the parameter omega, the offset parameter
- /*!
- \param [in] omega the new offset parameter
- */
- virtual void setOmega(const Double_t omega) {omega_ = omega;}
-
- //! Get the offset parameter
- /*!
- \return the offset parameter
- */
- virtual Double_t getOmega() const {return omega_;}
-
- protected:
- //! Complex resonant amplitude
- /*!
- \param [in] mass appropriate invariant mass for the resonance
- \param [in] spinTerm spin term
- */
- virtual LauComplex resAmp(Double_t mass, Double_t spinTerm);
-
- private:
- //! Copy constructor (not implemented)
- LauPolNR(const LauPolNR& rhs);
-
- //! Copy assignment operator (not implemented)
- LauPolNR& operator=(const LauPolNR& rhs);
-
- //! The offset parameter
- Double_t omega_;
-
- //! The order in the mass
- UInt_t order_;
-
- ClassDef(LauPolNR,0) // Polynomial Non-resonant model
+ public:
+ //! Constructor
+ /*!
+ \param [in] resInfo the object containing information on the resonance name, mass, width, spin, charge, etc.
+ \param [in] resPairAmpInt the number of the daughter not produced by the resonance
+ \param [in] daughters the daughter particles
+ */
+ LauPolNR( LauResonanceInfo* resInfo, const Int_t resPairAmpInt, const LauDaughters* daughters );
+
+ //! Destructor
+ virtual ~LauPolNR();
+
+ //! Initialise the model
+ virtual void initialise();
+
+ //! Get the resonance model type
+ /*!
+ \return the resonance model type
+ */
+ virtual LauAbsResonance::LauResonanceModel getResonanceModel() const
+ {
+ return LauAbsResonance::PolNR;
+ }
+
+ //! Set the parameter omega, the offset parameter
+ /*!
+ \param [in] omega the new offset parameter
+ */
+ virtual void setOmega( const Double_t omega ) { omega_ = omega; }
+
+ //! Get the offset parameter
+ /*!
+ \return the offset parameter
+ */
+ virtual Double_t getOmega() const { return omega_; }
+
+ protected:
+ //! Complex resonant amplitude
+ /*!
+ \param [in] mass appropriate invariant mass for the resonance
+ \param [in] spinTerm spin term
+ */
+ virtual LauComplex resAmp( Double_t mass, Double_t spinTerm );
+
+ private:
+ //! Copy constructor (not implemented)
+ LauPolNR( const LauPolNR& rhs );
+
+ //! Copy assignment operator (not implemented)
+ LauPolNR& operator=( const LauPolNR& rhs );
+
+ //! The offset parameter
+ Double_t omega_;
+
+ //! The order in the mass
+ UInt_t order_;
+
+ ClassDef( LauPolNR, 0 ) // Polynomial Non-resonant model
};
#endif
diff --git a/inc/LauPolarFormFactorNR.hh b/inc/LauPolarFormFactorNR.hh
index 568da95..0cf69f2 100644
--- a/inc/LauPolarFormFactorNR.hh
+++ b/inc/LauPolarFormFactorNR.hh
@@ -1,142 +1,143 @@
/*
Copyright 2018 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauPolarFormFactorNR.hh
\brief File containing declaration of LauPolarFormFactorNR class.
*/
/*! \class LauPolarFormFactorNR
\brief Class for defining a nonresonant form factor model
Defines the nonresonant form factor model from:
- Nogueira, Bediaga, Cavalcante, Frederico, Lorenco: Phys. Rev. D92 (2015) 054010, arXiv:1506.08332 [hep-ph]
- Pelaez, Yndurain: Phys. Rev. D71 (2005) 074016, arXiv:hep-ph/0411334
+ Nogueira, Bediaga, Cavalcante, Frederico, Lorenco: Phys. Rev. D92 (2015) 054010, arXiv:1506.08332 [hep-ph]
+ Pelaez, Yndurain: Phys. Rev. D71 (2005) 074016, arXiv:hep-ph/0411334
*/
#ifndef LAU_POLAR_FORM_FACTOR_NR
#define LAU_POLAR_FORM_FACTOR_NR
-#include "TString.h"
-
-#include "LauComplex.hh"
#include "LauAbsResonance.hh"
+#include "LauComplex.hh"
+
+#include "TString.h"
class LauKinematics;
class LauParameter;
-
class LauPolarFormFactorNR : public LauAbsResonance {
- public:
- //! Constructor
- /*!
- \param [in] resInfo the object containing information on the resonance name, mass, width, spin, charge, etc.
- \param [in] resType the model of the resonance
- \param [in] resPairAmpInt the number of the daughter not produced by the resonance
- \param [in] daughters the daughter particles
- */
- LauPolarFormFactorNR(LauResonanceInfo* resInfo, const LauAbsResonance::LauResonanceModel resType,
- const Int_t resPairAmpInt, const LauDaughters* daughters);
-
- //! Destructor
- virtual ~LauPolarFormFactorNR();
-
- //! Initialise the model
- virtual void initialise();
-
- //! Get the resonance model type
- /*!
- \return the resonance model type
- */
- virtual LauAbsResonance::LauResonanceModel getResonanceModel() const {return model_;}
-
- //! Set value of the various parameters
- /*!
- \param [in] name the name of the parameter to be changed
- \param [in] value the new parameter value
- */
- virtual void setResonanceParameter(const TString& name, const Double_t value);
-
- //! Allow the various parameters to float in the fit
- /*!
- \param [in] name the name of the parameter to be floated
- */
- virtual void floatResonanceParameter(const TString& name);
-
- //! Access the given resonance parameter
- /*!
- \param [in] name the name of the parameter
- \return the corresponding parameter
- */
- virtual LauParameter* getResonanceParameter(const TString& name);
-
- //! Retrieve the resonance parameters, e.g. so that they can be loaded into a fit
- /*!
- \return floating parameters of the resonance
- */
- virtual const std::vector<LauParameter*>& getFloatingParameters();
-
- protected:
- //! Set the parameter lambda, the NR shape parameter
- /*!
- \param [in] lambda the NR shape parameter
- */
- void setLambda(const Double_t lambda);
-
- //! Get the parameter lambda, the NR shape parameter
- /*!
- \return lambda, the NR shape parameter
- */
- Double_t getLambda() const {return (lambda_!=0) ? lambda_->value() : 0.0;}
-
- //! See if the lambda parameter is fixed or floating
- /*!
- \return kTRUE if the lambda parameter is fixed, kFALSE otherwise
- */
- Bool_t fixLambda() const {return (lambda_!=0) ? lambda_->fixed() : kTRUE;}
-
- //! Complex resonant amplitude
- /*!
- \param [in] mass appropriate invariant mass for the resonance
- \param [in] spinTerm Zemach spin term
- */
- virtual LauComplex resAmp(Double_t mass, Double_t spinTerm);
-
- private:
- //! Copy constructor (not implemented)
- LauPolarFormFactorNR(const LauPolarFormFactorNR& rhs);
-
- //! Copy assignment operator (not implemented)
- LauPolarFormFactorNR& operator=(const LauPolarFormFactorNR& rhs);
-
- //! The NR shape parameter
- LauParameter* lambda_;
-
- //! The model to use
- LauAbsResonance::LauResonanceModel model_;
-
- ClassDef(LauPolarFormFactorNR,0)
+ public:
+ //! Constructor
+ /*!
+ \param [in] resInfo the object containing information on the resonance name, mass, width, spin, charge, etc.
+ \param [in] resType the model of the resonance
+ \param [in] resPairAmpInt the number of the daughter not produced by the resonance
+ \param [in] daughters the daughter particles
+ */
+ LauPolarFormFactorNR( LauResonanceInfo* resInfo,
+ const LauAbsResonance::LauResonanceModel resType,
+ const Int_t resPairAmpInt,
+ const LauDaughters* daughters );
+
+ //! Destructor
+ virtual ~LauPolarFormFactorNR();
+
+ //! Initialise the model
+ virtual void initialise();
+
+ //! Get the resonance model type
+ /*!
+ \return the resonance model type
+ */
+ virtual LauAbsResonance::LauResonanceModel getResonanceModel() const { return model_; }
+
+ //! Set value of the various parameters
+ /*!
+ \param [in] name the name of the parameter to be changed
+ \param [in] value the new parameter value
+ */
+ virtual void setResonanceParameter( const TString& name, const Double_t value );
+
+ //! Allow the various parameters to float in the fit
+ /*!
+ \param [in] name the name of the parameter to be floated
+ */
+ virtual void floatResonanceParameter( const TString& name );
+
+ //! Access the given resonance parameter
+ /*!
+ \param [in] name the name of the parameter
+ \return the corresponding parameter
+ */
+ virtual LauParameter* getResonanceParameter( const TString& name );
+
+ //! Retrieve the resonance parameters, e.g. so that they can be loaded into a fit
+ /*!
+ \return floating parameters of the resonance
+ */
+ virtual const std::vector<LauParameter*>& getFloatingParameters();
+
+ protected:
+ //! Set the parameter lambda, the NR shape parameter
+ /*!
+ \param [in] lambda the NR shape parameter
+ */
+ void setLambda( const Double_t lambda );
+
+ //! Get the parameter lambda, the NR shape parameter
+ /*!
+ \return lambda, the NR shape parameter
+ */
+ Double_t getLambda() const { return ( lambda_ != 0 ) ? lambda_->value() : 0.0; }
+
+ //! See if the lambda parameter is fixed or floating
+ /*!
+ \return kTRUE if the lambda parameter is fixed, kFALSE otherwise
+ */
+ Bool_t fixLambda() const { return ( lambda_ != 0 ) ? lambda_->fixed() : kTRUE; }
+
+ //! Complex resonant amplitude
+ /*!
+ \param [in] mass appropriate invariant mass for the resonance
+ \param [in] spinTerm Zemach spin term
+ */
+ virtual LauComplex resAmp( Double_t mass, Double_t spinTerm );
+
+ private:
+ //! Copy constructor (not implemented)
+ LauPolarFormFactorNR( const LauPolarFormFactorNR& rhs );
+
+ //! Copy assignment operator (not implemented)
+ LauPolarFormFactorNR& operator=( const LauPolarFormFactorNR& rhs );
+
+ //! The NR shape parameter
+ LauParameter* lambda_;
+
+ //! The model to use
+ LauAbsResonance::LauResonanceModel model_;
+
+ ClassDef( LauPolarFormFactorNR, 0 )
};
#endif
diff --git a/inc/LauPolarFormFactorSymNR.hh b/inc/LauPolarFormFactorSymNR.hh
index 111b3a2..27eef2f 100644
--- a/inc/LauPolarFormFactorSymNR.hh
+++ b/inc/LauPolarFormFactorSymNR.hh
@@ -1,150 +1,151 @@
/*
Copyright 2018 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauPolarFormFactorSymNR.hh
\brief File containing declaration of LauPolarFormFactorSymNR class.
*/
/*! \class LauPolarFormFactorSymNR
\brief Class for defining a nonresonant form factor model
Defines the nonresonant form factor model from:
- Nogueira, Bediaga, Cavalcante, Frederico, Lorenco: Phys. Rev. D92 (2015) 054010, arXiv:1506.08332 [hep-ph]
- Pelaez, Yndurain: Phys. Rev. D71 (2005) 074016, arXiv:hep-ph/0411334
+ Nogueira, Bediaga, Cavalcante, Frederico, Lorenco: Phys. Rev. D92 (2015) 054010, arXiv:1506.08332 [hep-ph]
+ Pelaez, Yndurain: Phys. Rev. D71 (2005) 074016, arXiv:hep-ph/0411334
modified for symmetric DPs.
*/
#ifndef LAU_POLAR_FORM_FACTOR_SYM_NR
#define LAU_POLAR_FORM_FACTOR_SYM_NR
-#include "TString.h"
-
-#include "LauComplex.hh"
#include "LauAbsResonance.hh"
+#include "LauComplex.hh"
+
+#include "TString.h"
class LauKinematics;
class LauParameter;
-
class LauPolarFormFactorSymNR : public LauAbsResonance {
- public:
- //! Constructor
- /*!
- \param [in] resInfo the object containing information on the resonance name, mass, width, spin, charge, etc.
- \param [in] resType the model of the resonance
- \param [in] resPairAmpInt the number of the daughter not produced by the resonance
- \param [in] daughters the daughter particles
- */
- LauPolarFormFactorSymNR(LauResonanceInfo* resInfo, const LauAbsResonance::LauResonanceModel resType,
- const Int_t resPairAmpInt, const LauDaughters* daughters);
-
- //! Destructor
- virtual ~LauPolarFormFactorSymNR();
-
- //! Initialise the model
- virtual void initialise();
-
- //! Get the complex dynamical amplitude
- /*!
- \param [in] kinematics the kinematic variables of the current event
- \return the complex amplitude
- */
- virtual LauComplex amplitude(const LauKinematics* kinematics);
-
- //! Get the resonance model type
- /*!
- \return the resonance model type
- */
- virtual LauAbsResonance::LauResonanceModel getResonanceModel() const {return model_;}
-
- //! Set value of the various parameters
- /*!
- \param [in] name the name of the parameter to be changed
- \param [in] value the new parameter value
- */
- virtual void setResonanceParameter(const TString& name, const Double_t value);
-
- //! Allow the various parameters to float in the fit
- /*!
- \param [in] name the name of the parameter to be floated
- */
- virtual void floatResonanceParameter(const TString& name);
-
- //! Access the given resonance parameter
- /*!
- \param [in] name the name of the parameter
- \return the corresponding parameter
- */
- virtual LauParameter* getResonanceParameter(const TString& name);
-
- //! Retrieve the resonance parameters, e.g. so that they can be loaded into a fit
- /*!
- \return floating parameters of the resonance
- */
- virtual const std::vector<LauParameter*>& getFloatingParameters();
-
- protected:
- //! Set the parameter lambda, the NR shape parameter
- /*!
- \param [in] lambda the NR shape parameter
- */
- void setLambda(const Double_t lambda);
-
- //! Get the parameter lambda, the NR shape parameter
- /*!
- \return lambda the NR shape parameter
- */
- Double_t getLambda() const {return (lambda_!=0) ? lambda_->value() : 0.0;}
-
- //! See if the lambda parameter is fixed or floating
- /*!
- \return kTRUE if the lambda parameter is fixed, kFALSE otherwise
- */
- Bool_t fixLambda() const {return (lambda_!=0) ? lambda_->fixed() : kTRUE;}
-
- //! Complex resonant amplitude
- /*!
- \param [in] mass appropriate invariant mass for the resonance
- \param [in] spinTerm Zemach spin term
- */
- virtual LauComplex resAmp(Double_t mass, Double_t spinTerm);
-
- private:
- //! Copy constructor (not implemented)
- LauPolarFormFactorSymNR(const LauPolarFormFactorSymNR& rhs);
-
- //! Copy assignment operator (not implemented)
- LauPolarFormFactorSymNR& operator=(const LauPolarFormFactorSymNR& rhs);
-
- //! The NR shape parameter
- LauParameter* lambda_;
-
- //! The model to use
- LauAbsResonance::LauResonanceModel model_;
-
- ClassDef(LauPolarFormFactorSymNR,0)
+ public:
+ //! Constructor
+ /*!
+ \param [in] resInfo the object containing information on the resonance name, mass, width, spin, charge, etc.
+ \param [in] resType the model of the resonance
+ \param [in] resPairAmpInt the number of the daughter not produced by the resonance
+ \param [in] daughters the daughter particles
+ */
+ LauPolarFormFactorSymNR( LauResonanceInfo* resInfo,
+ const LauAbsResonance::LauResonanceModel resType,
+ const Int_t resPairAmpInt,
+ const LauDaughters* daughters );
+
+ //! Destructor
+ virtual ~LauPolarFormFactorSymNR();
+
+ //! Initialise the model
+ virtual void initialise();
+
+ //! Get the complex dynamical amplitude
+ /*!
+ \param [in] kinematics the kinematic variables of the current event
+ \return the complex amplitude
+ */
+ virtual LauComplex amplitude( const LauKinematics* kinematics );
+
+ //! Get the resonance model type
+ /*!
+ \return the resonance model type
+ */
+ virtual LauAbsResonance::LauResonanceModel getResonanceModel() const { return model_; }
+
+ //! Set value of the various parameters
+ /*!
+ \param [in] name the name of the parameter to be changed
+ \param [in] value the new parameter value
+ */
+ virtual void setResonanceParameter( const TString& name, const Double_t value );
+
+ //! Allow the various parameters to float in the fit
+ /*!
+ \param [in] name the name of the parameter to be floated
+ */
+ virtual void floatResonanceParameter( const TString& name );
+
+ //! Access the given resonance parameter
+ /*!
+ \param [in] name the name of the parameter
+ \return the corresponding parameter
+ */
+ virtual LauParameter* getResonanceParameter( const TString& name );
+
+ //! Retrieve the resonance parameters, e.g. so that they can be loaded into a fit
+ /*!
+ \return floating parameters of the resonance
+ */
+ virtual const std::vector<LauParameter*>& getFloatingParameters();
+
+ protected:
+ //! Set the parameter lambda, the NR shape parameter
+ /*!
+ \param [in] lambda the NR shape parameter
+ */
+ void setLambda( const Double_t lambda );
+
+ //! Get the parameter lambda, the NR shape parameter
+ /*!
+ \return lambda the NR shape parameter
+ */
+ Double_t getLambda() const { return ( lambda_ != 0 ) ? lambda_->value() : 0.0; }
+
+ //! See if the lambda parameter is fixed or floating
+ /*!
+ \return kTRUE if the lambda parameter is fixed, kFALSE otherwise
+ */
+ Bool_t fixLambda() const { return ( lambda_ != 0 ) ? lambda_->fixed() : kTRUE; }
+
+ //! Complex resonant amplitude
+ /*!
+ \param [in] mass appropriate invariant mass for the resonance
+ \param [in] spinTerm Zemach spin term
+ */
+ virtual LauComplex resAmp( Double_t mass, Double_t spinTerm );
+
+ private:
+ //! Copy constructor (not implemented)
+ LauPolarFormFactorSymNR( const LauPolarFormFactorSymNR& rhs );
+
+ //! Copy assignment operator (not implemented)
+ LauPolarFormFactorSymNR& operator=( const LauPolarFormFactorSymNR& rhs );
+
+ //! The NR shape parameter
+ LauParameter* lambda_;
+
+ //! The model to use
+ LauAbsResonance::LauResonanceModel model_;
+
+ ClassDef( LauPolarFormFactorSymNR, 0 )
};
#endif
diff --git a/inc/LauPolarGammaCPCoeffSet.hh b/inc/LauPolarGammaCPCoeffSet.hh
index 77263fd..5c8b445 100644
--- a/inc/LauPolarGammaCPCoeffSet.hh
+++ b/inc/LauPolarGammaCPCoeffSet.hh
@@ -1,260 +1,276 @@
/*
Copyright 2014 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauPolarGammaCPCoeffSet.hh
\brief File containing declaration of LauPolarGammaCPCoeffSet class.
*/
/*! \class LauPolarGammaCPCoeffSet
\brief Class for defining a complex coefficient useful for extracting the CKM angle gamma from B -> D h h Dalitz plots.
Holds a set of real values that define the complex coefficient of an amplitude component.
Depending on the type of the D decay, the amplitude has one of the following forms:
CP-odd eigenstate: ( x + i * y ) * ( 1 - rB * exp( i * ( deltaB +/- gamma ) ) )
CP-even eigenstate: ( x + i * y ) * ( 1 + rB * exp( i * ( deltaB +/- gamma ) ) )
ADS favoured state: ( x + i * y ) * ( 1 + rB * rD * exp( i * ( deltaB - deltaD +/- gamma ) ) )
ADS suppressed state: ( x + i * y ) * ( rD * exp( - i * deltaD ) + rB * exp( i * ( deltaB +/- gamma ) ) )
[Phys. Rev. D79, 051301 (2009)]
*/
#ifndef LAU_POLARGAMMACP_COEFF_SET
#define LAU_POLARGAMMACP_COEFF_SET
-#include <iosfwd>
-#include <vector>
-
-#include "Rtypes.h"
-
#include "LauAbsCoeffSet.hh"
#include "LauComplex.hh"
#include "LauParameter.hh"
+#include "Rtypes.h"
+
+#include <iosfwd>
+#include <vector>
class LauPolarGammaCPCoeffSet : public LauAbsCoeffSet {
- public:
- //! The possible D decay modes
- enum DecayType {
- GLW_CPOdd, /*!< GLW CP-odd, e.g. D0 -> K0 pi0 */
- GLW_CPEven, /*!< GLW CP-even, e.g. D0 -> K+ K- */
- ADS_Favoured, /*!< ADS Favoured, e.g. D0 -> K- pi+ */
- ADS_Suppressed, /*!< ADS Suppressed, e.g. D0 -> K+ pi- */
- GLW_CPOdd_btouOnly, /*!< GLW CP-odd, e.g. D0 -> K0 pi0, where B decay only proceeds via b -> u transition */
- GLW_CPEven_btouOnly, /*!< GLW CP-even, e.g. D0 -> K+ K-, where B decay only proceeds via b -> u transition */
- ADS_Favoured_btouOnly, /*!< ADS Favoured, e.g. D0 -> K- pi+, where B decay only proceeds via b -> u transition */
- ADS_Suppressed_btouOnly, /*!< ADS Suppressed, e.g. D0 -> K+ pi-, where B decay only proceeds via b -> u transition */
- };
-
- //! Constructor
- /*!
- \param [in] compName the name of the coefficient set
- \param [in] decayType the type of the D decay
- \param [in] x the real part of the b -> c amplitude
- \param [in] y the imaginary part of the b -> c amplitude
- \param [in] rB the magnitude of the ratio of the b -> u and b -> c amplitudes
- \param [in] deltaB the relative CP-conserving (strong) phase of the b -> u and b -> c amplitudes
- \param [in] gamma the relative CP-violating (weak) phase of the b -> u and b -> c amplitudes
- \param [in] rD the magnitude of the ratio of the favoured and suppressed D-decay amplitudes
- \param [in] deltaD the relative strong phase of the favoured and suppressed D-decay amplitudes
- \param [in] xFixed whether x is fixed
- \param [in] yFixed whether y is fixed
- \param [in] rBFixed whether rB is fixed
- \param [in] deltaBFixed whether deltaB is fixed
- \param [in] gammaFixed whether gamma is fixed
- \param [in] rDFixed whether rD is fixed
- \param [in] deltaDFixed whether deltaD is fixed
- \param [in] rBSecondStage whether rB should be floated only in the second stage of the fit
- \param [in] deltaBSecondStage whether deltaB should be floated only in the second stage of the fit
- \param [in] gammaSecondStage whether gamma should be floated only in the second stage of the fit
- \param [in] rDSecondStage whether rD should be floated only in the second stage of the fit
- \param [in] deltaDSecondStage whether deltaD should be floated only in the second stage of the fit
- \param [in] useGlobalGamma whether gamma should be shared with other resonances
- \param [in] useGlobalADSPars whether rD and deltaD should be shared with other resonances
- */
- LauPolarGammaCPCoeffSet(const TString& compName, const DecayType decayType,
- const Double_t x, const Double_t y,
- const Double_t rB, const Double_t deltaB, const Double_t gamma,
- const Double_t rD, const Double_t deltaD,
- const Bool_t xFixed, const Bool_t yFixed,
- const Bool_t rBFixed, const Bool_t deltaBFixed, const Bool_t gammaFixed,
- const Bool_t rDFixed, const Bool_t deltaDFixed,
- const Bool_t rBSecondStage = kFALSE, const Bool_t deltaBSecondStage = kFALSE, const Bool_t gammaSecondStage = kFALSE,
- const Bool_t rDSecondStage = kFALSE, const Bool_t deltaDSecondStage = kFALSE,
- const Bool_t useGlobalGamma = kFALSE,
- const Bool_t useGlobalADSPars = kFALSE);
-
- //! Destructor
- virtual ~LauPolarGammaCPCoeffSet(){}
-
- //! Retrieve the parameters of the coefficient, e.g. so that they can be loaded into a fit
- /*!
- \return the parameters of the coefficient
- */
- virtual std::vector<LauParameter*> getParameters();
-
- //! Print the current values of the parameters
- virtual void printParValues() const;
-
- //! Print the column headings for a results table
- /*!
- \param [out] stream the stream to print to
- */
- virtual void printTableHeading(std::ostream& stream) const;
-
- //! Print the parameters of the complex coefficient as a row in the results table
- /*!
- \param [out] stream the stream to print to
- */
- virtual void printTableRow(std::ostream& stream) const;
-
- //! Randomise the starting values of the parameters for a fit
- virtual void randomiseInitValues();
-
- //! Make sure values are in "standard" ranges, e.g. phases should be between -pi and pi
- virtual void finaliseValues();
-
- //! Retrieve the complex coefficient for a particle
- /*!
- \return the complex coefficient for a particle
- */
- virtual const LauComplex& particleCoeff();
-
- //! Retrieve the complex coefficient for an antiparticle
- /*!
- \return the complex coefficient for an antiparticle
- */
- virtual const LauComplex& antiparticleCoeff();
-
- //! Set the parameters based on the complex coefficients for particles and antiparticles
- /*!
- This method is not supported by this class because there are more than four parameters, hence there is not a unique solution.
-
- \param [in] coeff the complex coefficient for a particle
- \param [in] coeffBar the complex coefficient for an antiparticle
- \param [in] init whether or not the initial and generated values should also be adjusted
- */
- virtual void setCoeffValues( const LauComplex& coeff, const LauComplex& coeffBar, Bool_t init );
-
- //! Calculate the CP asymmetry
- /*!
- \return the CP asymmetry
- */
- virtual LauParameter acp();
-
- //! Create a clone of the coefficient set
- /*!
- \param [in] newName the clone's name
- \param [in] cloneOption special option for the cloning operation
- \param [in] constFactor a constant factor to multiply the clone's parameters by
- \return a clone of the coefficient set
- */
- virtual LauAbsCoeffSet* createClone(const TString& newName, CloneOption cloneOption = All, Double_t constFactor = 1.0);
-
- private:
- //! Copy constructor
- /*!
- This creates cloned parameters, not copies.
- \param [in] rhs the coefficient to clone
- \param [in] cloneOption special option for the cloning operation
- \param [in] constFactor a constant factor to multiply the clone's parameters by
- */
- LauPolarGammaCPCoeffSet(const LauPolarGammaCPCoeffSet& rhs, CloneOption cloneOption = All, Double_t constFactor = 1.0);
-
- //! Copy assignment operator (not implemented)
- /*!
- \param [in] rhs the coefficient to clone
- */
- LauPolarGammaCPCoeffSet& operator=(const LauPolarGammaCPCoeffSet& rhs);
-
- //! Prepend the base name and index to the name of a parameter
- /*!
- \param [in,out] par pointer to the parameter
- \param [in] oldBaseName the old base name, which might need to be removed before adding the new one
- */
- virtual void adjustName(LauParameter* par, const TString& oldBaseName);
-
- //! Update the amplitudes based on the new values of the parameters
- void updateAmplitudes();
-
- //! The type of the D decay
- const DecayType decayType_;
-
- // the actual fit parameters
- // (need to be pointers so they can be cloned)
-
- //! The real part of the b -> c amplitude
- LauParameter* x_;
-
- //! The imaginary part of the b -> c amplitude
- LauParameter* y_;
-
- //! the magnitude of the ratio of the b -> u and b -> c amplitudes
- LauParameter* rB_;
-
- //! the relative CP-conserving (strong) phase of the b -> u and b -> c amplitudes
- LauParameter* deltaB_;
-
- //! the relative CP-violating (weak) phase of the b -> u and b -> c amplitudes
- LauParameter* gamma_;
-
- //! the magnitude of the ratio of the favoured and suppressed D-decay amplitudes
- LauParameter* rD_;
-
- //! the relative strong phase of the favoured and suppressed D-decay amplitudes
- LauParameter* deltaD_;
-
- //! The CP-violating phase (shared by multiple resonances)
- static LauParameter* gammaGlobal_;
-
- //! the magnitude of the ratio of the favoured and suppressed D-decay amplitudes (shared by multiple resonances)
- static LauParameter* rDGlobal_;
-
- //! the relative strong phase of the favoured and suppressed D-decay amplitudes (shared by multiple resonances)
- static LauParameter* deltaDGlobal_;
-
- //! Whether the global gamma is used for this resonance
- const Bool_t useGlobalGamma_;
-
- //! Whether the global rD and deltaD are used for this resonance
- const Bool_t useGlobalADSPars_;
-
- //! The b -> c part of the complex coefficient
- LauComplex nonCPPart_;
- //! The b -> u part of the complex coefficient for the particle
- LauComplex cpPart_;
- //! The b -> u part of the complex coefficient for the antiparticle
- LauComplex cpAntiPart_;
-
- //! The particle complex coefficient
- LauComplex particleCoeff_;
- //! The antiparticle complex coefficient
- LauComplex antiparticleCoeff_;
-
- //! The CP asymmetry
- LauParameter acp_;
-
- ClassDef(LauPolarGammaCPCoeffSet, 0)
+ public:
+ //! The possible D decay modes
+ enum DecayType {
+ GLW_CPOdd, /*!< GLW CP-odd, e.g. D0 -> K0 pi0 */
+ GLW_CPEven, /*!< GLW CP-even, e.g. D0 -> K+ K- */
+ ADS_Favoured, /*!< ADS Favoured, e.g. D0 -> K- pi+ */
+ ADS_Suppressed, /*!< ADS Suppressed, e.g. D0 -> K+ pi- */
+ GLW_CPOdd_btouOnly, /*!< GLW CP-odd, e.g. D0 -> K0 pi0, where B decay only proceeds via b -> u transition */
+ GLW_CPEven_btouOnly, /*!< GLW CP-even, e.g. D0 -> K+ K-, where B decay only proceeds via b -> u transition */
+ ADS_Favoured_btouOnly, /*!< ADS Favoured, e.g. D0 -> K- pi+, where B decay only proceeds via b -> u transition */
+ ADS_Suppressed_btouOnly, /*!< ADS Suppressed, e.g. D0 -> K+ pi-, where B decay only proceeds via b -> u transition */
+ };
+
+ //! Constructor
+ /*!
+ \param [in] compName the name of the coefficient set
+ \param [in] decayType the type of the D decay
+ \param [in] x the real part of the b -> c amplitude
+ \param [in] y the imaginary part of the b -> c amplitude
+ \param [in] rB the magnitude of the ratio of the b -> u and b -> c amplitudes
+ \param [in] deltaB the relative CP-conserving (strong) phase of the b -> u and b -> c amplitudes
+ \param [in] gamma the relative CP-violating (weak) phase of the b -> u and b -> c amplitudes
+ \param [in] rD the magnitude of the ratio of the favoured and suppressed D-decay amplitudes
+ \param [in] deltaD the relative strong phase of the favoured and suppressed D-decay amplitudes
+ \param [in] xFixed whether x is fixed
+ \param [in] yFixed whether y is fixed
+ \param [in] rBFixed whether rB is fixed
+ \param [in] deltaBFixed whether deltaB is fixed
+ \param [in] gammaFixed whether gamma is fixed
+ \param [in] rDFixed whether rD is fixed
+ \param [in] deltaDFixed whether deltaD is fixed
+ \param [in] rBSecondStage whether rB should be floated only in the second stage of the fit
+ \param [in] deltaBSecondStage whether deltaB should be floated only in the second stage of the fit
+ \param [in] gammaSecondStage whether gamma should be floated only in the second stage of the fit
+ \param [in] rDSecondStage whether rD should be floated only in the second stage of the fit
+ \param [in] deltaDSecondStage whether deltaD should be floated only in the second stage of the fit
+ \param [in] useGlobalGamma whether gamma should be shared with other resonances
+ \param [in] useGlobalADSPars whether rD and deltaD should be shared with other resonances
+ */
+ LauPolarGammaCPCoeffSet( const TString& compName,
+ const DecayType decayType,
+ const Double_t x,
+ const Double_t y,
+ const Double_t rB,
+ const Double_t deltaB,
+ const Double_t gamma,
+ const Double_t rD,
+ const Double_t deltaD,
+ const Bool_t xFixed,
+ const Bool_t yFixed,
+ const Bool_t rBFixed,
+ const Bool_t deltaBFixed,
+ const Bool_t gammaFixed,
+ const Bool_t rDFixed,
+ const Bool_t deltaDFixed,
+ const Bool_t rBSecondStage = kFALSE,
+ const Bool_t deltaBSecondStage = kFALSE,
+ const Bool_t gammaSecondStage = kFALSE,
+ const Bool_t rDSecondStage = kFALSE,
+ const Bool_t deltaDSecondStage = kFALSE,
+ const Bool_t useGlobalGamma = kFALSE,
+ const Bool_t useGlobalADSPars = kFALSE );
+
+ //! Destructor
+ virtual ~LauPolarGammaCPCoeffSet() {}
+
+ //! Retrieve the parameters of the coefficient, e.g. so that they can be loaded into a fit
+ /*!
+ \return the parameters of the coefficient
+ */
+ virtual std::vector<LauParameter*> getParameters();
+
+ //! Print the current values of the parameters
+ virtual void printParValues() const;
+
+ //! Print the column headings for a results table
+ /*!
+ \param [out] stream the stream to print to
+ */
+ virtual void printTableHeading( std::ostream& stream ) const;
+
+ //! Print the parameters of the complex coefficient as a row in the results table
+ /*!
+ \param [out] stream the stream to print to
+ */
+ virtual void printTableRow( std::ostream& stream ) const;
+
+ //! Randomise the starting values of the parameters for a fit
+ virtual void randomiseInitValues();
+
+ //! Make sure values are in "standard" ranges, e.g. phases should be between -pi and pi
+ virtual void finaliseValues();
+
+ //! Retrieve the complex coefficient for a particle
+ /*!
+ \return the complex coefficient for a particle
+ */
+ virtual const LauComplex& particleCoeff();
+
+ //! Retrieve the complex coefficient for an antiparticle
+ /*!
+ \return the complex coefficient for an antiparticle
+ */
+ virtual const LauComplex& antiparticleCoeff();
+
+ //! Set the parameters based on the complex coefficients for particles and antiparticles
+ /*!
+ This method is not supported by this class because there are more than four parameters, hence there is not a unique solution.
+
+ \param [in] coeff the complex coefficient for a particle
+ \param [in] coeffBar the complex coefficient for an antiparticle
+ \param [in] init whether or not the initial and generated values should also be adjusted
+ */
+ virtual void setCoeffValues( const LauComplex& coeff, const LauComplex& coeffBar, Bool_t init );
+
+ //! Calculate the CP asymmetry
+ /*!
+ \return the CP asymmetry
+ */
+ virtual LauParameter acp();
+
+ //! Create a clone of the coefficient set
+ /*!
+ \param [in] newName the clone's name
+ \param [in] cloneOption special option for the cloning operation
+ \param [in] constFactor a constant factor to multiply the clone's parameters by
+ \return a clone of the coefficient set
+ */
+ virtual LauAbsCoeffSet* createClone( const TString& newName,
+ CloneOption cloneOption = All,
+ Double_t constFactor = 1.0 );
+
+ private:
+ //! Copy constructor
+ /*!
+ This creates cloned parameters, not copies.
+
+ \param [in] rhs the coefficient to clone
+ \param [in] cloneOption special option for the cloning operation
+ \param [in] constFactor a constant factor to multiply the clone's parameters by
+ */
+ LauPolarGammaCPCoeffSet( const LauPolarGammaCPCoeffSet& rhs,
+ CloneOption cloneOption = All,
+ Double_t constFactor = 1.0 );
+
+ //! Copy assignment operator (not implemented)
+ /*!
+ \param [in] rhs the coefficient to clone
+ */
+ LauPolarGammaCPCoeffSet& operator=( const LauPolarGammaCPCoeffSet& rhs );
+
+ //! Prepend the base name and index to the name of a parameter
+ /*!
+ \param [in,out] par pointer to the parameter
+ \param [in] oldBaseName the old base name, which might need to be removed before adding the new one
+ */
+ virtual void adjustName( LauParameter* par, const TString& oldBaseName );
+
+ //! Update the amplitudes based on the new values of the parameters
+ void updateAmplitudes();
+
+ //! The type of the D decay
+ const DecayType decayType_;
+
+ // the actual fit parameters
+ // (need to be pointers so they can be cloned)
+
+ //! The real part of the b -> c amplitude
+ LauParameter* x_;
+
+ //! The imaginary part of the b -> c amplitude
+ LauParameter* y_;
+
+ //! the magnitude of the ratio of the b -> u and b -> c amplitudes
+ LauParameter* rB_;
+
+ //! the relative CP-conserving (strong) phase of the b -> u and b -> c amplitudes
+ LauParameter* deltaB_;
+
+ //! the relative CP-violating (weak) phase of the b -> u and b -> c amplitudes
+ LauParameter* gamma_;
+
+ //! the magnitude of the ratio of the favoured and suppressed D-decay amplitudes
+ LauParameter* rD_;
+
+ //! the relative strong phase of the favoured and suppressed D-decay amplitudes
+ LauParameter* deltaD_;
+
+ //! The CP-violating phase (shared by multiple resonances)
+ static LauParameter* gammaGlobal_;
+
+ //! the magnitude of the ratio of the favoured and suppressed D-decay amplitudes (shared by multiple resonances)
+ static LauParameter* rDGlobal_;
+
+ //! the relative strong phase of the favoured and suppressed D-decay amplitudes (shared by multiple resonances)
+ static LauParameter* deltaDGlobal_;
+
+ //! Whether the global gamma is used for this resonance
+ const Bool_t useGlobalGamma_;
+
+ //! Whether the global rD and deltaD are used for this resonance
+ const Bool_t useGlobalADSPars_;
+
+ //! The b -> c part of the complex coefficient
+ LauComplex nonCPPart_;
+ //! The b -> u part of the complex coefficient for the particle
+ LauComplex cpPart_;
+ //! The b -> u part of the complex coefficient for the antiparticle
+ LauComplex cpAntiPart_;
+
+ //! The particle complex coefficient
+ LauComplex particleCoeff_;
+ //! The antiparticle complex coefficient
+ LauComplex antiparticleCoeff_;
+
+ //! The CP asymmetry
+ LauParameter acp_;
+
+ ClassDef( LauPolarGammaCPCoeffSet, 0 )
};
#endif
diff --git a/inc/LauPoleRes.hh b/inc/LauPoleRes.hh
index f7e1ba4..b49c376 100644
--- a/inc/LauPoleRes.hh
+++ b/inc/LauPoleRes.hh
@@ -1,94 +1,95 @@
/*
Copyright 2018 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauPoleRes.hh
\brief File containing declaration of LauPoleRes class.
*/
/*! \class LauPoleRes
\brief Class for defining a pole-type resonance model
Class for defining a pole-type resonance model.
This is a pole type resonance 1/((m_s)^2-m^2); m_s=m0-iw0, good to represent the sigma (f0(500)).
J. A. Oller, Final state interactions in hadronic D decays, Phys. Rev. D71 (2005) 054030, arXiv:hep-ph/0411105.
*/
#ifndef LAU_POLE_RES
#define LAU_POLE_RES
-#include "TString.h"
-
-#include "LauComplex.hh"
#include "LauAbsResonance.hh"
+#include "LauComplex.hh"
+#include "TString.h"
class LauPoleRes : public LauAbsResonance {
- public:
- //! Constructor
- /*!
- \param [in] resInfo the object containing information on the resonance name, mass, width, spin, charge, etc.
- \param [in] resPairAmpInt the number of the daughter not produced by the resonance
- \param [in] daughters the daughter particles
- */
- LauPoleRes(LauResonanceInfo* resInfo, const Int_t resPairAmpInt, const LauDaughters* daughters);
-
- //! Destructor
- virtual ~LauPoleRes();
-
- //! Initialise the model
- virtual void initialise();
-
- //! Get the resonance model type
- /*!
- \return the resonance model type
- */
- virtual LauAbsResonance::LauResonanceModel getResonanceModel() const {return LauAbsResonance::Pole;}
-
- //! Retrieve the resonance parameters, e.g. so that they can be loaded into a fit
- /*!
- \return floating parameters of the resonance
- */
- virtual const std::vector<LauParameter*>& getFloatingParameters();
-
- protected:
- //! Complex resonant amplitude
- /*!
- \param [in] mass appropriate invariant mass for the resonance
- \param [in] spinTerm Zemach spin term
- */
- virtual LauComplex resAmp(Double_t mass, Double_t spinTerm);
-
- private:
- //! Copy constructor (not implemented)
- LauPoleRes(const LauPoleRes& rhs);
-
- //! Copy assignment operator (not implemented)
- LauPoleRes& operator=(const LauPoleRes& rhs);
-
- ClassDef(LauPoleRes,0) // Pole resonance model
-
+ public:
+ //! Constructor
+ /*!
+ \param [in] resInfo the object containing information on the resonance name, mass, width, spin, charge, etc.
+ \param [in] resPairAmpInt the number of the daughter not produced by the resonance
+ \param [in] daughters the daughter particles
+ */
+ LauPoleRes( LauResonanceInfo* resInfo, const Int_t resPairAmpInt, const LauDaughters* daughters );
+
+ //! Destructor
+ virtual ~LauPoleRes();
+
+ //! Initialise the model
+ virtual void initialise();
+
+ //! Get the resonance model type
+ /*!
+ \return the resonance model type
+ */
+ virtual LauAbsResonance::LauResonanceModel getResonanceModel() const
+ {
+ return LauAbsResonance::Pole;
+ }
+
+ //! Retrieve the resonance parameters, e.g. so that they can be loaded into a fit
+ /*!
+ \return floating parameters of the resonance
+ */
+ virtual const std::vector<LauParameter*>& getFloatingParameters();
+
+ protected:
+ //! Complex resonant amplitude
+ /*!
+ \param [in] mass appropriate invariant mass for the resonance
+ \param [in] spinTerm Zemach spin term
+ */
+ virtual LauComplex resAmp( Double_t mass, Double_t spinTerm );
+
+ private:
+ //! Copy constructor (not implemented)
+ LauPoleRes( const LauPoleRes& rhs );
+
+ //! Copy assignment operator (not implemented)
+ LauPoleRes& operator=( const LauPoleRes& rhs );
+
+ ClassDef( LauPoleRes, 0 ) // Pole resonance model
};
#endif
diff --git a/inc/LauPrint.hh b/inc/LauPrint.hh
index f7eea37..a5dc2d8 100644
--- a/inc/LauPrint.hh
+++ b/inc/LauPrint.hh
@@ -1,82 +1,80 @@
/*
Copyright 2004 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauPrint.hh
\brief File containing declaration of LauPrint class and LauOutputLevel enum.
*/
#ifndef LAU_PRINT
#define LAU_PRINT
#include "Rtypes.h"
#include <iosfwd>
-
/*! \enum LauOutputLevel
\brief Enumeration to define verbosity level for various printouts
*/
enum class LauOutputLevel {
- None = -1, //!< Zero printout
- Quiet = 0, //!< Reduced printout
- Standard = 1, //!< Normal level of printout
- Verbose = 2, //!< Verbose printout
- ExtraVerbose = 3 //!< Highly verbose printout
+ None = -1, //!< Zero printout
+ Quiet = 0, //!< Reduced printout
+ Standard = 1, //!< Normal level of printout
+ Verbose = 2, //!< Verbose printout
+ ExtraVerbose = 3 //!< Highly verbose printout
};
/*! \class LauPrint
\brief Class to define various output print commands.
Class to define various output print commands (for output tables etc..)
*/
class LauPrint {
- public:
- //! Constructor
- LauPrint();
-
- //! Destructor
- virtual ~LauPrint();
+ public:
+ //! Constructor
+ LauPrint();
- //! Method to choose the printing format to a specified level of precision
- /*!
- \param [in,out] stream the output stream to be printed to
- \param [in] value the double value to be printed
- */
- void printFormat(std::ostream& stream, Double_t value) const;
+ //! Destructor
+ virtual ~LauPrint();
- private:
- //! Copy constructor (not implemented)
- LauPrint(const LauPrint& rhs);
+ //! Method to choose the printing format to a specified level of precision
+ /*!
+ \param [in,out] stream the output stream to be printed to
+ \param [in] value the double value to be printed
+ */
+ void printFormat( std::ostream& stream, Double_t value ) const;
- //! Copy assignment operator (not implemented)
- LauPrint& operator=(const LauPrint& rhs);
+ private:
+ //! Copy constructor (not implemented)
+ LauPrint( const LauPrint& rhs );
- ClassDef(LauPrint,0)
+ //! Copy assignment operator (not implemented)
+ LauPrint& operator=( const LauPrint& rhs );
+ ClassDef( LauPrint, 0 )
};
#endif
diff --git a/inc/LauRandom.hh b/inc/LauRandom.hh
index 515d9c1..b8980e9 100644
--- a/inc/LauRandom.hh
+++ b/inc/LauRandom.hh
@@ -1,66 +1,66 @@
/*
Copyright 2005 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauRandom.hh
\brief File containing LauRandom namespace.
*/
/*! \namespace LauRandom
\brief Namespace for holding the random number generator functions.
Holds one generator with a given (changable) seed and one where the seed is taken from the machine clock.
*/
#ifndef LAU_RANDOM
#define LAU_RANDOM
#include "Rtypes.h"
class TRandom;
namespace LauRandom {
- //! Access the singleton random number generator with a particular seed
- /*!
- The seed value can be set using LauRandom::setSeed
-
- \return pointer to the singleton random number generator
- */
- TRandom* randomFun();
-
- //! Access the singleton random number generator with seed set from machine clock time (within +-1 sec).
- /*!
- \return pointer to the singleton random number generator
- */
- TRandom* zeroSeedRandom();
-
- //! Set seed of random-number generator to a given value
- /*!
- \param [in] seed the seed to be used in the generation
- */
- void setSeed(UInt_t seed);
-
-}
+ //! Access the singleton random number generator with a particular seed
+ /*!
+ The seed value can be set using LauRandom::setSeed
+
+ \return pointer to the singleton random number generator
+ */
+ TRandom* randomFun();
+
+ //! Access the singleton random number generator with seed set from machine clock time (within +-1 sec).
+ /*!
+ \return pointer to the singleton random number generator
+ */
+ TRandom* zeroSeedRandom();
+
+ //! Set seed of random-number generator to a given value
+ /*!
+ \param [in] seed the seed to be used in the generation
+ */
+ void setSeed( UInt_t seed );
+
+} // namespace LauRandom
#endif
diff --git a/inc/LauRealImagCPCoeffSet.hh b/inc/LauRealImagCPCoeffSet.hh
index b339b14..61526d3 100644
--- a/inc/LauRealImagCPCoeffSet.hh
+++ b/inc/LauRealImagCPCoeffSet.hh
@@ -1,172 +1,183 @@
/*
Copyright 2014 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauRealImagCPCoeffSet.hh
\brief File containing declaration of LauRealImagCPCoeffSet class.
*/
/*! \class LauRealImagCPCoeffSet
\brief Class for defining a complex coefficient using a simple Cartesian CP convention.
Holds a set of real values that define the complex coefficient of an amplitude component.
The amplitudes have the form:
c = x + i * y
cbar = xbar + i * ybar
*/
#ifndef LAU_REALIMAGCP_COEFF_SET
#define LAU_REALIMAGCP_COEFF_SET
-#include <iosfwd>
-#include <vector>
-
-#include "Rtypes.h"
-
#include "LauAbsCoeffSet.hh"
#include "LauComplex.hh"
#include "LauParameter.hh"
+#include "Rtypes.h"
+
+#include <iosfwd>
+#include <vector>
class LauRealImagCPCoeffSet : public LauAbsCoeffSet {
- public:
- //! Constructor
- /*!
- \param [in] compName the name of the coefficient set
- \param [in] x the real part for the particle
- \param [in] y the imaginary part for the particle
- \param [in] xbar the real part for the antiparticle
- \param [in] ybar the imaginary part for the antiparticle
- \param [in] xFixed whether x is fixed
- \param [in] yFixed whether y is fixed
- \param [in] xbarFixed whether xbar is fixed
- \param [in] ybarFixed whether ybar is fixed
- */
- LauRealImagCPCoeffSet(const TString& compName, Double_t x, Double_t y, Double_t xbar, Double_t ybar,
- Bool_t xFixed, Bool_t yFixed, Bool_t xbarFixed, Bool_t ybarFixed);
-
- //! Destructor
- virtual ~LauRealImagCPCoeffSet(){}
-
- //! Retrieve the parameters of the coefficient, e.g. so that they can be loaded into a fit
- /*!
- \return the parameters of the coefficient
- */
- virtual std::vector<LauParameter*> getParameters();
-
- //! Print the current values of the parameters
- virtual void printParValues() const;
-
- //! Print the column headings for a results table
- /*!
- \param [out] stream the stream to print to
- */
- virtual void printTableHeading(std::ostream& stream) const;
-
- //! Print the parameters of the complex coefficient as a row in the results table
- /*!
- \param [out] stream the stream to print to
- */
- virtual void printTableRow(std::ostream& stream) const;
-
- //! Randomise the starting values of the parameters for a fit
- virtual void randomiseInitValues();
-
- //! Make sure values are in "standard" ranges, e.g. phases should be between -pi and pi
- virtual void finaliseValues();
-
- //! Retrieve the complex coefficient for a particle
- /*!
- \return the complex coefficient for a particle
- */
- virtual const LauComplex& particleCoeff();
-
- //! Retrieve the complex coefficient for an antiparticle
- /*!
- \return the complex coefficient for an antiparticle
- */
- virtual const LauComplex& antiparticleCoeff();
-
- //! Set the parameters based on the complex coefficients for particles and antiparticles
- /*!
- \param [in] coeff the complex coefficient for a particle
- \param [in] coeffBar the complex coefficient for an antiparticle
- \param [in] init whether or not the initial and generated values should also be adjusted
- */
- virtual void setCoeffValues( const LauComplex& coeff, const LauComplex& coeffBar, Bool_t init );
-
- //! Calculate the CP asymmetry
- /*!
- \return the CP asymmetry
- */
- virtual LauParameter acp();
-
- //! Create a clone of the coefficient set
- /*!
- \param [in] newName the clone's name
- \param [in] cloneOption special option for the cloning operation
- \param [in] constFactor a constant factor to multiply the clone's parameters by
- \return a clone of the coefficient set
- */
- virtual LauAbsCoeffSet* createClone(const TString& newName, CloneOption cloneOption = All, Double_t constFactor = 1.0);
-
- private:
- //! Copy constructor
- /*!
- This creates cloned parameters, not copies.
- \param [in] rhs the coefficient to clone
- \param [in] cloneOption special option for the cloning operation
- \param [in] constFactor a constant factor to multiply the clone's parameters by
- */
- LauRealImagCPCoeffSet(const LauRealImagCPCoeffSet& rhs, CloneOption cloneOption = All, Double_t constFactor = 1.0);
-
- //! Copy assignment operator (not implemented)
- /*!
- \param [in] rhs the coefficient to clone
- */
- LauRealImagCPCoeffSet& operator=(const LauRealImagCPCoeffSet& rhs);
-
- // the actual fit parameters
- // (need to be pointers so they can be cloned)
- //! The real part for the particle
- LauParameter* x_;
- //! The imaginary part for the particle
- LauParameter* y_;
- //! The real part for the antiparticle
- LauParameter* xbar_;
- //! The imaginary part for the antiparticle
- LauParameter* ybar_;
-
- //! The particle complex coefficient
- LauComplex particleCoeff_;
- //! The antiparticle complex coefficient
- LauComplex antiparticleCoeff_;
-
- //! The CP asymmetry
- LauParameter acp_;
-
- ClassDef(LauRealImagCPCoeffSet, 0)
+ public:
+ //! Constructor
+ /*!
+ \param [in] compName the name of the coefficient set
+ \param [in] x the real part for the particle
+ \param [in] y the imaginary part for the particle
+ \param [in] xbar the real part for the antiparticle
+ \param [in] ybar the imaginary part for the antiparticle
+ \param [in] xFixed whether x is fixed
+ \param [in] yFixed whether y is fixed
+ \param [in] xbarFixed whether xbar is fixed
+ \param [in] ybarFixed whether ybar is fixed
+ */
+ LauRealImagCPCoeffSet( const TString& compName,
+ Double_t x,
+ Double_t y,
+ Double_t xbar,
+ Double_t ybar,
+ Bool_t xFixed,
+ Bool_t yFixed,
+ Bool_t xbarFixed,
+ Bool_t ybarFixed );
+
+ //! Destructor
+ virtual ~LauRealImagCPCoeffSet() {}
+
+ //! Retrieve the parameters of the coefficient, e.g. so that they can be loaded into a fit
+ /*!
+ \return the parameters of the coefficient
+ */
+ virtual std::vector<LauParameter*> getParameters();
+
+ //! Print the current values of the parameters
+ virtual void printParValues() const;
+
+ //! Print the column headings for a results table
+ /*!
+ \param [out] stream the stream to print to
+ */
+ virtual void printTableHeading( std::ostream& stream ) const;
+
+ //! Print the parameters of the complex coefficient as a row in the results table
+ /*!
+ \param [out] stream the stream to print to
+ */
+ virtual void printTableRow( std::ostream& stream ) const;
+
+ //! Randomise the starting values of the parameters for a fit
+ virtual void randomiseInitValues();
+
+ //! Make sure values are in "standard" ranges, e.g. phases should be between -pi and pi
+ virtual void finaliseValues();
+
+ //! Retrieve the complex coefficient for a particle
+ /*!
+ \return the complex coefficient for a particle
+ */
+ virtual const LauComplex& particleCoeff();
+
+ //! Retrieve the complex coefficient for an antiparticle
+ /*!
+ \return the complex coefficient for an antiparticle
+ */
+ virtual const LauComplex& antiparticleCoeff();
+
+ //! Set the parameters based on the complex coefficients for particles and antiparticles
+ /*!
+ \param [in] coeff the complex coefficient for a particle
+ \param [in] coeffBar the complex coefficient for an antiparticle
+ \param [in] init whether or not the initial and generated values should also be adjusted
+ */
+ virtual void setCoeffValues( const LauComplex& coeff, const LauComplex& coeffBar, Bool_t init );
+
+ //! Calculate the CP asymmetry
+ /*!
+ \return the CP asymmetry
+ */
+ virtual LauParameter acp();
+
+ //! Create a clone of the coefficient set
+ /*!
+ \param [in] newName the clone's name
+ \param [in] cloneOption special option for the cloning operation
+ \param [in] constFactor a constant factor to multiply the clone's parameters by
+ \return a clone of the coefficient set
+ */
+ virtual LauAbsCoeffSet* createClone( const TString& newName,
+ CloneOption cloneOption = All,
+ Double_t constFactor = 1.0 );
+
+ private:
+ //! Copy constructor
+ /*!
+ This creates cloned parameters, not copies.
+
+ \param [in] rhs the coefficient to clone
+ \param [in] cloneOption special option for the cloning operation
+ \param [in] constFactor a constant factor to multiply the clone's parameters by
+ */
+ LauRealImagCPCoeffSet( const LauRealImagCPCoeffSet& rhs,
+ CloneOption cloneOption = All,
+ Double_t constFactor = 1.0 );
+
+ //! Copy assignment operator (not implemented)
+ /*!
+ \param [in] rhs the coefficient to clone
+ */
+ LauRealImagCPCoeffSet& operator=( const LauRealImagCPCoeffSet& rhs );
+
+ // the actual fit parameters
+ // (need to be pointers so they can be cloned)
+ //! The real part for the particle
+ LauParameter* x_;
+ //! The imaginary part for the particle
+ LauParameter* y_;
+ //! The real part for the antiparticle
+ LauParameter* xbar_;
+ //! The imaginary part for the antiparticle
+ LauParameter* ybar_;
+
+ //! The particle complex coefficient
+ LauComplex particleCoeff_;
+ //! The antiparticle complex coefficient
+ LauComplex antiparticleCoeff_;
+
+ //! The CP asymmetry
+ LauParameter acp_;
+
+ ClassDef( LauRealImagCPCoeffSet, 0 )
};
#endif
diff --git a/inc/LauRealImagCoeffSet.hh b/inc/LauRealImagCoeffSet.hh
index e35a507..573d45c 100644
--- a/inc/LauRealImagCoeffSet.hh
+++ b/inc/LauRealImagCoeffSet.hh
@@ -1,157 +1,162 @@
/*
Copyright 2006 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauRealImagCoeffSet.hh
\brief File containing declaration of LauRealImagCoeffSet class.
*/
/*! \class LauRealImagCoeffSet
\brief Class for defining a complex coefficient using real and imaginary parts.
Holds a set of real values that define the complex coefficient of an amplitude component.
The amplitude has the form x + i*y.
*/
#ifndef LAU_REALIMAG_COEFF_SET
#define LAU_REALIMAG_COEFF_SET
-#include <iosfwd>
-#include <vector>
-
-#include "Rtypes.h"
-
#include "LauAbsCoeffSet.hh"
#include "LauComplex.hh"
#include "LauParameter.hh"
+#include "Rtypes.h"
+
+#include <iosfwd>
+#include <vector>
class LauRealImagCoeffSet : public LauAbsCoeffSet {
- public:
- //! Constructor
- /*!
- \param [in] compName the name of the coefficient set
- \param [in] x the real part
- \param [in] y the imaginary part
- \param [in] xFixed whether x is fixed
- \param [in] yFixed whether y is fixed
- */
- LauRealImagCoeffSet(const TString& compName, Double_t x, Double_t y, Bool_t xFixed, Bool_t yFixed);
-
- //! Destructor
- virtual ~LauRealImagCoeffSet(){}
-
- //! Retrieve the parameters of the coefficient, e.g. so that they can be loaded into a fit
- /*!
- \return the parameters of the coefficient
- */
- virtual std::vector<LauParameter*> getParameters();
-
- //! Print the current values of the parameters
- virtual void printParValues() const;
-
- //! Print the column headings for a results table
- /*!
- \param [out] stream the stream to print to
- */
- virtual void printTableHeading(std::ostream& stream) const;
-
- //! Print the parameters of the complex coefficient as a row in the results table
- /*!
- \param [out] stream the stream to print to
- */
- virtual void printTableRow(std::ostream& stream) const;
-
- //! Randomise the starting values of the parameters for a fit
- virtual void randomiseInitValues();
-
- //! Make sure values are in "standard" ranges, e.g. phases should be between -pi and pi
- virtual void finaliseValues();
-
- //! Retrieve the complex coefficient for a particle
- /*!
- \return the complex coefficient for a particle
- */
- virtual const LauComplex& particleCoeff();
-
- //! Retrieve the complex coefficient for an antiparticle
- /*!
- \return the complex coefficient for an antiparticle
- */
- virtual const LauComplex& antiparticleCoeff();
-
- //! Set the parameters based on the complex coefficients for particles and antiparticles
- /*!
- This class does not support CP violation so this method takes the average of the two inputs.
- \param [in] coeff the complex coefficient for a particle
- \param [in] coeffBar the complex coefficient for an antiparticle
- \param [in] init whether or not the initial and generated values should also be adjusted
- */
- virtual void setCoeffValues( const LauComplex& coeff, const LauComplex& coeffBar, Bool_t init );
-
- //! Calculate the CP asymmetry
- /*!
- \return the CP asymmetry (zero by design)
- */
- virtual LauParameter acp();
-
- //! Create a clone of the coefficient set
- /*!
- \param [in] newName the clone's name
- \param [in] cloneOption special option for the cloning operation
- \param [in] constFactor a constant factor to multiply the clone's parameters by
- \return a clone of the coefficient set
- */
- virtual LauAbsCoeffSet* createClone(const TString& newName, CloneOption cloneOption = All, Double_t constFactor = 1.0);
-
- private:
- //! Copy constructor
- /*!
- This creates cloned parameters, not copies.
- \param [in] rhs the coefficient to clone
- \param [in] cloneOption special option for the cloning operation
- \param [in] constFactor a constant factor to multiply the clone's parameters by
- */
- LauRealImagCoeffSet(const LauRealImagCoeffSet& rhs, CloneOption cloneOption = All, Double_t constFactor = 1.0);
-
- //! Copy assignment operator (not implemented)
- /*!
- \param [in] rhs the coefficient to clone
- */
- LauRealImagCoeffSet& operator=(const LauRealImagCoeffSet& rhs);
-
- // the actual fit parameters
- // (need to be pointers so they can be cloned)
- //! The real part
- LauParameter* x_;
- //! The imaginary part
- LauParameter* y_;
-
- //! The complex coefficient
- LauComplex coeff_;
-
- ClassDef(LauRealImagCoeffSet, 0)
+ public:
+ //! Constructor
+ /*!
+ \param [in] compName the name of the coefficient set
+ \param [in] x the real part
+ \param [in] y the imaginary part
+ \param [in] xFixed whether x is fixed
+ \param [in] yFixed whether y is fixed
+ */
+ LauRealImagCoeffSet( const TString& compName, Double_t x, Double_t y, Bool_t xFixed, Bool_t yFixed );
+
+ //! Destructor
+ virtual ~LauRealImagCoeffSet() {}
+
+ //! Retrieve the parameters of the coefficient, e.g. so that they can be loaded into a fit
+ /*!
+ \return the parameters of the coefficient
+ */
+ virtual std::vector<LauParameter*> getParameters();
+
+ //! Print the current values of the parameters
+ virtual void printParValues() const;
+
+ //! Print the column headings for a results table
+ /*!
+ \param [out] stream the stream to print to
+ */
+ virtual void printTableHeading( std::ostream& stream ) const;
+
+ //! Print the parameters of the complex coefficient as a row in the results table
+ /*!
+ \param [out] stream the stream to print to
+ */
+ virtual void printTableRow( std::ostream& stream ) const;
+
+ //! Randomise the starting values of the parameters for a fit
+ virtual void randomiseInitValues();
+
+ //! Make sure values are in "standard" ranges, e.g. phases should be between -pi and pi
+ virtual void finaliseValues();
+
+ //! Retrieve the complex coefficient for a particle
+ /*!
+ \return the complex coefficient for a particle
+ */
+ virtual const LauComplex& particleCoeff();
+
+ //! Retrieve the complex coefficient for an antiparticle
+ /*!
+ \return the complex coefficient for an antiparticle
+ */
+ virtual const LauComplex& antiparticleCoeff();
+
+ //! Set the parameters based on the complex coefficients for particles and antiparticles
+ /*!
+ This class does not support CP violation so this method takes the average of the two inputs.
+
+ \param [in] coeff the complex coefficient for a particle
+ \param [in] coeffBar the complex coefficient for an antiparticle
+ \param [in] init whether or not the initial and generated values should also be adjusted
+ */
+ virtual void setCoeffValues( const LauComplex& coeff, const LauComplex& coeffBar, Bool_t init );
+
+ //! Calculate the CP asymmetry
+ /*!
+ \return the CP asymmetry (zero by design)
+ */
+ virtual LauParameter acp();
+
+ //! Create a clone of the coefficient set
+ /*!
+ \param [in] newName the clone's name
+ \param [in] cloneOption special option for the cloning operation
+ \param [in] constFactor a constant factor to multiply the clone's parameters by
+ \return a clone of the coefficient set
+ */
+ virtual LauAbsCoeffSet* createClone( const TString& newName,
+ CloneOption cloneOption = All,
+ Double_t constFactor = 1.0 );
+
+ private:
+ //! Copy constructor
+ /*!
+ This creates cloned parameters, not copies.
+
+ \param [in] rhs the coefficient to clone
+ \param [in] cloneOption special option for the cloning operation
+ \param [in] constFactor a constant factor to multiply the clone's parameters by
+ */
+ LauRealImagCoeffSet( const LauRealImagCoeffSet& rhs,
+ CloneOption cloneOption = All,
+ Double_t constFactor = 1.0 );
+
+ //! Copy assignment operator (not implemented)
+ /*!
+ \param [in] rhs the coefficient to clone
+ */
+ LauRealImagCoeffSet& operator=( const LauRealImagCoeffSet& rhs );
+
+ // the actual fit parameters
+ // (need to be pointers so they can be cloned)
+ //! The real part
+ LauParameter* x_;
+ //! The imaginary part
+ LauParameter* y_;
+
+ //! The complex coefficient
+ LauComplex coeff_;
+
+ ClassDef( LauRealImagCoeffSet, 0 )
};
#endif
diff --git a/inc/LauRealImagGammaCPCoeffSet.hh b/inc/LauRealImagGammaCPCoeffSet.hh
index d0908a7..4e08111 100644
--- a/inc/LauRealImagGammaCPCoeffSet.hh
+++ b/inc/LauRealImagGammaCPCoeffSet.hh
@@ -1,189 +1,205 @@
/*
Copyright 2014 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauRealImagGammaCPCoeffSet.hh
\brief File containing declaration of LauRealImagGammaCPCoeffSet class.
*/
/*! \class LauRealImagGammaCPCoeffSet
\brief Class for defining a complex coefficient using a Cartesian nonCP part multiplied by a simple Cartesian CP convention.
Holds a set of real values that define the complex coefficient of an amplitude component.
The amplitudes have the form:
c = ( x + i * y ) * ( 1 + xCP + i * yCP )
cbar = ( x + i * y ) * ( 1 + xbarCP + i * ybarCP )
[Phys. Rev. D79, 051301 (2009)]
*/
#ifndef LAU_REALIMAGGAMMACP_COEFF_SET
#define LAU_REALIMAGGAMMACP_COEFF_SET
-#include <iosfwd>
-#include <vector>
-
-#include "Rtypes.h"
-
#include "LauAbsCoeffSet.hh"
#include "LauComplex.hh"
#include "LauParameter.hh"
+#include "Rtypes.h"
+
+#include <iosfwd>
+#include <vector>
class LauRealImagGammaCPCoeffSet : public LauAbsCoeffSet {
- public:
- //! Constructor
- /*!
- \param [in] compName the name of the coefficient set
- \param [in] x the real nonCP part
- \param [in] y the imaginary nonCP part
- \param [in] xCP the real CP part for the particle
- \param [in] yCP the imaginary CP part for the particle
- \param [in] xbarCP the real CP part for the antiparticle
- \param [in] ybarCP the imaginary CP part for the antiparticle
- \param [in] xFixed whether x is fixed
- \param [in] yFixed whether y is fixed
- \param [in] xCPFixed whether x is fixed
- \param [in] yCPFixed whether y is fixed
- \param [in] xbarCPFixed whether xbar is fixed
- \param [in] ybarCPFixed whether ybar is fixed
- */
- LauRealImagGammaCPCoeffSet(const TString& compName, const Double_t x, const Double_t y, const Double_t xCP, const Double_t yCP, const Double_t xbarCP, const Double_t ybarCP,
- const Bool_t xFixed, const Bool_t yFixed, const Bool_t xCPFixed, const Bool_t yCPFixed, const Bool_t xbarCPFixed, const Bool_t ybarCPFixed);
-
- //! Destructor
- virtual ~LauRealImagGammaCPCoeffSet(){}
-
- //! Retrieve the parameters of the coefficient, e.g. so that they can be loaded into a fit
- /*!
- \return the parameters of the coefficient
- */
- virtual std::vector<LauParameter*> getParameters();
-
- //! Print the current values of the parameters
- virtual void printParValues() const;
-
- //! Print the column headings for a results table
- /*!
- \param [out] stream the stream to print to
- */
- virtual void printTableHeading(std::ostream& stream) const;
-
- //! Print the parameters of the complex coefficient as a row in the results table
- /*!
- \param [out] stream the stream to print to
- */
- virtual void printTableRow(std::ostream& stream) const;
-
- //! Randomise the starting values of the parameters for a fit
- virtual void randomiseInitValues();
-
- //! Make sure values are in "standard" ranges, e.g. phases should be between -pi and pi
- virtual void finaliseValues();
-
- //! Retrieve the complex coefficient for a particle
- /*!
- \return the complex coefficient for a particle
- */
- virtual const LauComplex& particleCoeff();
-
- //! Retrieve the complex coefficient for an antiparticle
- /*!
- \return the complex coefficient for an antiparticle
- */
- virtual const LauComplex& antiparticleCoeff();
-
- //! Set the parameters based on the complex coefficients for particles and antiparticles
- /*!
- This method is not supported by this class because there are more than four parameters so there is not a unique solution.
- \param [in] coeff the complex coefficient for a particle
- \param [in] coeffBar the complex coefficient for an antiparticle
- \param [in] init whether or not the initial and generated values should also be adjusted
- */
- virtual void setCoeffValues( const LauComplex& coeff, const LauComplex& coeffBar, Bool_t init );
-
- //! Calculate the CP asymmetry
- /*!
- \return the CP asymmetry
- */
- virtual LauParameter acp();
-
- //! Create a clone of the coefficient set
- /*!
- \param [in] newName the clone's name
- \param [in] cloneOption special option for the cloning operation
- \param [in] constFactor a constant factor to multiply the clone's parameters by
- \return a clone of the coefficient set
- */
- virtual LauAbsCoeffSet* createClone(const TString& newName, CloneOption cloneOption = All, Double_t constFactor = 1.0);
-
- private:
- //! Copy constructor
- /*!
- This creates cloned parameters, not copies.
- \param [in] rhs the coefficient to clone
- \param [in] cloneOption special option for the cloning operation
- \param [in] constFactor a constant factor to multiply the clone's parameters by
- */
- LauRealImagGammaCPCoeffSet(const LauRealImagGammaCPCoeffSet& rhs, CloneOption cloneOption = All, Double_t constFactor = 1.0);
-
- //! Copy assignment operator (not implemented)
- /*!
- \param [in] rhs the coefficient to clone
- */
- LauRealImagGammaCPCoeffSet& operator=(const LauRealImagGammaCPCoeffSet& rhs);
-
- // the actual fit parameters
- // (need to be pointers so they can be cloned)
- //! The real nonCP part
- LauParameter* x_;
- //! The imaginary nonCP part
- LauParameter* y_;
- //! The real CP part for the particle
- LauParameter* xCP_;
- //! The imaginary CP part for the particle
- LauParameter* yCP_;
- //! The real CP part for the antiparticle
- LauParameter* xbarCP_;
- //! The imaginary CP part for the antiparticle
- LauParameter* ybarCP_;
-
- //! The nonCP part of the complex coefficient
- LauComplex nonCPPart_;
- //! The CP part of the complex coefficient for the particle
- LauComplex cpPart_;
- //! The CP part of the complex coefficient for the antiparticle
- LauComplex cpAntiPart_;
-
- //! The particle complex coefficient
- LauComplex particleCoeff_;
- //! The antiparticle complex coefficient
- LauComplex antiparticleCoeff_;
-
- //! The CP asymmetry
- LauParameter acp_;
-
- ClassDef(LauRealImagGammaCPCoeffSet, 0)
+ public:
+ //! Constructor
+ /*!
+ \param [in] compName the name of the coefficient set
+ \param [in] x the real nonCP part
+ \param [in] y the imaginary nonCP part
+ \param [in] xCP the real CP part for the particle
+ \param [in] yCP the imaginary CP part for the particle
+ \param [in] xbarCP the real CP part for the antiparticle
+ \param [in] ybarCP the imaginary CP part for the antiparticle
+ \param [in] xFixed whether x is fixed
+ \param [in] yFixed whether y is fixed
+ \param [in] xCPFixed whether x is fixed
+ \param [in] yCPFixed whether y is fixed
+ \param [in] xbarCPFixed whether xbar is fixed
+ \param [in] ybarCPFixed whether ybar is fixed
+ */
+ LauRealImagGammaCPCoeffSet( const TString& compName,
+ const Double_t x,
+ const Double_t y,
+ const Double_t xCP,
+ const Double_t yCP,
+ const Double_t xbarCP,
+ const Double_t ybarCP,
+ const Bool_t xFixed,
+ const Bool_t yFixed,
+ const Bool_t xCPFixed,
+ const Bool_t yCPFixed,
+ const Bool_t xbarCPFixed,
+ const Bool_t ybarCPFixed );
+
+ //! Destructor
+ virtual ~LauRealImagGammaCPCoeffSet() {}
+
+ //! Retrieve the parameters of the coefficient, e.g. so that they can be loaded into a fit
+ /*!
+ \return the parameters of the coefficient
+ */
+ virtual std::vector<LauParameter*> getParameters();
+
+ //! Print the current values of the parameters
+ virtual void printParValues() const;
+
+ //! Print the column headings for a results table
+ /*!
+ \param [out] stream the stream to print to
+ */
+ virtual void printTableHeading( std::ostream& stream ) const;
+
+ //! Print the parameters of the complex coefficient as a row in the results table
+ /*!
+ \param [out] stream the stream to print to
+ */
+ virtual void printTableRow( std::ostream& stream ) const;
+
+ //! Randomise the starting values of the parameters for a fit
+ virtual void randomiseInitValues();
+
+ //! Make sure values are in "standard" ranges, e.g. phases should be between -pi and pi
+ virtual void finaliseValues();
+
+ //! Retrieve the complex coefficient for a particle
+ /*!
+ \return the complex coefficient for a particle
+ */
+ virtual const LauComplex& particleCoeff();
+
+ //! Retrieve the complex coefficient for an antiparticle
+ /*!
+ \return the complex coefficient for an antiparticle
+ */
+ virtual const LauComplex& antiparticleCoeff();
+
+ //! Set the parameters based on the complex coefficients for particles and antiparticles
+ /*!
+ This method is not supported by this class because there are more than four parameters so there is not a unique solution.
+
+ \param [in] coeff the complex coefficient for a particle
+ \param [in] coeffBar the complex coefficient for an antiparticle
+ \param [in] init whether or not the initial and generated values should also be adjusted
+ */
+ virtual void setCoeffValues( const LauComplex& coeff, const LauComplex& coeffBar, Bool_t init );
+
+ //! Calculate the CP asymmetry
+ /*!
+ \return the CP asymmetry
+ */
+ virtual LauParameter acp();
+
+ //! Create a clone of the coefficient set
+ /*!
+ \param [in] newName the clone's name
+ \param [in] cloneOption special option for the cloning operation
+ \param [in] constFactor a constant factor to multiply the clone's parameters by
+ \return a clone of the coefficient set
+ */
+ virtual LauAbsCoeffSet* createClone( const TString& newName,
+ CloneOption cloneOption = All,
+ Double_t constFactor = 1.0 );
+
+ private:
+ //! Copy constructor
+ /*!
+ This creates cloned parameters, not copies.
+
+ \param [in] rhs the coefficient to clone
+ \param [in] cloneOption special option for the cloning operation
+ \param [in] constFactor a constant factor to multiply the clone's parameters by
+ */
+ LauRealImagGammaCPCoeffSet( const LauRealImagGammaCPCoeffSet& rhs,
+ CloneOption cloneOption = All,
+ Double_t constFactor = 1.0 );
+
+ //! Copy assignment operator (not implemented)
+ /*!
+ \param [in] rhs the coefficient to clone
+ */
+ LauRealImagGammaCPCoeffSet& operator=( const LauRealImagGammaCPCoeffSet& rhs );
+
+ // the actual fit parameters
+ // (need to be pointers so they can be cloned)
+ //! The real nonCP part
+ LauParameter* x_;
+ //! The imaginary nonCP part
+ LauParameter* y_;
+ //! The real CP part for the particle
+ LauParameter* xCP_;
+ //! The imaginary CP part for the particle
+ LauParameter* yCP_;
+ //! The real CP part for the antiparticle
+ LauParameter* xbarCP_;
+ //! The imaginary CP part for the antiparticle
+ LauParameter* ybarCP_;
+
+ //! The nonCP part of the complex coefficient
+ LauComplex nonCPPart_;
+ //! The CP part of the complex coefficient for the particle
+ LauComplex cpPart_;
+ //! The CP part of the complex coefficient for the antiparticle
+ LauComplex cpAntiPart_;
+
+ //! The particle complex coefficient
+ LauComplex particleCoeff_;
+ //! The antiparticle complex coefficient
+ LauComplex antiparticleCoeff_;
+
+ //! The CP asymmetry
+ LauParameter acp_;
+
+ ClassDef( LauRealImagGammaCPCoeffSet, 0 )
};
#endif
diff --git a/inc/LauRelBreitWignerRes.hh b/inc/LauRelBreitWignerRes.hh
index 1923a6d..319fcb4 100644
--- a/inc/LauRelBreitWignerRes.hh
+++ b/inc/LauRelBreitWignerRes.hh
@@ -1,128 +1,130 @@
/*
Copyright 2004 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauRelBreitWignerRes.hh
\brief File containing declaration of LauRelBreitWignerRes class.
*/
/*! \class LauRelBreitWignerRes
\brief Class for defining the relativistic Breit-Wigner resonance model
Class for defining the relativistic Breit-Wigner resonance model, which
includes the use of Blatt-Weisskopf barrier factors.
*/
#ifndef LAU_REL_BREIT_WIGNER_RES
#define LAU_REL_BREIT_WIGNER_RES
-#include "TString.h"
-
#include "LauAbsResonance.hh"
#include "LauComplex.hh"
+#include "TString.h"
class LauRelBreitWignerRes : public LauAbsResonance {
- public:
- //! Constructor
- /*!
- \param [in] resInfo the object containing information on the resonance name, mass, width, spin, charge, etc.
- \param [in] resPairAmpInt the number of the daughter not produced by the resonance
- \param [in] daughters the daughter particles
- */
- LauRelBreitWignerRes(LauResonanceInfo* resInfo, const Int_t resPairAmpInt, const LauDaughters* daughters);
-
- //! Destructor
- virtual ~LauRelBreitWignerRes();
-
- //! Initialise the model
- virtual void initialise();
-
- //! Get the resonance model type
- /*!
- \return the resonance model type
- */
- virtual LauAbsResonance::LauResonanceModel getResonanceModel() const {return LauAbsResonance::RelBW;}
-
- //! Retrieve the resonance parameters, e.g. so that they can be loaded into a fit
- /*!
- \return floating parameters of the resonance
- */
- virtual const std::vector<LauParameter*>& getFloatingParameters();
-
- protected:
- //! Complex resonant amplitude
- /*!
- \param [in] mass appropriate invariant mass for the resonance
- \param [in] spinTerm spin term
- */
- virtual LauComplex resAmp(Double_t mass, Double_t spinTerm);
-
- //! Calculate the form factor for the resonance
- /*!
- \param [in] z particle momentum multipled by the barrier radius
- \return value of the form factor
- */
- Double_t calcFFactor(Double_t z);
-
-
- private:
- //! Copy constructor (not implemented)
- LauRelBreitWignerRes(const LauRelBreitWignerRes& rhs);
-
- //! Copy assignment operator (not implemented)
- LauRelBreitWignerRes& operator=(const LauRelBreitWignerRes& rhs);
-
- //! Momentum of the daughters in the resonance rest frame (at pole mass)
- Double_t q0_;
- //! The resonance mass
- Double_t resMass_;
- //! Square of the resonance mass
- Double_t resMassSq_;
- //! The resonance width
- Double_t resWidth_;
- //! The resonance barrier radius
- Double_t resRadius_;
- //! The parent barrier radius
- Double_t parRadius_;
- //! Sum of the two daughter masses
- Double_t mDaugSum_;
- //! Square of the sum of the two daughter masses
- Double_t mDaugSumSq_;
- //! Difference of the two daughter masses
- Double_t mDaugDiff_;
- //! Square of the difference of the two daughter masses
- Double_t mDaugDiffSq_;
- //! Square of the parent mass
- Double_t mParentSq_;
- //! Square of the bachelor mass
- Double_t mBachSq_;
- //! Value of the form factor for resonance decay (at pole mass)
- Double_t FR0_;
-
- ClassDef(LauRelBreitWignerRes,0) // Relativistic Breit-Wigner resonance model
-
+ public:
+ //! Constructor
+ /*!
+ \param [in] resInfo the object containing information on the resonance name, mass, width, spin, charge, etc.
+ \param [in] resPairAmpInt the number of the daughter not produced by the resonance
+ \param [in] daughters the daughter particles
+ */
+ LauRelBreitWignerRes( LauResonanceInfo* resInfo,
+ const Int_t resPairAmpInt,
+ const LauDaughters* daughters );
+
+ //! Destructor
+ virtual ~LauRelBreitWignerRes();
+
+ //! Initialise the model
+ virtual void initialise();
+
+ //! Get the resonance model type
+ /*!
+ \return the resonance model type
+ */
+ virtual LauAbsResonance::LauResonanceModel getResonanceModel() const
+ {
+ return LauAbsResonance::RelBW;
+ }
+
+ //! Retrieve the resonance parameters, e.g. so that they can be loaded into a fit
+ /*!
+ \return floating parameters of the resonance
+ */
+ virtual const std::vector<LauParameter*>& getFloatingParameters();
+
+ protected:
+ //! Complex resonant amplitude
+ /*!
+ \param [in] mass appropriate invariant mass for the resonance
+ \param [in] spinTerm spin term
+ */
+ virtual LauComplex resAmp( Double_t mass, Double_t spinTerm );
+
+ //! Calculate the form factor for the resonance
+ /*!
+ \param [in] z particle momentum multipled by the barrier radius
+ \return value of the form factor
+ */
+ Double_t calcFFactor( Double_t z );
+
+ private:
+ //! Copy constructor (not implemented)
+ LauRelBreitWignerRes( const LauRelBreitWignerRes& rhs );
+
+ //! Copy assignment operator (not implemented)
+ LauRelBreitWignerRes& operator=( const LauRelBreitWignerRes& rhs );
+
+ //! Momentum of the daughters in the resonance rest frame (at pole mass)
+ Double_t q0_;
+ //! The resonance mass
+ Double_t resMass_;
+ //! Square of the resonance mass
+ Double_t resMassSq_;
+ //! The resonance width
+ Double_t resWidth_;
+ //! The resonance barrier radius
+ Double_t resRadius_;
+ //! The parent barrier radius
+ Double_t parRadius_;
+ //! Sum of the two daughter masses
+ Double_t mDaugSum_;
+ //! Square of the sum of the two daughter masses
+ Double_t mDaugSumSq_;
+ //! Difference of the two daughter masses
+ Double_t mDaugDiff_;
+ //! Square of the difference of the two daughter masses
+ Double_t mDaugDiffSq_;
+ //! Square of the parent mass
+ Double_t mParentSq_;
+ //! Square of the bachelor mass
+ Double_t mBachSq_;
+ //! Value of the form factor for resonance decay (at pole mass)
+ Double_t FR0_;
+
+ ClassDef( LauRelBreitWignerRes, 0 ) // Relativistic Breit-Wigner resonance model
};
#endif
diff --git a/inc/LauRescattering2Res.hh b/inc/LauRescattering2Res.hh
index 401aeda..ad51315 100644
--- a/inc/LauRescattering2Res.hh
+++ b/inc/LauRescattering2Res.hh
@@ -1,187 +1,220 @@
/*
Copyright 2018 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauRescattering2Res.hh
\brief File containing declaration of LauRescattering2Res class.
*/
/*! \class LauRescattering2Res
\brief Class for defining an alternative rescattering model.
Model for pipi SWave proposed by J.Schechter as used by Cleo (PRD76,01200(2007)
- to replace the sigma and f0(980) contributions.
+ to replace the sigma and f0(980) contributions.
*/
#ifndef LAU_RESCATTERING2_RES
#define LAU_RESCATTERING2_RES
-#include "TString.h"
-
#include "LauAbsResonance.hh"
#include "LauComplex.hh"
-class LauKinematics;
+#include "TString.h"
+class LauKinematics;
class LauRescattering2Res : public LauAbsResonance {
- public:
- //! Constructor
- /*!
- \param [in] resInfo the object containing information on the resonance name, mass, width, spin, charge, etc.
- \param [in] resPairAmpInt the number of the daughter not produced by the resonance
- \param [in] daughters the daughter particles
- */
- LauRescattering2Res(LauResonanceInfo* resInfo, const Int_t resPairAmpInt, const LauDaughters* daughters);
-
- //! Destructor
- virtual ~LauRescattering2Res();
-
- //! Initialise the model
- virtual void initialise();
-
-
- //! Get the resonance model type
- /*!
- \return the resonance model type
- */
- virtual LauAbsResonance::LauResonanceModel getResonanceModel() const {return LauAbsResonance::Rescattering2;}
-
- //! Set value of a resonance parameter
- /*!
- \param [in] name the name of the parameter to be changed
- \param [in] value the new parameter value
- */
- virtual void setResonanceParameter(const TString& name, const Double_t value);
-
- //! Allow the various parameters to float in the fit
- /*!
- \param [in] name the name of the parameter to be floated
- */
- virtual void floatResonanceParameter(const TString& name);
-
- //! Access the given resonance parameter
- /*!
- \param [in] name the name of the parameter
- \return the corresponding parameter
- */
- virtual LauParameter* getResonanceParameter(const TString& name);
-
- //! Retrieve the resonance parameters, e.g. so that they can be loaded into a fit
- /*!
- \return floating parameters of the resonance
- */
- virtual const std::vector<LauParameter*>& getFloatingParameters();
-
- protected:
- //! This is not meant to be called
- virtual LauComplex resAmp(Double_t mass, Double_t spinTerm);
-
- Double_t pn(const Double_t x, const Double_t n) const;
- Double_t x(const Double_t sqr_t, const Int_t i) const;
- Double_t phi00(const Double_t sqr_t, const Int_t i) const;
- Double_t g00(const Double_t sqr_t, const Int_t i) const;
-
- void setB1Parameter(const Double_t B1);
- void setB2Parameter(const Double_t B2);
- void setB3Parameter(const Double_t B3);
- void setC1Parameter(const Double_t C1);
- void setC2Parameter(const Double_t C2);
- void setC3Parameter(const Double_t C3);
- void setC4Parameter(const Double_t C4);
- void setC5Parameter(const Double_t C5);
- void setD0Parameter(const Double_t D0);
- void setD1Parameter(const Double_t D1);
- void setD2Parameter(const Double_t D2);
- void setD3Parameter(const Double_t D3);
- void setF1Parameter(const Double_t F1);
- void setF2Parameter(const Double_t F2);
- void setF3Parameter(const Double_t F3);
- void setF4Parameter(const Double_t F4);
-
- Double_t getB1Parameter() const {return (B1_!=0) ? B1_->value() : 0.0;}
- Bool_t fixB1Parameter() const {return (B1_!=0) ? B1_->fixed() : kTRUE;}
- Double_t getB2Parameter() const {return (B2_!=0) ? B2_->value() : 0.0;}
- Bool_t fixB2Parameter() const {return (B2_!=0) ? B2_->fixed() : kTRUE;}
- Double_t getB3Parameter() const {return (B3_!=0) ? B3_->value() : 0.0;}
- Bool_t fixB3Parameter() const {return (B3_!=0) ? B3_->fixed() : kTRUE;}
- Double_t getC1Parameter() const {return (C1_!=0)? C1_->value() : 0.0;}
- Bool_t fixC1Parameter() const {return (C1_!=0) ?C1_->fixed() : kTRUE;}
- Double_t getC2Parameter() const {return (C2_!=0)? C2_->value() : 0.0;}
- Bool_t fixC2Parameter() const {return (C2_!=0) ?C2_->fixed() : kTRUE;}
- Double_t getC3Parameter() const {return (C3_!=0)? C3_->value() : 0.0;}
- Bool_t fixC3Parameter() const {return (C3_!=0) ?C3_->fixed() : kTRUE;}
- Double_t getC4Parameter() const {return (C4_!=0)? C4_->value() : 0.0;}
- Bool_t fixC4Parameter() const {return (C4_!=0) ?C4_->fixed() : kTRUE;}
- Double_t getC5Parameter() const {return (C5_!=0)? C5_->value() : 0.0;}
- Bool_t fixC5Parameter() const {return (C5_!=0) ?C5_->fixed() : kTRUE;}
- Double_t getD0Parameter() const {return (D0_!=0) ? D0_->value() : 0.0;}
- Bool_t fixD0Parameter() const {return (D0_!=0) ? D0_->fixed() : kTRUE;}
- Double_t getD1Parameter() const {return (D1_!=0) ? D1_->value() : 0.0;}
- Bool_t fixD1Parameter() const {return (D1_!=0) ? D1_->fixed() : kTRUE;}
- Double_t getD2Parameter() const {return (D2_!=0) ? D2_->value() : 0.0;}
- Bool_t fixD2Parameter() const {return (D2_!=0) ? D2_->fixed() : kTRUE;}
- Double_t getD3Parameter() const {return (D3_!=0) ? D3_->value() : 0.0;}
- Bool_t fixD3Parameter() const {return (D3_!=0) ? D3_->fixed() : kTRUE;}
- Double_t getF1Parameter() const {return (F1_!=0) ? F1_->value() : 0.0;}
- Bool_t fixF1Parameter() const {return (F1_!=0) ? F1_->fixed() : kTRUE;}
- Double_t getF2Parameter() const {return (F2_!=0) ? F2_->value() : 0.0;}
- Bool_t fixF2Parameter() const {return (F2_!=0) ? F2_->fixed() : kTRUE;}
- Double_t getF3Parameter() const {return (F3_!=0) ? F3_->value() : 0.0;}
- Bool_t fixF3Parameter() const {return (F3_!=0) ? F3_->fixed() : kTRUE;}
- Double_t getF4Parameter() const {return (F4_!=0) ? F4_->value() : 0.0;}
- Bool_t fixF4Parameter() const {return (F4_!=0) ? F4_->fixed() : kTRUE;}
-
-
- private:
- //! Copy constructor (not implemented)
- LauRescattering2Res(const LauRescattering2Res& rhs);
-
- //! Copy assignment operator (not implemented)
- LauRescattering2Res& operator=(const LauRescattering2Res& rhs);
-
- //! Parameter
- LauParameter* B1_;
- LauParameter* B2_;
- LauParameter* B3_;
- LauParameter* C1_;
- LauParameter* C2_;
- LauParameter* C3_;
- LauParameter* C4_;
- LauParameter* C5_;
- LauParameter* D0_;
- LauParameter* D1_;
- LauParameter* D2_;
- LauParameter* D3_;
- LauParameter* F1_;
- LauParameter* F2_;
- LauParameter* F3_;
- LauParameter* F4_;
-
- Double_t sqr_tmin[3], sqr_tmax[3];
- Double_t B0_, C0_, F0_;
-
- ClassDef(LauRescattering2Res,0) // pipi S wave model by Schechter amplitude model
+ public:
+ //! Constructor
+ /*!
+ \param [in] resInfo the object containing information on the resonance name, mass, width, spin, charge, etc.
+ \param [in] resPairAmpInt the number of the daughter not produced by the resonance
+ \param [in] daughters the daughter particles
+ */
+ LauRescattering2Res( LauResonanceInfo* resInfo,
+ const Int_t resPairAmpInt,
+ const LauDaughters* daughters );
+
+ //! Destructor
+ virtual ~LauRescattering2Res();
+
+ //! Initialise the model
+ virtual void initialise();
+
+ //! Get the resonance model type
+ /*!
+ \return the resonance model type
+ */
+ virtual LauAbsResonance::LauResonanceModel getResonanceModel() const
+ {
+ return LauAbsResonance::Rescattering2;
+ }
+
+ //! Set value of a resonance parameter
+ /*!
+ \param [in] name the name of the parameter to be changed
+ \param [in] value the new parameter value
+ */
+ virtual void setResonanceParameter( const TString& name, const Double_t value );
+
+ //! Allow the various parameters to float in the fit
+ /*!
+ \param [in] name the name of the parameter to be floated
+ */
+ virtual void floatResonanceParameter( const TString& name );
+
+ //! Access the given resonance parameter
+ /*!
+ \param [in] name the name of the parameter
+ \return the corresponding parameter
+ */
+ virtual LauParameter* getResonanceParameter( const TString& name );
+
+ //! Retrieve the resonance parameters, e.g. so that they can be loaded into a fit
+ /*!
+ \return floating parameters of the resonance
+ */
+ virtual const std::vector<LauParameter*>& getFloatingParameters();
+
+ protected:
+ //! This is not meant to be called
+ virtual LauComplex resAmp( Double_t mass, Double_t spinTerm );
+
+ Double_t pn( const Double_t x, const Double_t n ) const;
+ Double_t x( const Double_t sqr_t, const Int_t i ) const;
+ Double_t phi00( const Double_t sqr_t, const Int_t i ) const;
+ Double_t g00( const Double_t sqr_t, const Int_t i ) const;
+
+ void setB1Parameter( const Double_t B1 );
+ void setB2Parameter( const Double_t B2 );
+ void setB3Parameter( const Double_t B3 );
+ void setC1Parameter( const Double_t C1 );
+ void setC2Parameter( const Double_t C2 );
+ void setC3Parameter( const Double_t C3 );
+ void setC4Parameter( const Double_t C4 );
+ void setC5Parameter( const Double_t C5 );
+ void setD0Parameter( const Double_t D0 );
+ void setD1Parameter( const Double_t D1 );
+ void setD2Parameter( const Double_t D2 );
+ void setD3Parameter( const Double_t D3 );
+ void setF1Parameter( const Double_t F1 );
+ void setF2Parameter( const Double_t F2 );
+ void setF3Parameter( const Double_t F3 );
+ void setF4Parameter( const Double_t F4 );
+
+ Double_t getB1Parameter() const { return ( B1_ != 0 ) ? B1_->value() : 0.0; }
+
+ Bool_t fixB1Parameter() const { return ( B1_ != 0 ) ? B1_->fixed() : kTRUE; }
+
+ Double_t getB2Parameter() const { return ( B2_ != 0 ) ? B2_->value() : 0.0; }
+
+ Bool_t fixB2Parameter() const { return ( B2_ != 0 ) ? B2_->fixed() : kTRUE; }
+
+ Double_t getB3Parameter() const { return ( B3_ != 0 ) ? B3_->value() : 0.0; }
+
+ Bool_t fixB3Parameter() const { return ( B3_ != 0 ) ? B3_->fixed() : kTRUE; }
+
+ Double_t getC1Parameter() const { return ( C1_ != 0 ) ? C1_->value() : 0.0; }
+
+ Bool_t fixC1Parameter() const { return ( C1_ != 0 ) ? C1_->fixed() : kTRUE; }
+
+ Double_t getC2Parameter() const { return ( C2_ != 0 ) ? C2_->value() : 0.0; }
+
+ Bool_t fixC2Parameter() const { return ( C2_ != 0 ) ? C2_->fixed() : kTRUE; }
+
+ Double_t getC3Parameter() const { return ( C3_ != 0 ) ? C3_->value() : 0.0; }
+
+ Bool_t fixC3Parameter() const { return ( C3_ != 0 ) ? C3_->fixed() : kTRUE; }
+
+ Double_t getC4Parameter() const { return ( C4_ != 0 ) ? C4_->value() : 0.0; }
+
+ Bool_t fixC4Parameter() const { return ( C4_ != 0 ) ? C4_->fixed() : kTRUE; }
+
+ Double_t getC5Parameter() const { return ( C5_ != 0 ) ? C5_->value() : 0.0; }
+
+ Bool_t fixC5Parameter() const { return ( C5_ != 0 ) ? C5_->fixed() : kTRUE; }
+
+ Double_t getD0Parameter() const { return ( D0_ != 0 ) ? D0_->value() : 0.0; }
+
+ Bool_t fixD0Parameter() const { return ( D0_ != 0 ) ? D0_->fixed() : kTRUE; }
+
+ Double_t getD1Parameter() const { return ( D1_ != 0 ) ? D1_->value() : 0.0; }
+
+ Bool_t fixD1Parameter() const { return ( D1_ != 0 ) ? D1_->fixed() : kTRUE; }
+
+ Double_t getD2Parameter() const { return ( D2_ != 0 ) ? D2_->value() : 0.0; }
+
+ Bool_t fixD2Parameter() const { return ( D2_ != 0 ) ? D2_->fixed() : kTRUE; }
+
+ Double_t getD3Parameter() const { return ( D3_ != 0 ) ? D3_->value() : 0.0; }
+
+ Bool_t fixD3Parameter() const { return ( D3_ != 0 ) ? D3_->fixed() : kTRUE; }
+
+ Double_t getF1Parameter() const { return ( F1_ != 0 ) ? F1_->value() : 0.0; }
+
+ Bool_t fixF1Parameter() const { return ( F1_ != 0 ) ? F1_->fixed() : kTRUE; }
+
+ Double_t getF2Parameter() const { return ( F2_ != 0 ) ? F2_->value() : 0.0; }
+
+ Bool_t fixF2Parameter() const { return ( F2_ != 0 ) ? F2_->fixed() : kTRUE; }
+
+ Double_t getF3Parameter() const { return ( F3_ != 0 ) ? F3_->value() : 0.0; }
+
+ Bool_t fixF3Parameter() const { return ( F3_ != 0 ) ? F3_->fixed() : kTRUE; }
+
+ Double_t getF4Parameter() const { return ( F4_ != 0 ) ? F4_->value() : 0.0; }
+
+ Bool_t fixF4Parameter() const { return ( F4_ != 0 ) ? F4_->fixed() : kTRUE; }
+
+ private:
+ //! Copy constructor (not implemented)
+ LauRescattering2Res( const LauRescattering2Res& rhs );
+
+ //! Copy assignment operator (not implemented)
+ LauRescattering2Res& operator=( const LauRescattering2Res& rhs );
+
+ //! Parameter
+ LauParameter* B1_;
+ LauParameter* B2_;
+ LauParameter* B3_;
+ LauParameter* C1_;
+ LauParameter* C2_;
+ LauParameter* C3_;
+ LauParameter* C4_;
+ LauParameter* C5_;
+ LauParameter* D0_;
+ LauParameter* D1_;
+ LauParameter* D2_;
+ LauParameter* D3_;
+ LauParameter* F1_;
+ LauParameter* F2_;
+ LauParameter* F3_;
+ LauParameter* F4_;
+
+ Double_t sqr_tmin[3], sqr_tmax[3];
+ Double_t B0_, C0_, F0_;
+
+ ClassDef( LauRescattering2Res, 0 ) // pipi S wave model by Schechter amplitude model
};
#endif
diff --git a/inc/LauRescatteringRes.hh b/inc/LauRescatteringRes.hh
index fb56a23..9d4b774 100644
--- a/inc/LauRescatteringRes.hh
+++ b/inc/LauRescatteringRes.hh
@@ -1,304 +1,298 @@
/*
Copyright 2018 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauRescatteringRes.hh
\brief File containing declaration of LauRescatteringRes class.
*/
/*! \class LauRescatteringRes
\brief Class for defining the rescattering model.
Defines the Rescatering models from PiPi-KK Inelastic Scatering :
- 2005: J.R. Pelaez, F. J. Ynduráin: PHYSICAL REVIEW D 71, 074016 (2005)
- 2015: J. H. Alvarenga Nogueira, I. Bediaga, A. B. R. Cavalcante, T. Frederico, and O. Lourenço: PHYSICAL REVIEW D 92, 054010 (2015)
- 2018: J.R. Pelaez, A.Rodas: Unpublished yet PiPi -> KK scattering up to 1.47 GeV with hyperbolic dispersion relations.
+ 2005: J.R. Pelaez, F. J. Ynduráin: PHYSICAL REVIEW D 71, 074016 (2005)
+ 2015: J. H. Alvarenga Nogueira, I. Bediaga, A. B. R. Cavalcante, T. Frederico, and O. Lourenço: PHYSICAL REVIEW D 92, 054010 (2015)
+ 2018: J.R. Pelaez, A.Rodas: Unpublished yet PiPi -> KK scattering up to 1.47 GeV with hyperbolic dispersion relations.
*/
#ifndef LAU_RESCATTERING_RES
#define LAU_RESCATTERING_RES
-#include "TString.h"
-
-#include "LauComplex.hh"
#include "LauAbsResonance.hh"
+#include "LauComplex.hh"
+
+#include "TString.h"
class LauKinematics;
class LauParameter;
-
class LauRescatteringRes : public LauAbsResonance {
- public:
- //! Constructor
- /*!
- \param [in] resInfo the object containing information on the resonance name, mass, width, spin, charge, etc.
- \param [in] resType the model of the resonance
- \param [in] resPairAmpInt the number of the daughter not produced by the resonance
- \param [in] daughters the daughter particles
- */
- LauRescatteringRes(LauResonanceInfo* resInfo, const LauAbsResonance::LauResonanceModel resType,
- const Int_t resPairAmpInt, const LauDaughters* daughters);
-
- //! Destructor
- virtual ~LauRescatteringRes();
-
- //! Initialise the model
- virtual void initialise();
-
- //! Get the complex dynamical amplitude
- /*!
- \param [in] kinematics the kinematic variables of the current event
- \return the complex amplitude
- */
- virtual LauComplex amplitude(const LauKinematics* kinematics);
-
-
- //! Get the resonance model type
- /*!
- \return the resonance model type
- */
-
- virtual LauAbsResonance::LauResonanceModel getResonanceModel() const {return model_;}
-
- //! Set value of the various parameters
- /*!
- \param [in] name the name of the parameter to be changed
- \param [in] value the new parameter value
- */
- virtual void setResonanceParameter(const TString& name, const Double_t value);
-
- //! Allow the various parameters to float in the fit
- /*!
- \param [in] name the name of the parameter to be floated
- */
- virtual void floatResonanceParameter(const TString& name);
-
- //! Access the given resonance parameter
- /*!
- \param [in] name the name of the parameter
- \return the corresponding parameter
- */
- virtual LauParameter* getResonanceParameter(const TString& name);
-
- //! Retrieve the resonance parameters, e.g. so that they can be loaded into a fit
- /*!
- \return floating parameters of the resonance
- */
- virtual const std::vector<LauParameter*>& getFloatingParameters();
-
- protected:
- //! Set the parameter lambdaPiPi, the term for the PiPi
- /*!
- \param [in] lambda the term for the PiPi
- */
- void setLambdaPiPi(const Double_t lambda);
-
- //! Get the lambdaPiPi, the term for the PiPi
- /*!
- \return lambdaPiPi, the term for the PiPi
- */
- Double_t getLambdaPiPi() const {return (lambdaPiPi_!=0) ? lambdaPiPi_->value() : 0.0;}
-
- //! See if the lambdaPiPi parameter is fixed or floating
- /*!
- \return kTRUE if the lambdaPiPi parameter is fixed, kFALSE otherwise
- */
- Bool_t fixLambdaPiPi() const {return (lambdaPiPi_!=0) ? lambdaPiPi_->fixed() : kTRUE;}
-
- //! Set the parameter lambdaKK, the term for the KK
- /*!
- \param [in] lambda the term for the KK
- */
- void setLambdaKK(const Double_t lambda);
-
- //! Get the lambdaKK, the term for the KK
- /*!
- \return lambdaKK, the term for the KK
- */
- Double_t getLambdaKK() const {return (lambdaKK_!=0) ? lambdaKK_->value() : 0.0;}
-
- //! See if the lambdaKK parameter is fixed or floating
- /*!
- \return kTRUE if the lambdaKK parameter is fixed, kFALSE otherwise
- */
- Bool_t fixLambdaKK() const {return (lambdaKK_!=0) ? lambdaKK_->fixed() : kTRUE;}
-
- //! Set the parameter Ms
- /*!
- \param [in] Ms
- */
- void setMs(const Double_t Ms);
-
- //! Get the Ms
- /*!
- \return the Ms
- */
- Double_t getMs() const {return (Ms_!=0) ? Ms_->value() : 0.0;}
-
- //! See if the Ms parameter is fixed or floating
- /*!
- \return kTRUE if the Ms parameter is fixed, kFALSE otherwise
- */
- Bool_t fixMs() const {return (Ms_!=0) ? Ms_->fixed() : kTRUE;}
-
-
- //! Set the parameter Mf
- /*!
- \param [in] Mf
- */
- void setMf(const Double_t Mf);
-
- //! Get the Mf
- /*!
- \return the Mf
- */
- Double_t getMf() const {return (Mf_!=0) ? Mf_->value() : 0.0;}
-
- //! See if the Mf parameter is fixed or floating
- /*!
- \return kTRUE if the Mf parameter is fixed, kFALSE otherwise
- */
- Bool_t fixMf() const {return (Mf_!=0) ? Mf_->fixed() : kTRUE;}
-
-
- //! Set the parameter Mprime
- /*!
- \param [in] Mprime
- */
- void setMprime(const Double_t Mprime);
-
- //! Get the Mprime
- /*!
- \return the Mprime
- */
- Double_t getMprime() const {return (Mprime_!=0) ? Mprime_->value() : 0.0;}
-
- //! See if the Mprime parameter is fixed or floating
- /*!
- \return kTRUE if the Mprime parameter is fixed, kFALSE otherwise
- */
- Bool_t fixMprime() const {return (Mprime_!=0) ? Mprime_->fixed() : kTRUE;}
-
-
- //! Set the parameter Eps1
- /*!
- \param [in] Eps1
- */
- void setEps1(const Double_t Eps1);
-
- //! Get the Eps1
- /*!
- \return the Eps1
- */
- Double_t getEps1() const {return (Eps1_!=0) ? Eps1_->value() : 0.0;}
-
- //! See if the Eps1 parameter is fixed or floating
- /*!
- \return kTRUE if the Eps1 parameter is fixed, kFALSE otherwise
- */
- Bool_t fixEps1() const {return (Eps1_!=0) ? Eps1_->fixed() : kTRUE;}
-
-
- //! Set the parameter Eps2
- /*!
- \param [in] Eps2
- */
- void setEps2(const Double_t Eps2);
-
- //! Get the Eps2
- /*!
- \return the Eps2
- */
- Double_t getEps2() const {return (Eps2_!=0) ? Eps2_->value() : 0.0;}
-
- //! See if the Eps2 parameter is fixed or floating
- /*!
- \return kTRUE if the Eps2 parameter is fixed, kFALSE otherwise
- */
- Bool_t fixEps2() const {return (Eps2_!=0) ? Eps2_->fixed() : kTRUE;}
-
-
- //! Set the parameter C0
- /*!
- \param [in] C0
- */
- void setC0(const Double_t C0);
-
- //! Get the C0
- /*!
- \return the C0
- */
- Double_t getC0() const {return (C0_!=0) ? C0_->value() : 0.0;}
-
- //! See if the C0 parameter is fixed or floating
- /*!
- \return kTRUE if the C0 parameter is fixed, kFALSE otherwise
- */
- Bool_t fixC0() const {return (C0_!=0) ? C0_->fixed() : kTRUE;}
-
-
- //! Complex resonant amplitude
- /*!
- \param [in] mass appropriate invariant mass for the resonance
- \param [in] spinTerm Zemach spin term
- */
- virtual LauComplex resAmp(Double_t mass, Double_t spinTerm);
-
- private:
- //! Copy constructor (not implemented)
- LauRescatteringRes(const LauRescatteringRes& rhs);
-
- //! Copy assignment operator (not implemented)
- LauRescatteringRes& operator=(const LauRescatteringRes& rhs);
-
- //! the term for the PiPi
- LauParameter* lambdaPiPi_;
-
- //! the term for the KK
- LauParameter* lambdaKK_;
-
- //! the term for the Mf_
- LauParameter* Mf_;
-
- //! the term for the Ms
- LauParameter* Ms_;
-
- //! the term for the Mprime
- LauParameter* Mprime_;
-
- //! the term for the Eps1
- LauParameter* Eps1_;
-
- //! the term for the Eps2
- LauParameter* Eps2_;
-
- //! the term for the C0
- LauParameter* C0_;
-
- //! The model to use
- LauAbsResonance::LauResonanceModel model_;
-
- ClassDef(LauRescatteringRes,0)
+ public:
+ //! Constructor
+ /*!
+ \param [in] resInfo the object containing information on the resonance name, mass, width, spin, charge, etc.
+ \param [in] resType the model of the resonance
+ \param [in] resPairAmpInt the number of the daughter not produced by the resonance
+ \param [in] daughters the daughter particles
+ */
+ LauRescatteringRes( LauResonanceInfo* resInfo,
+ const LauAbsResonance::LauResonanceModel resType,
+ const Int_t resPairAmpInt,
+ const LauDaughters* daughters );
+
+ //! Destructor
+ virtual ~LauRescatteringRes();
+
+ //! Initialise the model
+ virtual void initialise();
+
+ //! Get the complex dynamical amplitude
+ /*!
+ \param [in] kinematics the kinematic variables of the current event
+ \return the complex amplitude
+ */
+ virtual LauComplex amplitude( const LauKinematics* kinematics );
+
+ //! Get the resonance model type
+ /*!
+ \return the resonance model type
+ */
+
+ virtual LauAbsResonance::LauResonanceModel getResonanceModel() const { return model_; }
+
+ //! Set value of the various parameters
+ /*!
+ \param [in] name the name of the parameter to be changed
+ \param [in] value the new parameter value
+ */
+ virtual void setResonanceParameter( const TString& name, const Double_t value );
+
+ //! Allow the various parameters to float in the fit
+ /*!
+ \param [in] name the name of the parameter to be floated
+ */
+ virtual void floatResonanceParameter( const TString& name );
+
+ //! Access the given resonance parameter
+ /*!
+ \param [in] name the name of the parameter
+ \return the corresponding parameter
+ */
+ virtual LauParameter* getResonanceParameter( const TString& name );
+
+ //! Retrieve the resonance parameters, e.g. so that they can be loaded into a fit
+ /*!
+ \return floating parameters of the resonance
+ */
+ virtual const std::vector<LauParameter*>& getFloatingParameters();
+
+ protected:
+ //! Set the parameter lambdaPiPi, the term for the PiPi
+ /*!
+ \param [in] lambda the term for the PiPi
+ */
+ void setLambdaPiPi( const Double_t lambda );
+
+ //! Get the lambdaPiPi, the term for the PiPi
+ /*!
+ \return lambdaPiPi, the term for the PiPi
+ */
+ Double_t getLambdaPiPi() const { return ( lambdaPiPi_ != 0 ) ? lambdaPiPi_->value() : 0.0; }
+
+ //! See if the lambdaPiPi parameter is fixed or floating
+ /*!
+ \return kTRUE if the lambdaPiPi parameter is fixed, kFALSE otherwise
+ */
+ Bool_t fixLambdaPiPi() const { return ( lambdaPiPi_ != 0 ) ? lambdaPiPi_->fixed() : kTRUE; }
+
+ //! Set the parameter lambdaKK, the term for the KK
+ /*!
+ \param [in] lambda the term for the KK
+ */
+ void setLambdaKK( const Double_t lambda );
+
+ //! Get the lambdaKK, the term for the KK
+ /*!
+ \return lambdaKK, the term for the KK
+ */
+ Double_t getLambdaKK() const { return ( lambdaKK_ != 0 ) ? lambdaKK_->value() : 0.0; }
+
+ //! See if the lambdaKK parameter is fixed or floating
+ /*!
+ \return kTRUE if the lambdaKK parameter is fixed, kFALSE otherwise
+ */
+ Bool_t fixLambdaKK() const { return ( lambdaKK_ != 0 ) ? lambdaKK_->fixed() : kTRUE; }
+
+ //! Set the parameter Ms
+ /*!
+ \param [in] Ms
+ */
+ void setMs( const Double_t Ms );
+
+ //! Get the Ms
+ /*!
+ \return the Ms
+ */
+ Double_t getMs() const { return ( Ms_ != 0 ) ? Ms_->value() : 0.0; }
+
+ //! See if the Ms parameter is fixed or floating
+ /*!
+ \return kTRUE if the Ms parameter is fixed, kFALSE otherwise
+ */
+ Bool_t fixMs() const { return ( Ms_ != 0 ) ? Ms_->fixed() : kTRUE; }
+
+ //! Set the parameter Mf
+ /*!
+ \param [in] Mf
+ */
+ void setMf( const Double_t Mf );
+
+ //! Get the Mf
+ /*!
+ \return the Mf
+ */
+ Double_t getMf() const { return ( Mf_ != 0 ) ? Mf_->value() : 0.0; }
+
+ //! See if the Mf parameter is fixed or floating
+ /*!
+ \return kTRUE if the Mf parameter is fixed, kFALSE otherwise
+ */
+ Bool_t fixMf() const { return ( Mf_ != 0 ) ? Mf_->fixed() : kTRUE; }
+
+ //! Set the parameter Mprime
+ /*!
+ \param [in] Mprime
+ */
+ void setMprime( const Double_t Mprime );
+
+ //! Get the Mprime
+ /*!
+ \return the Mprime
+ */
+ Double_t getMprime() const { return ( Mprime_ != 0 ) ? Mprime_->value() : 0.0; }
+
+ //! See if the Mprime parameter is fixed or floating
+ /*!
+ \return kTRUE if the Mprime parameter is fixed, kFALSE otherwise
+ */
+ Bool_t fixMprime() const { return ( Mprime_ != 0 ) ? Mprime_->fixed() : kTRUE; }
+
+ //! Set the parameter Eps1
+ /*!
+ \param [in] Eps1
+ */
+ void setEps1( const Double_t Eps1 );
+
+ //! Get the Eps1
+ /*!
+ \return the Eps1
+ */
+ Double_t getEps1() const { return ( Eps1_ != 0 ) ? Eps1_->value() : 0.0; }
+
+ //! See if the Eps1 parameter is fixed or floating
+ /*!
+ \return kTRUE if the Eps1 parameter is fixed, kFALSE otherwise
+ */
+ Bool_t fixEps1() const { return ( Eps1_ != 0 ) ? Eps1_->fixed() : kTRUE; }
+
+ //! Set the parameter Eps2
+ /*!
+ \param [in] Eps2
+ */
+ void setEps2( const Double_t Eps2 );
+
+ //! Get the Eps2
+ /*!
+ \return the Eps2
+ */
+ Double_t getEps2() const { return ( Eps2_ != 0 ) ? Eps2_->value() : 0.0; }
+
+ //! See if the Eps2 parameter is fixed or floating
+ /*!
+ \return kTRUE if the Eps2 parameter is fixed, kFALSE otherwise
+ */
+ Bool_t fixEps2() const { return ( Eps2_ != 0 ) ? Eps2_->fixed() : kTRUE; }
+
+ //! Set the parameter C0
+ /*!
+ \param [in] C0
+ */
+ void setC0( const Double_t C0 );
+
+ //! Get the C0
+ /*!
+ \return the C0
+ */
+ Double_t getC0() const { return ( C0_ != 0 ) ? C0_->value() : 0.0; }
+
+ //! See if the C0 parameter is fixed or floating
+ /*!
+ \return kTRUE if the C0 parameter is fixed, kFALSE otherwise
+ */
+ Bool_t fixC0() const { return ( C0_ != 0 ) ? C0_->fixed() : kTRUE; }
+
+ //! Complex resonant amplitude
+ /*!
+ \param [in] mass appropriate invariant mass for the resonance
+ \param [in] spinTerm Zemach spin term
+ */
+ virtual LauComplex resAmp( Double_t mass, Double_t spinTerm );
+
+ private:
+ //! Copy constructor (not implemented)
+ LauRescatteringRes( const LauRescatteringRes& rhs );
+
+ //! Copy assignment operator (not implemented)
+ LauRescatteringRes& operator=( const LauRescatteringRes& rhs );
+
+ //! the term for the PiPi
+ LauParameter* lambdaPiPi_;
+
+ //! the term for the KK
+ LauParameter* lambdaKK_;
+
+ //! the term for the Mf_
+ LauParameter* Mf_;
+
+ //! the term for the Ms
+ LauParameter* Ms_;
+
+ //! the term for the Mprime
+ LauParameter* Mprime_;
+
+ //! the term for the Eps1
+ LauParameter* Eps1_;
+
+ //! the term for the Eps2
+ LauParameter* Eps2_;
+
+ //! the term for the C0
+ LauParameter* C0_;
+
+ //! The model to use
+ LauAbsResonance::LauResonanceModel model_;
+
+ ClassDef( LauRescatteringRes, 0 )
};
#endif
diff --git a/inc/LauResonanceInfo.hh b/inc/LauResonanceInfo.hh
index 3df334d..9492a24 100644
--- a/inc/LauResonanceInfo.hh
+++ b/inc/LauResonanceInfo.hh
@@ -1,205 +1,209 @@
/*
Copyright 2006 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauResonanceInfo.hh
\brief File containing declaration of LauResonanceInfo class.
*/
/*! \class LauResonanceInfo
\brief Class for defining the properties of a resonant particle.
*/
#ifndef LAU_RESONANCE_INFO
#define LAU_RESONANCE_INFO
-#include <iosfwd>
-#include <set>
+#include "LauBlattWeisskopfFactor.hh"
#include "TString.h"
-#include "LauBlattWeisskopfFactor.hh"
+#include <iosfwd>
+#include <set>
class LauParameter;
-
class LauResonanceInfo {
- public:
- //! Constructor
- /*!
- \param [in] name the name of the resonant particle
- \param [in] mass the mass of the resonant particle
- \param [in] width the width of the resonant particle
- \param [in] spin the spin of the resonant particle
- \param [in] charge the charge of the resonant particle
- \param [in] bwCategory the Blatt-Weisskopf barrier factor category
- \param [in] bwRadius the Blatt-Weisskopf radius of the resonant particle
- */
- LauResonanceInfo(const TString& name, const Double_t mass, const Double_t width, const Int_t spin, const Int_t charge, const LauBlattWeisskopfFactor::BlattWeisskopfCategory bwCategory, const Double_t bwRadius = 4.0);
-
- //! Destructor
- virtual ~LauResonanceInfo();
-
- //! Retrieve the name of the resonant particle
- /*!
- \return the name of the resonant particle
- */
- TString getName() const {return name_;}
-
- //! Retrieve the sanitised name of the resonant particle
- /*!
- Removes/replaces characters from the name that cause
- problems when used in TBranch names
-
- \return the sanitised name of the resonant particle
- */
- TString getSanitisedName() const {return sanitisedName_;}
-
- //! Retrieve the mass of the resonant particle
- /*!
- \return the mass of the resonant particle
- */
- LauParameter* getMass() const {return mass_;}
-
- //! Retrieve the width of the resonant particle
- /*!
- \return the width of the resonant particle
- */
- LauParameter* getWidth() const {return width_;}
-
- //! Retrieve the spin of the resonant particle
- /*!
- \return the spin of the resonant particle
- */
- UInt_t getSpin() const {return spin_;}
-
- //! Retrieve the charge of the resonant particle
- /*!
- \return the charge of the resonant particle
- */
- Int_t getCharge() const {return charge_;}
-
- //! Retrieve the BW category of the resonant particle
- /*!
- \return the BW category of the resonant particle
- */
- LauBlattWeisskopfFactor::BlattWeisskopfCategory getBWCategory() const {return bwCategory_;}
-
- //! Retrieve the BW radius of the resonant particle
- /*!
- \return the BW radius of the resonant particle
- */
- Double_t getBWRadius() const {return bwRadius_;}
-
- //! Create the charge conjugate particle info record
- /*!
- The mass and width parameters are cloned
- */
- LauResonanceInfo* createChargeConjugate();
-
- //! Create another record that will share parameters with this one
- /*!
- The name needs to be specified.
- The spin and charge are assumed to be the same.
- The mass, width and other parameters will be cloned.
-
- \param [in] name the name of the resonant particle
- */
- LauResonanceInfo* createSharedParameterRecord( const TString& name );
-
- //! Retrieve an extra parameter of the resonance
- /*!
- \return the extra parameter (or null pointer if not found)
- */
- LauParameter* getExtraParameter( const TString& parName );
-
- //! Add an extra parameter of the resonance
- /*!
- \param [in] param the extra parameter to be added
- \param [in] independentPar governs whether any info record that usually shares parameters with this one should also share this one (the default) or make its own independent version
- */
- void addExtraParameter( LauParameter* param, const Bool_t independentPar = kFALSE );
-
- protected:
- //! Add a clone of an extra parameter of the resonance
- /*!
- \param [in] param the extra parameter to be added
- \param [in] copyNotClone should we create an unlinked copy instead of cloning - default is to clone
- */
- void addCloneOfExtraParameter( LauParameter* param, const Bool_t copyNotClone = kFALSE );
-
- private:
- //! Copy constructor (not implemented)
- LauResonanceInfo( const LauResonanceInfo& other );
-
- //! Copy constructor (with new name and charge)
- LauResonanceInfo( const LauResonanceInfo& other, const TString& newName, const Int_t newCharge );
-
- //! Copy assignment operator (not implemented)
- LauResonanceInfo& operator=( const LauResonanceInfo& other );
-
- //! Create the sanitised name by removing characters that are illegal in TBranch names
- void sanitiseName();
-
- //! The name of the resonant particle
- TString name_;
-
- //! The name of the resonant particle with illegal characters removed
- TString sanitisedName_;
-
- //! The mass of the resonant particle
- LauParameter* mass_;
-
- //! The width of the resonant particle
- LauParameter* width_;
-
- //! The spin of the resonant particle
- UInt_t spin_;
-
- //! The charge of the resonant particle
- Int_t charge_;
-
- //! The Blatt-Weisskopf barrier factor category
- LauBlattWeisskopfFactor::BlattWeisskopfCategory bwCategory_;
-
- //! The Blatt-Weisskopf radius of the resonant particle
- Double_t bwRadius_;
-
- //! The conjugate info object
- LauResonanceInfo* conjugate_;
-
- //! Other info objects that share parameters with this one
- std::vector<LauResonanceInfo*> sharedParRecords_;
-
- //! Extra parameters
- std::set<LauParameter*> extraPars_;
-
- ClassDef(LauResonanceInfo, 0) // Specify each allowed resonance
-
+ public:
+ //! Constructor
+ /*!
+ \param [in] name the name of the resonant particle
+ \param [in] mass the mass of the resonant particle
+ \param [in] width the width of the resonant particle
+ \param [in] spin the spin of the resonant particle
+ \param [in] charge the charge of the resonant particle
+ \param [in] bwCategory the Blatt-Weisskopf barrier factor category
+ \param [in] bwRadius the Blatt-Weisskopf radius of the resonant particle
+ */
+ LauResonanceInfo( const TString& name,
+ const Double_t mass,
+ const Double_t width,
+ const Int_t spin,
+ const Int_t charge,
+ const LauBlattWeisskopfFactor::BlattWeisskopfCategory bwCategory,
+ const Double_t bwRadius = 4.0 );
+
+ //! Destructor
+ virtual ~LauResonanceInfo();
+
+ //! Retrieve the name of the resonant particle
+ /*!
+ \return the name of the resonant particle
+ */
+ TString getName() const { return name_; }
+
+ //! Retrieve the sanitised name of the resonant particle
+ /*!
+ Removes/replaces characters from the name that cause
+ problems when used in TBranch names
+
+ \return the sanitised name of the resonant particle
+ */
+ TString getSanitisedName() const { return sanitisedName_; }
+
+ //! Retrieve the mass of the resonant particle
+ /*!
+ \return the mass of the resonant particle
+ */
+ LauParameter* getMass() const { return mass_; }
+
+ //! Retrieve the width of the resonant particle
+ /*!
+ \return the width of the resonant particle
+ */
+ LauParameter* getWidth() const { return width_; }
+
+ //! Retrieve the spin of the resonant particle
+ /*!
+ \return the spin of the resonant particle
+ */
+ UInt_t getSpin() const { return spin_; }
+
+ //! Retrieve the charge of the resonant particle
+ /*!
+ \return the charge of the resonant particle
+ */
+ Int_t getCharge() const { return charge_; }
+
+ //! Retrieve the BW category of the resonant particle
+ /*!
+ \return the BW category of the resonant particle
+ */
+ LauBlattWeisskopfFactor::BlattWeisskopfCategory getBWCategory() const { return bwCategory_; }
+
+ //! Retrieve the BW radius of the resonant particle
+ /*!
+ \return the BW radius of the resonant particle
+ */
+ Double_t getBWRadius() const { return bwRadius_; }
+
+ //! Create the charge conjugate particle info record
+ /*!
+ The mass and width parameters are cloned
+ */
+ LauResonanceInfo* createChargeConjugate();
+
+ //! Create another record that will share parameters with this one
+ /*!
+ The name needs to be specified.
+ The spin and charge are assumed to be the same.
+ The mass, width and other parameters will be cloned.
+
+ \param [in] name the name of the resonant particle
+ */
+ LauResonanceInfo* createSharedParameterRecord( const TString& name );
+
+ //! Retrieve an extra parameter of the resonance
+ /*!
+ \return the extra parameter (or null pointer if not found)
+ */
+ LauParameter* getExtraParameter( const TString& parName );
+
+ //! Add an extra parameter of the resonance
+ /*!
+ \param [in] param the extra parameter to be added
+ \param [in] independentPar governs whether any info record that usually shares parameters with this one should also share this one (the default) or make its own independent version
+ */
+ void addExtraParameter( LauParameter* param, const Bool_t independentPar = kFALSE );
+
+ protected:
+ //! Add a clone of an extra parameter of the resonance
+ /*!
+ \param [in] param the extra parameter to be added
+ \param [in] copyNotClone should we create an unlinked copy instead of cloning - default is to clone
+ */
+ void addCloneOfExtraParameter( LauParameter* param, const Bool_t copyNotClone = kFALSE );
+
+ private:
+ //! Copy constructor (not implemented)
+ LauResonanceInfo( const LauResonanceInfo& other );
+
+ //! Copy constructor (with new name and charge)
+ LauResonanceInfo( const LauResonanceInfo& other, const TString& newName, const Int_t newCharge );
+
+ //! Copy assignment operator (not implemented)
+ LauResonanceInfo& operator=( const LauResonanceInfo& other );
+
+ //! Create the sanitised name by removing characters that are illegal in TBranch names
+ void sanitiseName();
+
+ //! The name of the resonant particle
+ TString name_;
+
+ //! The name of the resonant particle with illegal characters removed
+ TString sanitisedName_;
+
+ //! The mass of the resonant particle
+ LauParameter* mass_;
+
+ //! The width of the resonant particle
+ LauParameter* width_;
+
+ //! The spin of the resonant particle
+ UInt_t spin_;
+
+ //! The charge of the resonant particle
+ Int_t charge_;
+
+ //! The Blatt-Weisskopf barrier factor category
+ LauBlattWeisskopfFactor::BlattWeisskopfCategory bwCategory_;
+
+ //! The Blatt-Weisskopf radius of the resonant particle
+ Double_t bwRadius_;
+
+ //! The conjugate info object
+ LauResonanceInfo* conjugate_;
+
+ //! Other info objects that share parameters with this one
+ std::vector<LauResonanceInfo*> sharedParRecords_;
+
+ //! Extra parameters
+ std::set<LauParameter*> extraPars_;
+
+ ClassDef( LauResonanceInfo, 0 ) // Specify each allowed resonance
};
//! output operator formatting of an info record
std::ostream& operator<<( std::ostream& stream, const LauResonanceInfo& infoRecord );
#endif
diff --git a/inc/LauResonanceMaker.hh b/inc/LauResonanceMaker.hh
index 0f09938..051b84a 100644
--- a/inc/LauResonanceMaker.hh
+++ b/inc/LauResonanceMaker.hh
@@ -1,199 +1,208 @@
/*
Copyright 2004 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauResonanceMaker.hh
\brief File containing declaration of LauResonanceMaker class.
*/
/*! \class LauResonanceMaker
\brief Singleton factory class for creating resonances.
Singleton factory class for creating resonances. Information records for all known resonances are stored within this class.
*/
#ifndef LAU_RESONANCE_MAKER
#define LAU_RESONANCE_MAKER
-#include <iosfwd>
-#include <vector>
+#include "LauAbsResonance.hh"
#include "TString.h"
-#include "LauAbsResonance.hh"
+#include <iosfwd>
+#include <vector>
class LauDaughters;
class LauResonanceInfo;
-
class LauResonanceMaker {
- public:
- //! Get the factory instance
- static LauResonanceMaker& get();
-
- //! Set the type of BW factor (for all categories)
- /*!
- This must be used before creating any resonances
-
- \param [in] bwType the Blatt-Weisskopf barrier type
- */
- void setBWType(const LauBlattWeisskopfFactor::BarrierType bwType);
-
- //! Set the rest frame in which the bachelor momentum should be calculated (for all BW categories)
- /*!
- This must be used before creating any resonances
-
- \param [in] restFrame the rest frame in which the bachelor momentum should be calculated for the Blatt-Weisskopf factors
- */
- void setBWBachelorRestFrame(const LauBlattWeisskopfFactor::RestFrame restFrame);
-
- //! Set the spin formalism to be used for all resonances
- /*!
- This must be used before creating any resonances
-
- \param [in] spinType the spin formalism to be used
- */
- void setSpinFormalism(const LauAbsResonance::LauSpinType spinType);
-
- //! Set the BW radius for the given category
- /*!
- \param [in] bwCategory the Blatt-Weisskopf barrier factor category
- \param [in] bwRadius the radius value to be used for the given category
- */
- void setDefaultBWRadius(const LauBlattWeisskopfFactor::BlattWeisskopfCategory bwCategory, const Double_t bwRadius);
-
- //! Fix or release the Blatt-Weisskopf barrier radius for the given category
- /*!
- \param [in] bwCategory the Blatt-Weisskopf barrier factor category
- \param [in] fixRadius new status of the radius (kTRUE = fixed, kFALSE = floating)
- */
- void fixBWRadius(const LauBlattWeisskopfFactor::BlattWeisskopfCategory bwCategory, const Bool_t fixRadius);
-
- //! Create a resonance
- /*!
- \param [in] daughters defines the Dalitz plot in which the resonance should be created
- \param [in] resName the name of the resonant particle
- \param [in] resPairAmpInt the index of the daughter not produced by the resonance
- \param [in] resType the type of the resonance
- \param [in] bwCategory the Blatt-Weisskopf barrier factor category
- \return the resonance
- */
- LauAbsResonance* getResonance(const LauDaughters* daughters, const TString& resName, const Int_t resPairAmpInt, const LauAbsResonance::LauResonanceModel resType, const LauBlattWeisskopfFactor::BlattWeisskopfCategory bwCategory = LauBlattWeisskopfFactor::Default);
-
- //! Retrieve the integer index for the specified resonance
- /*!
- \param [in] name the name of the resonant particle
- \return the index
- */
- Int_t resTypeInt(const TString& name) const;
-
- //! Retrieve the number of defined resonances
- /*!
- \return the number of defined resonances
- */
- UInt_t getNResDefMax() const {return nResDefMax_;}
-
- //! Print the information records, one per line, to the requested stream
- /*!
- \param [in,out] stream the stream to which to print the info
- */
- void printAll( std::ostream& stream ) const;
-
- //! Get the information for the given resonance name
- /*!
- \param [in] resName the name of the resonant particle
- \return the LauResonanceInfo pointer if we can find the resonance name
- */
- LauResonanceInfo* getResInfo(const TString& resName) const;
-
- //! Retrieve parent Blatt-Weisskopf factor (for use by K-matrix pole/SVP which doesn't have a `resInfo')
- LauBlattWeisskopfFactor* getParentBWFactor(Int_t newSpin, LauBlattWeisskopfFactor::BarrierType barrierType);
-
- protected:
- //! Create the list of known resonances
- void createResonanceVector();
-
- //! Retrieve Blatt-Weisskopf factor for the given category
- LauBlattWeisskopfFactor* getBWFactor(const LauBlattWeisskopfFactor::BlattWeisskopfCategory bwCategory, const LauResonanceInfo* resInfo);
-
- private:
- /*!
- \struct BlattWeisskopfCategoryInfo
- \brief Data structure to store information on a given Blatt-Weisskopf category
- */
- struct BlattWeisskopfCategoryInfo {
- //! The BW factor object
- LauBlattWeisskopfFactor* bwFactor_;
- //! The default value for the radius in this category
- Double_t defaultRadius_;
- //! Whether or not the radius value for this category should be fixed in the fit
- Bool_t radiusFixed_;
- };
-
- //! Define a type to hold information on each BW category
- typedef std::map<LauBlattWeisskopfFactor::BlattWeisskopfCategory,BlattWeisskopfCategoryInfo> BWFactorCategoryMap;
-
- //! Constructor
- LauResonanceMaker();
-
- //! Destructor
- virtual ~LauResonanceMaker();
-
- //! Copy constructor (not inplemented)
- LauResonanceMaker( const LauResonanceMaker& other );
-
- //! Copy assignment (not implemented)
- LauResonanceMaker& operator=( const LauResonanceMaker& other );
-
- //! The singleton instance
- static LauResonanceMaker* resonanceMaker_;
-
- //! The number of known resonances
- UInt_t nResDefMax_;
-
- //! The known resonances
- std::vector<LauResonanceInfo*> resInfo_;
-
- //! The type of the Blatt-Weisskopf barrier to use for all resonances
- LauBlattWeisskopfFactor::BarrierType bwBarrierType_;
-
- //! The rest frame in which the bachelor momentum used in the Blatt-Weisskopf factors should be calculated
- LauBlattWeisskopfFactor::RestFrame bwRestFrame_;
-
- //! The spin formalism that should be used for all resonances
- LauAbsResonance::LauSpinType spinFormalism_;
-
- //! The Blatt-Weisskopf factor objects (and related information) for each category
- BWFactorCategoryMap bwFactors_;
-
- //! The Blatt-Weisskopf factor objects for resonances in the independent category
- std::vector<LauBlattWeisskopfFactor*> bwIndepFactors_;
-
- //! Boolean flag to control printing a summary of the formalism to be used when the first resonance is created
- Bool_t summaryPrinted_;
-
- ClassDef(LauResonanceMaker,0) // Kinematic routines
+ public:
+ //! Get the factory instance
+ static LauResonanceMaker& get();
+
+ //! Set the type of BW factor (for all categories)
+ /*!
+ This must be used before creating any resonances
+
+ \param [in] bwType the Blatt-Weisskopf barrier type
+ */
+ void setBWType( const LauBlattWeisskopfFactor::BarrierType bwType );
+
+ //! Set the rest frame in which the bachelor momentum should be calculated (for all BW categories)
+ /*!
+ This must be used before creating any resonances
+
+ \param [in] restFrame the rest frame in which the bachelor momentum should be calculated for the Blatt-Weisskopf factors
+ */
+ void setBWBachelorRestFrame( const LauBlattWeisskopfFactor::RestFrame restFrame );
+
+ //! Set the spin formalism to be used for all resonances
+ /*!
+ This must be used before creating any resonances
+
+ \param [in] spinType the spin formalism to be used
+ */
+ void setSpinFormalism( const LauAbsResonance::LauSpinType spinType );
+
+ //! Set the BW radius for the given category
+ /*!
+ \param [in] bwCategory the Blatt-Weisskopf barrier factor category
+ \param [in] bwRadius the radius value to be used for the given category
+ */
+ void setDefaultBWRadius( const LauBlattWeisskopfFactor::BlattWeisskopfCategory bwCategory,
+ const Double_t bwRadius );
+
+ //! Fix or release the Blatt-Weisskopf barrier radius for the given category
+ /*!
+ \param [in] bwCategory the Blatt-Weisskopf barrier factor category
+ \param [in] fixRadius new status of the radius (kTRUE = fixed, kFALSE = floating)
+ */
+ void fixBWRadius( const LauBlattWeisskopfFactor::BlattWeisskopfCategory bwCategory,
+ const Bool_t fixRadius );
+
+ //! Create a resonance
+ /*!
+ \param [in] daughters defines the Dalitz plot in which the resonance should be created
+ \param [in] resName the name of the resonant particle
+ \param [in] resPairAmpInt the index of the daughter not produced by the resonance
+ \param [in] resType the type of the resonance
+ \param [in] bwCategory the Blatt-Weisskopf barrier factor category
+ \return the resonance
+ */
+ LauAbsResonance* getResonance( const LauDaughters* daughters,
+ const TString& resName,
+ const Int_t resPairAmpInt,
+ const LauAbsResonance::LauResonanceModel resType,
+ const LauBlattWeisskopfFactor::BlattWeisskopfCategory bwCategory =
+ LauBlattWeisskopfFactor::Default );
+
+ //! Retrieve the integer index for the specified resonance
+ /*!
+ \param [in] name the name of the resonant particle
+ \return the index
+ */
+ Int_t resTypeInt( const TString& name ) const;
+
+ //! Retrieve the number of defined resonances
+ /*!
+ \return the number of defined resonances
+ */
+ UInt_t getNResDefMax() const { return nResDefMax_; }
+
+ //! Print the information records, one per line, to the requested stream
+ /*!
+ \param [in,out] stream the stream to which to print the info
+ */
+ void printAll( std::ostream& stream ) const;
+
+ //! Get the information for the given resonance name
+ /*!
+ \param [in] resName the name of the resonant particle
+ \return the LauResonanceInfo pointer if we can find the resonance name
+ */
+ LauResonanceInfo* getResInfo( const TString& resName ) const;
+
+ //! Retrieve parent Blatt-Weisskopf factor (for use by K-matrix pole/SVP which doesn't have a `resInfo')
+ LauBlattWeisskopfFactor* getParentBWFactor( Int_t newSpin,
+ LauBlattWeisskopfFactor::BarrierType barrierType );
+
+ protected:
+ //! Create the list of known resonances
+ void createResonanceVector();
+
+ //! Retrieve Blatt-Weisskopf factor for the given category
+ LauBlattWeisskopfFactor* getBWFactor( const LauBlattWeisskopfFactor::BlattWeisskopfCategory bwCategory,
+ const LauResonanceInfo* resInfo );
+
+ private:
+ /*!
+ \struct BlattWeisskopfCategoryInfo
+ \brief Data structure to store information on a given Blatt-Weisskopf category
+ */
+ struct BlattWeisskopfCategoryInfo {
+ //! The BW factor object
+ LauBlattWeisskopfFactor* bwFactor_;
+ //! The default value for the radius in this category
+ Double_t defaultRadius_;
+ //! Whether or not the radius value for this category should be fixed in the fit
+ Bool_t radiusFixed_;
+ };
+
+ //! Define a type to hold information on each BW category
+ typedef std::map<LauBlattWeisskopfFactor::BlattWeisskopfCategory, BlattWeisskopfCategoryInfo>
+ BWFactorCategoryMap;
+
+ //! Constructor
+ LauResonanceMaker();
+
+ //! Destructor
+ virtual ~LauResonanceMaker();
+
+ //! Copy constructor (not inplemented)
+ LauResonanceMaker( const LauResonanceMaker& other );
+
+ //! Copy assignment (not implemented)
+ LauResonanceMaker& operator=( const LauResonanceMaker& other );
+
+ //! The singleton instance
+ static LauResonanceMaker* resonanceMaker_;
+
+ //! The number of known resonances
+ UInt_t nResDefMax_;
+
+ //! The known resonances
+ std::vector<LauResonanceInfo*> resInfo_;
+
+ //! The type of the Blatt-Weisskopf barrier to use for all resonances
+ LauBlattWeisskopfFactor::BarrierType bwBarrierType_;
+
+ //! The rest frame in which the bachelor momentum used in the Blatt-Weisskopf factors should be calculated
+ LauBlattWeisskopfFactor::RestFrame bwRestFrame_;
+
+ //! The spin formalism that should be used for all resonances
+ LauAbsResonance::LauSpinType spinFormalism_;
+
+ //! The Blatt-Weisskopf factor objects (and related information) for each category
+ BWFactorCategoryMap bwFactors_;
+
+ //! The Blatt-Weisskopf factor objects for resonances in the independent category
+ std::vector<LauBlattWeisskopfFactor*> bwIndepFactors_;
+
+ //! Boolean flag to control printing a summary of the formalism to be used when the first resonance is created
+ Bool_t summaryPrinted_;
+
+ ClassDef( LauResonanceMaker, 0 ) // Kinematic routines
};
#endif
diff --git a/inc/LauResultsExtractor.hh b/inc/LauResultsExtractor.hh
index 29f7ea5..9440852 100644
--- a/inc/LauResultsExtractor.hh
+++ b/inc/LauResultsExtractor.hh
@@ -1,126 +1,126 @@
/*
Copyright 2005 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
+#include "TString.h"
+
#include <map>
#include <vector>
-#include "TString.h"
-
class TChain;
class TFile;
class TH1;
class TTree;
/*! \file LauResultsExtractor.hh
\brief File containing declaration of LauResultsExtractor class.
*/
/*! \class LauResultsExtractor
\brief Utility class to allow the extraction of the best fit from a series of fits to a given data sample
A utility class to allow the extraction of the best fit from a series of fits to a given data sample.
When fitting amplitude models, the likelihood parameter space is highly complex.
Hence the fitter can often wander into local minima.
To mitigate this effect a data sample can be fitted many times with randomised starting values of the isobar parameters.
It is then necessary to determine which of these fits gives the best solution, i.e. the minimum NLL.
This class performs this task, reading in a series of fits for each data sample and writing out a single file that contains the results of the best fit for each data sample.
*/
-class LauResultsExtractor
-{
- public:
- //! Constructor
- /*!
- \param [in] inputFileName name of text file containing the input ROOT files
- \param [in] outputFileName name of the file to which the best fit info should be written
- \param [in] treeName name of the tree to read from the input files
- */
- LauResultsExtractor(const TString& inputFileName, const TString& outputFileName, const TString& treeName);
-
- //! Destructor
- virtual ~LauResultsExtractor();
-
- //! Run the calculations
- /*!
- \param [in] numExpts the number of experiments to process
- */
- void process(const Int_t numExpts);
-
- protected:
- //! Create storage for leaves and call SetBranchAddress for each
- void setupInputTree();
- //! Create branches in the output tree
- void setupOutputTree(TTree * tree);
- //! Toggle branch status of input tree branches (except iExpt, fitStatus and NLL)
- void setInputTreeBranchStatus(const Bool_t status);
- //! Clear all information
- void clearMaps();
- //! Write the output file
- void writeFile();
-
- private:
- //! Name of text file containing list of input files
- TString inputFileName_;
- //! Name of output ROOT file
- TString outputFileName_;
- //! Name of tree in input ROOT files
- TString treeName_;
-
- //! Chain of inputs
- TChain * inputTree_;
-
- //! Output file
- TFile * outputFile_;
- //! Output tree
- TTree * outputTree_;
-
- //! Number of entries in the input chain
- Int_t nEntries_;
-
- // Tree variables
- //! Storage for experiment ID variable
- Int_t iExpt_;
- //! Storage for fit status variable
- Int_t fitStatus_;
- //! Storage for NLL variable
- Double_t NLL_;
- //! Storage for EDM variable
- Double_t EDM_;
- //! Storage for other input variables
- std::map<TString,Double_t> otherVars_;
-
- //! Best NLL and corresponding tree entries for each experiment
- std::map< Int_t, std::pair<Double_t,Int_t> > bestNLL_;
- //! Worst NLL and corresponding tree entries for each experiment
- std::map< Int_t, std::pair<Double_t,Int_t> > worstNLL_;
- //! All NLL values for each experiment
- std::map< Int_t, std::vector<Double_t> > allNLLs_;
-
- //! Histograms of the NLL values for each experiment
- std::map< Int_t, TH1* > nllHistos_;
-
- ClassDef(LauResultsExtractor,0)
+class LauResultsExtractor {
+ public:
+ //! Constructor
+ /*!
+ \param [in] inputFileName name of text file containing the input ROOT files
+ \param [in] outputFileName name of the file to which the best fit info should be written
+ \param [in] treeName name of the tree to read from the input files
+ */
+ LauResultsExtractor( const TString& inputFileName,
+ const TString& outputFileName,
+ const TString& treeName );
+
+ //! Destructor
+ virtual ~LauResultsExtractor();
+
+ //! Run the calculations
+ /*!
+ \param [in] numExpts the number of experiments to process
+ */
+ void process( const Int_t numExpts );
+
+ protected:
+ //! Create storage for leaves and call SetBranchAddress for each
+ void setupInputTree();
+ //! Create branches in the output tree
+ void setupOutputTree( TTree* tree );
+ //! Toggle branch status of input tree branches (except iExpt, fitStatus and NLL)
+ void setInputTreeBranchStatus( const Bool_t status );
+ //! Clear all information
+ void clearMaps();
+ //! Write the output file
+ void writeFile();
+
+ private:
+ //! Name of text file containing list of input files
+ TString inputFileName_;
+ //! Name of output ROOT file
+ TString outputFileName_;
+ //! Name of tree in input ROOT files
+ TString treeName_;
+
+ //! Chain of inputs
+ TChain* inputTree_;
+
+ //! Output file
+ TFile* outputFile_;
+ //! Output tree
+ TTree* outputTree_;
+
+ //! Number of entries in the input chain
+ Int_t nEntries_;
+
+ // Tree variables
+ //! Storage for experiment ID variable
+ Int_t iExpt_;
+ //! Storage for fit status variable
+ Int_t fitStatus_;
+ //! Storage for NLL variable
+ Double_t NLL_;
+ //! Storage for EDM variable
+ Double_t EDM_;
+ //! Storage for other input variables
+ std::map<TString, Double_t> otherVars_;
+
+ //! Best NLL and corresponding tree entries for each experiment
+ std::map<Int_t, std::pair<Double_t, Int_t>> bestNLL_;
+ //! Worst NLL and corresponding tree entries for each experiment
+ std::map<Int_t, std::pair<Double_t, Int_t>> worstNLL_;
+ //! All NLL values for each experiment
+ std::map<Int_t, std::vector<Double_t>> allNLLs_;
+
+ //! Histograms of the NLL values for each experiment
+ std::map<Int_t, TH1*> nllHistos_;
+
+ ClassDef( LauResultsExtractor, 0 )
};
-
diff --git a/inc/LauRhoOmegaMix.hh b/inc/LauRhoOmegaMix.hh
index 127fa1a..4d8b4c9 100644
--- a/inc/LauRhoOmegaMix.hh
+++ b/inc/LauRhoOmegaMix.hh
@@ -1,285 +1,280 @@
/*
Copyright 2016 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauRhoOmegaMix.hh
\brief File containing declaration of LauRhoOmegaMix class.
*/
/*! \class LauRhoOmegaMix
\brief Class for defining the rho-omega resonance mixing model
Formulae from Paul Rensing thesis, SLAC Report 421 and Bill Dunwoodie's note
http://www.slac.stanford.edu/~wmd/omega-rho_mixing/omega-rho_mixing.note
*/
#ifndef LAU_RHO_OMEGA_MIX
#define LAU_RHO_OMEGA_MIX
-#include "TString.h"
-
#include "LauAbsResonance.hh"
#include "LauComplex.hh"
+#include "TString.h"
+
#include <vector>
class LauResonanceInfo;
class LauDaughters;
class LauParameter;
class LauRhoOmegaMix : public LauAbsResonance {
-public:
+ public:
//! Constructor
/*!
- \param [in] resInfo the object containing information on the resonance name, mass, width, spin, charge, etc.
- \param [in] resType the model of the resonance
- \param [in] resPairAmpInt the number of the daughter not produced by the resonance
- \param [in] daughters the daughter particles
+ \param [in] resInfo the object containing information on the resonance name, mass, width, spin, charge, etc.
+ \param [in] resType the model of the resonance
+ \param [in] resPairAmpInt the number of the daughter not produced by the resonance
+ \param [in] daughters the daughter particles
*/
- LauRhoOmegaMix(LauResonanceInfo* resInfo, const LauAbsResonance::LauResonanceModel resType,
- const Int_t resPairAmpInt, const LauDaughters* daughters);
+ LauRhoOmegaMix( LauResonanceInfo* resInfo,
+ const LauAbsResonance::LauResonanceModel resType,
+ const Int_t resPairAmpInt,
+ const LauDaughters* daughters );
//! Destructor
virtual ~LauRhoOmegaMix();
//! Initialise the model
virtual void initialise();
//! Initialise the rho resonance
void initialiseRho();
//! Initialise the omega resonance
void initialiseOmega();
//! Get the complex dynamical amplitude
/*!
- \param [in] kinematics the kinematic variables of the current event
- \return the complex amplitude
+ \param [in] kinematics the kinematic variables of the current event
+ \return the complex amplitude
*/
- virtual LauComplex amplitude(const LauKinematics* kinematics);
+ virtual LauComplex amplitude( const LauKinematics* kinematics );
//! Get the resonance model type
/*!
- \return the resonance model type
+ \return the resonance model type
*/
- virtual LauAbsResonance::LauResonanceModel getResonanceModel() const {return model_;}
+ virtual LauAbsResonance::LauResonanceModel getResonanceModel() const { return model_; }
//! Set value of the various parameters
/*!
- \param [in] name the name of the parameter to be changed
- \param [in] value the new parameter value
+ \param [in] name the name of the parameter to be changed
+ \param [in] value the new parameter value
*/
- virtual void setResonanceParameter(const TString& name, const Double_t value);
+ virtual void setResonanceParameter( const TString& name, const Double_t value );
//! Allow the various parameters to float in the fit
/*!
- \param [in] name the name of the parameter to be floated
+ \param [in] name the name of the parameter to be floated
*/
- virtual void floatResonanceParameter(const TString& name);
+ virtual void floatResonanceParameter( const TString& name );
//! Access the given resonance parameter
/*!
- \param [in] name the name of the parameter
- \return the corresponding parameter
+ \param [in] name the name of the parameter
+ \return the corresponding parameter
*/
- virtual LauParameter* getResonanceParameter(const TString& name);
+ virtual LauParameter* getResonanceParameter( const TString& name );
//! Retrieve the resonance parameters, e.g. so that they can be loaded into a fit
/*!
- \return floating parameters of the resonance
+ \return floating parameters of the resonance
*/
virtual const std::vector<LauParameter*>& getFloatingParameters();
//! Set which rho/omega amplitude to calculate for FF
- void setWhichAmpSq(Int_t which) { whichAmpSq_ = which; }
-
-protected:
+ void setWhichAmpSq( Int_t which ) { whichAmpSq_ = which; }
+ protected:
//! Set the omega pole mass parameter
/*!
- \param [in] mOmega new value for the omega mass parameter
+ \param [in] mOmega new value for the omega mass parameter
*/
- void setmOmegaValue(const Double_t mOmega);
+ void setmOmegaValue( const Double_t mOmega );
//! Get the omega pole mass parameter value
/*!
- \return value of the omega pole mass parameter
+ \return value of the omega pole mass parameter
*/
- Double_t getmOmegaValue() const { return (mOmega_!=0) ? mOmega_->unblindValue() : 0.0; }
+ Double_t getmOmegaValue() const { return ( mOmega_ != 0 ) ? mOmega_->unblindValue() : 0.0; }
//! Fix the omega pole mass parameter value
/*!
- \return kTRUE if the omega pole mass parameter is fixed, kFALSE otherwise
+ \return kTRUE if the omega pole mass parameter is fixed, kFALSE otherwise
*/
- Bool_t fixmOmegaValue() const { return (mOmega_!=0) ? mOmega_->fixed() : 0.0; }
-
+ Bool_t fixmOmegaValue() const { return ( mOmega_ != 0 ) ? mOmega_->fixed() : 0.0; }
//! Set the omega pole width parameter
/*!
- \param [in] wOmega new value for the omega width parameter
+ \param [in] wOmega new value for the omega width parameter
*/
- void setwOmegaValue(const Double_t wOmega);
+ void setwOmegaValue( const Double_t wOmega );
//! Get the omega pole width parameter value
/*!
- \return value of the omega pole width parameter
+ \return value of the omega pole width parameter
*/
- Double_t getwOmegaValue() const { return (wOmega_!=0) ? wOmega_->unblindValue() : 0.0; }
+ Double_t getwOmegaValue() const { return ( wOmega_ != 0 ) ? wOmega_->unblindValue() : 0.0; }
//! Fix the omega pole width parameter value
/*!
- \return kTRUE if the omega pole width parameter is fixed, kFALSE otherwise
+ \return kTRUE if the omega pole width parameter is fixed, kFALSE otherwise
*/
- Bool_t fixwOmegaValue() const { return (wOmega_!=0) ? wOmega_->fixed() : 0.0; }
-
+ Bool_t fixwOmegaValue() const { return ( wOmega_ != 0 ) ? wOmega_->fixed() : 0.0; }
//! Set the omega B magnitude mixing parameter
/*!
- \param [in] magB new value for the omega B magnitude mixing parameter
+ \param [in] magB new value for the omega B magnitude mixing parameter
*/
- void setmagBValue(const Double_t magB);
+ void setmagBValue( const Double_t magB );
//! Get the omega B magnitude mixing parameter
/*!
- \return value of the omega B magnitude mixing parameter
+ \return value of the omega B magnitude mixing parameter
*/
- Double_t getmagBValue() const { return (magB_!=0) ? magB_->unblindValue() : 0.0; }
+ Double_t getmagBValue() const { return ( magB_ != 0 ) ? magB_->unblindValue() : 0.0; }
//! Fix the omega B magnitude mixing parameter value
/*!
- \return kTRUE if the omega B magnitude mixing parameter is fixed, kFALSE otherwise
+ \return kTRUE if the omega B magnitude mixing parameter is fixed, kFALSE otherwise
*/
- Bool_t fixmagBValue() const { return (magB_!=0) ? magB_->fixed() : 0.0; }
-
+ Bool_t fixmagBValue() const { return ( magB_ != 0 ) ? magB_->fixed() : 0.0; }
//! Set the omega B phase mixing parameter
/*!
- \param [in] phiB new value for the omega B phase mixing parameter
+ \param [in] phiB new value for the omega B phase mixing parameter
*/
- void setphiBValue(const Double_t phiB);
+ void setphiBValue( const Double_t phiB );
//! Get the omega B phase mixing parameter
/*!
- \return value of the omega B phase mixing parameter
+ \return value of the omega B phase mixing parameter
*/
- Double_t getphiBValue() const { return (phiB_!=0) ? phiB_->unblindValue() : 0.0; }
+ Double_t getphiBValue() const { return ( phiB_ != 0 ) ? phiB_->unblindValue() : 0.0; }
//! Fix the omega B phase mixing parameter value
/*!
- \return kTRUE if the omega B phase mixing parameter is fixed, kFALSE otherwise
+ \return kTRUE if the omega B phase mixing parameter is fixed, kFALSE otherwise
*/
- Bool_t fixphiBValue() const { return (phiB_!=0) ? phiB_->fixed() : 0.0; }
-
+ Bool_t fixphiBValue() const { return ( phiB_ != 0 ) ? phiB_->fixed() : 0.0; }
//! Set the omega mixing parameter delta
/*!
- \param [in] delta new value for the omega mixing parameter delta
+ \param [in] delta new value for the omega mixing parameter delta
*/
- void setdeltaValue(const Double_t delta);
+ void setdeltaValue( const Double_t delta );
//! Get the omega mixing parameter delta
/*!
- \return value of the omega mixing parameter delta
+ \return value of the omega mixing parameter delta
*/
- Double_t getdeltaValue() const { return (delta_!=0) ? delta_->unblindValue() : 0.0; }
+ Double_t getdeltaValue() const { return ( delta_ != 0 ) ? delta_->unblindValue() : 0.0; }
//! Fix the omega mixing parameter delta value
/*!
- \return kTRUE if the omega mixing parameter delta is fixed, kFALSE otherwise
+ \return kTRUE if the omega mixing parameter delta is fixed, kFALSE otherwise
*/
- Bool_t fixdeltaValue() const { return (delta_!=0) ? delta_->fixed() : 0.0; }
+ Bool_t fixdeltaValue() const { return ( delta_ != 0 ) ? delta_->fixed() : 0.0; }
//! This is not called, amplitude is used directly instead
- virtual LauComplex resAmp(Double_t mass, Double_t spinTerm);
+ virtual LauComplex resAmp( Double_t mass, Double_t spinTerm );
//! Check that both daughters are the same type of particle
void checkDaughterTypes() const;
-private:
-
+ private:
//! Copy constructor (not implemented)
- LauRhoOmegaMix(const LauRhoOmegaMix& rhs);
+ LauRhoOmegaMix( const LauRhoOmegaMix& rhs );
//! Copy assignment operator (not implemented)
- LauRhoOmegaMix& operator=(const LauRhoOmegaMix& rhs);
+ LauRhoOmegaMix& operator=( const LauRhoOmegaMix& rhs );
//! The model to use
LauAbsResonance::LauResonanceModel model_;
//! Previous value of the pole mass of the rho resonance
Double_t rhoMass_;
//! Previous value of the barrier radius of the rho resonance
Double_t rhoResRadius_;
//! Previous value of the parents barrier radius of the rho resonance
Double_t rhoParRadius_;
//! Pole mass of the omega contribution
LauParameter* mOmega_;
//! Initial default value of the omega pole mass from LauResonanceMaker
Double_t mOmega0_;
//! Current value of the omega pole mass (floating or fixed)
Double_t mOmegaCur_;
//! Pole width of the omega contribution
LauParameter* wOmega_;
//! Initial default value of the omega pole width from LauResonanceMaker
Double_t wOmega0_;
//! Current value of the omega pole mass (floating or fixed)
Double_t wOmegaCur_;
//! B magnitude parameter of the omega mixing contribution
LauParameter* magB_;
//! B phase parameter of the omega mixing contribution
LauParameter* phiB_;
//! delta parameter of the omega mixing contribution
LauParameter* delta_;
//! Boolean to specify if we want to use the denominator factor
Bool_t useDenom_;
//! Boolean to specify if we have performed the first initialisation
Bool_t doneFirstInit_;
//! Pointer to the rho (or first) resonance lineshape
LauAbsResonance* rhoRes_;
//! Pointer to the omega (second) resonance lineshape
LauAbsResonance* omegaRes_;
//! Which amplitude to calculate for rho/omega fit fractions
Int_t whichAmpSq_;
- ClassDef(LauRhoOmegaMix,0) // Rho-omega mixing model
-
+ ClassDef( LauRhoOmegaMix, 0 ) // Rho-omega mixing model
};
#endif
diff --git a/inc/LauRooFitTask.hh b/inc/LauRooFitTask.hh
index d4884d1..57690ce 100644
--- a/inc/LauRooFitTask.hh
+++ b/inc/LauRooFitTask.hh
@@ -1,177 +1,182 @@
/*
Copyright 2017 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauRooFitTask.hh
\brief File containing declaration of LauRooFitTask class.
*/
/*! \class LauRooFitTask
\brief A class for creating a RooFit-based task process for simultaneous/combined fits
Implementation of the JFit method described in arXiv:1409.5080 [physics.data-an].
*/
#ifndef LAU_ROO_FIT_TASK
#define LAU_ROO_FIT_TASK
-#include <set>
-#include <utility>
-#include <vector>
+#include "LauSimFitTask.hh"
#include "RooArgSet.h"
#include "TMatrixDfwd.h"
#include "TString.h"
-#include "LauSimFitTask.hh"
+#include <set>
+#include <utility>
+#include <vector>
class LauParameter;
class RooAbsData;
class RooAbsPdf;
class RooFormulaVar;
class RooNLLVar;
class RooRealVar;
class TFile;
class TTree;
-
class LauRooFitTask : public LauSimFitTask {
- public:
- //! Constructor
- LauRooFitTask( RooAbsPdf& model, const Bool_t extended, const RooArgSet& vars, const TString& weightVarName = "" );
-
- //! Destructor
- virtual ~LauRooFitTask();
-
- //! Initialise the fit model
- virtual void initialise();
-
- //! This function sets the parameter values from Minuit
- /*!
- \param [in] par an array storing the various parameter values
- \param [in] npar the number of free parameters
- */
- virtual void setParsFromMinuit(Double_t* par, Int_t npar);
-
- //! Calculates the total negative log-likelihood
- virtual Double_t getTotNegLogLikelihood();
-
- protected:
-
- //! Package the initial fit parameters for transmission to the coordinator
- /*!
- \param [out] array the array to be filled with the LauParameter objects
- */
- virtual void prepareInitialParArray( TObjArray& array );
-
- //! Convert a RooRealVar into a LauParameter
- /*!
- \param [in] rooParameter the RooRealVar to be converted
- \return the newly created LauParameter
- */
- LauParameter* convertToLauParameter( const RooRealVar* rooParameter ) const;
-
- //! Convert a RooFormulaVar into LauParameters
- /*!
- \param [in] rooFormula the RooFormulaVar to be converted
- \return the vector of pointers to the RooRealVars and newly created LauParameters
- */
- std::vector< std::pair<RooRealVar*,LauParameter*> > convertToLauParameters( const RooFormulaVar* rooFormula ) const;
-
- //! Perform all finalisation actions
- /*!
- - Receive the results of the fit from the coordinator
- - Perform any finalisation routines
- - Package the finalised fit parameters for transmission back to the coordinator
-
- \param [in] fitStat the status of the fit, e.g. status code, EDM, NLL
- \param [in] parsFromCoordinator the parameters at the fit minimum
- \param [in] covMat the fit covariance matrix
- \param [out] parsToCoordinator the array to be filled with the finalised LauParameter objects
- */
- virtual void finaliseExperiment( const LauAbsFitter::FitStatus& fitStat, const TObjArray* parsFromCoordinator, const TMatrixD* covMat, TObjArray& parsToCoordinator );
-
- //! Open the input file and verify that all required variables are present
- /*!
- \param [in] dataFileName the name of the input file
- \param [in] dataTreeName the name of the input tree
- */
- virtual Bool_t verifyFitData(const TString& dataFileName, const TString& dataTreeName);
-
- //! Read in the data for the current experiment
- /*!
- \return the number of events read in
- */
- virtual UInt_t readExperimentData();
-
- //! Cache the input data values to calculate the likelihood during the fit
- virtual void cacheInputFitVars();
-
- private:
- //! Cleanup the data
- void cleanData();
-
- //! Copy constructor (not implemented)
- LauRooFitTask(const LauRooFitTask& rhs);
-
- //! Copy assignment operator (not implemented)
- LauRooFitTask& operator=(const LauRooFitTask& rhs);
-
- //! The model
- RooAbsPdf& model_;
-
- //! The dataset variables
- RooArgSet dataVars_;
-
- //! The name of the (optional) weight variable in the dataset
- TString weightVarName_;
-
- //! The data file
- TFile* dataFile_;
-
- //! The data tree
- TTree* dataTree_;
-
- //! The data for the current experiment
- RooAbsData* exptData_;
-
- //! Is the PDF extended?
- const Bool_t extended_;
-
- //! The experiment category variable
- std::set<UInt_t> iExptSet_;
-
- //! The NLL variable
- RooNLLVar* nllVar_;
-
- //! The fit parameters (as RooRealVar's)
- std::vector<RooRealVar*> fitVars_;
-
- //! The fit parameters (as LauParameter's)
- std::vector<LauParameter*> fitPars_;
-
- ClassDef(LauRooFitTask,0);
+ public:
+ //! Constructor
+ LauRooFitTask( RooAbsPdf& model,
+ const Bool_t extended,
+ const RooArgSet& vars,
+ const TString& weightVarName = "" );
+
+ //! Destructor
+ virtual ~LauRooFitTask();
+
+ //! Initialise the fit model
+ virtual void initialise();
+
+ //! This function sets the parameter values from Minuit
+ /*!
+ \param [in] par an array storing the various parameter values
+ \param [in] npar the number of free parameters
+ */
+ virtual void setParsFromMinuit( Double_t* par, Int_t npar );
+
+ //! Calculates the total negative log-likelihood
+ virtual Double_t getTotNegLogLikelihood();
+
+ protected:
+ //! Package the initial fit parameters for transmission to the coordinator
+ /*!
+ \param [out] array the array to be filled with the LauParameter objects
+ */
+ virtual void prepareInitialParArray( TObjArray& array );
+
+ //! Convert a RooRealVar into a LauParameter
+ /*!
+ \param [in] rooParameter the RooRealVar to be converted
+ \return the newly created LauParameter
+ */
+ LauParameter* convertToLauParameter( const RooRealVar* rooParameter ) const;
+
+ //! Convert a RooFormulaVar into LauParameters
+ /*!
+ \param [in] rooFormula the RooFormulaVar to be converted
+ \return the vector of pointers to the RooRealVars and newly created LauParameters
+ */
+ std::vector<std::pair<RooRealVar*, LauParameter*>> convertToLauParameters(
+ const RooFormulaVar* rooFormula ) const;
+
+ //! Perform all finalisation actions
+ /*!
+ - Receive the results of the fit from the coordinator
+ - Perform any finalisation routines
+ - Package the finalised fit parameters for transmission back to the coordinator
+
+ \param [in] fitStat the status of the fit, e.g. status code, EDM, NLL
+ \param [in] parsFromCoordinator the parameters at the fit minimum
+ \param [in] covMat the fit covariance matrix
+ \param [out] parsToCoordinator the array to be filled with the finalised LauParameter objects
+ */
+ virtual void finaliseExperiment( const LauAbsFitter::FitStatus& fitStat,
+ const TObjArray* parsFromCoordinator,
+ const TMatrixD* covMat,
+ TObjArray& parsToCoordinator );
+
+ //! Open the input file and verify that all required variables are present
+ /*!
+ \param [in] dataFileName the name of the input file
+ \param [in] dataTreeName the name of the input tree
+ */
+ virtual Bool_t verifyFitData( const TString& dataFileName, const TString& dataTreeName );
+
+ //! Read in the data for the current experiment
+ /*!
+ \return the number of events read in
+ */
+ virtual UInt_t readExperimentData();
+
+ //! Cache the input data values to calculate the likelihood during the fit
+ virtual void cacheInputFitVars();
+
+ private:
+ //! Cleanup the data
+ void cleanData();
+
+ //! Copy constructor (not implemented)
+ LauRooFitTask( const LauRooFitTask& rhs );
+
+ //! Copy assignment operator (not implemented)
+ LauRooFitTask& operator=( const LauRooFitTask& rhs );
+
+ //! The model
+ RooAbsPdf& model_;
+
+ //! The dataset variables
+ RooArgSet dataVars_;
+
+ //! The name of the (optional) weight variable in the dataset
+ TString weightVarName_;
+
+ //! The data file
+ TFile* dataFile_;
+
+ //! The data tree
+ TTree* dataTree_;
+
+ //! The data for the current experiment
+ RooAbsData* exptData_;
+
+ //! Is the PDF extended?
+ const Bool_t extended_;
+
+ //! The experiment category variable
+ std::set<UInt_t> iExptSet_;
+
+ //! The NLL variable
+ RooNLLVar* nllVar_;
+
+ //! The fit parameters (as RooRealVar's)
+ std::vector<RooRealVar*> fitVars_;
+
+ //! The fit parameters (as LauParameter's)
+ std::vector<LauParameter*> fitPars_;
+
+ ClassDef( LauRooFitTask, 0 );
};
#endif
diff --git a/inc/LauSPlot.hh b/inc/LauSPlot.hh
index 3f90555..82685a3 100644
--- a/inc/LauSPlot.hh
+++ b/inc/LauSPlot.hh
@@ -1,374 +1,374 @@
/*
Copyright 2006 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauSPlot.hh
\brief File containing declaration of LauSPlot class.
*/
/*! \class LauSPlot
\brief Class for defining the SPlot technique
Class for defining the SPlot technique based on TSplot from ROOT by the following authors:
Muriel Pivk, Anna Kreshuk (10/2005).
(Original copyright notice below)
Code extended to deal with the following two extra scenarios:
- Extended sPlots (see appendix B of sPlot paper)
- 2D PDFs, i.e. one PDF for 2 variables
When performing a multidimensional fit, the sWeights are calculated
excluding each dimension in turn and excluding none of the variables. This
allows sPlots of the fit variables to be made by using the weight
calculated when that variable is excluded, while variables not in the fit
can be plotted from the complete information.
*/
/**********************************************************************
* *
* Copyright (c) 2005 ROOT Foundation, CERN/PH-SFT *
* *
**********************************************************************/
#ifndef LAU_SPLOT
#define LAU_SPLOT
-#include <vector>
-#include <map>
-#include <set>
-
#include "TMatrixD.h"
#include "TString.h"
+#include <map>
+#include <set>
+#include <vector>
+
class TEventList;
class TLeaf;
class TFile;
class TTree;
-
class LauSPlot : public TObject {
- public:
- //! Type to store names, e.g. of the discriminating/control variables
- typedef std::set<TString> NameSet;
-
- //! Type to associate a category name with a double precision number, e.g. a yield or PDF value for a given species
- typedef std::map<TString,Double_t> NumbMap;
-
- //! Type to associate a variable name with the leaf of the input tree
- typedef std::map<TString,TLeaf*> LeafMap;
-
- //! Type to associate the name of the species that have 2D PDFs with the names of the two variables involved in each such PDF
- typedef std::multimap< TString, std::pair<TString,TString> > TwoDMap;
-
- //! Constructor
- /*!
- \param [in] fileName the name of the data file (containing the input tree)
- \param [in] treeName the name of the input tree (containing the per-event llhds)
- \param [in] firstExpt the first experiment
- \param [in] nExpt the number of experiments
- \param [in] variableNames the names of the discriminating variables
- \param [in] freeSpecies the species that are free to float in the fit
- \param [in] fixdSpecies the species that are fixed in the fit
- \param [in] twodimPDFs the species that have 2D PDFs and the name of the variables involved in each such PDF
- \param [in] sigSplit boolean flag to check whether the signal is split into Truth Matched and Self Cross Feed
- \param [in] scfDPSmeared boolean flag to check whether the SCF is smeared in the DP
- */
- LauSPlot(const TString& fileName, const TString& treeName,
- Int_t firstExpt,
- Int_t nExpt,
- const NameSet& variableNames,
- const LauSPlot::NumbMap& freeSpecies,
- const LauSPlot::NumbMap& fixdSpecies,
- const TwoDMap& twodimPDFs,
- Bool_t sigSplit = kFALSE,
- Bool_t scfDPSmeared = kFALSE);
-
- //! Destructor
- virtual ~LauSPlot();
-
- //! Method to calculate the sWeights and cN coeffs.
- /*!
- \param [in] option control print level (default set to no print out)\n
- "Q" - no print out (default)\n
- "V" - prints the estimated # of events in species\n
- "VV" - as "V" + the MINUIT printing + sums of weights for control
- */
- void runCalculations(const TString& option = "q");
-
- //! Save the sWeight results as a friend tree to the input tree (in the same file)
- void writeOutResults();
-
- //! Access the per-event total PDF values for each species
- /*!
- \return the per-event total PDF values
- */
- const std::vector<LauSPlot::NumbMap>& totalPdf() const {return pdfTot_;}
-
- protected:
- //! Check whether the input tree has been successfully read
- /*!
- \return true/false whether the task have been successfully performed
- */
- Bool_t readInput() const {return readInput_;}
-
- //! Set that the input tree has been successfully read
- /*!
- \param [in] ok set that the input tree has been succeessfully read
- */
- void readInput(Bool_t ok) {readInput_ = ok;}
-
- //! Check whether the signal is split into Truth Matched and Self Cross Feed
- /*!
- \return true/false whether the signal is split into TM and SCF
- */
- Bool_t signalSplit() const {return signalSplit_;}
-
- //! Check whether the Self Cross Feed is smeared in the DP
- /*!
- \return true/false whether the Self Cross Feed is smeared in the DP
- */
- Bool_t scfDPSmear() const {return scfDPSmear_;}
-
- //! Check whether the cN branches have been already created
- /*!
- \return true/false whether cN branches have been already created
- */
- Bool_t definedCNBranches() const {return definedCNBranches_;}
-
- //! Set that the cN branches have been already defined
- /*!
- \param [in] defined set that the cN branches have been already defined
- */
- void definedCNBranches(Bool_t defined) {definedCNBranches_ = defined;}
-
- //! Check whether the sWeights branches have been already created
- /*!
- \return true/false whether sWeights branches have been already created
- */
- Bool_t definedSWeightBranches() const {return definedSWeightBranches_;}
-
- //! Set that the sWeights branches have been already defined
- /*!
- \param [in] defined set that the sWeights branches have been already defined
- */
- void definedSWeightBranches(Bool_t defined) {definedSWeightBranches_ = defined;}
-
- //! Method to open the file in "update" mode and grab the input tree for reading
- void openInputFileAndTree();
-
- //! Read the leaf structure from the tree and check the status of the read (calls LauSPlot::readInputLeaves and LauSPlot::checkLeaves)
- void readInputInfo();
-
- //! Read the leaf structure from the tree and setup the leaf map
- Bool_t readInputLeaves();
-
- //! Check whether the leaf structure makes sense given the PDFs we are expecting
- Bool_t checkLeaves() const;
-
- //! Create (if not already done) the tree for storing the cN coeffs
- void createCNTree();
- //! Create the branches for each cN coefficient
- void defineCNBranches();
-
- //! Create (if not already done) the tree for storing the sWeights
- void createSWeightTree();
- //! Create the branches to store the sWeights
- void defineSWeightBranches();
-
- //! Set the event list to contain only events from the given experiment
- /*!
- \param [in] iExpt the required experiment number
- */
- void setExperiment(Int_t iExpt);
-
- //! Reads the values of each PDF likelihood for every event in the experiment
- void readExpt();
-
- //! Make sure that we're using Minuit
- void checkFitter() const;
-
- //! Initialise Minuit, set the verbosity
- /*!
- \param [in] opt option to set the print level (opt = "Q", "V" or "W" == "VV")
- */
- void initialiseFitter(const TString& opt);
-
- //! Add the species yields as fit parameters and fix them as appropriate
- void setFitParameters() const;
-
- //! Perform the minimisation wrt the yields alone
- void runFit();
-
- //! Update the yields with the newly fitted values and print them (unless print option is "Q").
- /*!
- \param [in] opt option to set the print level (opt = "Q", "V" or "W")
- */
- void retrieveFittedParameters(const TString& opt);
-
- //! Print the supplied covariance matrix or, if pointer is null, the one previously calculated
- /*!
- \param [in] covmat 2D array containing the covariace matrix elements
- */
- void printCovMatrixElements(const Double_t * covmat = 0) const;
-
- //! Print the sum of sWeights for all species
- /*!
- \param [in] exclName the name of variable excluded (or "none")
- */
- void printSumOfWeights(const TString& exclName) const;
-
- // Calculate the covariance matrix from the various PDFs
- /*!
- \return true if calculation succeeded or false in case the covariance matrix can not be inverted
- */
- Bool_t calcCovMatrix();
-
- //! Calculate the total likelihood for each species by multiply together all the PDFs for that species
- /*!
- \param [in] exclName the name of excluded variable (or "none")
- */
- void calcTotPDFValues(const TString& exclName);
-
- //! Computes the cN for the extended sPlots from the covariance matrix
- /*!
- \param [in] exclName the name of excluded variable (or "none")
- \param [in] covmat 2D array containing the covariace matrix elements
- */
- void calcCNCoeffs(const TString& exclName, const Double_t * covmat = 0);
-
- //! Computes the sWeights from the PDFs and covariance matrix
- /*!
- \param [in] exclName the name of excluded variable (or "none")
- \param [in] covmat 2D array containing the covariace matrix elements
- */
- void calcSWeights(const TString& exclName, Double_t * covmat = 0);
-
- //! Copy the sWeight of a given event into LauSPlot::sWeightsCurrent_, from which they can be stored in the output tree
- /*!
- \param [in] iEvent the requested event
- */
- void copyEventWeights(Int_t iEvent);
-
- //! Fill the cN branches
- void fillCNBranches();
-
- //! Fill the sWeights branches
- void fillSWeightBranches();
-
- //! Add the sWeightTree as a friend tree of the input tree
- void addFriendTree();
-
- private:
- //! Copy constructor (not implemented)
- LauSPlot(const LauSPlot& rhs);
-
- //! Copy assignment operator (not implemented)
- LauSPlot& operator=(const LauSPlot& rhs);
-
- //! The name of the data file
- TString fileName_;
- //! The name of the input tree (containing the per-event llhds)
- TString inputTreeName_;
- //! The name of the cn tree (containing the cN coefficients)
- TString cnTreeName_;
- //! The name of the sweight tree (containing the sWeights)
- TString sweightTreeName_;
- //! Pointer to the data file object
- TFile* file_;
- //! Pointer to the input tree
- TTree* inputTree_;
- //! Pointer to the output tree containing the cN coefficients
- TTree* cnTree_;
- //! Pointer to the output tree containing the sWeights
- TTree* sweightTree_;
-
- //! Pointer to an event list, that is used to loop through the experiments
- TEventList* eventList_;
-
- //! Collection to hold pointers to the leaves of the input tree
- LeafMap leaves_;
-
- //! The names of the discriminating variables
- NameSet variableNames_;
- //! The names and estimated yields of the free species
- NumbMap freeSpecies_;
- //! The names and estimated yields of the fixed species
- NumbMap fixdSpecies_;
- //! The names and estimated yields of the free species - need to keep the original values
- NumbMap origFreeSpecies_;
- //! The names and estimated yields of the fixed species - need to keep the original values
- NumbMap origFixdSpecies_;
- //! The names of the species that have 2D PDFs and the names of the variables involved
- TwoDMap twodimPDFs_;
-
- //! Is the signal split into TM and SCF?
- const Bool_t signalSplit_;
- //! If so then is the SCF smeared in the DP?
- const Bool_t scfDPSmear_;
-
- //! Flag whether the input tree has been successfully read
- Bool_t readInput_;
- //! Flag whether the cN branches have already been created
- Bool_t definedCNBranches_;
- //! Flag whether the sWeights branches have already been created
- Bool_t definedSWeightBranches_;
-
- //! First experiment
- Int_t firstExpt_;
- //! Number of experiments
- Int_t nExpt_;
- //! The current experiment
- Int_t iExpt_;
- //! Number of events in current experiment
- Int_t nEvents_;
- //! Number of discriminating variables
- Int_t nDiscVars_;
- //! Number of species free to float in the fit
- Int_t nFreeSpecies_;
- //! Number of species fixed in the fit
- Int_t nFixdSpecies_;
- //! Total number of species (free + fixed)
- Int_t nSpecies_;
-
- //! The per-event values of the total PDF for each species
- std::vector<NumbMap> pdfTot_;
- //! The per-event values of the PDFs for each species for each disc variable
- std::vector<std::map<TString,NumbMap> > discPdf_;
- //! The per-event values of the SCF fraction
- std::vector<Double_t> scfFrac_;
-
- //! The calculated covariance matrix
- TMatrixD covMat_;
-
- //! The per-event values of the computed sWeights (for each species and for each combination of excluded vars)
- std::vector< std::map<TString,NumbMap> > sWeights_;
- //! The current-event values of the computed sWeights
- std::map<TString,NumbMap> sWeightsCurrent_;
- //! The extended sPlot coefficients (for each species and for each combination of excluded vars)
- std::map<TString,NumbMap> cN_;
-
- ClassDef(LauSPlot, 0)
+ public:
+ //! Type to store names, e.g. of the discriminating/control variables
+ typedef std::set<TString> NameSet;
+
+ //! Type to associate a category name with a double precision number, e.g. a yield or PDF value for a given species
+ typedef std::map<TString, Double_t> NumbMap;
+
+ //! Type to associate a variable name with the leaf of the input tree
+ typedef std::map<TString, TLeaf*> LeafMap;
+
+ //! Type to associate the name of the species that have 2D PDFs with the names of the two variables involved in each such PDF
+ typedef std::multimap<TString, std::pair<TString, TString>> TwoDMap;
+
+ //! Constructor
+ /*!
+ \param [in] fileName the name of the data file (containing the input tree)
+ \param [in] treeName the name of the input tree (containing the per-event llhds)
+ \param [in] firstExpt the first experiment
+ \param [in] nExpt the number of experiments
+ \param [in] variableNames the names of the discriminating variables
+ \param [in] freeSpecies the species that are free to float in the fit
+ \param [in] fixdSpecies the species that are fixed in the fit
+ \param [in] twodimPDFs the species that have 2D PDFs and the name of the variables involved in each such PDF
+ \param [in] sigSplit boolean flag to check whether the signal is split into Truth Matched and Self Cross Feed
+ \param [in] scfDPSmeared boolean flag to check whether the SCF is smeared in the DP
+ */
+ LauSPlot( const TString& fileName,
+ const TString& treeName,
+ Int_t firstExpt,
+ Int_t nExpt,
+ const NameSet& variableNames,
+ const LauSPlot::NumbMap& freeSpecies,
+ const LauSPlot::NumbMap& fixdSpecies,
+ const TwoDMap& twodimPDFs,
+ Bool_t sigSplit = kFALSE,
+ Bool_t scfDPSmeared = kFALSE );
+
+ //! Destructor
+ virtual ~LauSPlot();
+
+ //! Method to calculate the sWeights and cN coeffs.
+ /*!
+ \param [in] option control print level (default set to no print out)\n
+ "Q" - no print out (default)\n
+ "V" - prints the estimated # of events in species\n
+ "VV" - as "V" + the MINUIT printing + sums of weights for control
+ */
+ void runCalculations( const TString& option = "q" );
+
+ //! Save the sWeight results as a friend tree to the input tree (in the same file)
+ void writeOutResults();
+
+ //! Access the per-event total PDF values for each species
+ /*!
+ \return the per-event total PDF values
+ */
+ const std::vector<LauSPlot::NumbMap>& totalPdf() const { return pdfTot_; }
+
+ protected:
+ //! Check whether the input tree has been successfully read
+ /*!
+ \return true/false whether the task have been successfully performed
+ */
+ Bool_t readInput() const { return readInput_; }
+
+ //! Set that the input tree has been successfully read
+ /*!
+ \param [in] ok set that the input tree has been succeessfully read
+ */
+ void readInput( Bool_t ok ) { readInput_ = ok; }
+
+ //! Check whether the signal is split into Truth Matched and Self Cross Feed
+ /*!
+ \return true/false whether the signal is split into TM and SCF
+ */
+ Bool_t signalSplit() const { return signalSplit_; }
+
+ //! Check whether the Self Cross Feed is smeared in the DP
+ /*!
+ \return true/false whether the Self Cross Feed is smeared in the DP
+ */
+ Bool_t scfDPSmear() const { return scfDPSmear_; }
+
+ //! Check whether the cN branches have been already created
+ /*!
+ \return true/false whether cN branches have been already created
+ */
+ Bool_t definedCNBranches() const { return definedCNBranches_; }
+
+ //! Set that the cN branches have been already defined
+ /*!
+ \param [in] defined set that the cN branches have been already defined
+ */
+ void definedCNBranches( Bool_t defined ) { definedCNBranches_ = defined; }
+
+ //! Check whether the sWeights branches have been already created
+ /*!
+ \return true/false whether sWeights branches have been already created
+ */
+ Bool_t definedSWeightBranches() const { return definedSWeightBranches_; }
+
+ //! Set that the sWeights branches have been already defined
+ /*!
+ \param [in] defined set that the sWeights branches have been already defined
+ */
+ void definedSWeightBranches( Bool_t defined ) { definedSWeightBranches_ = defined; }
+
+ //! Method to open the file in "update" mode and grab the input tree for reading
+ void openInputFileAndTree();
+
+ //! Read the leaf structure from the tree and check the status of the read (calls LauSPlot::readInputLeaves and LauSPlot::checkLeaves)
+ void readInputInfo();
+
+ //! Read the leaf structure from the tree and setup the leaf map
+ Bool_t readInputLeaves();
+
+ //! Check whether the leaf structure makes sense given the PDFs we are expecting
+ Bool_t checkLeaves() const;
+
+ //! Create (if not already done) the tree for storing the cN coeffs
+ void createCNTree();
+ //! Create the branches for each cN coefficient
+ void defineCNBranches();
+
+ //! Create (if not already done) the tree for storing the sWeights
+ void createSWeightTree();
+ //! Create the branches to store the sWeights
+ void defineSWeightBranches();
+
+ //! Set the event list to contain only events from the given experiment
+ /*!
+ \param [in] iExpt the required experiment number
+ */
+ void setExperiment( Int_t iExpt );
+
+ //! Reads the values of each PDF likelihood for every event in the experiment
+ void readExpt();
+
+ //! Make sure that we're using Minuit
+ void checkFitter() const;
+
+ //! Initialise Minuit, set the verbosity
+ /*!
+ \param [in] opt option to set the print level (opt = "Q", "V" or "W" == "VV")
+ */
+ void initialiseFitter( const TString& opt );
+
+ //! Add the species yields as fit parameters and fix them as appropriate
+ void setFitParameters() const;
+
+ //! Perform the minimisation wrt the yields alone
+ void runFit();
+
+ //! Update the yields with the newly fitted values and print them (unless print option is "Q").
+ /*!
+ \param [in] opt option to set the print level (opt = "Q", "V" or "W")
+ */
+ void retrieveFittedParameters( const TString& opt );
+
+ //! Print the supplied covariance matrix or, if pointer is null, the one previously calculated
+ /*!
+ \param [in] covmat 2D array containing the covariace matrix elements
+ */
+ void printCovMatrixElements( const Double_t* covmat = 0 ) const;
+
+ //! Print the sum of sWeights for all species
+ /*!
+ \param [in] exclName the name of variable excluded (or "none")
+ */
+ void printSumOfWeights( const TString& exclName ) const;
+
+ // Calculate the covariance matrix from the various PDFs
+ /*!
+ \return true if calculation succeeded or false in case the covariance matrix can not be inverted
+ */
+ Bool_t calcCovMatrix();
+
+ //! Calculate the total likelihood for each species by multiply together all the PDFs for that species
+ /*!
+ \param [in] exclName the name of excluded variable (or "none")
+ */
+ void calcTotPDFValues( const TString& exclName );
+
+ //! Computes the cN for the extended sPlots from the covariance matrix
+ /*!
+ \param [in] exclName the name of excluded variable (or "none")
+ \param [in] covmat 2D array containing the covariace matrix elements
+ */
+ void calcCNCoeffs( const TString& exclName, const Double_t* covmat = 0 );
+
+ //! Computes the sWeights from the PDFs and covariance matrix
+ /*!
+ \param [in] exclName the name of excluded variable (or "none")
+ \param [in] covmat 2D array containing the covariace matrix elements
+ */
+ void calcSWeights( const TString& exclName, Double_t* covmat = 0 );
+
+ //! Copy the sWeight of a given event into LauSPlot::sWeightsCurrent_, from which they can be stored in the output tree
+ /*!
+ \param [in] iEvent the requested event
+ */
+ void copyEventWeights( Int_t iEvent );
+
+ //! Fill the cN branches
+ void fillCNBranches();
+
+ //! Fill the sWeights branches
+ void fillSWeightBranches();
+
+ //! Add the sWeightTree as a friend tree of the input tree
+ void addFriendTree();
+
+ private:
+ //! Copy constructor (not implemented)
+ LauSPlot( const LauSPlot& rhs );
+
+ //! Copy assignment operator (not implemented)
+ LauSPlot& operator=( const LauSPlot& rhs );
+
+ //! The name of the data file
+ TString fileName_;
+ //! The name of the input tree (containing the per-event llhds)
+ TString inputTreeName_;
+ //! The name of the cn tree (containing the cN coefficients)
+ TString cnTreeName_;
+ //! The name of the sweight tree (containing the sWeights)
+ TString sweightTreeName_;
+ //! Pointer to the data file object
+ TFile* file_;
+ //! Pointer to the input tree
+ TTree* inputTree_;
+ //! Pointer to the output tree containing the cN coefficients
+ TTree* cnTree_;
+ //! Pointer to the output tree containing the sWeights
+ TTree* sweightTree_;
+
+ //! Pointer to an event list, that is used to loop through the experiments
+ TEventList* eventList_;
+
+ //! Collection to hold pointers to the leaves of the input tree
+ LeafMap leaves_;
+
+ //! The names of the discriminating variables
+ NameSet variableNames_;
+ //! The names and estimated yields of the free species
+ NumbMap freeSpecies_;
+ //! The names and estimated yields of the fixed species
+ NumbMap fixdSpecies_;
+ //! The names and estimated yields of the free species - need to keep the original values
+ NumbMap origFreeSpecies_;
+ //! The names and estimated yields of the fixed species - need to keep the original values
+ NumbMap origFixdSpecies_;
+ //! The names of the species that have 2D PDFs and the names of the variables involved
+ TwoDMap twodimPDFs_;
+
+ //! Is the signal split into TM and SCF?
+ const Bool_t signalSplit_;
+ //! If so then is the SCF smeared in the DP?
+ const Bool_t scfDPSmear_;
+
+ //! Flag whether the input tree has been successfully read
+ Bool_t readInput_;
+ //! Flag whether the cN branches have already been created
+ Bool_t definedCNBranches_;
+ //! Flag whether the sWeights branches have already been created
+ Bool_t definedSWeightBranches_;
+
+ //! First experiment
+ Int_t firstExpt_;
+ //! Number of experiments
+ Int_t nExpt_;
+ //! The current experiment
+ Int_t iExpt_;
+ //! Number of events in current experiment
+ Int_t nEvents_;
+ //! Number of discriminating variables
+ Int_t nDiscVars_;
+ //! Number of species free to float in the fit
+ Int_t nFreeSpecies_;
+ //! Number of species fixed in the fit
+ Int_t nFixdSpecies_;
+ //! Total number of species (free + fixed)
+ Int_t nSpecies_;
+
+ //! The per-event values of the total PDF for each species
+ std::vector<NumbMap> pdfTot_;
+ //! The per-event values of the PDFs for each species for each disc variable
+ std::vector<std::map<TString, NumbMap>> discPdf_;
+ //! The per-event values of the SCF fraction
+ std::vector<Double_t> scfFrac_;
+
+ //! The calculated covariance matrix
+ TMatrixD covMat_;
+
+ //! The per-event values of the computed sWeights (for each species and for each combination of excluded vars)
+ std::vector<std::map<TString, NumbMap>> sWeights_;
+ //! The current-event values of the computed sWeights
+ std::map<TString, NumbMap> sWeightsCurrent_;
+ //! The extended sPlot coefficients (for each species and for each combination of excluded vars)
+ std::map<TString, NumbMap> cN_;
+
+ ClassDef( LauSPlot, 0 )
};
#endif
diff --git a/inc/LauScfMap.hh b/inc/LauScfMap.hh
index d80ee39..9817195 100644
--- a/inc/LauScfMap.hh
+++ b/inc/LauScfMap.hh
@@ -1,137 +1,137 @@
/*
Copyright 2006 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauScfMap.hh
\brief File containing declaration of LauScfMap class.
*/
/*! \class LauScfMap
\brief Class for representing the 4D smearing matrix for mis-reconstructed signal (self cross feed)
The smearing matrix is formed from a 2D array of 2D histograms
*/
#ifndef LAU_SCF_MAP
#define LAU_SCF_MAP
#include "Rtypes.h"
-#include <vector>
#include <map>
+#include <vector>
class TH2;
class LauScfMap {
- public:
- //! Constructor
- LauScfMap();
-
- //! Destructor
- virtual ~LauScfMap();
-
- //! Construct the smearing matrix from the supplied histograms
- /*!
- The histograms should give the migration probabilities from a given true bin to a given reco bin.
-
- These can be constructed as follows:\n
- Each histogram contains only the events that were generated in a given true bin.\n
- The events are plotted at their reconstructed co-ordinates.\n
- The histogram is then normalised.
-
- All histograms should be identically binned.\n
- There should be as many histograms supplied as there are bins in each.\n
- The order of the histograms in the vector should match the ROOT "global bin number" ordering.
-
- \param [in] histos vector of two-dimensional histograms
- */
- void setHistos(const std::vector<const TH2*>& histos);
-
- //! Get the number of bins
- /*!
- \return the number of bins
- */
- Int_t getNumberOfBins() const { return numberOfBins_; };
-
- //! Create lists of the co-ordinates of the centres of true bins
- /*!
- \param [out] xCoords the vector of x co-ordinates of the centre of each true bin
- \param [out] yCoords the vector of y co-ordinates of the centre of each true bin
- */
- void listBinCentres( std::vector<Double_t>& xCoords, std::vector<Double_t>& yCoords) const;
-
- //! Find the global bin number for the given co-ordinates
- /*!
- \param [in] xCoord the vector of x co-ordinate
- \param [in] yCoord the vector of y co-ordinate
- \return the global bin number
- */
- Int_t binNumber(Double_t xCoord, Double_t yCoord) const;
-
- //! Find which true bins contribute to the given reco bin
- /*!
- \param [in] recoBin the reco global bin number
- \return the list of true bins that contribute (the numbers returned are not global bin numbers but the index in the LauScfMap::histos_ storage)
- */
- const std::vector<Int_t>* trueBins(Int_t recoBin) const;
-
- //! Probability of a true event in the given true bin migrating to the reco bin
- /*!
- \param [in] recoBin the reco global bin number
- \param [in] trueBin the true bin index in the LauScfMap::histos_ storage (as provided by LauScfMap::trueBins)
- \return the migration probability
- */
- Double_t prob(Int_t recoBin, Int_t trueBin) const;
-
- //! Retrieve the migration histogram for trueBin
- /*!
- \param [in] trueBin the true global bin number
- \return the migration histogram
- */
- TH2* trueHist(Int_t trueBin);
-
- private:
- //! Copy constructor (not implemented)
- LauScfMap( const LauScfMap& rhs );
-
- //! Copy assignment operator (not implemented)
- LauScfMap& operator=( const LauScfMap& rhs );
-
- //! The vector of two-dimensional histograms
- std::vector<TH2*> histos_;
-
- //! Map that links each reco global bin number and the vector of true bin indices into LauScfMap::histos_
- std::map< Int_t, std::vector<Int_t> > contribs_;
-
- //! Number of bins in the x-axis
- Int_t nBinsX_;
- //! Number of bins in the y-axis
- Int_t nBinsY_;
- //! Number of bins in a 2D histogram (nBinsX_*nBinsY_)
- Int_t numberOfBins_;
-
- ClassDef(LauScfMap, 0)
+ public:
+ //! Constructor
+ LauScfMap();
+
+ //! Destructor
+ virtual ~LauScfMap();
+
+ //! Construct the smearing matrix from the supplied histograms
+ /*!
+ The histograms should give the migration probabilities from a given true bin to a given reco bin.
+
+ These can be constructed as follows:\n
+ Each histogram contains only the events that were generated in a given true bin.\n
+ The events are plotted at their reconstructed co-ordinates.\n
+ The histogram is then normalised.
+
+ All histograms should be identically binned.\n
+ There should be as many histograms supplied as there are bins in each.\n
+ The order of the histograms in the vector should match the ROOT "global bin number" ordering.
+
+ \param [in] histos vector of two-dimensional histograms
+ */
+ void setHistos( const std::vector<const TH2*>& histos );
+
+ //! Get the number of bins
+ /*!
+ \return the number of bins
+ */
+ Int_t getNumberOfBins() const { return numberOfBins_; };
+
+ //! Create lists of the co-ordinates of the centres of true bins
+ /*!
+ \param [out] xCoords the vector of x co-ordinates of the centre of each true bin
+ \param [out] yCoords the vector of y co-ordinates of the centre of each true bin
+ */
+ void listBinCentres( std::vector<Double_t>& xCoords, std::vector<Double_t>& yCoords ) const;
+
+ //! Find the global bin number for the given co-ordinates
+ /*!
+ \param [in] xCoord the vector of x co-ordinate
+ \param [in] yCoord the vector of y co-ordinate
+ \return the global bin number
+ */
+ Int_t binNumber( Double_t xCoord, Double_t yCoord ) const;
+
+ //! Find which true bins contribute to the given reco bin
+ /*!
+ \param [in] recoBin the reco global bin number
+ \return the list of true bins that contribute (the numbers returned are not global bin numbers but the index in the LauScfMap::histos_ storage)
+ */
+ const std::vector<Int_t>* trueBins( Int_t recoBin ) const;
+
+ //! Probability of a true event in the given true bin migrating to the reco bin
+ /*!
+ \param [in] recoBin the reco global bin number
+ \param [in] trueBin the true bin index in the LauScfMap::histos_ storage (as provided by LauScfMap::trueBins)
+ \return the migration probability
+ */
+ Double_t prob( Int_t recoBin, Int_t trueBin ) const;
+
+ //! Retrieve the migration histogram for trueBin
+ /*!
+ \param [in] trueBin the true global bin number
+ \return the migration histogram
+ */
+ TH2* trueHist( Int_t trueBin );
+
+ private:
+ //! Copy constructor (not implemented)
+ LauScfMap( const LauScfMap& rhs );
+
+ //! Copy assignment operator (not implemented)
+ LauScfMap& operator=( const LauScfMap& rhs );
+
+ //! The vector of two-dimensional histograms
+ std::vector<TH2*> histos_;
+
+ //! Map that links each reco global bin number and the vector of true bin indices into LauScfMap::histos_
+ std::map<Int_t, std::vector<Int_t>> contribs_;
+
+ //! Number of bins in the x-axis
+ Int_t nBinsX_;
+ //! Number of bins in the y-axis
+ Int_t nBinsY_;
+ //! Number of bins in a 2D histogram (nBinsX_*nBinsY_)
+ Int_t numberOfBins_;
+
+ ClassDef( LauScfMap, 0 )
};
#endif
diff --git a/inc/LauSigmaRes.hh b/inc/LauSigmaRes.hh
index 99875e3..51c52c9 100644
--- a/inc/LauSigmaRes.hh
+++ b/inc/LauSigmaRes.hh
@@ -1,202 +1,203 @@
/*
Copyright 2004 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauSigmaRes.hh
\brief File containing declaration of LauSigmaRes class.
*/
/*! \class LauSigmaRes
\brief Class for defining the Sigma resonance model
Class for defining the Sigma resonance model. Formulae and data values from
Phys.Lett.B 572, 1 (2003) - author D.V.Bugg
*/
#ifndef LAU_SIGMA_RES
#define LAU_SIGMA_RES
-#include "TString.h"
-
#include "LauAbsResonance.hh"
#include "LauComplex.hh"
+#include "TString.h"
class LauSigmaRes : public LauAbsResonance {
- public:
- //! Constructor
- /*!
- \param [in] resInfo the object containing information on the resonance name, mass, width, spin, charge, etc.
- \param [in] resPairAmpInt the number of the daughter not produced by the resonance
- \param [in] daughters the daughter particles
- */
- LauSigmaRes(LauResonanceInfo* resInfo, const Int_t resPairAmpInt, const LauDaughters* daughters);
-
- //! Destructor
- virtual ~LauSigmaRes();
-
- //! Initialise the model
- virtual void initialise();
-
- //! Get the resonance model type
- /*!
- \return the resonance model type
- */
- virtual LauAbsResonance::LauResonanceModel getResonanceModel() const {return LauAbsResonance::Sigma;}
-
- //! Set value of the various parameters
- /*!
- \param [in] name the name of the parameter to be changed
- \param [in] value the new parameter value
- */
- virtual void setResonanceParameter(const TString& name, const Double_t value);
-
- //! Allow the various parameters to float in the fit
- /*!
- \param [in] name the name of the parameter to be floated
- */
- virtual void floatResonanceParameter(const TString& name);
-
- //! Access the given resonance parameter
- /*!
- \param [in] name the name of the parameter
- \return the corresponding parameter
- */
- virtual LauParameter* getResonanceParameter(const TString& name);
-
- //! Retrieve the resonance parameters, e.g. so that they can be loaded into a fit
- /*!
- \return floating parameters of the resonance
- */
- virtual const std::vector<LauParameter*>& getFloatingParameters();
-
- protected:
- //! Set the b1 parameter
- /*!
- \param [in] b1 new value for b1 parameter
- */
- void setB1Value(const Double_t b1);
-
- //! Set the b2 parameter
- /*!
- \param [in] b2 new value for b2 parameter
- */
- void setB2Value(const Double_t b2);
-
- //! Set the A parameter
- /*!
- \param [in] A new value for A parameter
- */
- void setAValue(const Double_t A);
-
- //! Set the m0 parameter
- /*!
- \param [in] m0 new value for m0 parameter
- */
- void setM0Value(const Double_t m0);
-
- //! Get the b1 parameter value
- /*!
- \return value of the b1 parameter
- */
- Double_t getB1Value() const { return (b1_!=0) ? b1_->unblindValue() : 0.0; }
-
- //! Get the b2 parameter value
- /*!
- \return value of the b2 parameter
- */
- Double_t getB2Value() const { return (b2_!=0) ? b2_->unblindValue() : 0.0; }
-
- //! Get the A parameter value
- /*!
- \return value of the A parameter
- */
- Double_t getAValue() const { return (a_!=0) ? a_->unblindValue() : 0.0; }
-
- //! Get the m0 parameter value
- /*!
- \return value of the m0 parameter
- */
- Double_t getM0Value() const { return (m0_!=0) ? m0_->unblindValue() : 0.0; }
-
- //! Fix the b1 parameter value
- /*!
- \return kTRUE if the b1 parameter is fixed, kFALSE otherwise
- */
- Bool_t fixB1Value() const { return (b1_!=0) ? b1_->fixed() : 0.0; }
-
- //! Fix the b2 parameter value
- /*!
- \return kTRUE if the b2 parameter is fixed, kFALSE otherwise
- */
- Bool_t fixB2Value() const { return (b2_!=0) ? b2_->fixed() : 0.0; }
-
- //! Fix the A parameter value
- /*!
- \return kTRUE if the A parameter is fixed, kFALSE otherwise
- */
- Bool_t fixAValue() const { return (a_!=0) ? a_->fixed() : 0.0; }
-
- //! Fix the m0 parameter value
- /*!
- \return kTRUE if the m0 parameter is fixed, kFALSE otherwise
- */
- Bool_t fixM0Value() const { return (m0_!=0) ? m0_->fixed() : 0.0; }
-
- //! Complex resonant ampltiude
- /*!
- \param [in] mass appropriate invariant mass for the resonance
- \param [in] spinTerm spin term
- */
- virtual LauComplex resAmp(Double_t mass, Double_t spinTerm);
-
- //! Check that both daughters are the same type of particle
- void checkDaughterTypes() const;
-
- private:
- //! Copy constructor (not implemented)
- LauSigmaRes(const LauSigmaRes& rhs);
-
- //! Copy assignment operator (not implemented)
- LauSigmaRes& operator=(const LauSigmaRes& rhs);
-
- //! Defined as 4*mPi*mPi
- Double_t mPiSq4_;
- //! Defined as 0.5*mPi*mPi
- Double_t sAdler_;
-
- //! Factor from BES data
- LauParameter* b1_;
- //! Factor from BES data
- LauParameter* b2_;
- //! Factor from BES data
- LauParameter* a_;
- //! Factor from BES data
- LauParameter* m0_;
-
- ClassDef(LauSigmaRes,0) // Sigma resonance model
-
+ public:
+ //! Constructor
+ /*!
+ \param [in] resInfo the object containing information on the resonance name, mass, width, spin, charge, etc.
+ \param [in] resPairAmpInt the number of the daughter not produced by the resonance
+ \param [in] daughters the daughter particles
+ */
+ LauSigmaRes( LauResonanceInfo* resInfo, const Int_t resPairAmpInt, const LauDaughters* daughters );
+
+ //! Destructor
+ virtual ~LauSigmaRes();
+
+ //! Initialise the model
+ virtual void initialise();
+
+ //! Get the resonance model type
+ /*!
+ \return the resonance model type
+ */
+ virtual LauAbsResonance::LauResonanceModel getResonanceModel() const
+ {
+ return LauAbsResonance::Sigma;
+ }
+
+ //! Set value of the various parameters
+ /*!
+ \param [in] name the name of the parameter to be changed
+ \param [in] value the new parameter value
+ */
+ virtual void setResonanceParameter( const TString& name, const Double_t value );
+
+ //! Allow the various parameters to float in the fit
+ /*!
+ \param [in] name the name of the parameter to be floated
+ */
+ virtual void floatResonanceParameter( const TString& name );
+
+ //! Access the given resonance parameter
+ /*!
+ \param [in] name the name of the parameter
+ \return the corresponding parameter
+ */
+ virtual LauParameter* getResonanceParameter( const TString& name );
+
+ //! Retrieve the resonance parameters, e.g. so that they can be loaded into a fit
+ /*!
+ \return floating parameters of the resonance
+ */
+ virtual const std::vector<LauParameter*>& getFloatingParameters();
+
+ protected:
+ //! Set the b1 parameter
+ /*!
+ \param [in] b1 new value for b1 parameter
+ */
+ void setB1Value( const Double_t b1 );
+
+ //! Set the b2 parameter
+ /*!
+ \param [in] b2 new value for b2 parameter
+ */
+ void setB2Value( const Double_t b2 );
+
+ //! Set the A parameter
+ /*!
+ \param [in] A new value for A parameter
+ */
+ void setAValue( const Double_t A );
+
+ //! Set the m0 parameter
+ /*!
+ \param [in] m0 new value for m0 parameter
+ */
+ void setM0Value( const Double_t m0 );
+
+ //! Get the b1 parameter value
+ /*!
+ \return value of the b1 parameter
+ */
+ Double_t getB1Value() const { return ( b1_ != 0 ) ? b1_->unblindValue() : 0.0; }
+
+ //! Get the b2 parameter value
+ /*!
+ \return value of the b2 parameter
+ */
+ Double_t getB2Value() const { return ( b2_ != 0 ) ? b2_->unblindValue() : 0.0; }
+
+ //! Get the A parameter value
+ /*!
+ \return value of the A parameter
+ */
+ Double_t getAValue() const { return ( a_ != 0 ) ? a_->unblindValue() : 0.0; }
+
+ //! Get the m0 parameter value
+ /*!
+ \return value of the m0 parameter
+ */
+ Double_t getM0Value() const { return ( m0_ != 0 ) ? m0_->unblindValue() : 0.0; }
+
+ //! Fix the b1 parameter value
+ /*!
+ \return kTRUE if the b1 parameter is fixed, kFALSE otherwise
+ */
+ Bool_t fixB1Value() const { return ( b1_ != 0 ) ? b1_->fixed() : 0.0; }
+
+ //! Fix the b2 parameter value
+ /*!
+ \return kTRUE if the b2 parameter is fixed, kFALSE otherwise
+ */
+ Bool_t fixB2Value() const { return ( b2_ != 0 ) ? b2_->fixed() : 0.0; }
+
+ //! Fix the A parameter value
+ /*!
+ \return kTRUE if the A parameter is fixed, kFALSE otherwise
+ */
+ Bool_t fixAValue() const { return ( a_ != 0 ) ? a_->fixed() : 0.0; }
+
+ //! Fix the m0 parameter value
+ /*!
+ \return kTRUE if the m0 parameter is fixed, kFALSE otherwise
+ */
+ Bool_t fixM0Value() const { return ( m0_ != 0 ) ? m0_->fixed() : 0.0; }
+
+ //! Complex resonant ampltiude
+ /*!
+ \param [in] mass appropriate invariant mass for the resonance
+ \param [in] spinTerm spin term
+ */
+ virtual LauComplex resAmp( Double_t mass, Double_t spinTerm );
+
+ //! Check that both daughters are the same type of particle
+ void checkDaughterTypes() const;
+
+ private:
+ //! Copy constructor (not implemented)
+ LauSigmaRes( const LauSigmaRes& rhs );
+
+ //! Copy assignment operator (not implemented)
+ LauSigmaRes& operator=( const LauSigmaRes& rhs );
+
+ //! Defined as 4*mPi*mPi
+ Double_t mPiSq4_;
+ //! Defined as 0.5*mPi*mPi
+ Double_t sAdler_;
+
+ //! Factor from BES data
+ LauParameter* b1_;
+ //! Factor from BES data
+ LauParameter* b2_;
+ //! Factor from BES data
+ LauParameter* a_;
+ //! Factor from BES data
+ LauParameter* m0_;
+
+ ClassDef( LauSigmaRes, 0 ) // Sigma resonance model
};
#endif
diff --git a/inc/LauSigmoidPdf.hh b/inc/LauSigmoidPdf.hh
index 1f74fad..6d7ac49 100644
--- a/inc/LauSigmoidPdf.hh
+++ b/inc/LauSigmoidPdf.hh
@@ -1,96 +1,97 @@
/*
Copyright 2012 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauSigmoidPdf.hh
\brief File containing declaration of LauSigmoidPdf class.
*/
/*! \class LauSigmoidPdf
\brief Class for defining a generalised sigmoid PDF.
Class for defining a generalised sigmoid PDF:
f(x) = 1 / ( 1 + e^(b - ax) )
The standard sigmoid is obtained when a = 1 and b = 0.
*/
-
#ifndef LAU_SIGMOID_PDF
#define LAU_SIGMOID_PDF
-#include <vector>
+#include "LauAbsPdf.hh"
#include "TString.h"
-#include "LauAbsPdf.hh"
+#include <vector>
class LauParameter;
-
class LauSigmoidPdf : public LauAbsPdf {
- public:
- //! Constructor
- /*!
- \param [in] theVarName the name of the abscissa variable
- \param [in] params the PDF parameters - a and b
- \param [in] minAbscissa the minimum value of the abscissa
- \param [in] maxAbscissa the maximum value of the abscissa
- */
- LauSigmoidPdf(const TString& theVarName, const std::vector<LauAbsRValue*>& params, Double_t minAbscissa, Double_t maxAbscissa);
-
- //! Destructor
- virtual ~LauSigmoidPdf();
-
- //! Copy constructor
- LauSigmoidPdf(const LauSigmoidPdf& other);
-
- //! Calculate the likelihood (and intermediate info) for a given abscissa
- /*!
- \param [in] abscissas the values of the abscissa(s)
- */
- virtual void calcLikelihoodInfo(const LauAbscissas& abscissas);
-
- using LauAbsPdf::calcLikelihoodInfo;
-
- //! Calculate the normalisation
- virtual void calcNorm();
-
- //! Calculate the PDF height
- /*!
- \param [in] kinematics the current DP kinematics
- */
- virtual void calcPDFHeight( const LauKinematics* kinematics );
-
- protected:
-
- private:
- //! Parameter a
- LauAbsRValue* a_;
- //! Parameter b
- LauAbsRValue* b_;
-
- ClassDef(LauSigmoidPdf,0) // Define the Sigmoid PDF
+ public:
+ //! Constructor
+ /*!
+ \param [in] theVarName the name of the abscissa variable
+ \param [in] params the PDF parameters - a and b
+ \param [in] minAbscissa the minimum value of the abscissa
+ \param [in] maxAbscissa the maximum value of the abscissa
+ */
+ LauSigmoidPdf( const TString& theVarName,
+ const std::vector<LauAbsRValue*>& params,
+ Double_t minAbscissa,
+ Double_t maxAbscissa );
+
+ //! Destructor
+ virtual ~LauSigmoidPdf();
+
+ //! Copy constructor
+ LauSigmoidPdf( const LauSigmoidPdf& other );
+
+ //! Calculate the likelihood (and intermediate info) for a given abscissa
+ /*!
+ \param [in] abscissas the values of the abscissa(s)
+ */
+ virtual void calcLikelihoodInfo( const LauAbscissas& abscissas );
+
+ using LauAbsPdf::calcLikelihoodInfo;
+
+ //! Calculate the normalisation
+ virtual void calcNorm();
+
+ //! Calculate the PDF height
+ /*!
+ \param [in] kinematics the current DP kinematics
+ */
+ virtual void calcPDFHeight( const LauKinematics* kinematics );
+
+ protected:
+
+ private:
+ //! Parameter a
+ LauAbsRValue* a_;
+ //! Parameter b
+ LauAbsRValue* b_;
+
+ ClassDef( LauSigmoidPdf, 0 ) // Define the Sigmoid PDF
};
#endif
diff --git a/inc/LauSimFitCoordinator.hh b/inc/LauSimFitCoordinator.hh
index 73240b2..cb6c018 100644
--- a/inc/LauSimFitCoordinator.hh
+++ b/inc/LauSimFitCoordinator.hh
@@ -1,230 +1,229 @@
/*
Copyright 2013 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauSimFitCoordinator.hh
\brief File containing declaration of LauSimFitCoordinator class.
*/
/*! \class LauSimFitCoordinator
\brief The coordinator process for simultaneous/combined fits
Implementation of the JFit method described in arXiv:1409.5080 [physics.data-an].
This class acts as the interface between the task processes and the minimiser.
*/
#ifndef LAU_SIM_FIT_COORDINATOR
#define LAU_SIM_FIT_COORDINATOR
-#include <map>
-#include <vector>
+#include "LauFitObject.hh"
#include "TMatrixD.h"
#include "TStopwatch.h"
#include "TString.h"
-#include "LauFitObject.hh"
+#include <map>
+#include <vector>
class TMessage;
class TMonitor;
class TSocket;
class LauAbsRValue;
class LauParameter;
class LauFitNtuple;
-
class LauSimFitCoordinator : public LauFitObject {
- public:
- //! Constructor
- /*!
- \param [in] numTasks the number of tasks processes to expect connections from
- \param [in] port the port on which to listen for connections from the tasks
- */
- LauSimFitCoordinator( UInt_t numTasks, UInt_t port = 9090 );
-
- //! Destructor
- virtual ~LauSimFitCoordinator();
-
- //! Run the fit
- /*!
- \param [in] fitNtupleFileName the file to which the ntuple containing the fit results should be written
- \param [in] useAsymmErrors should asymmetric errors be calculated or not
- \param [in] doTwoStageFit should the fit be performed in two stages or not
- */
- void runSimFit( const TString& fitNtupleFileName, const Bool_t useAsymmErrors = kFALSE, const Bool_t doTwoStageFit = kFALSE );
+ public:
+ //! Constructor
+ /*!
+ \param [in] numTasks the number of tasks processes to expect connections from
+ \param [in] port the port on which to listen for connections from the tasks
+ */
+ LauSimFitCoordinator( UInt_t numTasks, UInt_t port = 9090 );
+
+ //! Destructor
+ virtual ~LauSimFitCoordinator();
+
+ //! Run the fit
+ /*!
+ \param [in] fitNtupleFileName the file to which the ntuple containing the fit results should be written
+ \param [in] useAsymmErrors should asymmetric errors be calculated or not
+ \param [in] doTwoStageFit should the fit be performed in two stages or not
+ */
+ void runSimFit( const TString& fitNtupleFileName,
+ const Bool_t useAsymmErrors = kFALSE,
+ const Bool_t doTwoStageFit = kFALSE );
- //! Mark that the fit is calculating asymmetric errors
- /*!
- This function has to be public since it is called by
- the fitter interface to mark when entering and exiting
- the asymmetric error calculation.
- It should not be called otherwise!
+ //! Mark that the fit is calculating asymmetric errors
+ /*!
+ This function has to be public since it is called by
+ the fitter interface to mark when entering and exiting
+ the asymmetric error calculation.
+ It should not be called otherwise!
- \param [in] inAsymErrCalc boolean marking that the fit is calculating the asymmetric errors
- */
- virtual void withinAsymErrorCalc(const Bool_t inAsymErrCalc);
+ \param [in] inAsymErrCalc boolean marking that the fit is calculating the asymmetric errors
+ */
+ virtual void withinAsymErrorCalc( const Bool_t inAsymErrCalc );
- // Need to unshadow the query method defined in the base class
- using LauFitObject::withinAsymErrorCalc;
+ // Need to unshadow the query method defined in the base class
+ using LauFitObject::withinAsymErrorCalc;
- //! This function sets the parameter values from Minuit
- /*!
- This function has to be public since it is called from the global FCN.
- It should not be called otherwise!
+ //! This function sets the parameter values from Minuit
+ /*!
+ This function has to be public since it is called from the global FCN.
+ It should not be called otherwise!
- \param [in] par an array storing the various parameter values
- \param [in] npar the number of free parameters
- */
- virtual void setParsFromMinuit(Double_t* par, Int_t npar);
+ \param [in] par an array storing the various parameter values
+ \param [in] npar the number of free parameters
+ */
+ virtual void setParsFromMinuit( Double_t* par, Int_t npar );
- //! Calculate the new value of the negative log likelihood
- /*!
- This function has to be public since it is called from the global FCN.
- It should not be called otherwise!
- */
- virtual Double_t getTotNegLogLikelihood();
+ //! Calculate the new value of the negative log likelihood
+ /*!
+ This function has to be public since it is called from the global FCN.
+ It should not be called otherwise!
+ */
+ virtual Double_t getTotNegLogLikelihood();
- protected:
- //! Print information on the parameters
- void printParInfo() const;
+ protected:
+ //! Print information on the parameters
+ void printParInfo() const;
- //! Initialise
- void initialise();
+ //! Initialise
+ void initialise();
- //! Initialise socket connections for the tasks
- void initSockets();
+ //! Initialise socket connections for the tasks
+ void initSockets();
- //! Determine/update the parameter initial values from all tasks
- void getParametersFromTasks();
+ //! Determine/update the parameter initial values from all tasks
+ void getParametersFromTasks();
- //! Determine the parameter names and initial values from all tasks
- void getParametersFromTasksFirstTime();
+ //! Determine the parameter names and initial values from all tasks
+ void getParametersFromTasksFirstTime();
- //! Update and verify the parameter initial values from all tasks
- void updateParametersFromTasks();
+ //! Update and verify the parameter initial values from all tasks
+ void updateParametersFromTasks();
- //! Check for compatibility between two same-named parameters, which should therefore be identical
- void checkParameter( const LauParameter* param, UInt_t index ) const;
+ //! Check for compatibility between two same-named parameters, which should therefore be identical
+ void checkParameter( const LauParameter* param, UInt_t index ) const;
- //! Add parameters to the list of Gaussian constrained parameters
- void addConParameters();
+ //! Add parameters to the list of Gaussian constrained parameters
+ void addConParameters();
- //! Calculate the penalty terms to the log likelihood from Gaussian constraints
- Double_t getLogLikelihoodPenalty();
+ //! Calculate the penalty terms to the log likelihood from Gaussian constraints
+ Double_t getLogLikelihoodPenalty();
- //! Instruct the tasks to read the input data for the given experiment
- /*!
- \return success/failure of the reading operations
- */
- Bool_t readData();
+ //! Instruct the tasks to read the input data for the given experiment
+ /*!
+ \return success/failure of the reading operations
+ */
+ Bool_t readData();
- //! Instruct the tasks to perform the caching
- /*!
- \return success/failure of the caching operations
- */
- Bool_t cacheInputData();
+ //! Instruct the tasks to perform the caching
+ /*!
+ \return success/failure of the caching operations
+ */
+ Bool_t cacheInputData();
- //! Perform the fit for the current experiment
- void fitExpt();
+ //! Perform the fit for the current experiment
+ void fitExpt();
- //! Instruct the tasks to update the initial fit parameter values, if required
- void checkInitFitParams();
+ //! Instruct the tasks to update the initial fit parameter values, if required
+ void checkInitFitParams();
- //! Return the final parameters to the tasks and instruct them to perform their finalisation
- Bool_t finalise();
+ //! Return the final parameters to the tasks and instruct them to perform their finalisation
+ Bool_t finalise();
- //! Instruct the tasks to write out the fit results
- Bool_t writeOutResults();
+ //! Instruct the tasks to write out the fit results
+ Bool_t writeOutResults();
+ private:
+ //! Copy constructor (not implemented)
+ LauSimFitCoordinator( const LauSimFitCoordinator& rhs );
- private:
- //! Copy constructor (not implemented)
- LauSimFitCoordinator(const LauSimFitCoordinator& rhs);
+ //! Copy assignment operator (not implemented)
+ LauSimFitCoordinator& operator=( const LauSimFitCoordinator& rhs );
- //! Copy assignment operator (not implemented)
- LauSimFitCoordinator& operator=(const LauSimFitCoordinator& rhs);
+ //! The number of tasks
+ const UInt_t nTasks_;
- //! The number of tasks
- const UInt_t nTasks_;
+ //! The requested port
+ const UInt_t reqPort_;
- //! The requested port
- const UInt_t reqPort_;
+ //! The covariance sub-matrices for each task
+ std::vector<TMatrixD> covMatrices_;
- //! The covariance sub-matrices for each task
- std::vector<TMatrixD> covMatrices_;
+ //! Parallel setup monitor
+ TMonitor* socketMonitor_;
- //! Parallel setup monitor
- TMonitor* socketMonitor_;
+ //! Sockets for each of the tasks
+ std::vector<TSocket*> socketTasks_;
- //! Sockets for each of the tasks
- std::vector<TSocket*> socketTasks_;
+ //! Messages to tasks
+ std::vector<TMessage*> messagesToTasks_;
- //! Messages to tasks
- std::vector<TMessage*> messagesToTasks_;
+ //! Message from tasks to the coordinator
+ TMessage* messageFromTask_;
- //! Message from tasks to the coordinator
- TMessage* messageFromTask_;
+ //! Map of parameter names to index in the values vector
+ std::map<TString, UInt_t> parIndices_;
- //! Map of parameter names to index in the values vector
- std::map< TString, UInt_t > parIndices_;
+ //! Reverse map of index in the values vector to parameter names
+ std::map<UInt_t, TString> parNames_;
- //! Reverse map of index in the values vector to parameter names
- std::map< UInt_t, TString > parNames_;
+ //! Parameters
+ std::vector<LauParameter*> params_;
- //! Parameters
- std::vector<LauParameter*> params_;
+ //! Gaussian constraints
+ std::vector<LauAbsRValue*> conVars_;
- //! Gaussian constraints
- std::vector<LauAbsRValue*> conVars_;
+ //! Parameter values
+ std::vector<Double_t> parValues_;
- //! Parameter values
- std::vector<Double_t> parValues_;
+ //! Lists of indices for each task
+ std::vector<std::vector<UInt_t>> taskIndices_;
- //! Lists of indices for each task
- std::vector< std::vector<UInt_t> > taskIndices_;
+ //! Lists of indices of free parameters for each task
+ std::vector<std::vector<UInt_t>> taskFreeIndices_;
- //! Lists of indices of free parameters for each task
- std::vector< std::vector<UInt_t> > taskFreeIndices_;
+ //! Parameter values to send to the tasks
+ std::vector<Double_t*> vectorPar_;
- //! Parameter values to send to the tasks
- std::vector<Double_t*> vectorPar_;
+ //! Likelihood values returned from the tasks
+ std::vector<Double_t> vectorRes_;
- //! Likelihood values returned from the tasks
- std::vector<Double_t> vectorRes_;
+ //! The fit timer
+ TStopwatch timer_;
- //! The fit timer
- TStopwatch timer_;
+ //! The total fit timer
+ TStopwatch cumulTimer_;
- //! The total fit timer
- TStopwatch cumulTimer_;
+ //! The fit results ntuple
+ LauFitNtuple* fitNtuple_;
- //! The fit results ntuple
- LauFitNtuple* fitNtuple_;
-
- ClassDef(LauSimFitCoordinator,0);
+ ClassDef( LauSimFitCoordinator, 0 );
};
#endif
-
diff --git a/inc/LauSimFitTask.hh b/inc/LauSimFitTask.hh
index 1441807..466018e 100644
--- a/inc/LauSimFitTask.hh
+++ b/inc/LauSimFitTask.hh
@@ -1,190 +1,194 @@
/*
Copyright 2015 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauSimFitTask.hh
\brief File containing declaration of LauSimFitTask class.
*/
/*! \class LauSimFitTask
\brief The base class for any task process for simultaneous/combined fits
Implementation of the JFit method described in arXiv:1409.5080 [physics.data-an].
This class acts as the base class from which tasks should inherit.
This allows any fitting framework to plug in to the JFit method.
*/
#ifndef LAU_SIM_FIT_TASK
#define LAU_SIM_FIT_TASK
-#include "TMatrixDfwd.h"
-
#include "LauFitObject.hh"
+#include "TMatrixDfwd.h"
+
class TMessage;
class TSocket;
class TString;
class LauFitNtuple;
-
class LauSimFitTask : public LauFitObject {
- public:
- //! Constructor
- LauSimFitTask();
-
- //! Destructor
- virtual ~LauSimFitTask();
-
- //! Obtain the number of tasks
- UInt_t nTasks() const {return nTasks_;}
-
- //! Obtain the ID number of this task
- UInt_t taskId() const {return taskId_;}
-
- //! Start the task process for simultaneous fitting
- /*!
- \param [in] dataFileName the name of the input data file
- \param [in] dataTreeName the name of the tree containing the data
- \param [in] histFileName the file name for the output histograms
- \param [in] tableFileName the file name for the latex output file
- \param [in] addressCoordinator the hostname of the machine running the coordinator process
- \param [in] portCoordinator the port number on which the coordinator process is listening
- */
- virtual void runTask(const TString& dataFileName, const TString& dataTreeName,
- const TString& histFileName, const TString& tableFileName = "",
- const TString& addressCoordinator = "localhost", const UInt_t portCoordinator = 9090);
-
- //! Initialise the fit model
- /*!
- Each class that inherits from this one must implement
- this to do what is appropriate
- */
- virtual void initialise() = 0;
-
- //! This function sets the parameter values from Minuit
- /*!
- \param [in] par an array storing the various parameter values
- \param [in] npar the number of free parameters
- */
- virtual void setParsFromMinuit(Double_t* par, Int_t npar) = 0;
-
- //! Calculates the total negative log-likelihood
- virtual Double_t getTotNegLogLikelihood() = 0;
-
- protected:
- //! Const access to the fit ntuple
- const LauFitNtuple* fitNtuple() const {return fitNtuple_;}
-
- //! Access to the fit ntuple
- LauFitNtuple* fitNtuple() {return fitNtuple_;}
-
- //! Establish the connection to the coordinator process
- /*!
- \param [in] addressCoordinator the hostname of the machine running the coordinator process
- \param [in] portCoordinator the port number on which the coordinator process is listening
- */
- void connectToCoordinator( const TString& addressCoordinator, const UInt_t portCoordinator );
-
- //! Listen for requests from the coordinator and act accordingly
- void processCoordinatorRequests();
-
- //! Setup saving of fit results to ntuple/LaTeX table etc.
- /*!
- Provide here a default implementation that produces an ntuple only.
- Derived classes can override as they wish.
-
- \param [in] histFileName the file name for the output histograms
- \param [in] tableFileName the file name for the latex output file
- */
- virtual void setupResultsOutputs( const TString& histFileName, const TString& tableFileName );
-
- //! Package the initial fit parameters for transmission to the coordinator
- /*!
- \param [out] array the array to be filled with the LauParameter objects
- */
- virtual void prepareInitialParArray( TObjArray& array ) = 0;
-
- //! Perform all finalisation actions
- /*!
- - Receive the results of the fit from the coordinator
- - Perform any finalisation routines
- - Package the finalised fit parameters for transmission back to the coordinator
-
- \param [in] fitStat the status of the fit, e.g. status code, EDM, NLL
- \param [in] parsFromCoordinator the parameters at the fit minimum
- \param [in] covMat the fit covariance matrix
- \param [out] parsToCoordinator the array to be filled with the finalised LauParameter objects
- */
- virtual void finaliseExperiment( const LauAbsFitter::FitStatus& fitStat, const TObjArray* parsFromCoordinator, const TMatrixD* covMat, TObjArray& parsToCoordinator ) = 0;
-
- //! Open the input file and verify that all required variables are present
- /*!
- \param [in] dataFileName the name of the input file
- \param [in] dataTreeName the name of the input tree
- */
- virtual Bool_t verifyFitData(const TString& dataFileName, const TString& dataTreeName) = 0;
-
- //! Read in the data for the current experiment
- /*!
- \return the number of events read in
- */
- virtual UInt_t readExperimentData() = 0;
-
- //! Cache the input data values to calculate the likelihood during the fit
- virtual void cacheInputFitVars() = 0;
-
- //! Write out any fit results
- virtual void writeOutAllFitResults();
-
- private:
- //! Copy constructor (not implemented)
- LauSimFitTask(const LauSimFitTask& rhs);
-
- //! Copy assignment operator (not implemented)
- LauSimFitTask& operator=(const LauSimFitTask& rhs);
-
- //! A socket to enable parallel setup
- TSocket* socketCoordinator_;
-
- //! Message from coordinator to the tasks
- TMessage* messageFromCoordinator_;
-
- //! Task id number
- UInt_t taskId_;
-
- //! The total number of tasks
- UInt_t nTasks_;
-
- //! Parameter values array (for reading from the coordinator)
- Double_t* parValues_;
-
- //! The fit ntuple
- LauFitNtuple* fitNtuple_;
-
- ClassDef(LauSimFitTask,0);
+ public:
+ //! Constructor
+ LauSimFitTask();
+
+ //! Destructor
+ virtual ~LauSimFitTask();
+
+ //! Obtain the number of tasks
+ UInt_t nTasks() const { return nTasks_; }
+
+ //! Obtain the ID number of this task
+ UInt_t taskId() const { return taskId_; }
+
+ //! Start the task process for simultaneous fitting
+ /*!
+ \param [in] dataFileName the name of the input data file
+ \param [in] dataTreeName the name of the tree containing the data
+ \param [in] histFileName the file name for the output histograms
+ \param [in] tableFileName the file name for the latex output file
+ \param [in] addressCoordinator the hostname of the machine running the coordinator process
+ \param [in] portCoordinator the port number on which the coordinator process is listening
+ */
+ virtual void runTask( const TString& dataFileName,
+ const TString& dataTreeName,
+ const TString& histFileName,
+ const TString& tableFileName = "",
+ const TString& addressCoordinator = "localhost",
+ const UInt_t portCoordinator = 9090 );
+
+ //! Initialise the fit model
+ /*!
+ Each class that inherits from this one must implement
+ this to do what is appropriate
+ */
+ virtual void initialise() = 0;
+
+ //! This function sets the parameter values from Minuit
+ /*!
+ \param [in] par an array storing the various parameter values
+ \param [in] npar the number of free parameters
+ */
+ virtual void setParsFromMinuit( Double_t* par, Int_t npar ) = 0;
+
+ //! Calculates the total negative log-likelihood
+ virtual Double_t getTotNegLogLikelihood() = 0;
+
+ protected:
+ //! Const access to the fit ntuple
+ const LauFitNtuple* fitNtuple() const { return fitNtuple_; }
+
+ //! Access to the fit ntuple
+ LauFitNtuple* fitNtuple() { return fitNtuple_; }
+
+ //! Establish the connection to the coordinator process
+ /*!
+ \param [in] addressCoordinator the hostname of the machine running the coordinator process
+ \param [in] portCoordinator the port number on which the coordinator process is listening
+ */
+ void connectToCoordinator( const TString& addressCoordinator, const UInt_t portCoordinator );
+
+ //! Listen for requests from the coordinator and act accordingly
+ void processCoordinatorRequests();
+
+ //! Setup saving of fit results to ntuple/LaTeX table etc.
+ /*!
+ Provide here a default implementation that produces an ntuple only.
+ Derived classes can override as they wish.
+
+ \param [in] histFileName the file name for the output histograms
+ \param [in] tableFileName the file name for the latex output file
+ */
+ virtual void setupResultsOutputs( const TString& histFileName, const TString& tableFileName );
+
+ //! Package the initial fit parameters for transmission to the coordinator
+ /*!
+ \param [out] array the array to be filled with the LauParameter objects
+ */
+ virtual void prepareInitialParArray( TObjArray& array ) = 0;
+
+ //! Perform all finalisation actions
+ /*!
+ - Receive the results of the fit from the coordinator
+ - Perform any finalisation routines
+ - Package the finalised fit parameters for transmission back to the coordinator
+
+ \param [in] fitStat the status of the fit, e.g. status code, EDM, NLL
+ \param [in] parsFromCoordinator the parameters at the fit minimum
+ \param [in] covMat the fit covariance matrix
+ \param [out] parsToCoordinator the array to be filled with the finalised LauParameter objects
+ */
+ virtual void finaliseExperiment( const LauAbsFitter::FitStatus& fitStat,
+ const TObjArray* parsFromCoordinator,
+ const TMatrixD* covMat,
+ TObjArray& parsToCoordinator ) = 0;
+
+ //! Open the input file and verify that all required variables are present
+ /*!
+ \param [in] dataFileName the name of the input file
+ \param [in] dataTreeName the name of the input tree
+ */
+ virtual Bool_t verifyFitData( const TString& dataFileName, const TString& dataTreeName ) = 0;
+
+ //! Read in the data for the current experiment
+ /*!
+ \return the number of events read in
+ */
+ virtual UInt_t readExperimentData() = 0;
+
+ //! Cache the input data values to calculate the likelihood during the fit
+ virtual void cacheInputFitVars() = 0;
+
+ //! Write out any fit results
+ virtual void writeOutAllFitResults();
+
+ private:
+ //! Copy constructor (not implemented)
+ LauSimFitTask( const LauSimFitTask& rhs );
+
+ //! Copy assignment operator (not implemented)
+ LauSimFitTask& operator=( const LauSimFitTask& rhs );
+
+ //! A socket to enable parallel setup
+ TSocket* socketCoordinator_;
+
+ //! Message from coordinator to the tasks
+ TMessage* messageFromCoordinator_;
+
+ //! Task id number
+ UInt_t taskId_;
+
+ //! The total number of tasks
+ UInt_t nTasks_;
+
+ //! Parameter values array (for reading from the coordinator)
+ Double_t* parValues_;
+
+ //! The fit ntuple
+ LauFitNtuple* fitNtuple_;
+
+ ClassDef( LauSimFitTask, 0 );
};
#endif
-
diff --git a/inc/LauSimpleFitModel.hh b/inc/LauSimpleFitModel.hh
index d040e37..9f2ea22 100644
--- a/inc/LauSimpleFitModel.hh
+++ b/inc/LauSimpleFitModel.hh
@@ -1,548 +1,556 @@
/*
Copyright 2004 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauSimpleFitModel.hh
\brief File containing declaration of LauSimpleFitModel class.
*/
/*! \class LauSimpleFitModel
\brief Define a Dalitz plot according to the isobar model.
A class that allows the user to define a three-body B meson
Dalitz plot according to the isobar model, i.e. defining a set of resonances
that have complex amplitudes that can interfere with each other.
*/
#ifndef LAU_SIMPLE_FIT_MODEL
#define LAU_SIMPLE_FIT_MODEL
-#include <vector>
-
-#include "TString.h"
-
#include "LauAbsFitModel.hh"
#include "LauComplex.hh"
#include "LauParameter.hh"
+#include "TString.h"
+
+#include <vector>
+
class TH2;
class LauAbsBkgndDPModel;
class LauAbsCoeffSet;
class LauIsobarDynamics;
class LauAbsPdf;
class LauEffModel;
class LauEmbeddedData;
class LauKinematics;
class LauScfMap;
-
class LauSimpleFitModel : public LauAbsFitModel {
- public:
- //! Constructor
- /*!
- \param [in] sigDPModel the signal DP model
- */
- explicit LauSimpleFitModel(LauIsobarDynamics* sigDPModel);
-
- //! Destructor
- virtual ~LauSimpleFitModel();
-
- //! Set the signal event yield
- /*!
- \param [in] nSigEvents contains the signal yield and boolean to fix it or not
- */
- virtual void setNSigEvents(LauParameter* nSigEvents);
-
- //! Set the background event yield(s)
- /*!
- The name of the parameter must be that of the corresponding background category (so that it can be correctly assigned)
-
- \param [in] nBkgndEvents contains the name, yield and option to fix the background yield
- */
- virtual void setNBkgndEvents(LauAbsRValue* nBkgndEvents);
-
- //! Set the background DP models
- /*!
- \param [in] bkgndClass the name of the background class
- \param [in] bkgndModel the DP model of the background
- */
- void setBkgndDPModel(const TString& bkgndClass, LauAbsBkgndDPModel* bkgndModel);
-
- //! 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 boolean flag to specify that the supplied histogram contains only the upper half of a symmetric DP (or lower half if using square DP coordinates)
- \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
- */
- void splitSignalComponent( const TH2* dpHisto, const Bool_t upperHalf = kFALSE, const Bool_t fluctuateBins = kFALSE, LauScfMap* scfMap = 0 );
-
- //! 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 a single global number
-
- \param [in] scfFrac the SCF fraction value
- \param [in] fixed whether the SCF fraction is fixed or floated in the fit
- */
- void splitSignalComponent( const Double_t scfFrac, const Bool_t fixed );
-
- //! Determine whether we are splitting the signal into TM and SCF parts
- Bool_t useSCF() const { return useSCF_; }
-
- //! Determine whether the SCF fraction is DP-dependent
- Bool_t useSCFHist() const { return useSCFHist_; }
-
- //! Determine if we are smearing the SCF DP PDF
- Bool_t smearSCFDP() const { return (scfMap_ != 0); }
-
- //! Set the signal PDF for a given variable
- /*!
- \param [in] pdf the PDF to be added to the signal model
- */
- void setSignalPdf(LauAbsPdf* pdf);
-
- //! Set the SCF PDF for a given variable
- /*!
- \param [in] pdf the PDF to be added to the SCF model
- */
- void setSCFPdf(LauAbsPdf* pdf);
-
- //! Set the background PDF
- /*!
- \param [in] bkgndClass the name of the background class
- \param [in] pdf the PDF to be added to the background model
- */
- void setBkgndPdf(const TString& bkgndClass, LauAbsPdf* pdf);
-
- //! Embed full simulation events for the signal, rather than generating toy from the PDFs
- /*!
- \param [in] fileName the name of the file containing the events
- \param [in] treeName the name of the tree
- \param [in] reuseEventsWithinEnsemble sample with replacement but only replace events once each experiment has been generated
- \param [in] reuseEventsWithinExperiment sample with immediate replacement
- \param [in] useReweighting perform an accept/reject routine using the configured signal amplitude model based on the MC-truth DP coordinate
- */
- void embedSignal(const TString& fileName, const TString& treeName,
- Bool_t reuseEventsWithinEnsemble, Bool_t reuseEventsWithinExperiment = kFALSE,
- Bool_t useReweighting = kFALSE);
-
- //! Embed full simulation events for the given background class, rather than generating toy from the PDFs
- /*!
- \param [in] bkgndClass the name of the background class
- \param [in] fileName the name of the file containing the events
- \param [in] treeName the name of the tree
- \param [in] reuseEventsWithinEnsemble sample with replacement but only replace events once each experiment has been generated
- \param [in] reuseEventsWithinExperiment sample with immediate replacement
- */
- void embedBkgnd(const TString& bkgndClass, const TString& fileName, const TString& treeName,
- Bool_t reuseEventsWithinEnsemble, Bool_t reuseEventsWithinExperiment = kFALSE);
-
- //! Set the DP amplitude coefficients
- /*!
- The name of the coeffSet must match the name of one of the resonances in the DP model.
-
- The supplied order of coefficients will be rearranged to match the order in which the resonances are stored in the dynamics, see LauIsobarDynamics::addResonance.
-
- \param [in] coeffSet the set of coefficients
- */
- virtual void setAmpCoeffSet(LauAbsCoeffSet* coeffSet);
-
- //! Calculate the DP amplitude(s) for a given DP position
- /*!
- If not already done, this function will initialise the DP models
- \param [in] m13Sq the invariant mass squared of children 1 and 3
- \param [in] m23Sq the invariant mass squared of children 2 and 3
- \return a container of complex amplitudes, labelled to indicate to which component they belong
- */
- virtual std::map<TString, LauComplex> getDPAmps( const Double_t m13Sq, const Double_t m23Sq );
-
- //! Calculate the DP likelihood(s) for a given DP position
- /*!
- If not already done, this function will initialise the DP models
- \param [in] m13Sq the invariant mass squared of children 1 and 3
- \param [in] m23Sq the invariant mass squared of children 2 and 3
- \return a container of likelihood values, labelled to indicate to which component they belong
- */
- virtual std::map<TString, Double_t> getDPLikelihoods( const Double_t m13Sq, const Double_t m23Sq );
-
- protected:
- //! Define a map to be used to store a category name and numbers
- typedef std::map< TString, std::pair<Int_t,Double_t> > LauGenInfo;
-
- //! Typedef for a vector of background DP models
- typedef std::vector<LauAbsBkgndDPModel*> LauBkgndDPModelList;
-
- //! Typedef for a vector of background PDFs
- typedef std::vector<LauPdfPList> LauBkgndPdfsList;
-
- //! Typedef for a vector of background yields
- typedef std::vector<LauAbsRValue*> LauBkgndYieldList;
-
- //! Typedef for a vector of embedded data objects
- typedef std::vector<LauEmbeddedData*> LauBkgndEmbDataList;
-
- //! Typedef for a vector of booleans to flag if events are reused
- typedef std::vector<Bool_t> LauBkgndReuseEventsList;
-
- //! Weight events based on the DP model
- /*!
- \param [in] dataFileName the name of the data file
- \param [in] dataTreeName the name of the data tree
- */
- virtual void weightEvents( const TString& dataFileName, const TString& dataTreeName );
-
- //! Initialise the fit
- virtual void initialise();
-
- //! Initialise the signal DP model
- virtual void initialiseDPModels();
-
- //! Recalculate Normalization the signal DP models
- virtual void recalculateNormalisation();
-
- //! Update the coefficients
- virtual void updateCoeffs();
-
- //! Toy MC generation and fitting overloaded functions
- virtual Bool_t genExpt();
-
- //! Calculate things that depend on the fit parameters after they have been updated by Minuit
- virtual void propagateParUpdates();
-
- //! Read in the input fit data variables, e.g. m13Sq and m23Sq
- virtual void cacheInputFitVars();
-
- //! Check the initial fit parameters
- virtual void checkInitFitParams();
-
- //! Get the fit results and store them
- /*!
- \param [in] tablePrefixName prefix for the name of the output file
- */
- virtual void finaliseFitResults(const TString& tablePrefixName);
-
- //! Print the fit fractions, total DP rate and mean efficiency
- /*!
- \param [out] output the stream to which to print
- */
- virtual void printFitFractions(std::ostream& output);
-
- //! Write the fit results in latex table format
- /*!
- \param [in] outputFile the name of the output file
- */
- virtual void writeOutTable(const TString& outputFile);
-
- //! Save the pdf Plots for all the resonances of experiment number fitExp
- /*!
- \param [in] label prefix for the file name to be saved
- */
- virtual void savePDFPlots(const TString& label);
-
- //! Save the pdf Plots for the sum of ressonances correspondint to "sin" of experiment number fitExp
- /*!
- \param [in] label prefix for the file name to be saved
- \param [in] spin spin of the wave to be saved
- */
- virtual void savePDFPlotsWave(const TString& label, const Int_t& spin);
-
- //! Store the per event likelihood values
- virtual void storePerEvtLlhds();
-
- // Methods to do with calculating the likelihood functions
- // and manipulating the fitting parameters.
-
- //! Get the total likelihood for each event
- /*!
- \param [in] iEvt the event number
- */
- virtual Double_t getTotEvtLikelihood(UInt_t iEvt);
-
- //! Calculate the signal and background likelihoods for the DP for a given event
- /*!
- \param [in] iEvt the event number
- */
- virtual void getEvtDPLikelihood(UInt_t iEvt);
-
- //! Calculate the SCF likelihood for the DP for a given event
- /*!
- \param [in] iEvt the event number
- */
- virtual Double_t getEvtSCFDPLikelihood(UInt_t iEvt);
-
- //! Determine the signal and background likelihood for the extra variables for a given event
- /*!
- \param [in] iEvt the event number
- */
- virtual void getEvtExtraLikelihoods(UInt_t iEvt);
-
- //! Get the total number of events
- /*!
- \return the total number of events
- */
- virtual Double_t getEventSum() const;
-
- //! Set the fit parameters for the DP model
- void setSignalDPParameters();
-
- //! Set the fit parameters for the extra PDFs
- void setExtraPdfParameters();
-
- //! Set the initial yields
- void setFitNEvents();
-
- //! Set-up other parameters that are derived from the fit results, e.g. fit fractions
- void setExtraNtupleVars();
-
- //! Randomise the initial fit parameters
- void randomiseInitFitPars();
-
- //! Define the length of the background vectors
- virtual void setupBkgndVectors();
-
- //! Determine the number of events to generate for each hypothesis
- std::pair<LauGenInfo,Bool_t> eventsToGenerate();
-
- //! Generate signal event
- Bool_t generateSignalEvent();
-
- //! Generate background event
- /*!
- \param [in] bkgndID ID number of the background class
- */
- Bool_t generateBkgndEvent(UInt_t bkgndID);
-
- //! Setup the required ntuple branches
- void setupGenNtupleBranches();
-
- //! Store all of the DP information
- void setDPBranchValues();
-
- //! Generate from the extra PDFs
- /*!
- \param [in] extraPdfs the list of extra PDFs
- \param [in] embeddedData the embedded data sample
- */
- void generateExtraPdfValues(LauPdfPList* extraPdfs, LauEmbeddedData* embeddedData);
-
- //! Add sPlot branches for the extra PDFs
- /*!
- \param [in] extraPdfs the list of extra PDFs
- \param [in] prefix the list of prefixes for the branch names
- */
- void addSPlotNtupleBranches(const LauPdfPList* extraPdfs, const TString& prefix);
+ public:
+ //! Constructor
+ /*!
+ \param [in] sigDPModel the signal DP model
+ */
+ explicit LauSimpleFitModel( LauIsobarDynamics* sigDPModel );
+
+ //! Destructor
+ virtual ~LauSimpleFitModel();
+
+ //! Set the signal event yield
+ /*!
+ \param [in] nSigEvents contains the signal yield and boolean to fix it or not
+ */
+ virtual void setNSigEvents( LauParameter* nSigEvents );
+
+ //! Set the background event yield(s)
+ /*!
+ The name of the parameter must be that of the corresponding background category (so that it can be correctly assigned)
+
+ \param [in] nBkgndEvents contains the name, yield and option to fix the background yield
+ */
+ virtual void setNBkgndEvents( LauAbsRValue* nBkgndEvents );
+
+ //! Set the background DP models
+ /*!
+ \param [in] bkgndClass the name of the background class
+ \param [in] bkgndModel the DP model of the background
+ */
+ void setBkgndDPModel( const TString& bkgndClass, LauAbsBkgndDPModel* bkgndModel );
+
+ //! 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 boolean flag to specify that the supplied histogram contains only the upper half of a symmetric DP (or lower half if using square DP coordinates)
+ \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
+ */
+ void splitSignalComponent( const TH2* dpHisto,
+ const Bool_t upperHalf = kFALSE,
+ const Bool_t fluctuateBins = kFALSE,
+ LauScfMap* scfMap = 0 );
+
+ //! 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 a single global number
+
+ \param [in] scfFrac the SCF fraction value
+ \param [in] fixed whether the SCF fraction is fixed or floated in the fit
+ */
+ void splitSignalComponent( const Double_t scfFrac, const Bool_t fixed );
+
+ //! Determine whether we are splitting the signal into TM and SCF parts
+ Bool_t useSCF() const { return useSCF_; }
+
+ //! Determine whether the SCF fraction is DP-dependent
+ Bool_t useSCFHist() const { return useSCFHist_; }
+
+ //! Determine if we are smearing the SCF DP PDF
+ Bool_t smearSCFDP() const { return ( scfMap_ != 0 ); }
+
+ //! Set the signal PDF for a given variable
+ /*!
+ \param [in] pdf the PDF to be added to the signal model
+ */
+ void setSignalPdf( LauAbsPdf* pdf );
+
+ //! Set the SCF PDF for a given variable
+ /*!
+ \param [in] pdf the PDF to be added to the SCF model
+ */
+ void setSCFPdf( LauAbsPdf* pdf );
+
+ //! Set the background PDF
+ /*!
+ \param [in] bkgndClass the name of the background class
+ \param [in] pdf the PDF to be added to the background model
+ */
+ void setBkgndPdf( const TString& bkgndClass, LauAbsPdf* pdf );
+
+ //! Embed full simulation events for the signal, rather than generating toy from the PDFs
+ /*!
+ \param [in] fileName the name of the file containing the events
+ \param [in] treeName the name of the tree
+ \param [in] reuseEventsWithinEnsemble sample with replacement but only replace events once each experiment has been generated
+ \param [in] reuseEventsWithinExperiment sample with immediate replacement
+ \param [in] useReweighting perform an accept/reject routine using the configured signal amplitude model based on the MC-truth DP coordinate
+ */
+ void embedSignal( const TString& fileName,
+ const TString& treeName,
+ Bool_t reuseEventsWithinEnsemble,
+ Bool_t reuseEventsWithinExperiment = kFALSE,
+ Bool_t useReweighting = kFALSE );
+
+ //! Embed full simulation events for the given background class, rather than generating toy from the PDFs
+ /*!
+ \param [in] bkgndClass the name of the background class
+ \param [in] fileName the name of the file containing the events
+ \param [in] treeName the name of the tree
+ \param [in] reuseEventsWithinEnsemble sample with replacement but only replace events once each experiment has been generated
+ \param [in] reuseEventsWithinExperiment sample with immediate replacement
+ */
+ void embedBkgnd( const TString& bkgndClass,
+ const TString& fileName,
+ const TString& treeName,
+ Bool_t reuseEventsWithinEnsemble,
+ Bool_t reuseEventsWithinExperiment = kFALSE );
+
+ //! Set the DP amplitude coefficients
+ /*!
+ The name of the coeffSet must match the name of one of the resonances in the DP model.
+
+ The supplied order of coefficients will be rearranged to match the order in which the resonances are stored in the dynamics, see LauIsobarDynamics::addResonance.
+
+ \param [in] coeffSet the set of coefficients
+ */
+ virtual void setAmpCoeffSet( LauAbsCoeffSet* coeffSet );
+
+ //! Calculate the DP amplitude(s) for a given DP position
+ /*!
+ If not already done, this function will initialise the DP models
+
+ \param [in] m13Sq the invariant mass squared of children 1 and 3
+ \param [in] m23Sq the invariant mass squared of children 2 and 3
+ \return a container of complex amplitudes, labelled to indicate to which component they belong
+ */
+ virtual std::map<TString, LauComplex> getDPAmps( const Double_t m13Sq, const Double_t m23Sq );
+
+ //! Calculate the DP likelihood(s) for a given DP position
+ /*!
+ If not already done, this function will initialise the DP models
+
+ \param [in] m13Sq the invariant mass squared of children 1 and 3
+ \param [in] m23Sq the invariant mass squared of children 2 and 3
+ \return a container of likelihood values, labelled to indicate to which component they belong
+ */
+ virtual std::map<TString, Double_t> getDPLikelihoods( const Double_t m13Sq, const Double_t m23Sq );
+
+ protected:
+ //! Define a map to be used to store a category name and numbers
+ typedef std::map<TString, std::pair<Int_t, Double_t>> LauGenInfo;
+
+ //! Typedef for a vector of background DP models
+ typedef std::vector<LauAbsBkgndDPModel*> LauBkgndDPModelList;
+
+ //! Typedef for a vector of background PDFs
+ typedef std::vector<LauPdfPList> LauBkgndPdfsList;
+
+ //! Typedef for a vector of background yields
+ typedef std::vector<LauAbsRValue*> LauBkgndYieldList;
+
+ //! Typedef for a vector of embedded data objects
+ typedef std::vector<LauEmbeddedData*> LauBkgndEmbDataList;
+
+ //! Typedef for a vector of booleans to flag if events are reused
+ typedef std::vector<Bool_t> LauBkgndReuseEventsList;
+
+ //! Weight events based on the DP model
+ /*!
+ \param [in] dataFileName the name of the data file
+ \param [in] dataTreeName the name of the data tree
+ */
+ virtual void weightEvents( const TString& dataFileName, const TString& dataTreeName );
+
+ //! Initialise the fit
+ virtual void initialise();
+
+ //! Initialise the signal DP model
+ virtual void initialiseDPModels();
+
+ //! Recalculate Normalization the signal DP models
+ virtual void recalculateNormalisation();
+
+ //! Update the coefficients
+ virtual void updateCoeffs();
+
+ //! Toy MC generation and fitting overloaded functions
+ virtual Bool_t genExpt();
+
+ //! Calculate things that depend on the fit parameters after they have been updated by Minuit
+ virtual void propagateParUpdates();
+
+ //! Read in the input fit data variables, e.g. m13Sq and m23Sq
+ virtual void cacheInputFitVars();
+
+ //! Check the initial fit parameters
+ virtual void checkInitFitParams();
+
+ //! Get the fit results and store them
+ /*!
+ \param [in] tablePrefixName prefix for the name of the output file
+ */
+ virtual void finaliseFitResults( const TString& tablePrefixName );
+
+ //! Print the fit fractions, total DP rate and mean efficiency
+ /*!
+ \param [out] output the stream to which to print
+ */
+ virtual void printFitFractions( std::ostream& output );
+
+ //! Write the fit results in latex table format
+ /*!
+ \param [in] outputFile the name of the output file
+ */
+ virtual void writeOutTable( const TString& outputFile );
+
+ //! Save the pdf Plots for all the resonances of experiment number fitExp
+ /*!
+ \param [in] label prefix for the file name to be saved
+ */
+ virtual void savePDFPlots( const TString& label );
+
+ //! Save the pdf Plots for the sum of ressonances correspondint to "sin" of experiment number fitExp
+ /*!
+ \param [in] label prefix for the file name to be saved
+ \param [in] spin spin of the wave to be saved
+ */
+ virtual void savePDFPlotsWave( const TString& label, const Int_t& spin );
+
+ //! Store the per event likelihood values
+ virtual void storePerEvtLlhds();
+
+ // Methods to do with calculating the likelihood functions
+ // and manipulating the fitting parameters.
+
+ //! Get the total likelihood for each event
+ /*!
+ \param [in] iEvt the event number
+ */
+ virtual Double_t getTotEvtLikelihood( UInt_t iEvt );
+
+ //! Calculate the signal and background likelihoods for the DP for a given event
+ /*!
+ \param [in] iEvt the event number
+ */
+ virtual void getEvtDPLikelihood( UInt_t iEvt );
+
+ //! Calculate the SCF likelihood for the DP for a given event
+ /*!
+ \param [in] iEvt the event number
+ */
+ virtual Double_t getEvtSCFDPLikelihood( UInt_t iEvt );
+
+ //! Determine the signal and background likelihood for the extra variables for a given event
+ /*!
+ \param [in] iEvt the event number
+ */
+ virtual void getEvtExtraLikelihoods( UInt_t iEvt );
+
+ //! Get the total number of events
+ /*!
+ \return the total number of events
+ */
+ virtual Double_t getEventSum() const;
+
+ //! Set the fit parameters for the DP model
+ void setSignalDPParameters();
+
+ //! Set the fit parameters for the extra PDFs
+ void setExtraPdfParameters();
+
+ //! Set the initial yields
+ void setFitNEvents();
+
+ //! Set-up other parameters that are derived from the fit results, e.g. fit fractions
+ void setExtraNtupleVars();
+
+ //! Randomise the initial fit parameters
+ void randomiseInitFitPars();
+
+ //! Define the length of the background vectors
+ virtual void setupBkgndVectors();
+
+ //! Determine the number of events to generate for each hypothesis
+ std::pair<LauGenInfo, Bool_t> eventsToGenerate();
+
+ //! Generate signal event
+ Bool_t generateSignalEvent();
+
+ //! Generate background event
+ /*!
+ \param [in] bkgndID ID number of the background class
+ */
+ Bool_t generateBkgndEvent( UInt_t bkgndID );
+
+ //! Setup the required ntuple branches
+ void setupGenNtupleBranches();
+
+ //! Store all of the DP information
+ void setDPBranchValues();
+
+ //! Generate from the extra PDFs
+ /*!
+ \param [in] extraPdfs the list of extra PDFs
+ \param [in] embeddedData the embedded data sample
+ */
+ void generateExtraPdfValues( LauPdfPList* extraPdfs, LauEmbeddedData* embeddedData );
- //! Set the branches for the sPlot ntuple with extra PDFs
- /*!
- \param [in] extraPdfs the list of extra PDFs
- \param [in] prefix the list of prefixes for the branch names
- \param [in] iEvt the event number
- */
- Double_t setSPlotNtupleBranchValues(LauPdfPList* extraPdfs, const TString& prefix, UInt_t iEvt);
+ //! Add sPlot branches for the extra PDFs
+ /*!
+ \param [in] extraPdfs the list of extra PDFs
+ \param [in] prefix the list of prefixes for the branch names
+ */
+ void addSPlotNtupleBranches( const LauPdfPList* extraPdfs, const TString& prefix );
- //! Update the signal events after Minuit sets background parameters
- void updateSigEvents();
+ //! Set the branches for the sPlot ntuple with extra PDFs
+ /*!
+ \param [in] extraPdfs the list of extra PDFs
+ \param [in] prefix the list of prefixes for the branch names
+ \param [in] iEvt the event number
+ */
+ Double_t setSPlotNtupleBranchValues( LauPdfPList* extraPdfs, const TString& prefix, UInt_t iEvt );
- //! Add branches to store experiment number and the event number within the experiment
- virtual void setupSPlotNtupleBranches();
+ //! Update the signal events after Minuit sets background parameters
+ void updateSigEvents();
- //! Returns the names of all variables in the fit
- virtual LauSPlot::NameSet variableNames() const;
+ //! Add branches to store experiment number and the event number within the experiment
+ virtual void setupSPlotNtupleBranches();
- //! Returns the names and yields of species that are free in the fit
- virtual LauSPlot::NumbMap freeSpeciesNames() const;
+ //! Returns the names of all variables in the fit
+ virtual LauSPlot::NameSet variableNames() const;
- //! Returns the names and yields of species that are fixed in the fit
- virtual LauSPlot::NumbMap fixdSpeciesNames() const;
+ //! Returns the names and yields of species that are free in the fit
+ virtual LauSPlot::NumbMap freeSpeciesNames() const;
- //! Returns the species and variables for all 2D PDFs in the fit
- virtual LauSPlot::TwoDMap twodimPDFs() const;
+ //! Returns the names and yields of species that are fixed in the fit
+ virtual LauSPlot::NumbMap fixdSpeciesNames() const;
- //! Check if the signal is split into well-reconstructed and mis-reconstructed types
- virtual Bool_t splitSignal() const {return this->useSCF();}
+ //! Returns the species and variables for all 2D PDFs in the fit
+ virtual LauSPlot::TwoDMap twodimPDFs() const;
- //! Check if the mis-reconstructed signal is to be smeared in the DP
- virtual Bool_t scfDPSmear() const {return (scfMap_ != 0);}
+ //! Check if the signal is split into well-reconstructed and mis-reconstructed types
+ virtual Bool_t splitSignal() const { return this->useSCF(); }
- //! Append fake data points to the inputData for each bin in the SCF smearing matrix
- /*!
- We'll be caching the DP amplitudes and efficiencies of the centres of the true bins.
- To do so, we attach some fake points at the end of inputData, the number of the entry
- minus the total number of events corresponding to the number of the histogram for that
- given true bin in the LauScfMap object. (What this means is that when Laura is provided with
- the LauScfMap object by the user, it's the latter who has to make sure that it contains the
- right number of histograms and in exactly the right order!)
+ //! Check if the mis-reconstructed signal is to be smeared in the DP
+ virtual Bool_t scfDPSmear() const { return ( scfMap_ != 0 ); }
- \param [in] inputData the fit data
- */
- void appendBinCentres( LauFitDataTree* inputData );
+ //! Append fake data points to the inputData for each bin in the SCF smearing matrix
+ /*!
+ We'll be caching the DP amplitudes and efficiencies of the centres of the true bins.
+ To do so, we attach some fake points at the end of inputData, the number of the entry
+ minus the total number of events corresponding to the number of the histogram for that
+ given true bin in the LauScfMap object. (What this means is that when Laura is provided with
+ the LauScfMap object by the user, it's the latter who has to make sure that it contains the
+ right number of histograms and in exactly the right order!)
- private:
- //! Copy constructor (not implemented)
- LauSimpleFitModel(const LauSimpleFitModel& rhs);
+ \param [in] inputData the fit data
+ */
+ void appendBinCentres( LauFitDataTree* inputData );
- //! Copy assignment operator (not implemented)
- LauSimpleFitModel& operator=(const LauSimpleFitModel& rhs);
+ private:
+ //! Copy constructor (not implemented)
+ LauSimpleFitModel( const LauSimpleFitModel& rhs );
- //! The signal Dalitz plot model
- LauIsobarDynamics* sigDPModel_;
+ //! Copy assignment operator (not implemented)
+ LauSimpleFitModel& operator=( const LauSimpleFitModel& rhs );
- //! The background Dalitz Plot model
- LauBkgndDPModelList bkgndDPModels_;
+ //! The signal Dalitz plot model
+ LauIsobarDynamics* sigDPModel_;
- //! The Dalitz plot kinematics object
- LauKinematics *kinematics_;
+ //! The background Dalitz Plot model
+ LauBkgndDPModelList bkgndDPModels_;
- //! The signal PDFs
- LauPdfPList signalPdfs_;
+ //! The Dalitz plot kinematics object
+ LauKinematics* kinematics_;
- //! The SCF PDFs
- LauPdfPList scfPdfs_;
+ //! The signal PDFs
+ LauPdfPList signalPdfs_;
- //! The background PDFs
- LauBkgndPdfsList bkgndPdfs_;
+ //! The SCF PDFs
+ LauPdfPList scfPdfs_;
- //! Background boolean
- Bool_t usingBkgnd_;
+ //! The background PDFs
+ LauBkgndPdfsList bkgndPdfs_;
- //! Number of signal components
- UInt_t nSigComp_;
+ //! Background boolean
+ Bool_t usingBkgnd_;
- //! Number of signal DP parameters
- UInt_t nSigDPPar_;
+ //! Number of signal components
+ UInt_t nSigComp_;
- //! Number of extra PDF parameters
- UInt_t nExtraPdfPar_;
+ //! Number of signal DP parameters
+ UInt_t nSigDPPar_;
- //! Number of normalisation parameters (i.e. yields)
- UInt_t nNormPar_;
+ //! Number of extra PDF parameters
+ UInt_t nExtraPdfPar_;
- //! Magnitudes and Phases
- std::vector<LauAbsCoeffSet*> coeffPars_;
+ //! Number of normalisation parameters (i.e. yields)
+ UInt_t nNormPar_;
- //! Fit fractions
- LauParArray fitFrac_;
+ //! Magnitudes and Phases
+ std::vector<LauAbsCoeffSet*> coeffPars_;
- //! Fit fractions (uncorrected for the efficiency)
- LauParArray fitFracEffUnCorr_;
+ //! Fit fractions
+ LauParArray fitFrac_;
- //! The mean efficiency
- LauParameter meanEff_;
+ //! Fit fractions (uncorrected for the efficiency)
+ LauParArray fitFracEffUnCorr_;
- //! The average DP rate
- LauParameter dpRate_;
+ //! The mean efficiency
+ LauParameter meanEff_;
- //! Signal yield
- LauParameter* signalEvents_;
+ //! The average DP rate
+ LauParameter dpRate_;
- //! Background yield(s)
- LauBkgndYieldList bkgndEvents_;
+ //! Signal yield
+ LauParameter* signalEvents_;
- //! Is the signal split into TM and SCF
- Bool_t useSCF_;
+ //! Background yield(s)
+ LauBkgndYieldList bkgndEvents_;
- //! Is the SCF fraction DP-dependent
- Bool_t useSCFHist_;
+ //! Is the signal split into TM and SCF
+ Bool_t useSCF_;
- //! The (global) SCF fraction parameter
- LauParameter scfFrac_;
+ //! Is the SCF fraction DP-dependent
+ Bool_t useSCFHist_;
- //! The histogram giving the DP-dependence of the SCF fraction
- LauEffModel* scfFracHist_;
+ //! The (global) SCF fraction parameter
+ LauParameter scfFrac_;
- //! The smearing matrix for the SCF DP PDF
- LauScfMap* scfMap_;
+ //! The histogram giving the DP-dependence of the SCF fraction
+ LauEffModel* scfFracHist_;
- //! The cached values of the SCF fraction for each event
- std::vector<Double_t> recoSCFFracs_;
+ //! The smearing matrix for the SCF DP PDF
+ LauScfMap* scfMap_;
- //! The cached values of the SCF fraction for each bin centre
- std::vector<Double_t> fakeSCFFracs_;
+ //! The cached values of the SCF fraction for each event
+ std::vector<Double_t> recoSCFFracs_;
- //! The cached values of the sqDP jacobians for each event
- std::vector<Double_t> recoJacobians_;
+ //! The cached values of the SCF fraction for each bin centre
+ std::vector<Double_t> fakeSCFFracs_;
- //! The cached values of the sqDP jacobians for each true bin
- std::vector<Double_t> fakeJacobians_;
+ //! The cached values of the sqDP jacobians for each event
+ std::vector<Double_t> recoJacobians_;
- //! Run choice variables
- Bool_t compareFitData_;
+ //! The cached values of the sqDP jacobians for each true bin
+ std::vector<Double_t> fakeJacobians_;
- //! The complex coefficients
- std::vector<LauComplex> coeffs_;
+ //! Run choice variables
+ Bool_t compareFitData_;
- // Embedding full simulation events
+ //! The complex coefficients
+ std::vector<LauComplex> coeffs_;
- //! The signal event tree
- LauEmbeddedData* signalTree_;
+ // Embedding full simulation events
- //! The background event tree
- LauBkgndEmbDataList bkgndTree_;
+ //! The signal event tree
+ LauEmbeddedData* signalTree_;
- //! Boolean to reuse signal events
- Bool_t reuseSignal_;
+ //! The background event tree
+ LauBkgndEmbDataList bkgndTree_;
- //! Boolean to use reweighting
- Bool_t useReweighting_;
+ //! Boolean to reuse signal events
+ Bool_t reuseSignal_;
- //! Vector of booleans to reuse background events
- LauBkgndReuseEventsList reuseBkgnd_;
+ //! Boolean to use reweighting
+ Bool_t useReweighting_;
- //! Signal likelihood value
- Double_t sigDPLike_;
+ //! Vector of booleans to reuse background events
+ LauBkgndReuseEventsList reuseBkgnd_;
- //! SCF likelihood value
- Double_t scfDPLike_;
+ //! Signal likelihood value
+ Double_t sigDPLike_;
- //! Background likelihood value(s)
- std::vector<Double_t> bkgndDPLike_;
+ //! SCF likelihood value
+ Double_t scfDPLike_;
- //! Signal likelihood from extra PDFs
- Double_t sigExtraLike_;
+ //! Background likelihood value(s)
+ std::vector<Double_t> bkgndDPLike_;
- //! SCF likelihood from extra PDFs
- Double_t scfExtraLike_;
+ //! Signal likelihood from extra PDFs
+ Double_t sigExtraLike_;
- //! Background likelihood value(s) from extra PDFs
- std::vector<Double_t> bkgndExtraLike_;
+ //! SCF likelihood from extra PDFs
+ Double_t scfExtraLike_;
- //! Total signal likelihood
- Double_t sigTotalLike_;
+ //! Background likelihood value(s) from extra PDFs
+ std::vector<Double_t> bkgndExtraLike_;
- //! Total SCF likelihood
- Double_t scfTotalLike_;
+ //! Total signal likelihood
+ Double_t sigTotalLike_;
- //! Total background likelihood(s)
- std::vector<Double_t> bkgndTotalLike_;
+ //! Total SCF likelihood
+ Double_t scfTotalLike_;
- ClassDef(LauSimpleFitModel,0) // Total fit/ToyMC model
+ //! Total background likelihood(s)
+ std::vector<Double_t> bkgndTotalLike_;
+ ClassDef( LauSimpleFitModel, 0 ) // Total fit/ToyMC model
};
#endif
diff --git a/inc/LauString.hh b/inc/LauString.hh
index 2312437..c14fb12 100644
--- a/inc/LauString.hh
+++ b/inc/LauString.hh
@@ -1,181 +1,179 @@
/*
Copyright 2008 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauString.hh
\brief File containing declaration of LauString class.
*/
/*! \class LauString
\brief Class for defining a string.
*/
#ifndef LAU_STRING_HH
#define LAU_STRING_HH
+#include "TString.h"
+
#include <iostream>
-#include <string>
#include <sstream>
+#include <string>
#include <vector>
-#include "TString.h"
-
class LauString {
- public:
-
- //! Constructor for an empty string
- LauString();
-
- //! Constructor for a string using an array of characters
- /*!
- \param [in] s string text
- */
- LauString(const char* s);
-
- //! Constructor for a string using an STL string
- /*!
- \param [in] s string text
- */
- LauString(const std::string& s);
-
- //! Constructor for a string using a TString
- /*!
- \param [in] s string text
- */
- LauString(const TString& s);
-
- //! Copy constructor
- LauString(const LauString& s);
-
- //! Copy assignment operator
- LauString& operator=(const LauString& s);
-
- //! Destructor
- virtual ~LauString();
-
- //! Add an integer value to the string
- /*!
- \param [in] integer integer to add
- */
- void addInteger(int integer);
-
- //! Add a double value to the string
- /*!
- \param [in] value double to add
- */
- void addDouble(double value);
-
- //! Add some text from a character array
- /*!
- \param [in] text text to add
- */
- void addText(const char* text) {theString_ += text;}
-
- //! Add some text from an STL string
- /*!
- \param [in] text text to add
- */
- void addText(const std::string& text) {theString_ += text;}
-
- //! Add some text from a TString
- /*!
- \param [in] text text to add
- */
- void addText(const TString& text) {theString_ += text.Data();}
-
- //! Add an integer to the string
- /*!
- \param [in] integer integer to add
- */
- LauString operator += (int integer);
-
- //! Add a double to the string
- /*!
- \param [in] value double to add
- */
- LauString operator += (double value);
-
- //! Add some text from a character array
- /*!
- \param [in] text text to add
- */
- LauString operator += (const char* text);
-
- //! Add some text from an STL string
- /*!
- \param [in] text text to add
- */
- LauString operator += (const std::string& text);
-
- //! Add some text from a TString
- /*!
- \param [in] text text to add
- */
- LauString operator += (const TString& text);
-
- //! Retrieve the string as an STL string
- /*!
- \return the string as an STL string
- */
- std::string getString() const {return theString_;}
-
- //! Retrieve the string as an array of characters
- /*!
- \return the string as an array of characters
- */
- const char* getData() const {return theString_.c_str();}
-
- //! Retrieve the string as a TString
- /*!
- \return the string as a TString
- */
- TString getTString() const {return TString(theString_.c_str());}
-
- //! Retrieve the total size of the string
- /*!
- \return the total size of the string
- */
- int size() const {return theString_.size();}
-
- //! Split up a string according to a split string (e.g. ":" or " ")
- /*!
- \param [in] splitter substring to split on
- */
- std::vector<std::string> split(const std::string& splitter) const;
-
- //! Split up a string according to a split string (e.g. ":" or " ")
- /*!
- \param [in] splitter substring to split on
- */
- std::vector<std::string> split(const LauString& splitter) const;
-
- protected:
-
- private:
- //! The string
- std::string theString_;
-
+ public:
+ //! Constructor for an empty string
+ LauString();
+
+ //! Constructor for a string using an array of characters
+ /*!
+ \param [in] s string text
+ */
+ LauString( const char* s );
+
+ //! Constructor for a string using an STL string
+ /*!
+ \param [in] s string text
+ */
+ LauString( const std::string& s );
+
+ //! Constructor for a string using a TString
+ /*!
+ \param [in] s string text
+ */
+ LauString( const TString& s );
+
+ //! Copy constructor
+ LauString( const LauString& s );
+
+ //! Copy assignment operator
+ LauString& operator=( const LauString& s );
+
+ //! Destructor
+ virtual ~LauString();
+
+ //! Add an integer value to the string
+ /*!
+ \param [in] integer integer to add
+ */
+ void addInteger( int integer );
+
+ //! Add a double value to the string
+ /*!
+ \param [in] value double to add
+ */
+ void addDouble( double value );
+
+ //! Add some text from a character array
+ /*!
+ \param [in] text text to add
+ */
+ void addText( const char* text ) { theString_ += text; }
+
+ //! Add some text from an STL string
+ /*!
+ \param [in] text text to add
+ */
+ void addText( const std::string& text ) { theString_ += text; }
+
+ //! Add some text from a TString
+ /*!
+ \param [in] text text to add
+ */
+ void addText( const TString& text ) { theString_ += text.Data(); }
+
+ //! Add an integer to the string
+ /*!
+ \param [in] integer integer to add
+ */
+ LauString operator+=( int integer );
+
+ //! Add a double to the string
+ /*!
+ \param [in] value double to add
+ */
+ LauString operator+=( double value );
+
+ //! Add some text from a character array
+ /*!
+ \param [in] text text to add
+ */
+ LauString operator+=( const char* text );
+
+ //! Add some text from an STL string
+ /*!
+ \param [in] text text to add
+ */
+ LauString operator+=( const std::string& text );
+
+ //! Add some text from a TString
+ /*!
+ \param [in] text text to add
+ */
+ LauString operator+=( const TString& text );
+
+ //! Retrieve the string as an STL string
+ /*!
+ \return the string as an STL string
+ */
+ std::string getString() const { return theString_; }
+
+ //! Retrieve the string as an array of characters
+ /*!
+ \return the string as an array of characters
+ */
+ const char* getData() const { return theString_.c_str(); }
+
+ //! Retrieve the string as a TString
+ /*!
+ \return the string as a TString
+ */
+ TString getTString() const { return TString( theString_.c_str() ); }
+
+ //! Retrieve the total size of the string
+ /*!
+ \return the total size of the string
+ */
+ int size() const { return theString_.size(); }
+
+ //! Split up a string according to a split string (e.g. ":" or " ")
+ /*!
+ \param [in] splitter substring to split on
+ */
+ std::vector<std::string> split( const std::string& splitter ) const;
+
+ //! Split up a string according to a split string (e.g. ":" or " ")
+ /*!
+ \param [in] splitter substring to split on
+ */
+ std::vector<std::string> split( const LauString& splitter ) const;
+
+ protected:
+
+ private:
+ //! The string
+ std::string theString_;
};
#endif
diff --git a/inc/LauSumPdf.hh b/inc/LauSumPdf.hh
index 4231669..0c95c4e 100644
--- a/inc/LauSumPdf.hh
+++ b/inc/LauSumPdf.hh
@@ -1,120 +1,122 @@
/*
Copyright 2006 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauSumPdf.hh
\brief File containing declaration of LauSumPdf class.
*/
/*! \class LauSumPdf
\brief Class for defining a PDF that is the sum of two other PDFs.
- Class that allows the user to define PDF that is the sum of two other PDFs.
+ Class that allows the user to define PDF that is the sum of two other PDFs.
The relative fraction of the two PDFs is user-defined and can be a free parameter.
*/
#ifndef LAU_SUM_PDF
#define LAU_SUM_PDF
-#include "Rtypes.h"
-
#include "LauAbsPdf.hh"
-class LauParameter;
+#include "Rtypes.h"
+class LauParameter;
class LauSumPdf : public LauAbsPdf {
- public:
- //! Constructor
- /*!
- \param [in] pdf1 the first PDF
- \param [in] pdf2 the second PDF
- \param [in] frac1 the fractional contribution of the first PDF to the final PDF
- */
- LauSumPdf(LauAbsPdf* pdf1, LauAbsPdf* pdf2, LauParameter* frac1);
-
- //! Destructor
- virtual ~LauSumPdf();
-
- //! Returns the number of input variables
- /*!
- \return the number of input variables
- */
- UInt_t nInputVars() const {return pdf1_->nInputVars();}
-
- //! Boolean for the DP dependence of PDFs in the sum
- /*!
- \return DP dependence of PDF
- */
- virtual Bool_t isDPDependent() const {return (pdf1_->isDPDependent() || pdf2_->isDPDependent());}
-
- //! Cache information from data
- /*!
- \param [in] inputData the input data
- */
- virtual void cacheInfo(const LauFitDataTree& inputData);
-
- //! Calculate the likelihood (and intermediate info) for a given abscissa
- /*!
- \param [in] abscissas the values of the abscissa(s)
- */
- virtual void calcLikelihoodInfo(const LauAbscissas& abscissas);
-
- //! Calculate the likelihood (and intermediate info) for a given event number
- /*!
- \param [in] iEvt event number
- */
- virtual void calcLikelihoodInfo(UInt_t iEvt);
-
- //! Calculate the normalisation
- virtual void calcNorm();
-
- //! Calculate the PDF height
- /*!
- \param [in] kinematics the current DP kinematics
- */
- virtual void calcPDFHeight( const LauKinematics* kinematics );
-
- protected:
-
- private:
- //! Copy constructor (not implemented)
- LauSumPdf(const LauSumPdf& rhs);
-
- //! Copy assignment operator (not implemented)
- LauSumPdf& operator=(const LauSumPdf& rhs);
-
- //! First PDF
- LauAbsPdf* pdf1_;
-
- //! Second PDF
- LauAbsPdf* pdf2_;
-
- //! Fractional contribution of first PDF to the final PDF
- LauAbsRValue* frac_;
-
- ClassDef(LauSumPdf,0) // Define the sum PDF
+ public:
+ //! Constructor
+ /*!
+ \param [in] pdf1 the first PDF
+ \param [in] pdf2 the second PDF
+ \param [in] frac1 the fractional contribution of the first PDF to the final PDF
+ */
+ LauSumPdf( LauAbsPdf* pdf1, LauAbsPdf* pdf2, LauParameter* frac1 );
+
+ //! Destructor
+ virtual ~LauSumPdf();
+
+ //! Returns the number of input variables
+ /*!
+ \return the number of input variables
+ */
+ UInt_t nInputVars() const { return pdf1_->nInputVars(); }
+
+ //! Boolean for the DP dependence of PDFs in the sum
+ /*!
+ \return DP dependence of PDF
+ */
+ virtual Bool_t isDPDependent() const
+ {
+ return ( pdf1_->isDPDependent() || pdf2_->isDPDependent() );
+ }
+
+ //! Cache information from data
+ /*!
+ \param [in] inputData the input data
+ */
+ virtual void cacheInfo( const LauFitDataTree& inputData );
+
+ //! Calculate the likelihood (and intermediate info) for a given abscissa
+ /*!
+ \param [in] abscissas the values of the abscissa(s)
+ */
+ virtual void calcLikelihoodInfo( const LauAbscissas& abscissas );
+
+ //! Calculate the likelihood (and intermediate info) for a given event number
+ /*!
+ \param [in] iEvt event number
+ */
+ virtual void calcLikelihoodInfo( UInt_t iEvt );
+
+ //! Calculate the normalisation
+ virtual void calcNorm();
+
+ //! Calculate the PDF height
+ /*!
+ \param [in] kinematics the current DP kinematics
+ */
+ virtual void calcPDFHeight( const LauKinematics* kinematics );
+
+ protected:
+
+ private:
+ //! Copy constructor (not implemented)
+ LauSumPdf( const LauSumPdf& rhs );
+
+ //! Copy assignment operator (not implemented)
+ LauSumPdf& operator=( const LauSumPdf& rhs );
+
+ //! First PDF
+ LauAbsPdf* pdf1_;
+
+ //! Second PDF
+ LauAbsPdf* pdf2_;
+
+ //! Fractional contribution of first PDF to the final PDF
+ LauAbsRValue* frac_;
+
+ ClassDef( LauSumPdf, 0 ) // Define the sum PDF
};
#endif
diff --git a/inc/LauTextFileParser.hh b/inc/LauTextFileParser.hh
index 8b4a02d..0855b86 100644
--- a/inc/LauTextFileParser.hh
+++ b/inc/LauTextFileParser.hh
@@ -1,124 +1,123 @@
/*
Copyright 2008 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauTextFileParser.hh
\brief File containing declaration of LauTextFileParser class.
*/
/*! \class LauTextFileParser
\brief Class for parsing text files.
Class for parsing text files. Each line is split on spaces.
*/
#ifndef LAU_TEXT_FILE_PARSER_HH
#define LAU_TEXT_FILE_PARSER_HH
#include "TString.h"
#include <iostream>
-#include <string>
+#include <map>
#include <sstream>
+#include <string>
#include <vector>
-#include <map>
class LauTextFileParser {
- public:
- //! Constructor
- /*!
- \param [in] s filename
- */
- LauTextFileParser(const char* s);
-
- //! Constructor
- /*!
- \param [in] s filename
- */
- LauTextFileParser(const std::string& s);
-
- //! Constructor
- /*!
- \param [in] s filename
- */
- LauTextFileParser(const TString& s);
-
- //! Destructor
- virtual ~LauTextFileParser();
-
- //! Parse the file
- void processFile();
-
- //! Retrieve the specified line
- /*!
- \param [in] lineNo the line number
- \return the specified line
- */
- std::vector<std::string> getLine(UInt_t lineNo);
-
- //! Retrieve the next line
- /*!
- \return the next line
- */
- std::vector<std::string> getNextLine();
-
- //! Set the line number
- /*!
- \param [in] lineNo the new line number
- */
- void resetLineNumber(UInt_t lineNo) {lineNumber_ = lineNo;}
-
- //! Get the total number of lines that are not comments
- /*!
- \return the total number of non-comment lines
- */
- UInt_t getTotalNumLines() const {return totalLines_;}
-
- protected:
-
- private:
- //! Copy constructor (not implemented)
- LauTextFileParser(const LauTextFileParser& rhs);
-
- //! Copy assignment operator (not implemented)
- LauTextFileParser& operator=(const LauTextFileParser& rhs);
-
- //! The type used to contain the parsed text
- typedef std::map<int, std::vector<std::string> > LineMap;
-
- //! The name of the file
- std::string theFile_;
-
- //! The parsed text
- LineMap lineMap_;
-
- //! The total number of lines in the file
- UInt_t totalLines_;
-
- //! The current line number
- UInt_t lineNumber_;
-
+ public:
+ //! Constructor
+ /*!
+ \param [in] s filename
+ */
+ LauTextFileParser( const char* s );
+
+ //! Constructor
+ /*!
+ \param [in] s filename
+ */
+ LauTextFileParser( const std::string& s );
+
+ //! Constructor
+ /*!
+ \param [in] s filename
+ */
+ LauTextFileParser( const TString& s );
+
+ //! Destructor
+ virtual ~LauTextFileParser();
+
+ //! Parse the file
+ void processFile();
+
+ //! Retrieve the specified line
+ /*!
+ \param [in] lineNo the line number
+ \return the specified line
+ */
+ std::vector<std::string> getLine( UInt_t lineNo );
+
+ //! Retrieve the next line
+ /*!
+ \return the next line
+ */
+ std::vector<std::string> getNextLine();
+
+ //! Set the line number
+ /*!
+ \param [in] lineNo the new line number
+ */
+ void resetLineNumber( UInt_t lineNo ) { lineNumber_ = lineNo; }
+
+ //! Get the total number of lines that are not comments
+ /*!
+ \return the total number of non-comment lines
+ */
+ UInt_t getTotalNumLines() const { return totalLines_; }
+
+ protected:
+
+ private:
+ //! Copy constructor (not implemented)
+ LauTextFileParser( const LauTextFileParser& rhs );
+
+ //! Copy assignment operator (not implemented)
+ LauTextFileParser& operator=( const LauTextFileParser& rhs );
+
+ //! The type used to contain the parsed text
+ typedef std::map<int, std::vector<std::string>> LineMap;
+
+ //! The name of the file
+ std::string theFile_;
+
+ //! The parsed text
+ LineMap lineMap_;
+
+ //! The total number of lines in the file
+ UInt_t totalLines_;
+
+ //! The current line number
+ UInt_t lineNumber_;
};
#endif
diff --git a/inc/LauVetoes.hh b/inc/LauVetoes.hh
index 83fe5e0..48cfbc0 100644
--- a/inc/LauVetoes.hh
+++ b/inc/LauVetoes.hh
@@ -1,147 +1,150 @@
/*
Copyright 2004 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauVetoes.hh
\brief File containing declaration of LauVetoes class.
*/
/*! \class LauVetoes
\brief Class for defining vetoes within the Dalitz plot.
Each veto is defined by an index corresponding to one of the three invariant mass-squared variables, and maximum and minimum values for the veto's range in the specified variable.
Each mass-squared variable is numbered according to the index of the daughter not involved in the vetoed mass-squared variable. For example a veto in m12 squared would receive the index 3.
Since v3r2, in the case of a symmetric DP, vetoes in m13 or m23 will automatically be symmetrised to the other variable (so only one needs to be specified).
However, if one wants to veto a region from a symmetric DP in the already-symmetrised co-ordinates, the special indices 4 and 5 can be used that will apply the veto to mMin or mMax, respectively.
*/
#ifndef LAU_VETOES
#define LAU_VETOES
-#include <vector>
-
#include "Rtypes.h"
-class LauKinematics;
+#include <vector>
+class LauKinematics;
class LauVetoes {
- public:
- //! Constructor
- LauVetoes();
-
- //! Destructor
- virtual ~LauVetoes();
-
- //! Copy constructor
- /*!
- \param [in] other the object to be copied
- */
- LauVetoes(const LauVetoes& other);
-
- //! Copy assignment operator
- /*!
- \param [in] other the object to be copied
- \return the assigned vetoes object
- */
- LauVetoes& operator=(const LauVetoes& other);
-
- //! Add a veto to the Dalitz plot
- /*!
- \param [in] resPairAmpInt the index of the mass-squared variable to be vetoed (in the case of symmetric DPs the special indices 4 and 5 can be used to indicate that a veto should be applied to mMin or mMax)
- \param [in] minMass the minimum mass of the veto
- \param [in] maxMass the maximum mass of the veto
- */
- void addMassVeto(const Int_t resPairAmpInt, const Double_t minMass, const Double_t maxMass);
-
- //! Add a veto to the Dalitz plot
- /*!
- \param [in] resPairAmpInt the index of the mass-squared variable to be vetoed (in the case of symmetric DPs the special indices 4 and 5 can be used to indicate that a veto should be applied to mMinSq or mMaxSq)
- \param [in] minMassSq the minimum mass-squared of the veto
- \param [in] maxMassSq the maximum mass-squared of the veto
- */
- void addMassSqVeto(const Int_t resPairAmpInt, const Double_t minMassSq, const Double_t maxMassSq);
-
- //! Check whether the specified Dalitz plot point passes the vetoes
- /*!
- \param [in] kinematics a point in the Dalitz plot
- \return true if the specified Dalitz plot point is outside all veto regions, false otherwise
- */
- Bool_t passVeto(const LauKinematics* kinematics) const;
-
- protected:
- //! Check whether the specified Dalitz plot point passes the vetoes
- /*!
- \param [in] m12Sq the mass-squared of the first and second daughters
- \param [in] m23Sq the mass-squared of the second and third daughters
- \param [in] m13Sq the mass-squared of the first and third daughters
- \param [in] symmetricDP is the DP symmetric
- \param [in] fullySymmetricDP is the DP fully symmetric
- \return true if the specified Dalitz plot point is outside all veto regions, false otherwise
- */
- Bool_t passVeto(const Double_t m12Sq, const Double_t m23Sq, const Double_t m13Sq, const Bool_t symmetricDP, const Bool_t fullySymmetricDP) const;
-
- //! Retrieve the number of vetoes
- /*!
- \return the number of vetoes
- */
- UInt_t getNVetoes() const {return nVetoes_;}
-
- //! Retrieve the index of the vetoed mass-squared variable for each veto
- /*!
- \return the index of the vetoed mass-squared variable for each veto
- */
- const std::vector<Int_t>& getVetoPairs() const {return vetoPair_;}
-
- //! Retrieve the minimum mass-squared for each veto
- /*!
- \return the minimum mass-squared for each veto
- */
- const std::vector<Double_t>& getVetoMinMass() const {return vetoMinMass_;}
-
- //! Retrieve the maximum mass-squared for each veto
- /*!
- \return the maximum mass-squared for each veto
- */
- const std::vector<Double_t>& getVetoMaxMass() const {return vetoMaxMass_;}
-
- private:
- //! The number of vetoes
- UInt_t nVetoes_;
-
- //! The index of the vetoed mass-squared variable for each veto
- std::vector<Int_t> vetoPair_;
-
- //! The minimum mass-squared for each veto
- std::vector<Double_t> vetoMinMass_;
-
- //! The maximum mass-squared for each veto
- std::vector<Double_t> vetoMaxMass_;
-
- ClassDef(LauVetoes,0) // Vetoes in the Dalitz plot
+ public:
+ //! Constructor
+ LauVetoes();
+
+ //! Destructor
+ virtual ~LauVetoes();
+
+ //! Copy constructor
+ /*!
+ \param [in] other the object to be copied
+ */
+ LauVetoes( const LauVetoes& other );
+
+ //! Copy assignment operator
+ /*!
+ \param [in] other the object to be copied
+ \return the assigned vetoes object
+ */
+ LauVetoes& operator=( const LauVetoes& other );
+
+ //! Add a veto to the Dalitz plot
+ /*!
+ \param [in] resPairAmpInt the index of the mass-squared variable to be vetoed (in the case of symmetric DPs the special indices 4 and 5 can be used to indicate that a veto should be applied to mMin or mMax)
+ \param [in] minMass the minimum mass of the veto
+ \param [in] maxMass the maximum mass of the veto
+ */
+ void addMassVeto( const Int_t resPairAmpInt, const Double_t minMass, const Double_t maxMass );
+
+ //! Add a veto to the Dalitz plot
+ /*!
+ \param [in] resPairAmpInt the index of the mass-squared variable to be vetoed (in the case of symmetric DPs the special indices 4 and 5 can be used to indicate that a veto should be applied to mMinSq or mMaxSq)
+ \param [in] minMassSq the minimum mass-squared of the veto
+ \param [in] maxMassSq the maximum mass-squared of the veto
+ */
+ void addMassSqVeto( const Int_t resPairAmpInt, const Double_t minMassSq, const Double_t maxMassSq );
+
+ //! Check whether the specified Dalitz plot point passes the vetoes
+ /*!
+ \param [in] kinematics a point in the Dalitz plot
+ \return true if the specified Dalitz plot point is outside all veto regions, false otherwise
+ */
+ Bool_t passVeto( const LauKinematics* kinematics ) const;
+
+ protected:
+ //! Check whether the specified Dalitz plot point passes the vetoes
+ /*!
+ \param [in] m12Sq the mass-squared of the first and second daughters
+ \param [in] m23Sq the mass-squared of the second and third daughters
+ \param [in] m13Sq the mass-squared of the first and third daughters
+ \param [in] symmetricDP is the DP symmetric
+ \param [in] fullySymmetricDP is the DP fully symmetric
+ \return true if the specified Dalitz plot point is outside all veto regions, false otherwise
+ */
+ Bool_t passVeto( const Double_t m12Sq,
+ const Double_t m23Sq,
+ const Double_t m13Sq,
+ const Bool_t symmetricDP,
+ const Bool_t fullySymmetricDP ) const;
+
+ //! Retrieve the number of vetoes
+ /*!
+ \return the number of vetoes
+ */
+ UInt_t getNVetoes() const { return nVetoes_; }
+
+ //! Retrieve the index of the vetoed mass-squared variable for each veto
+ /*!
+ \return the index of the vetoed mass-squared variable for each veto
+ */
+ const std::vector<Int_t>& getVetoPairs() const { return vetoPair_; }
+
+ //! Retrieve the minimum mass-squared for each veto
+ /*!
+ \return the minimum mass-squared for each veto
+ */
+ const std::vector<Double_t>& getVetoMinMass() const { return vetoMinMass_; }
+
+ //! Retrieve the maximum mass-squared for each veto
+ /*!
+ \return the maximum mass-squared for each veto
+ */
+ const std::vector<Double_t>& getVetoMaxMass() const { return vetoMaxMass_; }
+
+ private:
+ //! The number of vetoes
+ UInt_t nVetoes_;
+
+ //! The index of the vetoed mass-squared variable for each veto
+ std::vector<Int_t> vetoPair_;
+
+ //! The minimum mass-squared for each veto
+ std::vector<Double_t> vetoMinMass_;
+
+ //! The maximum mass-squared for each veto
+ std::vector<Double_t> vetoMaxMass_;
+
+ ClassDef( LauVetoes, 0 ) // Vetoes in the Dalitz plot
};
#endif
diff --git a/inc/LauWeightedSumEffModel.hh b/inc/LauWeightedSumEffModel.hh
index 485246e..4c7263e 100644
--- a/inc/LauWeightedSumEffModel.hh
+++ b/inc/LauWeightedSumEffModel.hh
@@ -1,123 +1,121 @@
/*
Copyright 2014 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauWeightedSumEffModel.hh
\brief File containing declaration of LauWeightedSumEffModel class.
*/
/*! \class LauWeightedSumEffModel
\brief Class that implements the efficiency description across the signal Dalitz plot.
Class that defines the efficiency model variation across the signal Dalitz plot.
- The phase space acceptance is determined from a weighted sum of LauAbsEffModel objects.
+ The phase space acceptance is determined from a weighted sum of LauAbsEffModel objects.
This is useful for samples that contain two different categories of signal with different efficiencies.
- The efficiency variation is defined in terms of x = m_13^2, y = m_23^2 for the Dalitz plot (default)
+ The efficiency variation is defined in terms of x = m_13^2, y = m_23^2 for the Dalitz plot (default)
or x = m', y = theta' for the square Dalitz plot
*/
#ifndef LAUWEIGHTEDSUMEFFMODEL
#define LAUWEIGHTEDSUMEFFMODEL
#include "LauAbsEffModel.hh"
class LauDaughters;
class LauKinematics;
-
class LauWeightedSumEffModel : public LauAbsEffModel {
- public:
- //! Constructor
- /*!
- \param [in] daughters the daughters particles of the Dalitz plot model
- */
- LauWeightedSumEffModel(const LauDaughters* daughters);
-
- //! Destructor
- virtual ~LauWeightedSumEffModel() {}
+ public:
+ //! Constructor
+ /*!
+ \param [in] daughters the daughters particles of the Dalitz plot model
+ */
+ LauWeightedSumEffModel( const LauDaughters* daughters );
- //! Add an efficiency variation across the phase space using a predetermined LauAbsEffModel object.
- /*!
- The efficiency is defined in terms of x = m_13^2, y = m_23^2 or x = m', y = theta' for the square Dalitz plot
+ //! Destructor
+ virtual ~LauWeightedSumEffModel() {}
- \param [in] effModel the LauAbsEffModel object that describes the efficiency variation
- \param [in] coeff the coefficient to multiply this efficiency by
- */
- void addEffModel(const LauAbsEffModel* effModel, Double_t coeff);
+ //! Add an efficiency variation across the phase space using a predetermined LauAbsEffModel object.
+ /*!
+ The efficiency is defined in terms of x = m_13^2, y = m_23^2 or x = m', y = theta' for the square Dalitz plot
- //! Determine the efficiency for a given point in the Dalitz plot.
- /*!
- The method uses the models set by the addEffModel() function and the vetoes information.
+ \param [in] effModel the LauAbsEffModel object that describes the efficiency variation
+ \param [in] coeff the coefficient to multiply this efficiency by
+ */
+ void addEffModel( const LauAbsEffModel* effModel, Double_t coeff );
- \param [in] kinematics the object that defines the DP position
- \return the efficiency value at the given point in the DP
- */
- Double_t calcEfficiency( const LauKinematics* kinematics ) const;
+ //! Determine the efficiency for a given point in the Dalitz plot.
+ /*!
+ The method uses the models set by the addEffModel() function and the vetoes information.
- //! Determine whether the given DP position is outside the vetoes
- /*!
- \param [in] kinematics the object that defines the DP position
- \return kTRUE if the DP position is outside all veto regions, kFALSE otherwise
- */
- Bool_t passVeto( const LauKinematics* kinematics ) const;
+ \param [in] kinematics the object that defines the DP position
+ \return the efficiency value at the given point in the DP
+ */
+ Double_t calcEfficiency( const LauKinematics* kinematics ) const;
- //! Determine whether the efficiency histogram has had its bins fluctuated within their errors
- Bool_t fluctuateEffHisto() const {return fluctuateEffHisto_;}
+ //! Determine whether the given DP position is outside the vetoes
+ /*!
+ \param [in] kinematics the object that defines the DP position
+ \return kTRUE if the DP position is outside all veto regions, kFALSE otherwise
+ */
+ Bool_t passVeto( const LauKinematics* kinematics ) const;
- //! Return the daughters object
- /*
- \return the LauDaughters object associated with the DP
- */
- const LauDaughters* getDaughters() const {return daughters_;}
+ //! Determine whether the efficiency histogram has had its bins fluctuated within their errors
+ Bool_t fluctuateEffHisto() const { return fluctuateEffHisto_; }
- private:
- //! Copy constructor - not implemented
- LauWeightedSumEffModel( const LauWeightedSumEffModel& rhs );
+ //! Return the daughters object
+ /*
+ \return the LauDaughters object associated with the DP
+ */
+ const LauDaughters* getDaughters() const { return daughters_; }
- //! Copy assignment operator - not implemented
- LauWeightedSumEffModel& operator=( const LauWeightedSumEffModel& rhs );
+ private:
+ //! Copy constructor - not implemented
+ LauWeightedSumEffModel( const LauWeightedSumEffModel& rhs );
- //! The daughters object
- const LauDaughters* daughters_;
+ //! Copy assignment operator - not implemented
+ LauWeightedSumEffModel& operator=( const LauWeightedSumEffModel& rhs );
- //! The efficiency model objects
- std::vector<const LauAbsEffModel*> effModel_;
+ //! The daughters object
+ const LauDaughters* daughters_;
- //! The efficiency model objects
- std::vector<Double_t> coeff_;
+ //! The efficiency model objects
+ std::vector<const LauAbsEffModel*> effModel_;
- //! Fluctuate histogram within the error
- Bool_t fluctuateEffHisto_;
+ //! The efficiency model objects
+ std::vector<Double_t> coeff_;
- //! Flag to track whether a warning has been issued for bin values less than zero
- mutable Bool_t lowBinWarningIssued_;
+ //! Fluctuate histogram within the error
+ Bool_t fluctuateEffHisto_;
- //! Flag to track whether a warning has been issued for bin values greater than one
- mutable Bool_t highBinWarningIssued_;
+ //! Flag to track whether a warning has been issued for bin values less than zero
+ mutable Bool_t lowBinWarningIssued_;
- ClassDef(LauWeightedSumEffModel, 0) // Implement the signal efficiency across the DP
+ //! Flag to track whether a warning has been issued for bin values greater than one
+ mutable Bool_t highBinWarningIssued_;
+ ClassDef( LauWeightedSumEffModel, 0 ) // Implement the signal efficiency across the DP
};
#endif
diff --git a/macros/makeFitFile.C b/macros/makeFitFile.C
index 5a04757..17edfab 100644
--- a/macros/makeFitFile.C
+++ b/macros/makeFitFile.C
@@ -1,111 +1,113 @@
/*
Copyright 2011 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
// Example of how to create an input data file for Laura++ to fit
//
// This example assumes that the input file contains the branches "m13" and
// "m23", which correspond to m_D0barpi+ and m_D0barpi-, respectively.
// Any additional variables that you wish to include in the fit or simply for
// information can be trivially added by including lines such as the following
// in the appropriate place:
//
// Double_t myVar(0.0);
// ...
// inputTree->SetBranchAddress("myVar",&myVar);
// ...
// outputTree->Branch("myVar",&myVar,"myVar/D");
//
// Square DP co-ordinates can also be included by changing the 5th argument of
// the LauDaughters ctor to kTRUE and uncommenting the appropriate lines.
-void makeFitFile(const TString& inputFileName, const TString& inputTreeName, const TString& outputFileName, const Long64_t nEvents = 0)
+void makeFitFile( const TString& inputFileName,
+ const TString& inputTreeName,
+ const TString& outputFileName,
+ const Long64_t nEvents = 0 )
{
- gSystem->Load("../lib/libLaura++.so");
+ gSystem->Load( "../lib/libLaura++.so" );
- LauDaughters* daughters = new LauDaughters( "B0", "pi+", "pi-", "D0_bar", kFALSE );
- LauKinematics* kinematics = daughters->getKinematics();
+ LauDaughters* daughters = new LauDaughters( "B0", "pi+", "pi-", "D0_bar", kFALSE );
+ LauKinematics* kinematics = daughters->getKinematics();
- TChain * inputTree = new TChain( inputTreeName );
- inputTree->Add( inputFileName );
+ TChain* inputTree = new TChain( inputTreeName );
+ inputTree->Add( inputFileName );
- Int_t iExpt(0);
+ Int_t iExpt( 0 );
- Double_t m12(0.0), m13(0.0), m23(0.0);
- Double_t m12Sq(0.0), m13Sq(0.0), m23Sq(0.0);
- Double_t h12(0.0), h13(0.0), h23(0.0);
- //Double_t mPrime(0.0), thPrime(0.0);
+ Double_t m12( 0.0 ), m13( 0.0 ), m23( 0.0 );
+ Double_t m12Sq( 0.0 ), m13Sq( 0.0 ), m23Sq( 0.0 );
+ Double_t h12( 0.0 ), h13( 0.0 ), h23( 0.0 );
+ //Double_t mPrime(0.0), thPrime(0.0);
- inputTree->SetBranchAddress("m13",&m13);
- inputTree->SetBranchAddress("m23",&m23);
+ inputTree->SetBranchAddress( "m13", &m13 );
+ inputTree->SetBranchAddress( "m23", &m23 );
- TFile * outputFile = TFile::Open(outputFileName,"recreate");
- TTree * outputTree = new TTree("fitTree","Input to Laura++ Fit");
+ TFile* outputFile = TFile::Open( outputFileName, "recreate" );
+ TTree* outputTree = new TTree( "fitTree", "Input to Laura++ Fit" );
- outputTree->Branch("iExpt",&iExpt,"iExpt/I");
- outputTree->Branch("m12",&m12,"m12/D");
- outputTree->Branch("m13",&m13,"m13/D");
- outputTree->Branch("m23",&m23,"m23/D");
- outputTree->Branch("m12Sq",&m12Sq,"m12Sq/D");
- outputTree->Branch("m13Sq",&m13Sq,"m13Sq/D");
- outputTree->Branch("m23Sq",&m23Sq,"m23Sq/D");
- outputTree->Branch("h12",&h12,"h12/D");
- outputTree->Branch("h13",&h13,"h13/D");
- outputTree->Branch("h23",&h23,"h23/D");
- //outputTree->Branch("mPrime",&mPrime,"mPrime/D");
- //outputTree->Branch("thPrime",&thPrime,"thPrime/D");
+ outputTree->Branch( "iExpt", &iExpt, "iExpt/I" );
+ outputTree->Branch( "m12", &m12, "m12/D" );
+ outputTree->Branch( "m13", &m13, "m13/D" );
+ outputTree->Branch( "m23", &m23, "m23/D" );
+ outputTree->Branch( "m12Sq", &m12Sq, "m12Sq/D" );
+ outputTree->Branch( "m13Sq", &m13Sq, "m13Sq/D" );
+ outputTree->Branch( "m23Sq", &m23Sq, "m23Sq/D" );
+ outputTree->Branch( "h12", &h12, "h12/D" );
+ outputTree->Branch( "h13", &h13, "h13/D" );
+ outputTree->Branch( "h23", &h23, "h23/D" );
+ //outputTree->Branch("mPrime",&mPrime,"mPrime/D");
+ //outputTree->Branch("thPrime",&thPrime,"thPrime/D");
- if (nEvents <= 0 || nEvents > inputTree->GetEntries()) {
- nEvents = inputTree->GetEntries();
- }
+ if ( nEvents <= 0 || nEvents > inputTree->GetEntries() ) {
+ nEvents = inputTree->GetEntries();
+ }
- for (Long64_t iEntry(0); iEntry<nEvents; ++iEntry) {
+ for ( Long64_t iEntry( 0 ); iEntry < nEvents; ++iEntry ) {
- inputTree->GetEntry(iEntry);
+ inputTree->GetEntry( iEntry );
- m13Sq = m13*m13;
- m23Sq = m23*m23;
+ m13Sq = m13 * m13;
+ m23Sq = m23 * m23;
- if ( ! kinematics->withinDPLimits( m13Sq, m23Sq ) ) {
- cerr << "WARNING : Reconstructed position of event " << iEntry << " not within DP boundary, skipping it." << endl;
- continue;
- }
+ if ( ! kinematics->withinDPLimits( m13Sq, m23Sq ) ) {
+ cerr << "WARNING : Reconstructed position of event " << iEntry
+ << " not within DP boundary, skipping it." << endl;
+ continue;
+ }
- kinematics->updateKinematics( m13Sq, m23Sq );
+ kinematics->updateKinematics( m13Sq, m23Sq );
- m12Sq = kinematics->getm12Sq();
- m12 = kinematics->getm12();
- h12 = kinematics->getc12();
- h13 = kinematics->getc13();
- h23 = kinematics->getc23();
- //mPrime = kinematics->getmPrime();
- //thPrime = kinematics->getThetaPrime();
+ m12Sq = kinematics->getm12Sq();
+ m12 = kinematics->getm12();
+ h12 = kinematics->getc12();
+ h13 = kinematics->getc13();
+ h23 = kinematics->getc23();
+ //mPrime = kinematics->getmPrime();
+ //thPrime = kinematics->getThetaPrime();
- outputTree->Fill();
+ outputTree->Fill();
+ }
- }
-
- outputFile->Write();
- outputFile->Close();
+ outputFile->Write();
+ outputFile->Close();
}
-
diff --git a/macros/plotComplexVars.C b/macros/plotComplexVars.C
index ec935ed..ab39e36 100644
--- a/macros/plotComplexVars.C
+++ b/macros/plotComplexVars.C
@@ -1,67 +1,70 @@
/*
Copyright 2010 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
-void plotComplexVars( TString fileName="test.root" )
+void plotComplexVars( TString fileName = "test.root" )
{
- TFile *_file0 = TFile::Open( fileName );
- TTree *fitResults = dynamic_cast<TTree *>(_file0->Get("fitResults"));
- fitResults->GetEntry(0);
+ TFile* _file0 = TFile::Open( fileName );
+ TTree* fitResults = dynamic_cast<TTree*>( _file0->Get( "fitResults" ) );
+ fitResults->GetEntry( 0 );
- TCanvas * c1 = new TCanvas("c1","c1",500,500);
- TH2F histo("histo","histo",120,-1.2,1.2,120,-1.2,1.2);
- histo.Draw();
+ TCanvas* c1 = new TCanvas( "c1", "c1", 500, 500 );
+ TH2F histo( "histo", "histo", 120, -1.2, 1.2, 120, -1.2, 1.2 );
+ histo.Draw();
- // draw grid
- gStyle->SetLineWidth(1);
- gStyle->SetLineStyle(3);
- TEllipse ellipse2( 0.0, 0.0, 1.0, 1.0); ellipse2.Draw();
- TEllipse ellipse1( 0.0, 0.0, 0.5, 0.5); ellipse1.Draw();
- TLine lh( -1.2, 0.0, 1.2, 0.0); lh.Draw();
- TLine lv( 0.0, -1.2, 0.0, 1.2); lv.Draw();
+ // draw grid
+ gStyle->SetLineWidth( 1 );
+ gStyle->SetLineStyle( 3 );
+ TEllipse ellipse2( 0.0, 0.0, 1.0, 1.0 );
+ ellipse2.Draw();
+ TEllipse ellipse1( 0.0, 0.0, 0.5, 0.5 );
+ ellipse1.Draw();
+ TLine lh( -1.2, 0.0, 1.2, 0.0 );
+ lh.Draw();
+ TLine lv( 0.0, -1.2, 0.0, 1.2 );
+ lv.Draw();
- // draw results
- fitResults->SetMarkerColor(2);
- fitResults->SetMarkerStyle(1);
- fitResults->Draw("A1_Y:A1_X","","same");
- fitResults->SetMarkerColor(1);
- fitResults->SetMarkerStyle(2);
- fitResults->Draw("A1_Y_True:A1_X_True","","same");
+ // draw results
+ fitResults->SetMarkerColor( 2 );
+ fitResults->SetMarkerStyle( 1 );
+ fitResults->Draw( "A1_Y:A1_X", "", "same" );
+ fitResults->SetMarkerColor( 1 );
+ fitResults->SetMarkerStyle( 2 );
+ fitResults->Draw( "A1_Y_True:A1_X_True", "", "same" );
- fitResults->SetMarkerColor(3);
- fitResults->SetMarkerStyle(1);
- fitResults->Draw("A2_Y:A2_X","","same");
- fitResults->SetMarkerColor(1);
- fitResults->SetMarkerStyle(2);
- fitResults->Draw("A2_Y_True:A2_X_True","","same");
+ fitResults->SetMarkerColor( 3 );
+ fitResults->SetMarkerStyle( 1 );
+ fitResults->Draw( "A2_Y:A2_X", "", "same" );
+ fitResults->SetMarkerColor( 1 );
+ fitResults->SetMarkerStyle( 2 );
+ fitResults->Draw( "A2_Y_True:A2_X_True", "", "same" );
- fitResults->SetMarkerColor(4);
- fitResults->SetMarkerStyle(1);
- fitResults->Draw("A3_Y:A3_X","","same");
- fitResults->SetMarkerColor(1);
- fitResults->SetMarkerStyle(2);
- fitResults->Draw("A3_Y_True:A3_X_True","","same");
-
- c1->SaveAs("complexVars.eps");
+ fitResults->SetMarkerColor( 4 );
+ fitResults->SetMarkerStyle( 1 );
+ fitResults->Draw( "A3_Y:A3_X", "", "same" );
+ fitResults->SetMarkerColor( 1 );
+ fitResults->SetMarkerStyle( 2 );
+ fitResults->Draw( "A3_Y_True:A3_X_True", "", "same" );
+ c1->SaveAs( "complexVars.eps" );
}
diff --git a/macros/plotCorrs.C b/macros/plotCorrs.C
index 2d0f1cb..01d91a4 100644
--- a/macros/plotCorrs.C
+++ b/macros/plotCorrs.C
@@ -1,99 +1,98 @@
/*
Copyright 2010 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
-void plotCorrs( TString fileName="test.root" )
+void plotCorrs( TString fileName = "test.root" )
{
- gStyle->SetOptStat(0);
- gStyle->SetPalette(1);
- gStyle->SetPadTopMargin(0.15);
- gStyle->SetPadBottomMargin(0.15);
- gStyle->SetPadLeftMargin(0.15);
- gStyle->SetPadRightMargin(0.15);
-
- TCanvas * c1 = new TCanvas("c1","c1");
-
- TFile *_file0 = TFile::Open( fileName );
- TTree *fitResults = dynamic_cast<TTree *>(_file0->Get("fitResults"));
- fitResults->GetEntry(0);
-
- TObjArray *listOfLeaves = fitResults->GetListOfLeaves();
-
- const UInt_t maxNVar(100);
- TString varNames[100];
-
- UInt_t nVar(0);
- for (UInt_t iLeaf=0; iLeaf<listOfLeaves->GetEntries(); ++iLeaf) {
- TLeaf *leaf = dynamic_cast<TLeaf*>((*listOfLeaves)[iLeaf]);
- TString name = leaf->GetName();
- if ( name.EndsWith( "_Error" ) ) {
- TString shortName( name( 0, name.Length()-6 ) );
- // std::cout << name << " " << shortName << std::endl;
- varNames[nVar] = shortName;
- ++nVar;
-
- if (maxNVar<nVar) {
- std::cerr << "Too many variables!!!" << std::endl;
- break;
- }
- }
- }
-
- TH2I corrHisto("corrHisto", "", nVar, -0.5, nVar-0.5, nVar, -0.5, nVar-0.5 );
-
- for (UInt_t iVar=0; iVar<nVar; ++iVar) {
- corrHisto.GetXaxis()->SetBinLabel( iVar+1, varNames[iVar] );
- corrHisto.GetYaxis()->SetBinLabel( iVar+1, varNames[iVar] );
-
- for (UInt_t jVar=0; jVar<nVar; ++jVar ){
-
- if (jVar==iVar) {
- corrHisto.SetBinContent( iVar+1, jVar+1, 100 );
- continue;
- }
-
- TString corrName = "corr__" + varNames[iVar] + "__" + varNames[jVar];
- TLeaf *corrLeaf = dynamic_cast<TLeaf *>(fitResults->GetListOfLeaves()->FindObject(corrName.Data()));
-
- corrHisto.SetBinContent( iVar+1, jVar+1, TMath::Nint(corrLeaf->GetValue()*100) );
- // std::cout << corrName << " " << corrLeaf->GetValue() << std::endl;
-
- }
- }
-
- corrHisto.SetMinimum(-100.0);
- corrHisto.SetMaximum( 100.0);
-
- corrHisto.GetZaxis()->SetTitle("Linear correlation coefficient (%)");
- corrHisto.GetZaxis()->SetTitleSize(0.033);
- corrHisto.GetZaxis()->SetLabelSize(0.033);
- corrHisto.GetXaxis()->SetLabelSize(0.033);
- corrHisto.GetYaxis()->SetLabelSize(0.033);
- corrHisto.GetXaxis()->LabelsOption("v");
-
- corrHisto.Draw("colz");
- corrHisto.Draw("text same");
-
- c1->SaveAs("corrHisto.eps");
-
+ gStyle->SetOptStat( 0 );
+ gStyle->SetPalette( 1 );
+ gStyle->SetPadTopMargin( 0.15 );
+ gStyle->SetPadBottomMargin( 0.15 );
+ gStyle->SetPadLeftMargin( 0.15 );
+ gStyle->SetPadRightMargin( 0.15 );
+
+ TCanvas* c1 = new TCanvas( "c1", "c1" );
+
+ TFile* _file0 = TFile::Open( fileName );
+ TTree* fitResults = dynamic_cast<TTree*>( _file0->Get( "fitResults" ) );
+ fitResults->GetEntry( 0 );
+
+ TObjArray* listOfLeaves = fitResults->GetListOfLeaves();
+
+ const UInt_t maxNVar( 100 );
+ TString varNames[100];
+
+ UInt_t nVar( 0 );
+ for ( UInt_t iLeaf = 0; iLeaf < listOfLeaves->GetEntries(); ++iLeaf ) {
+ TLeaf* leaf = dynamic_cast<TLeaf*>( ( *listOfLeaves )[iLeaf] );
+ TString name = leaf->GetName();
+ if ( name.EndsWith( "_Error" ) ) {
+ TString shortName( name( 0, name.Length() - 6 ) );
+ // std::cout << name << " " << shortName << std::endl;
+ varNames[nVar] = shortName;
+ ++nVar;
+
+ if ( maxNVar < nVar ) {
+ std::cerr << "Too many variables!!!" << std::endl;
+ break;
+ }
+ }
+ }
+
+ TH2I corrHisto( "corrHisto", "", nVar, -0.5, nVar - 0.5, nVar, -0.5, nVar - 0.5 );
+
+ for ( UInt_t iVar = 0; iVar < nVar; ++iVar ) {
+ corrHisto.GetXaxis()->SetBinLabel( iVar + 1, varNames[iVar] );
+ corrHisto.GetYaxis()->SetBinLabel( iVar + 1, varNames[iVar] );
+
+ for ( UInt_t jVar = 0; jVar < nVar; ++jVar ) {
+
+ if ( jVar == iVar ) {
+ corrHisto.SetBinContent( iVar + 1, jVar + 1, 100 );
+ continue;
+ }
+
+ TString corrName = "corr__" + varNames[iVar] + "__" + varNames[jVar];
+ TLeaf* corrLeaf = dynamic_cast<TLeaf*>(
+ fitResults->GetListOfLeaves()->FindObject( corrName.Data() ) );
+
+ corrHisto.SetBinContent( iVar + 1, jVar + 1, TMath::Nint( corrLeaf->GetValue() * 100 ) );
+ // std::cout << corrName << " " << corrLeaf->GetValue() << std::endl;
+ }
+ }
+
+ corrHisto.SetMinimum( -100.0 );
+ corrHisto.SetMaximum( 100.0 );
+
+ corrHisto.GetZaxis()->SetTitle( "Linear correlation coefficient (%)" );
+ corrHisto.GetZaxis()->SetTitleSize( 0.033 );
+ corrHisto.GetZaxis()->SetLabelSize( 0.033 );
+ corrHisto.GetXaxis()->SetLabelSize( 0.033 );
+ corrHisto.GetYaxis()->SetLabelSize( 0.033 );
+ corrHisto.GetXaxis()->LabelsOption( "v" );
+
+ corrHisto.Draw( "colz" );
+ corrHisto.Draw( "text same" );
+
+ c1->SaveAs( "corrHisto.eps" );
}
diff --git a/macros/plotCorrsFromToy.C b/macros/plotCorrsFromToy.C
index d9d82dd..1ca3b8e 100644
--- a/macros/plotCorrsFromToy.C
+++ b/macros/plotCorrsFromToy.C
@@ -1,125 +1,124 @@
/*
Copyright 2010 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
-void plotCorrsFromToy( TString fileName="test.root", const Bool_t plotIndividualCorrs=kFALSE )
+void plotCorrsFromToy( TString fileName = "test.root", const Bool_t plotIndividualCorrs = kFALSE )
{
- gStyle->SetOptStat(0);
- gStyle->SetPalette(1);
- gStyle->SetPadTopMargin(0.15);
- gStyle->SetPadBottomMargin(0.15);
- gStyle->SetPadLeftMargin(0.15);
- gStyle->SetPadRightMargin(0.15);
-
- TCanvas * c1 = new TCanvas("c1","c1");
-
- TFile *_file0 = TFile::Open( fileName );
- TTree *fitResults = dynamic_cast<TTree *>(_file0->Get("fitResults"));
- fitResults->GetEntry(0);
-
- if ( fitResults->GetEntries()==1 ) {
- std::cout << "Only one entry in fitResults tree ...\n"
- << "\t--> you probably want to use plotCorrs.C instead" << std::endl;
- return;
- }
-
- TObjArray *listOfLeaves = fitResults->GetListOfLeaves();
-
- const UInt_t maxNVar(100);
- TString varNames[100];
-
- UInt_t nVar(0);
- for (UInt_t iLeaf=0; iLeaf<listOfLeaves->GetEntries(); ++iLeaf) {
- TLeaf *leaf = dynamic_cast<TLeaf*>((*listOfLeaves)[iLeaf]);
- TString name = leaf->GetName();
- if ( name.EndsWith( "_Error" ) ) {
- TString shortName( name( 0, name.Length()-6 ) );
- // std::cout << name << " " << shortName << std::endl;
- varNames[nVar] = shortName;
- ++nVar;
-
- if (maxNVar<nVar) {
- std::cerr << "Too many variables!!!" << std::endl;
- break;
- }
- }
- }
-
- TH2I corrHisto("corrHisto", "correlations", nVar, -0.5, nVar-0.5, nVar, -0.5, nVar-0.5 );
-
- for (UInt_t iVar=0; iVar<nVar; ++iVar) {
- corrHisto.GetXaxis()->SetBinLabel( iVar+1, varNames[iVar] );
- corrHisto.GetYaxis()->SetBinLabel( iVar+1, varNames[iVar] );
-
- for (UInt_t jVar=0; jVar<nVar; ++jVar ){
-
- if (jVar==iVar) {
- corrHisto.SetBinContent( iVar+1, jVar+1, 100 );
- continue;
- }
-
- TString corrName = "corr__" + varNames[iVar] + "__" + varNames[jVar];
-
- if (plotIndividualCorrs) {
- fitResults->Draw(corrName);
- TString filename = corrName + ".eps";
- c1->SaveAs(filename);
- }
-
- // get correlation factor from the distribution of Y vs X
- TString drawCmd = varNames[jVar] + ":" + varNames[iVar] + ">>bob";
- fitResults->Draw(drawCmd);
- TH2 *histo = (TH2 *)gDirectory->Get("bob");
- Double_t corr = histo->GetCorrelationFactor();
- corrHisto.SetBinContent( iVar+1, jVar+1, TMath::Nint(corr*100) );
- delete histo;
-
- // // get average correlation factor from toy fit results (MINUIT)
- // Double_t avValue(0.0);
- // for (UInt_t iResult=0; iResult<fitResults->GetEntries(); ++iResult) {
- // fitResults->GetEntry(iResult);
- // TLeaf *corrLeaf = dynamic_cast<TLeaf *>(fitResults->GetListOfLeaves()->FindObject(corrName.Data()));
- // avValue += corrLeaf->GetValue();
-
- // };
- // avValue /= fitResults->GetEntries();
- // corrHisto.SetBinContent( iVar+1, jVar+1, TMath::Nint(avValue*100) );
-
- }
- }
-
- corrHisto.SetMinimum(-100.0);
- corrHisto.SetMaximum( 100.0);
-
- corrHisto.GetZaxis()->SetTitle("Linear correlation coefficient (%)");
- corrHisto.GetZaxis()->SetTitleSize(0.033);
- corrHisto.GetZaxis()->SetLabelSize(0.033);
- corrHisto.GetXaxis()->SetLabelSize(0.033);
- corrHisto.GetYaxis()->SetLabelSize(0.033);
- corrHisto.GetXaxis()->LabelsOption("v");
-
- corrHisto.Draw("colz");
- corrHisto.Draw("text same");
-
- c1->SaveAs("corrHisto.eps");
+ gStyle->SetOptStat( 0 );
+ gStyle->SetPalette( 1 );
+ gStyle->SetPadTopMargin( 0.15 );
+ gStyle->SetPadBottomMargin( 0.15 );
+ gStyle->SetPadLeftMargin( 0.15 );
+ gStyle->SetPadRightMargin( 0.15 );
+
+ TCanvas* c1 = new TCanvas( "c1", "c1" );
+
+ TFile* _file0 = TFile::Open( fileName );
+ TTree* fitResults = dynamic_cast<TTree*>( _file0->Get( "fitResults" ) );
+ fitResults->GetEntry( 0 );
+
+ if ( fitResults->GetEntries() == 1 ) {
+ std::cout << "Only one entry in fitResults tree ...\n"
+ << "\t--> you probably want to use plotCorrs.C instead" << std::endl;
+ return;
+ }
+
+ TObjArray* listOfLeaves = fitResults->GetListOfLeaves();
+
+ const UInt_t maxNVar( 100 );
+ TString varNames[100];
+
+ UInt_t nVar( 0 );
+ for ( UInt_t iLeaf = 0; iLeaf < listOfLeaves->GetEntries(); ++iLeaf ) {
+ TLeaf* leaf = dynamic_cast<TLeaf*>( ( *listOfLeaves )[iLeaf] );
+ TString name = leaf->GetName();
+ if ( name.EndsWith( "_Error" ) ) {
+ TString shortName( name( 0, name.Length() - 6 ) );
+ // std::cout << name << " " << shortName << std::endl;
+ varNames[nVar] = shortName;
+ ++nVar;
+
+ if ( maxNVar < nVar ) {
+ std::cerr << "Too many variables!!!" << std::endl;
+ break;
+ }
+ }
+ }
+
+ TH2I corrHisto( "corrHisto", "correlations", nVar, -0.5, nVar - 0.5, nVar, -0.5, nVar - 0.5 );
+
+ for ( UInt_t iVar = 0; iVar < nVar; ++iVar ) {
+ corrHisto.GetXaxis()->SetBinLabel( iVar + 1, varNames[iVar] );
+ corrHisto.GetYaxis()->SetBinLabel( iVar + 1, varNames[iVar] );
+
+ for ( UInt_t jVar = 0; jVar < nVar; ++jVar ) {
+
+ if ( jVar == iVar ) {
+ corrHisto.SetBinContent( iVar + 1, jVar + 1, 100 );
+ continue;
+ }
+
+ TString corrName = "corr__" + varNames[iVar] + "__" + varNames[jVar];
+
+ if ( plotIndividualCorrs ) {
+ fitResults->Draw( corrName );
+ TString filename = corrName + ".eps";
+ c1->SaveAs( filename );
+ }
+
+ // get correlation factor from the distribution of Y vs X
+ TString drawCmd = varNames[jVar] + ":" + varNames[iVar] + ">>bob";
+ fitResults->Draw( drawCmd );
+ TH2* histo = (TH2*)gDirectory->Get( "bob" );
+ Double_t corr = histo->GetCorrelationFactor();
+ corrHisto.SetBinContent( iVar + 1, jVar + 1, TMath::Nint( corr * 100 ) );
+ delete histo;
+
+ // // get average correlation factor from toy fit results (MINUIT)
+ // Double_t avValue(0.0);
+ // for (UInt_t iResult=0; iResult<fitResults->GetEntries(); ++iResult) {
+ // fitResults->GetEntry(iResult);
+ // TLeaf *corrLeaf = dynamic_cast<TLeaf *>(fitResults->GetListOfLeaves()->FindObject(corrName.Data()));
+ // avValue += corrLeaf->GetValue();
+
+ // };
+ // avValue /= fitResults->GetEntries();
+ // corrHisto.SetBinContent( iVar+1, jVar+1, TMath::Nint(avValue*100) );
+ }
+ }
+
+ corrHisto.SetMinimum( -100.0 );
+ corrHisto.SetMaximum( 100.0 );
+
+ corrHisto.GetZaxis()->SetTitle( "Linear correlation coefficient (%)" );
+ corrHisto.GetZaxis()->SetTitleSize( 0.033 );
+ corrHisto.GetZaxis()->SetLabelSize( 0.033 );
+ corrHisto.GetXaxis()->SetLabelSize( 0.033 );
+ corrHisto.GetYaxis()->SetLabelSize( 0.033 );
+ corrHisto.GetXaxis()->LabelsOption( "v" );
+
+ corrHisto.Draw( "colz" );
+ corrHisto.Draw( "text same" );
+
+ c1->SaveAs( "corrHisto.eps" );
}
diff --git a/macros/plotDataIsobars.C b/macros/plotDataIsobars.C
index 0add255..3f88bb0 100644
--- a/macros/plotDataIsobars.C
+++ b/macros/plotDataIsobars.C
@@ -1,79 +1,81 @@
/*
Copyright 2010 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
-void plotDataIsobars( TString fileName="test.root" )
+void plotDataIsobars( TString fileName = "test.root" )
{
- gStyle->SetOptStat(0);
-
- TFile *_file0 = TFile::Open( fileName );
- TTree *fitResults = dynamic_cast<TTree *>(_file0->Get("fitResults"));
- fitResults->GetEntry(0);
-
- TCanvas * c1 = new TCanvas("c1","c1",500,500);
- TH2F histo("histo","histo",150,-1.5,1.5,150,-1.5,1.5);
- histo.Draw();
-
- // draw grid
- gStyle->SetLineWidth(1);
- gStyle->SetLineStyle(3);
- TEllipse ellipse2( 0.0, 0.0, 1.0, 1.0); ellipse2.Draw();
- TEllipse ellipse1( 0.0, 0.0, 0.5, 0.5); ellipse1.Draw();
- TLine lh( -1.5, 0.0, 1.5, 0.0); lh.Draw();
- TLine lv( 0.0, -1.5, 0.0, 1.5); lv.Draw();
-
- // draw results
- TObjArray *listOfLeaves = fitResults->GetListOfLeaves();
-
- const UInt_t maxNVar(100);
- TString varNames[100];
-
- const UInt_t nLeaves = listOfLeaves->GetEntries();
- UInt_t nVar(0);
- for (UInt_t iLeaf = 0; iLeaf < nLeaves; ++iLeaf) {
- TLeaf *leaf = dynamic_cast<TLeaf*>((*listOfLeaves)[iLeaf]);
- TString name = leaf->GetName();
- if ( name.BeginsWith("A") && name.EndsWith( "_X" ) ) {
- TString shortName( name( 0, name.Length()-2 ) );
- varNames[nVar] = shortName;
- ++nVar;
-
- if (maxNVar<nVar) {
- std::cerr << "Too many variables!!!" << std::endl;
- break;
- }
- }
- }
-
-
- for ( UInt_t iVar = 0; iVar < nVar; ++iVar ) {
- fitResults->SetMarkerColor(iVar+2);
- fitResults->SetMarkerStyle(2);
-
- TString drawCmd = varNames[iVar]+"_Y:"+varNames[iVar]+"_X";
- fitResults->Draw( drawCmd, "", "same" );
- }
-
- c1->SaveAs("data-isobars.eps");
-
+ gStyle->SetOptStat( 0 );
+
+ TFile* _file0 = TFile::Open( fileName );
+ TTree* fitResults = dynamic_cast<TTree*>( _file0->Get( "fitResults" ) );
+ fitResults->GetEntry( 0 );
+
+ TCanvas* c1 = new TCanvas( "c1", "c1", 500, 500 );
+ TH2F histo( "histo", "histo", 150, -1.5, 1.5, 150, -1.5, 1.5 );
+ histo.Draw();
+
+ // draw grid
+ gStyle->SetLineWidth( 1 );
+ gStyle->SetLineStyle( 3 );
+ TEllipse ellipse2( 0.0, 0.0, 1.0, 1.0 );
+ ellipse2.Draw();
+ TEllipse ellipse1( 0.0, 0.0, 0.5, 0.5 );
+ ellipse1.Draw();
+ TLine lh( -1.5, 0.0, 1.5, 0.0 );
+ lh.Draw();
+ TLine lv( 0.0, -1.5, 0.0, 1.5 );
+ lv.Draw();
+
+ // draw results
+ TObjArray* listOfLeaves = fitResults->GetListOfLeaves();
+
+ const UInt_t maxNVar( 100 );
+ TString varNames[100];
+
+ const UInt_t nLeaves = listOfLeaves->GetEntries();
+ UInt_t nVar( 0 );
+ for ( UInt_t iLeaf = 0; iLeaf < nLeaves; ++iLeaf ) {
+ TLeaf* leaf = dynamic_cast<TLeaf*>( ( *listOfLeaves )[iLeaf] );
+ TString name = leaf->GetName();
+ if ( name.BeginsWith( "A" ) && name.EndsWith( "_X" ) ) {
+ TString shortName( name( 0, name.Length() - 2 ) );
+ varNames[nVar] = shortName;
+ ++nVar;
+
+ if ( maxNVar < nVar ) {
+ std::cerr << "Too many variables!!!" << std::endl;
+ break;
+ }
+ }
+ }
+
+ for ( UInt_t iVar = 0; iVar < nVar; ++iVar ) {
+ fitResults->SetMarkerColor( iVar + 2 );
+ fitResults->SetMarkerStyle( 2 );
+
+ TString drawCmd = varNames[iVar] + "_Y:" + varNames[iVar] + "_X";
+ fitResults->Draw( drawCmd, "", "same" );
+ }
+
+ c1->SaveAs( "data-isobars.eps" );
}
diff --git a/src/Lau1DCubicSpline.cc b/src/Lau1DCubicSpline.cc
index 4d94fcd..bb09da6 100644
--- a/src/Lau1DCubicSpline.cc
+++ b/src/Lau1DCubicSpline.cc
@@ -1,342 +1,358 @@
/*
Copyright 2015 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file Lau1DCubicSpline.cc
- \brief File containing implementation of Lau1DCubicSpline class.
- */
+ \brief File containing implementation of Lau1DCubicSpline class.
+*/
+
+#include "Lau1DCubicSpline.hh"
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <TH2.h>
#include <TSystem.h>
-#include "Lau1DCubicSpline.hh"
-
-
-
-Lau1DCubicSpline::Lau1DCubicSpline(const std::vector<Double_t>& xs, const std::vector<Double_t>& ys,
- LauSplineType type,
- LauSplineBoundaryType leftBound,
- LauSplineBoundaryType rightBound,
- Double_t dydx0, Double_t dydxn) :
- nKnots_(xs.size()),
- x_(xs),
- y_(ys),
- type_(type),
- leftBound_(leftBound),
- rightBound_(rightBound),
- dydx0_(dydx0),
- dydxn_(dydxn)
+Lau1DCubicSpline::Lau1DCubicSpline( const std::vector<Double_t>& xs,
+ const std::vector<Double_t>& ys,
+ LauSplineType type,
+ LauSplineBoundaryType leftBound,
+ LauSplineBoundaryType rightBound,
+ Double_t dydx0,
+ Double_t dydxn ) :
+ nKnots_( xs.size() ),
+ x_( xs ),
+ y_( ys ),
+ type_( type ),
+ leftBound_( leftBound ),
+ rightBound_( rightBound ),
+ dydx0_( dydx0 ),
+ dydxn_( dydxn )
{
- init();
+ init();
}
Lau1DCubicSpline::~Lau1DCubicSpline()
{
}
-Double_t Lau1DCubicSpline::evaluate(Double_t x) const
+Double_t Lau1DCubicSpline::evaluate( Double_t x ) const
{
- // do not attempt to extrapolate the spline
- if( x<x_[0] || x>x_[nKnots_-1] ) {
- std::cout << "WARNING in Lau1DCubicSpline::evaluate : function is only defined between " << x_[0] << " and " << x_[nKnots_-1] << std::endl;
- std::cout << " value at " << x << " returned as 0" << std::endl;
- return 0.;
- }
-
- // first determine which 'cell' of the spline x is in
- // cell i runs from knot i to knot i+1
- Int_t cell(0);
-
- while( x > x_[cell+1] ) {
- ++cell;
- }
-
- // obtain x- and y-values of the neighbouring knots
- Double_t xLow = x_[cell];
- Double_t xHigh = x_[cell+1];
- Double_t yLow = y_[cell];
- Double_t yHigh = y_[cell+1];
-
- if(type_ == Lau1DCubicSpline::LinearInterpolation) {
- return yHigh*(x-xLow)/(xHigh-xLow) + yLow*(xHigh-x)/(xHigh-xLow);
- }
-
- // obtain t, the normalised x-coordinate within the cell,
- // and the coefficients a and b, which are defined in cell i as:
- //
- // a_i = k_i *(x_i+1 - x_i) - (y_i+1 - y_i),
- // b_i = -k_i+1*(x_i+1 - x_i) + (y_i+1 - y_i)
- //
- // where k_i is (by construction) the first derivative at knot i
- Double_t t = (x - xLow) / (xHigh - xLow);
- Double_t a = dydx_[cell] * (xHigh - xLow) - (yHigh - yLow);
- Double_t b = -1.*dydx_[cell+1] * (xHigh - xLow) + (yHigh - yLow);
-
- Double_t retVal = (1 - t) * yLow + t * yHigh + t * (1 - t) * ( a * (1 - t) + b * t );
-
- return retVal;
+ // do not attempt to extrapolate the spline
+ if ( x < x_[0] || x > x_[nKnots_ - 1] ) {
+ std::cout << "WARNING in Lau1DCubicSpline::evaluate : function is only defined between "
+ << x_[0] << " and " << x_[nKnots_ - 1] << std::endl;
+ std::cout << " value at " << x << " returned as 0"
+ << std::endl;
+ return 0.;
+ }
+
+ // first determine which 'cell' of the spline x is in
+ // cell i runs from knot i to knot i+1
+ Int_t cell( 0 );
+
+ while ( x > x_[cell + 1] ) {
+ ++cell;
+ }
+
+ // obtain x- and y-values of the neighbouring knots
+ Double_t xLow = x_[cell];
+ Double_t xHigh = x_[cell + 1];
+ Double_t yLow = y_[cell];
+ Double_t yHigh = y_[cell + 1];
+
+ if ( type_ == Lau1DCubicSpline::LinearInterpolation ) {
+ return yHigh * ( x - xLow ) / ( xHigh - xLow ) + yLow * ( xHigh - x ) / ( xHigh - xLow );
+ }
+
+ // obtain t, the normalised x-coordinate within the cell,
+ // and the coefficients a and b, which are defined in cell i as:
+ //
+ // a_i = k_i *(x_i+1 - x_i) - (y_i+1 - y_i),
+ // b_i = -k_i+1*(x_i+1 - x_i) + (y_i+1 - y_i)
+ //
+ // where k_i is (by construction) the first derivative at knot i
+ Double_t t = ( x - xLow ) / ( xHigh - xLow );
+ Double_t a = dydx_[cell] * ( xHigh - xLow ) - ( yHigh - yLow );
+ Double_t b = -1. * dydx_[cell + 1] * ( xHigh - xLow ) + ( yHigh - yLow );
+
+ Double_t retVal = ( 1 - t ) * yLow + t * yHigh + t * ( 1 - t ) * ( a * ( 1 - t ) + b * t );
+
+ return retVal;
}
-void Lau1DCubicSpline::updateYValues(const std::vector<Double_t>& ys)
+void Lau1DCubicSpline::updateYValues( const std::vector<Double_t>& ys )
{
- y_ = ys;
- this->calcDerivatives();
+ y_ = ys;
+ this->calcDerivatives();
}
-void Lau1DCubicSpline::updateType(LauSplineType type)
+void Lau1DCubicSpline::updateType( LauSplineType type )
{
- if(type_ != type) {
- type_ = type;
- this->calcDerivatives();
- }
+ if ( type_ != type ) {
+ type_ = type;
+ this->calcDerivatives();
+ }
}
-void Lau1DCubicSpline::updateBoundaryConditions(LauSplineBoundaryType leftBound,
- LauSplineBoundaryType rightBound,
- Double_t dydx0, Double_t dydxn)
+void Lau1DCubicSpline::updateBoundaryConditions( LauSplineBoundaryType leftBound,
+ LauSplineBoundaryType rightBound,
+ Double_t dydx0,
+ Double_t dydxn )
{
- Bool_t updateDerivatives(kFALSE);
-
- if(leftBound_ != leftBound || rightBound_ != rightBound) {
- leftBound_ = leftBound;
- rightBound_ = rightBound;
- updateDerivatives = kTRUE;
- }
-
- if(dydx0_ != dydx0) {
- dydx0_ = dydx0;
- if(leftBound_ == Lau1DCubicSpline::Clamped) updateDerivatives = kTRUE;
- }
-
- if(dydxn_ != dydxn) {
- dydxn_ = dydxn;
- if(rightBound_ == Lau1DCubicSpline::Clamped) updateDerivatives = kTRUE;
- }
-
- if(updateDerivatives) {
- this->calcDerivatives();
- }
+ Bool_t updateDerivatives( kFALSE );
+
+ if ( leftBound_ != leftBound || rightBound_ != rightBound ) {
+ leftBound_ = leftBound;
+ rightBound_ = rightBound;
+ updateDerivatives = kTRUE;
+ }
+
+ if ( dydx0_ != dydx0 ) {
+ dydx0_ = dydx0;
+ if ( leftBound_ == Lau1DCubicSpline::Clamped )
+ updateDerivatives = kTRUE;
+ }
+
+ if ( dydxn_ != dydxn ) {
+ dydxn_ = dydxn;
+ if ( rightBound_ == Lau1DCubicSpline::Clamped )
+ updateDerivatives = kTRUE;
+ }
+
+ if ( updateDerivatives ) {
+ this->calcDerivatives();
+ }
}
void Lau1DCubicSpline::init()
{
- if( y_.size() != x_.size()) {
- std::cout << "ERROR in Lau1DCubicSpline::init : The number of y-values given does not match the number of x-values" << std::endl;
- std::cout << " Found " << y_.size() << ", expected " << x_.size() << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- dydx_.insert(dydx_.begin(),nKnots_,0.);
-
- a_.insert(a_.begin(),nKnots_,0.);
- b_.insert(b_.begin(),nKnots_,0.);
- c_.insert(c_.begin(),nKnots_,0.);
- d_.insert(d_.begin(),nKnots_,0.);
-
- this->calcDerivatives();
+ if ( y_.size() != x_.size() ) {
+ std::cout << "ERROR in Lau1DCubicSpline::init : The number of y-values given does not match the number of x-values"
+ << std::endl;
+ std::cout << " Found " << y_.size() << ", expected "
+ << x_.size() << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ dydx_.insert( dydx_.begin(), nKnots_, 0. );
+
+ a_.insert( a_.begin(), nKnots_, 0. );
+ b_.insert( b_.begin(), nKnots_, 0. );
+ c_.insert( c_.begin(), nKnots_, 0. );
+ d_.insert( d_.begin(), nKnots_, 0. );
+
+ this->calcDerivatives();
}
void Lau1DCubicSpline::calcDerivatives()
{
- switch ( type_ ) {
- case Lau1DCubicSpline::StandardSpline :
- this->calcDerivativesStandard();
- break;
- case Lau1DCubicSpline::AkimaSpline :
- this->calcDerivativesAkima();
- break;
- case Lau1DCubicSpline::LinearInterpolation :
- //derivatives not needed for linear interpolation
- break;
- }
+ switch ( type_ ) {
+ case Lau1DCubicSpline::StandardSpline :
+ this->calcDerivativesStandard();
+ break;
+ case Lau1DCubicSpline::AkimaSpline :
+ this->calcDerivativesAkima();
+ break;
+ case Lau1DCubicSpline::LinearInterpolation :
+ //derivatives not needed for linear interpolation
+ break;
+ }
}
void Lau1DCubicSpline::calcDerivativesStandard()
{
- // derivatives are determined such that the second derivative is continuous at internal knots
-
- // derivatives, k_i, are the solutions to a set of linear equations of the form:
- // a_i * k_i-1 + b_i * k+i + c_i * k_i+1 = d_i with a_0 = 0, c_n-1 = 0
-
- // this is solved using the tridiagonal matrix algorithm as on en.wikipedia.org/wiki/Tridiagonal_matrix_algorithm
-
- // first and last equations give boundary conditions
- // - for natural boundary, require f''(x) = 0 at end knot
- // - for 'not a knot' boundary, require f'''(x) continuous at second knot
- // - for clamped boundary, require predefined value of f'(x) at end knot
-
- // non-zero values of a_0 and c_n-1 would give cyclic boundary conditions
- a_[0] = 0.;
- c_[nKnots_-1] = 0.;
-
- // set left boundary condition
- if(leftBound_ == Lau1DCubicSpline::Natural) {
- b_[0] = 2./(x_[1]-x_[0]);
- c_[0] = 1./(x_[1]-x_[0]);
- d_[0] = 3.*(y_[1]-y_[0])/((x_[1]-x_[0])*(x_[1]-x_[0]));
-
- } else if(leftBound_ == Lau1DCubicSpline::NotAKnot) {
- // define the width, h, and the 'slope', delta, of the first cell
- Double_t h1(x_[1]-x_[0]), h2(x_[2]-x_[0]);
- Double_t delta1((y_[1]-y_[0])/h1), delta2((y_[2]-y_[1])/h2);
-
- // these coefficients can be determined by requiring f'''_0(x_1) = f'''_1(x_1)
- // the requirement f''_0(x_1) = f''_1(x_1) has been used to remove the dependence on k_2
- b_[0] = h2;
- c_[0] = h1+h2;
- d_[0] = delta1*(2.*h2*h2 + 3.*h1*h2)/(h1+h2) + delta2*5.*h1*h1/(h1+h2);
-
- } else { //Clamped
- b_[0] = 1.;
- c_[0] = 0.;
- d_[0] = dydx0_;
- }
-
- // set right boundary condition
- if(rightBound_ == Lau1DCubicSpline::Natural) {
- a_[nKnots_-1] = 1./(x_[nKnots_-1]-x_[nKnots_-2]);
- b_[nKnots_-1] = 2./(x_[nKnots_-1]-x_[nKnots_-2]);
- d_[nKnots_-1] = 3.*(y_[nKnots_-1]-y_[nKnots_-2])/((x_[nKnots_-1]-x_[nKnots_-2])*(x_[nKnots_-1]-x_[nKnots_-2]));
-
- } else if(rightBound_ == Lau1DCubicSpline::NotAKnot) {
- // define the width, h, and the 'slope', delta, of the last cell
- Double_t hnm1(x_[nKnots_-1]-x_[nKnots_-2]), hnm2(x_[nKnots_-2]-x_[nKnots_-3]);
- Double_t deltanm1((y_[nKnots_-1]-y_[nKnots_-2])/hnm1), deltanm2((y_[nKnots_-2]-y_[nKnots_-3])/hnm2);
-
- // these coefficients can be determined by requiring f'''_n-3(x_n-2) = f'''_n-2(x_n-2)
- // the requirement f''_n-3(x_n-2) = f''_n-2(x_n-2) has been used to remove
- // the dependence on k_n-3
- a_[nKnots_-1] = hnm2 + hnm1;
- b_[nKnots_-1] = hnm1;
- d_[nKnots_-1] = deltanm2*hnm1*hnm1/(hnm2+hnm1) + deltanm1*(2.*hnm2*hnm2 + 3.*hnm2*hnm1)/(hnm2+hnm1);
-
- } else { //Clamped
- a_[nKnots_-1] = 0.;
- b_[nKnots_-1] = 1.;
- d_[nKnots_-1] = dydxn_;
- }
-
- // the remaining equations ensure that f_i-1''(x_i) = f''_i(x_i) for all internal knots
- for(UInt_t i=1; i<nKnots_-1; ++i) {
- a_[i] = 1./(x_[i]-x_[i-1]);
- b_[i] = 2./(x_[i]-x_[i-1]) + 2./(x_[i+1]-x_[i]);
- c_[i] = 1./(x_[i+1]-x_[i]);
- d_[i] = 3.*(y_[i]-y_[i-1])/((x_[i]-x_[i-1])*(x_[i]-x_[i-1])) + 3.*(y_[i+1]-y_[i])/((x_[i+1]-x_[i])*(x_[i+1]-x_[i]));
- }
-
- // forward sweep - replace c_i and d_i with
- //
- // c'_i = c_i / b_i for i = 0
- // c_i / (b_i - a_i * c_i-1) otherwise
- //
- // and
- //
- // d'_i = d_i / b_i for i = 0
- // (d_i - a_i * d_i-1) / (b_i - a_i * c_i-1) otherwise
-
- c_[0] /= b_[0];
- d_[0] /= b_[0];
-
- for(UInt_t i=1; i<nKnots_-1; ++i) {
- c_[i] = c_[i] / (b_[i] - a_[i]*c_[i-1]);
- d_[i] = (d_[i] - a_[i]*d_[i-1]) / (b_[i] - a_[i]*c_[i-1]);
- }
-
- d_[nKnots_-1] = (d_[nKnots_-1] - a_[nKnots_-1]*d_[nKnots_-2]) / (b_[nKnots_-1] - a_[nKnots_-1]*c_[nKnots_-2]);
-
- // back substitution - calculate k_i = dy/dx at each knot
- //
- // k_i = d'_i for i = n-1
- // d'_i - c'_i * k_i+1 otherwise
-
- dydx_[nKnots_-1] = d_[nKnots_-1];
-
- for(Int_t i=nKnots_-2; i>=0; --i) {
- dydx_[i] = d_[i] - c_[i]*dydx_[i+1];
- }
+ // derivatives are determined such that the second derivative is continuous at internal knots
+
+ // derivatives, k_i, are the solutions to a set of linear equations of the form:
+ // a_i * k_i-1 + b_i * k+i + c_i * k_i+1 = d_i with a_0 = 0, c_n-1 = 0
+
+ // this is solved using the tridiagonal matrix algorithm as on en.wikipedia.org/wiki/Tridiagonal_matrix_algorithm
+
+ // first and last equations give boundary conditions
+ // - for natural boundary, require f''(x) = 0 at end knot
+ // - for 'not a knot' boundary, require f'''(x) continuous at second knot
+ // - for clamped boundary, require predefined value of f'(x) at end knot
+
+ // non-zero values of a_0 and c_n-1 would give cyclic boundary conditions
+ a_[0] = 0.;
+ c_[nKnots_ - 1] = 0.;
+
+ // set left boundary condition
+ if ( leftBound_ == Lau1DCubicSpline::Natural ) {
+ b_[0] = 2. / ( x_[1] - x_[0] );
+ c_[0] = 1. / ( x_[1] - x_[0] );
+ d_[0] = 3. * ( y_[1] - y_[0] ) / ( ( x_[1] - x_[0] ) * ( x_[1] - x_[0] ) );
+
+ } else if ( leftBound_ == Lau1DCubicSpline::NotAKnot ) {
+ // define the width, h, and the 'slope', delta, of the first cell
+ Double_t h1( x_[1] - x_[0] ), h2( x_[2] - x_[0] );
+ Double_t delta1( ( y_[1] - y_[0] ) / h1 ), delta2( ( y_[2] - y_[1] ) / h2 );
+
+ // these coefficients can be determined by requiring f'''_0(x_1) = f'''_1(x_1)
+ // the requirement f''_0(x_1) = f''_1(x_1) has been used to remove the dependence on k_2
+ b_[0] = h2;
+ c_[0] = h1 + h2;
+ d_[0] = delta1 * ( 2. * h2 * h2 + 3. * h1 * h2 ) / ( h1 + h2 ) +
+ delta2 * 5. * h1 * h1 / ( h1 + h2 );
+
+ } else { //Clamped
+ b_[0] = 1.;
+ c_[0] = 0.;
+ d_[0] = dydx0_;
+ }
+
+ // set right boundary condition
+ if ( rightBound_ == Lau1DCubicSpline::Natural ) {
+ a_[nKnots_ - 1] = 1. / ( x_[nKnots_ - 1] - x_[nKnots_ - 2] );
+ b_[nKnots_ - 1] = 2. / ( x_[nKnots_ - 1] - x_[nKnots_ - 2] );
+ d_[nKnots_ - 1] = 3. * ( y_[nKnots_ - 1] - y_[nKnots_ - 2] ) /
+ ( ( x_[nKnots_ - 1] - x_[nKnots_ - 2] ) *
+ ( x_[nKnots_ - 1] - x_[nKnots_ - 2] ) );
+
+ } else if ( rightBound_ == Lau1DCubicSpline::NotAKnot ) {
+ // define the width, h, and the 'slope', delta, of the last cell
+ Double_t hnm1( x_[nKnots_ - 1] - x_[nKnots_ - 2] ), hnm2( x_[nKnots_ - 2] - x_[nKnots_ - 3] );
+ Double_t deltanm1( ( y_[nKnots_ - 1] - y_[nKnots_ - 2] ) / hnm1 ),
+ deltanm2( ( y_[nKnots_ - 2] - y_[nKnots_ - 3] ) / hnm2 );
+
+ // these coefficients can be determined by requiring f'''_n-3(x_n-2) = f'''_n-2(x_n-2)
+ // the requirement f''_n-3(x_n-2) = f''_n-2(x_n-2) has been used to remove
+ // the dependence on k_n-3
+ a_[nKnots_ - 1] = hnm2 + hnm1;
+ b_[nKnots_ - 1] = hnm1;
+ d_[nKnots_ - 1] = deltanm2 * hnm1 * hnm1 / ( hnm2 + hnm1 ) +
+ deltanm1 * ( 2. * hnm2 * hnm2 + 3. * hnm2 * hnm1 ) / ( hnm2 + hnm1 );
+
+ } else { //Clamped
+ a_[nKnots_ - 1] = 0.;
+ b_[nKnots_ - 1] = 1.;
+ d_[nKnots_ - 1] = dydxn_;
+ }
+
+ // the remaining equations ensure that f_i-1''(x_i) = f''_i(x_i) for all internal knots
+ for ( UInt_t i = 1; i < nKnots_ - 1; ++i ) {
+ a_[i] = 1. / ( x_[i] - x_[i - 1] );
+ b_[i] = 2. / ( x_[i] - x_[i - 1] ) + 2. / ( x_[i + 1] - x_[i] );
+ c_[i] = 1. / ( x_[i + 1] - x_[i] );
+ d_[i] = 3. * ( y_[i] - y_[i - 1] ) / ( ( x_[i] - x_[i - 1] ) * ( x_[i] - x_[i - 1] ) ) +
+ 3. * ( y_[i + 1] - y_[i] ) / ( ( x_[i + 1] - x_[i] ) * ( x_[i + 1] - x_[i] ) );
+ }
+
+ // forward sweep - replace c_i and d_i with
+ //
+ // c'_i = c_i / b_i for i = 0
+ // c_i / (b_i - a_i * c_i-1) otherwise
+ //
+ // and
+ //
+ // d'_i = d_i / b_i for i = 0
+ // (d_i - a_i * d_i-1) / (b_i - a_i * c_i-1) otherwise
+
+ c_[0] /= b_[0];
+ d_[0] /= b_[0];
+
+ for ( UInt_t i = 1; i < nKnots_ - 1; ++i ) {
+ c_[i] = c_[i] / ( b_[i] - a_[i] * c_[i - 1] );
+ d_[i] = ( d_[i] - a_[i] * d_[i - 1] ) / ( b_[i] - a_[i] * c_[i - 1] );
+ }
+
+ d_[nKnots_ - 1] = ( d_[nKnots_ - 1] - a_[nKnots_ - 1] * d_[nKnots_ - 2] ) /
+ ( b_[nKnots_ - 1] - a_[nKnots_ - 1] * c_[nKnots_ - 2] );
+
+ // back substitution - calculate k_i = dy/dx at each knot
+ //
+ // k_i = d'_i for i = n-1
+ // d'_i - c'_i * k_i+1 otherwise
+
+ dydx_[nKnots_ - 1] = d_[nKnots_ - 1];
+
+ for ( Int_t i = nKnots_ - 2; i >= 0; --i ) {
+ dydx_[i] = d_[i] - c_[i] * dydx_[i + 1];
+ }
}
-void Lau1DCubicSpline::calcDerivativesAkima() {
- //derivatives are calculated according to the Akima method
- // J.ACM vol. 17 no. 4 pp 589-602
-
- Double_t am1(0.), an(0.), anp1(0.);
-
- // a[i] is the slope of the segment from point i-1 to point i
- //
- // n.b. segment 0 is before point 0 and segment n is after point n-1
- // internal segments are numbered 1 - n-1
- for(UInt_t i=1; i<nKnots_; ++i) {
- a_[i] = (y_[i]-y_[i-1])/(x_[i]-x_[i-1]);
- }
-
- // calculate slopes between additional points on each end according to the Akima method
- // method assumes that the additional points follow a quadratic defined by the last three points
- // this leads to the relations a[2] - a[1] = a[1] - a[0] = a[0] - a[-1] and a[n-1] - a[n-2] = a[n] - a[n-1] = a[n+1] - a[n]
- a_[0] = 2*a_[1] - a_[2];
- am1 = 2*a_[0] - a_[1];
-
- an = 2*a_[nKnots_-1] - a_[nKnots_-2];
- anp1 = 2*an - a_[nKnots_-1];
-
- // b[i] is the weight of a[i] towards dydx[i]
- // c[i] is the weight of a[i+1] towards dydx[i]
- // See Appendix A of J.ACM vol. 17 no. 4 pp 589-602 for a justification of these weights
- b_[0] = TMath::Abs(a_[1] - a_[0]);
- b_[1] = TMath::Abs(a_[2] - a_[1]);
-
- c_[0] = TMath::Abs(a_[0] - am1 );
- c_[1] = TMath::Abs(a_[1] - a_[0]);
-
- for(UInt_t i=2; i<nKnots_-2; ++i) {
- b_[i] = TMath::Abs(a_[i+2] - a_[i+1]);
- c_[i] = TMath::Abs(a_[i] - a_[i-1]);
- }
-
- b_[nKnots_-2] = TMath::Abs(an - a_[nKnots_-1]);
- b_[nKnots_-1] = TMath::Abs(anp1 - an );
-
- c_[nKnots_-2] = TMath::Abs(a_[nKnots_-2] - a_[nKnots_-3]);
- c_[nKnots_-1] = TMath::Abs(a_[nKnots_-1] - a_[nKnots_-2]);
-
- // dy/dx calculated as the weighted average of a[i] and a[i+1]:
- // dy/dx_i = ( | a_i+2 - a_i+1 | a_i + | a_i - a_i-1 | a_i+1 ) / ( | a_i+2 - a_i+1 | + | a_i - a_i-1 | )
- // in the special case a_i-1 == a_i != a_i+1 == a_i+2 this function is undefined so dy/dx is then defined as (a_i + a_i+1) / 2
- for(UInt_t i=0; i<nKnots_-2; ++i) {
- if(b_[i]==0 && c_[i]==0) {
- dydx_[i] = ( a_[i] + a_[i+1] ) / 2.;
- } else {
- dydx_[i] = ( b_[i] * a_[i] + c_[i] * a_[i+1] ) / ( b_[i] + c_[i] );
- }
- }
-
- if(b_[nKnots_-1]==0 && c_[nKnots_-1]==0) {
- dydx_[nKnots_-1] = ( a_[nKnots_-1] + an ) / 2.;
- } else {
- dydx_[nKnots_-1] = ( b_[nKnots_-1] * a_[nKnots_-1] + c_[nKnots_-1] * an ) / ( b_[nKnots_-1] + c_[nKnots_-1] );
- }
+void Lau1DCubicSpline::calcDerivativesAkima()
+{
+ //derivatives are calculated according to the Akima method
+ // J.ACM vol. 17 no. 4 pp 589-602
+
+ Double_t am1( 0. ), an( 0. ), anp1( 0. );
+
+ // a[i] is the slope of the segment from point i-1 to point i
+ //
+ // n.b. segment 0 is before point 0 and segment n is after point n-1
+ // internal segments are numbered 1 - n-1
+ for ( UInt_t i = 1; i < nKnots_; ++i ) {
+ a_[i] = ( y_[i] - y_[i - 1] ) / ( x_[i] - x_[i - 1] );
+ }
+
+ // calculate slopes between additional points on each end according to the Akima method
+ // method assumes that the additional points follow a quadratic defined by the last three points
+ // this leads to the relations a[2] - a[1] = a[1] - a[0] = a[0] - a[-1] and a[n-1] - a[n-2] = a[n] - a[n-1] = a[n+1] - a[n]
+ a_[0] = 2 * a_[1] - a_[2];
+ am1 = 2 * a_[0] - a_[1];
+
+ an = 2 * a_[nKnots_ - 1] - a_[nKnots_ - 2];
+ anp1 = 2 * an - a_[nKnots_ - 1];
+
+ // b[i] is the weight of a[i] towards dydx[i]
+ // c[i] is the weight of a[i+1] towards dydx[i]
+ // See Appendix A of J.ACM vol. 17 no. 4 pp 589-602 for a justification of these weights
+ b_[0] = TMath::Abs( a_[1] - a_[0] );
+ b_[1] = TMath::Abs( a_[2] - a_[1] );
+
+ c_[0] = TMath::Abs( a_[0] - am1 );
+ c_[1] = TMath::Abs( a_[1] - a_[0] );
+
+ for ( UInt_t i = 2; i < nKnots_ - 2; ++i ) {
+ b_[i] = TMath::Abs( a_[i + 2] - a_[i + 1] );
+ c_[i] = TMath::Abs( a_[i] - a_[i - 1] );
+ }
+
+ b_[nKnots_ - 2] = TMath::Abs( an - a_[nKnots_ - 1] );
+ b_[nKnots_ - 1] = TMath::Abs( anp1 - an );
+
+ c_[nKnots_ - 2] = TMath::Abs( a_[nKnots_ - 2] - a_[nKnots_ - 3] );
+ c_[nKnots_ - 1] = TMath::Abs( a_[nKnots_ - 1] - a_[nKnots_ - 2] );
+
+ // dy/dx calculated as the weighted average of a[i] and a[i+1]:
+ // dy/dx_i = ( | a_i+2 - a_i+1 | a_i + | a_i - a_i-1 | a_i+1 ) / ( | a_i+2 - a_i+1 | + | a_i - a_i-1 | )
+ // in the special case a_i-1 == a_i != a_i+1 == a_i+2 this function is undefined so dy/dx is then defined as (a_i + a_i+1) / 2
+ for ( UInt_t i = 0; i < nKnots_ - 2; ++i ) {
+ if ( b_[i] == 0 && c_[i] == 0 ) {
+ dydx_[i] = ( a_[i] + a_[i + 1] ) / 2.;
+ } else {
+ dydx_[i] = ( b_[i] * a_[i] + c_[i] * a_[i + 1] ) / ( b_[i] + c_[i] );
+ }
+ }
+
+ if ( b_[nKnots_ - 1] == 0 && c_[nKnots_ - 1] == 0 ) {
+ dydx_[nKnots_ - 1] = ( a_[nKnots_ - 1] + an ) / 2.;
+ } else {
+ dydx_[nKnots_ - 1] = ( b_[nKnots_ - 1] * a_[nKnots_ - 1] + c_[nKnots_ - 1] * an ) /
+ ( b_[nKnots_ - 1] + c_[nKnots_ - 1] );
+ }
}
diff --git a/src/Lau1DHistPdf.cc b/src/Lau1DHistPdf.cc
index 0d34fe8..e8085d5 100644
--- a/src/Lau1DHistPdf.cc
+++ b/src/Lau1DHistPdf.cc
@@ -1,266 +1,274 @@
/*
Copyright 2006 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file Lau1DHistPdf.cc
\brief File containing implementation of Lau1DHistPdf class.
*/
-#include <cstdlib>
-#include <iostream>
-#include <vector>
+#include "Lau1DHistPdf.hh"
+
+#include "LauRandom.hh"
#include "TAxis.h"
#include "TH1.h"
#include "TRandom.h"
#include "TSystem.h"
-#include "Lau1DHistPdf.hh"
-#include "LauRandom.hh"
+#include <cstdlib>
+#include <iostream>
+#include <vector>
class LauParameter;
-
-
-Lau1DHistPdf::Lau1DHistPdf(const TString& theVarName, const TH1* hist, Double_t minAbscissa, Double_t maxAbscissa,
- Bool_t useInterpolation, Bool_t fluctuateBins) :
- LauAbsPdf(theVarName, std::vector<LauAbsRValue*>(), minAbscissa, maxAbscissa),
- hist_(hist ? dynamic_cast<TH1*>(hist->Clone()) : 0),
- useInterpolation_(useInterpolation),
- fluctuateBins_(fluctuateBins),
- nBins_(0),
- axisMin_(0.0),
- axisMax_(0.0),
- axisRange_(0.0)
+Lau1DHistPdf::Lau1DHistPdf( const TString& theVarName,
+ const TH1* hist,
+ Double_t minAbscissa,
+ Double_t maxAbscissa,
+ Bool_t useInterpolation,
+ Bool_t fluctuateBins ) :
+ LauAbsPdf( theVarName, std::vector<LauAbsRValue*>(), minAbscissa, maxAbscissa ),
+ hist_( hist ? dynamic_cast<TH1*>( hist->Clone() ) : 0 ),
+ useInterpolation_( useInterpolation ),
+ fluctuateBins_( fluctuateBins ),
+ nBins_( 0 ),
+ axisMin_( 0.0 ),
+ axisMax_( 0.0 ),
+ axisRange_( 0.0 )
{
- // Constructor
-
- // Set the directory for the histogram
- hist_->SetDirectory(0);
-
- // Save various attributes of the histogram
- nBins_ = hist_->GetNbinsX();
- TAxis* xAxis = hist_->GetXaxis();
- axisMin_ = xAxis->GetXmin();
- axisMax_ = xAxis->GetXmax();
- axisRange_ = axisMax_ - axisMin_;
-
- // Check that axis range corresponds to range of abscissa
- if (TMath::Abs(this->getMinAbscissa() - axisMin_)>1e-6) {
- std::cerr << "ERROR in Lau1DHistPdf::Lau1DHistPdf : Histogram axis minimum: " << axisMin_ <<
- " does not correspond to abscissa minimum: " << this->getMinAbscissa() << "." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- if (TMath::Abs(this->getMaxAbscissa() - axisMax_)>1e-6) {
- std::cerr << "ERROR in Lau1DHistPdf::Lau1DHistPdf : Histogram axis maximum: " << axisMax_ <<
- " does not correspond to abscissa maximum: " << this->getMaxAbscissa() << "." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // If the bins are to be fluctuated then do so now before
- // calculating anything that depends on the bin content.
- if (fluctuateBins) {
- this->doBinFluctuation();
- }
-
- // Calculate the PDF normalisation.
- this->calcNorm();
-
- // And check it is OK.
- this->checkNormalisation();
+ // Constructor
+
+ // Set the directory for the histogram
+ hist_->SetDirectory( 0 );
+
+ // Save various attributes of the histogram
+ nBins_ = hist_->GetNbinsX();
+ TAxis* xAxis = hist_->GetXaxis();
+ axisMin_ = xAxis->GetXmin();
+ axisMax_ = xAxis->GetXmax();
+ axisRange_ = axisMax_ - axisMin_;
+
+ // Check that axis range corresponds to range of abscissa
+ if ( TMath::Abs( this->getMinAbscissa() - axisMin_ ) > 1e-6 ) {
+ std::cerr << "ERROR in Lau1DHistPdf::Lau1DHistPdf : Histogram axis minimum: " << axisMin_
+ << " does not correspond to abscissa minimum: " << this->getMinAbscissa() << "."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ if ( TMath::Abs( this->getMaxAbscissa() - axisMax_ ) > 1e-6 ) {
+ std::cerr << "ERROR in Lau1DHistPdf::Lau1DHistPdf : Histogram axis maximum: " << axisMax_
+ << " does not correspond to abscissa maximum: " << this->getMaxAbscissa() << "."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // If the bins are to be fluctuated then do so now before
+ // calculating anything that depends on the bin content.
+ if ( fluctuateBins ) {
+ this->doBinFluctuation();
+ }
+
+ // Calculate the PDF normalisation.
+ this->calcNorm();
+
+ // And check it is OK.
+ this->checkNormalisation();
}
Lau1DHistPdf::~Lau1DHistPdf()
{
- // Destructor
- delete hist_; hist_ = 0;
+ // Destructor
+ delete hist_;
+ hist_ = 0;
}
void Lau1DHistPdf::calcPDFHeight( const LauKinematics* /*kinematics*/ )
{
- if (this->heightUpToDate()) {
- return;
- }
-
- // Get the maximum height of the histogram
- Int_t maxBin = hist_->GetMaximumBin();
- Double_t height = hist_->GetBinContent(maxBin);
- this->setMaxHeight(height);
+ if ( this->heightUpToDate() ) {
+ return;
+ }
+
+ // Get the maximum height of the histogram
+ Int_t maxBin = hist_->GetMaximumBin();
+ Double_t height = hist_->GetBinContent( maxBin );
+ this->setMaxHeight( height );
}
void Lau1DHistPdf::calcNorm()
{
- // Calculate the histogram normalisation.
+ // Calculate the histogram normalisation.
- // Loop over the range to get the total area.
- // Just sum the contributions up using 1e-3 increments of the range.
- // Multiply the end result by dx.
+ // Loop over the range to get the total area.
+ // Just sum the contributions up using 1e-3 increments of the range.
+ // Multiply the end result by dx.
- Double_t dx(1e-3*axisRange_);
- Double_t area(0.0);
+ Double_t dx( 1e-3 * axisRange_ );
+ Double_t area( 0.0 );
- Double_t x(axisMin_ + dx/2.0);
- while (x > axisMin_ && x < axisMax_) {
- area += this->interpolate(x);
- x += dx;
- }
+ Double_t x( axisMin_ + dx / 2.0 );
+ while ( x > axisMin_ && x < axisMax_ ) {
+ area += this->interpolate( x );
+ x += dx;
+ }
- Double_t norm = area*dx;
- this->setNorm(norm);
+ Double_t norm = area * dx;
+ this->setNorm( norm );
}
void Lau1DHistPdf::checkNormalisation()
{
- Double_t dx(1e-3*axisRange_);
- Double_t area(0.0);
- Double_t areaNoNorm(0.0);
-
- const Bool_t useInterpolationOrig { useInterpolation_ };
-
- Double_t x(axisMin_ + dx/2.0);
- while (x > axisMin_ && x < axisMax_) {
- area += this->interpolateNorm(x);
- useInterpolation_ = kFALSE;
- areaNoNorm += this->interpolate(x);
- useInterpolation_ = useInterpolationOrig;
- x += dx;
- }
- Double_t norm = area*dx;
-
- std::cout << "INFO in Lau1DHistPdf::checkNormalisation : Area = " << area << ", dx = " << dx << std::endl;
- std::cout << " : Area with no norm = " << areaNoNorm << "*dx = " << areaNoNorm*dx << std::endl;
- std::cout << " : The total area of the normalised histogram PDF is " << norm << std::endl;
+ Double_t dx( 1e-3 * axisRange_ );
+ Double_t area( 0.0 );
+ Double_t areaNoNorm( 0.0 );
+
+ const Bool_t useInterpolationOrig { useInterpolation_ };
+
+ Double_t x( axisMin_ + dx / 2.0 );
+ while ( x > axisMin_ && x < axisMax_ ) {
+ area += this->interpolateNorm( x );
+ useInterpolation_ = kFALSE;
+ areaNoNorm += this->interpolate( x );
+ useInterpolation_ = useInterpolationOrig;
+ x += dx;
+ }
+ Double_t norm = area * dx;
+
+ std::cout << "INFO in Lau1DHistPdf::checkNormalisation : Area = " << area << ", dx = " << dx
+ << std::endl;
+ std::cout << " : Area with no norm = " << areaNoNorm
+ << "*dx = " << areaNoNorm * dx << std::endl;
+ std::cout << " : The total area of the normalised histogram PDF is "
+ << norm << std::endl;
}
-Double_t Lau1DHistPdf::getBinHistValue(Int_t bin) const
+Double_t Lau1DHistPdf::getBinHistValue( Int_t bin ) const
{
- // Check that bin is in range [1 , nBins_]
- if ((bin < 1) || (bin > nBins_)) {
- return 0.0;
- }
- Double_t value = static_cast<Double_t>(hist_->GetBinContent(bin));
- // protect against negative values
- if ( value < 0.0 ) {
- std::cerr << "WARNING in Lau1DHistPdf::getBinHistValue : Negative bin content set to zero!" << std::endl;
- value = 0.0;
- }
- return value;
+ // Check that bin is in range [1 , nBins_]
+ if ( ( bin < 1 ) || ( bin > nBins_ ) ) {
+ return 0.0;
+ }
+ Double_t value = static_cast<Double_t>( hist_->GetBinContent( bin ) );
+ // protect against negative values
+ if ( value < 0.0 ) {
+ std::cerr << "WARNING in Lau1DHistPdf::getBinHistValue : Negative bin content set to zero!"
+ << std::endl;
+ value = 0.0;
+ }
+ return value;
}
-Double_t Lau1DHistPdf::interpolateNorm(Double_t x) const
+Double_t Lau1DHistPdf::interpolateNorm( Double_t x ) const
{
- // Get the normalised interpolated value.
- Double_t value = this->interpolate(x);
- Double_t norm = this->getNorm();
- return value/norm;
+ // Get the normalised interpolated value.
+ Double_t value = this->interpolate( x );
+ Double_t norm = this->getNorm();
+ return value / norm;
}
-void Lau1DHistPdf::calcLikelihoodInfo(const LauAbscissas& abscissas)
+void Lau1DHistPdf::calcLikelihoodInfo( const LauAbscissas& abscissas )
{
- // Check that the given abscissa is within the allowed range
- if (!this->checkRange(abscissas)) {
- gSystem->Exit(EXIT_FAILURE);
- }
+ // Check that the given abscissa is within the allowed range
+ if ( ! this->checkRange( abscissas ) ) {
+ gSystem->Exit( EXIT_FAILURE );
+ }
- // Get our abscissa
- Double_t abscissa = abscissas[0];
+ // Get our abscissa
+ Double_t abscissa = abscissas[0];
- // Calculate the interpolated value
- Double_t value = this->interpolate(abscissa);
- this->setUnNormPDFVal(value);
+ // Calculate the interpolated value
+ Double_t value = this->interpolate( abscissa );
+ this->setUnNormPDFVal( value );
}
-Double_t Lau1DHistPdf::interpolate(Double_t x) const
+Double_t Lau1DHistPdf::interpolate( Double_t x ) const
{
- // This function returns the interpolated value of the histogram function
- // for the given value of x by finding the adjacent bins and extrapolating
- // using weights based on the inverse distance of the point from the adajcent
- // bin centres.
-
- // Find the histogram bin
- Int_t bin = hist_->FindFixBin(x);
+ // This function returns the interpolated value of the histogram function
+ // for the given value of x by finding the adjacent bins and extrapolating
+ // using weights based on the inverse distance of the point from the adajcent
+ // bin centres.
- // Ask whether we want to do the interpolation, since this method is
- // not reliable for low statistics histograms.
- if (useInterpolation_ == kFALSE) {
- return this->getBinHistValue(bin);
- }
+ // Find the histogram bin
+ Int_t bin = hist_->FindFixBin( x );
- // Find the bin centres (actual co-ordinate positions, not histogram indices)
- Double_t cbinx = hist_->GetBinCenter(bin);
+ // Ask whether we want to do the interpolation, since this method is
+ // not reliable for low statistics histograms.
+ if ( useInterpolation_ == kFALSE ) {
+ return this->getBinHistValue( bin );
+ }
- // Find the adjacent bins
- Double_t deltax = x - cbinx;
+ // Find the bin centres (actual co-ordinate positions, not histogram indices)
+ Double_t cbinx = hist_->GetBinCenter( bin );
- Int_t bin_adj(0);
- if (deltax > 0.0) {
- bin_adj = bin + 1;
- } else {
- bin_adj = bin - 1;
- }
+ // Find the adjacent bins
+ Double_t deltax = x - cbinx;
+ Int_t bin_adj( 0 );
+ if ( deltax > 0.0 ) {
+ bin_adj = bin + 1;
+ } else {
+ bin_adj = bin - 1;
+ }
- Bool_t isBoundary(kFALSE);
- if ( bin_adj > nBins_ || bin_adj < 1 ) {
- isBoundary = kTRUE;
- }
+ Bool_t isBoundary( kFALSE );
+ if ( bin_adj > nBins_ || bin_adj < 1 ) {
+ isBoundary = kTRUE;
+ }
- // At the edges, do no interpolation, use entry in bin.
- if (isBoundary == kTRUE) {
- return this->getBinHistValue(bin);
- }
+ // At the edges, do no interpolation, use entry in bin.
+ if ( isBoundary == kTRUE ) {
+ return this->getBinHistValue( bin );
+ }
- // Linear interpolation using inverse distance as weights.
- // Find the adjacent bin centre
- Double_t cbinx_adj = hist_->GetBinCenter(bin_adj);
- Double_t deltax_adj = cbinx_adj - x;
+ // Linear interpolation using inverse distance as weights.
+ // Find the adjacent bin centre
+ Double_t cbinx_adj = hist_->GetBinCenter( bin_adj );
+ Double_t deltax_adj = cbinx_adj - x;
- Double_t dx0 = TMath::Abs(deltax);
- Double_t dx1 = TMath::Abs(deltax_adj);
+ Double_t dx0 = TMath::Abs( deltax );
+ Double_t dx1 = TMath::Abs( deltax_adj );
- Double_t denom = dx0 + dx1;
+ Double_t denom = dx0 + dx1;
- Double_t value0 = this->getBinHistValue(bin);
- Double_t value1 = this->getBinHistValue(bin_adj);
+ Double_t value0 = this->getBinHistValue( bin );
+ Double_t value1 = this->getBinHistValue( bin_adj );
- Double_t value = value0*dx1 + value1*dx0;
- value /= denom;
+ Double_t value = value0 * dx1 + value1 * dx0;
+ value /= denom;
- return value;
+ return value;
}
void Lau1DHistPdf::doBinFluctuation()
{
- TRandom* random = LauRandom::randomFun();
- for (Int_t bin(0); bin<nBins_; bin++) {
- Double_t currentContent = hist_->GetBinContent(bin+1);
- Double_t currentError = hist_->GetBinError(bin+1);
- Double_t newContent = random->Gaus(currentContent,currentError);
- if (newContent<0.0) {
- hist_->SetBinContent(bin+1,0.0);
- } else {
- hist_->SetBinContent(bin+1,newContent);
- }
- }
+ TRandom* random = LauRandom::randomFun();
+ for ( Int_t bin( 0 ); bin < nBins_; bin++ ) {
+ Double_t currentContent = hist_->GetBinContent( bin + 1 );
+ Double_t currentError = hist_->GetBinError( bin + 1 );
+ Double_t newContent = random->Gaus( currentContent, currentError );
+ if ( newContent < 0.0 ) {
+ hist_->SetBinContent( bin + 1, 0.0 );
+ } else {
+ hist_->SetBinContent( bin + 1, newContent );
+ }
+ }
}
-
diff --git a/src/Lau2DAbsHistDP.cc b/src/Lau2DAbsHistDP.cc
index da6e84a..922fcf5 100644
--- a/src/Lau2DAbsHistDP.cc
+++ b/src/Lau2DAbsHistDP.cc
@@ -1,194 +1,195 @@
/*
Copyright 2013 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file Lau2DAbsHistDP.cc
\brief File containing implementation of Lau2DAbsHistDP class.
*/
-#include <iostream>
-
-#include "TAxis.h"
-#include "TH2.h"
-#include "TRandom.h"
-#include "TSystem.h"
-
#include "Lau2DAbsHistDP.hh"
+
#include "LauBifurcatedGaussPdf.hh"
#include "LauDaughters.hh"
#include "LauKinematics.hh"
#include "LauRandom.hh"
+#include "TAxis.h"
+#include "TH2.h"
+#include "TRandom.h"
+#include "TSystem.h"
+#include <iostream>
-Lau2DAbsHistDP::Lau2DAbsHistDP(const LauDaughters* daughters, Bool_t useUpperHalfOnly, Bool_t squareDP) :
- kinematics_( (daughters!=0) ? daughters->getKinematics() : 0 ),
- upperHalf_(useUpperHalfOnly),
- squareDP_(squareDP)
+Lau2DAbsHistDP::Lau2DAbsHistDP( const LauDaughters* daughters,
+ Bool_t useUpperHalfOnly,
+ Bool_t squareDP ) :
+ kinematics_( ( daughters != 0 ) ? daughters->getKinematics() : 0 ),
+ upperHalf_( useUpperHalfOnly ),
+ squareDP_( squareDP )
{
- if ( squareDP && ! daughters->squareDP() ) {
- // The histogram provided is defined in the square DP but the
- // kinematics object has calculation of the square DP
- // co-ordinates disabled, so need to enable it,
- // which requires a bit of a unpleasant const_cast
- std::cerr << "WARNING in Lau2DAbsHistDP constructor : forcing kinematics to calculate the required square DP co-ordinates" << std::endl;
- LauKinematics* kine = const_cast<LauKinematics*>( kinematics_ );
- kine->squareDP(kTRUE);
- }
+ if ( squareDP && ! daughters->squareDP() ) {
+ // The histogram provided is defined in the square DP but the
+ // kinematics object has calculation of the square DP
+ // co-ordinates disabled, so need to enable it,
+ // which requires a bit of a unpleasant const_cast
+ std::cerr << "WARNING in Lau2DAbsHistDP constructor : forcing kinematics to calculate the required square DP co-ordinates"
+ << std::endl;
+ LauKinematics* kine = const_cast<LauKinematics*>( kinematics_ );
+ kine->squareDP( kTRUE );
+ }
}
Lau2DAbsHistDP::~Lau2DAbsHistDP()
{
}
-void Lau2DAbsHistDP::doBinFluctuation(TH2* hist)
+void Lau2DAbsHistDP::doBinFluctuation( TH2* hist )
{
- TRandom* random = LauRandom::randomFun();
-
- Int_t nBinsX = static_cast<Int_t>(hist->GetNbinsX());
- Int_t nBinsY = static_cast<Int_t>(hist->GetNbinsY());
-
- for (Int_t i(0); i<nBinsX; ++i) {
- for (Int_t j(0); j<nBinsY; ++j) {
- Double_t currentContent = hist->GetBinContent(i+1,j+1);
- Double_t currentError = hist->GetBinError(i+1,j+1);
- Double_t newContent = random->Gaus(currentContent,currentError);
- if (newContent<0.0) {
- hist->SetBinContent(i+1,j+1,0.0);
- } else {
- hist->SetBinContent(i+1,j+1,newContent);
- }
- }
- }
+ TRandom* random = LauRandom::randomFun();
+
+ Int_t nBinsX = static_cast<Int_t>( hist->GetNbinsX() );
+ Int_t nBinsY = static_cast<Int_t>( hist->GetNbinsY() );
+
+ for ( Int_t i( 0 ); i < nBinsX; ++i ) {
+ for ( Int_t j( 0 ); j < nBinsY; ++j ) {
+ Double_t currentContent = hist->GetBinContent( i + 1, j + 1 );
+ Double_t currentError = hist->GetBinError( i + 1, j + 1 );
+ Double_t newContent = random->Gaus( currentContent, currentError );
+ if ( newContent < 0.0 ) {
+ hist->SetBinContent( i + 1, j + 1, 0.0 );
+ } else {
+ hist->SetBinContent( i + 1, j + 1, newContent );
+ }
+ }
+ }
}
-void Lau2DAbsHistDP::doBinFluctuation(TH2* hist, const TH2* errorHi, const TH2* errorLo)
+void Lau2DAbsHistDP::doBinFluctuation( TH2* hist, const TH2* errorHi, const TH2* errorLo )
{
- LauParameter* mean = new LauParameter("mean", 0.5, 0.0, 1.0, kFALSE);
- LauParameter* sigL = new LauParameter("sigmaL", 0.5, 0.0, 1.0, kFALSE);
- LauParameter* sigR = new LauParameter("sigmaR", 0.5, 0.0, 1.0, kFALSE);
+ LauParameter* mean = new LauParameter( "mean", 0.5, 0.0, 1.0, kFALSE );
+ LauParameter* sigL = new LauParameter( "sigmaL", 0.5, 0.0, 1.0, kFALSE );
+ LauParameter* sigR = new LauParameter( "sigmaR", 0.5, 0.0, 1.0, kFALSE );
- std::vector<LauAbsRValue*> pars(3);
- pars[0] = mean;
- pars[1] = sigL;
- pars[2] = sigR;
+ std::vector<LauAbsRValue*> pars( 3 );
+ pars[0] = mean;
+ pars[1] = sigL;
+ pars[2] = sigR;
- const TString varName("tmp");
+ const TString varName( "tmp" );
- Int_t nBinsX = static_cast<Int_t>(hist->GetNbinsX());
- Int_t nBinsY = static_cast<Int_t>(hist->GetNbinsY());
+ Int_t nBinsX = static_cast<Int_t>( hist->GetNbinsX() );
+ Int_t nBinsY = static_cast<Int_t>( hist->GetNbinsY() );
- LauFitData genData;
+ LauFitData genData;
- for (Int_t i(0); i<nBinsX; ++i) {
- for (Int_t j(0); j<nBinsY; ++j) {
- const Double_t currentContent = hist->GetBinContent(i+1,j+1);
- const Double_t currentErrorLo = errorLo->GetBinContent(i+1,j+1);
- const Double_t currentErrorHi = errorHi->GetBinContent(i+1,j+1);
+ for ( Int_t i( 0 ); i < nBinsX; ++i ) {
+ for ( Int_t j( 0 ); j < nBinsY; ++j ) {
+ const Double_t currentContent = hist->GetBinContent( i + 1, j + 1 );
+ const Double_t currentErrorLo = errorLo->GetBinContent( i + 1, j + 1 );
+ const Double_t currentErrorHi = errorHi->GetBinContent( i + 1, j + 1 );
- mean->value( currentContent );
- sigL->value( currentErrorLo );
- sigR->value( currentErrorHi );
+ mean->value( currentContent );
+ sigL->value( currentErrorLo );
+ sigR->value( currentErrorHi );
- const Double_t minVal = TMath::Max( 0.0, currentContent-5.0*currentErrorLo );
- const Double_t maxVal = TMath::Min( 1.0, currentContent+5.0*currentErrorHi );
+ const Double_t minVal = TMath::Max( 0.0, currentContent - 5.0 * currentErrorLo );
+ const Double_t maxVal = TMath::Min( 1.0, currentContent + 5.0 * currentErrorHi );
- LauBifurcatedGaussPdf bfgaus(varName, pars, minVal, maxVal);
- bfgaus.heightUpToDate(kFALSE);
- genData = bfgaus.generate(0);
+ LauBifurcatedGaussPdf bfgaus( varName, pars, minVal, maxVal );
+ bfgaus.heightUpToDate( kFALSE );
+ genData = bfgaus.generate( 0 );
- const Double_t newContent = genData[varName];
+ const Double_t newContent = genData[varName];
- hist->SetBinContent(i+1,j+1,newContent);
- }
- }
+ hist->SetBinContent( i + 1, j + 1, newContent );
+ }
+ }
- delete pars[0];
- delete pars[1];
- delete pars[2];
- pars.clear();
+ delete pars[0];
+ delete pars[1];
+ delete pars[2];
+ pars.clear();
}
-void Lau2DAbsHistDP::raiseOrLowerBins(TH2* hist, const Double_t avEff, const Double_t avEffError)
+void Lau2DAbsHistDP::raiseOrLowerBins( TH2* hist, const Double_t avEff, const Double_t avEffError )
{
- TRandom* random = LauRandom::randomFun();
+ TRandom* random = LauRandom::randomFun();
- Double_t curAvg = this->computeAverageContents(hist);
- Double_t newAvg = random->Gaus(avEff,avEffError);
+ Double_t curAvg = this->computeAverageContents( hist );
+ Double_t newAvg = random->Gaus( avEff, avEffError );
- hist->Scale( newAvg / curAvg );
+ hist->Scale( newAvg / curAvg );
}
-Double_t Lau2DAbsHistDP::computeAverageContents(const TH2* hist) const
+Double_t Lau2DAbsHistDP::computeAverageContents( const TH2* hist ) const
{
- Double_t totalContent(0.0);
- Int_t binsWithinDPBoundary(0);
-
- Int_t nBinsX = static_cast<Int_t>(hist->GetNbinsX());
- Int_t nBinsY = static_cast<Int_t>(hist->GetNbinsY());
-
- // Loop through the bins and include any that have their centre or any
- // of the four corners within the kinematic boundary
- for ( Int_t i(0); i<nBinsX; ++i ) {
- Double_t binXCentre = hist->GetXaxis()->GetBinCenter(i+1);
- Double_t binXLowerEdge = hist->GetXaxis()->GetBinLowEdge(i+1);
- Double_t binXUpperEdge = hist->GetXaxis()->GetBinUpEdge(i+1);
-
- for ( Int_t j(0); j<nBinsY; ++j ) {
- Double_t binYCentre = hist->GetYaxis()->GetBinCenter(i+1);
- Double_t binYLowerEdge = hist->GetYaxis()->GetBinLowEdge(i+1);
- Double_t binYUpperEdge = hist->GetYaxis()->GetBinUpEdge(i+1);
-
- if ( this->withinDPBoundaries( binXCentre, binYCentre ) ||
- this->withinDPBoundaries( binXLowerEdge, binYLowerEdge ) ||
- this->withinDPBoundaries( binXUpperEdge, binYUpperEdge ) ||
- this->withinDPBoundaries( binXLowerEdge, binYUpperEdge ) ||
- this->withinDPBoundaries( binXUpperEdge, binYLowerEdge ) ) {
-
- totalContent += hist->GetBinContent(i+1, j+1);
- ++binsWithinDPBoundary;
- }
- }
- }
-
- return totalContent/binsWithinDPBoundary;
+ Double_t totalContent( 0.0 );
+ Int_t binsWithinDPBoundary( 0 );
+
+ Int_t nBinsX = static_cast<Int_t>( hist->GetNbinsX() );
+ Int_t nBinsY = static_cast<Int_t>( hist->GetNbinsY() );
+
+ // Loop through the bins and include any that have their centre or any
+ // of the four corners within the kinematic boundary
+ for ( Int_t i( 0 ); i < nBinsX; ++i ) {
+ Double_t binXCentre = hist->GetXaxis()->GetBinCenter( i + 1 );
+ Double_t binXLowerEdge = hist->GetXaxis()->GetBinLowEdge( i + 1 );
+ Double_t binXUpperEdge = hist->GetXaxis()->GetBinUpEdge( i + 1 );
+
+ for ( Int_t j( 0 ); j < nBinsY; ++j ) {
+ Double_t binYCentre = hist->GetYaxis()->GetBinCenter( i + 1 );
+ Double_t binYLowerEdge = hist->GetYaxis()->GetBinLowEdge( i + 1 );
+ Double_t binYUpperEdge = hist->GetYaxis()->GetBinUpEdge( i + 1 );
+
+ if ( this->withinDPBoundaries( binXCentre, binYCentre ) ||
+ this->withinDPBoundaries( binXLowerEdge, binYLowerEdge ) ||
+ this->withinDPBoundaries( binXUpperEdge, binYUpperEdge ) ||
+ this->withinDPBoundaries( binXLowerEdge, binYUpperEdge ) ||
+ this->withinDPBoundaries( binXUpperEdge, binYLowerEdge ) ) {
+
+ totalContent += hist->GetBinContent( i + 1, j + 1 );
+ ++binsWithinDPBoundary;
+ }
+ }
+ }
+
+ return totalContent / binsWithinDPBoundary;
}
-Bool_t Lau2DAbsHistDP::withinDPBoundaries(Double_t x, Double_t y) const
+Bool_t Lau2DAbsHistDP::withinDPBoundaries( Double_t x, Double_t y ) const
{
- return squareDP_ ? kinematics_->withinSqDPLimits(x,y) : kinematics_->withinDPLimits(x,y);
+ return squareDP_ ? kinematics_->withinSqDPLimits( x, y ) : kinematics_->withinDPLimits( x, y );
}
-void Lau2DAbsHistDP::getUpperHalf(Double_t& x, Double_t& y) const
+void Lau2DAbsHistDP::getUpperHalf( Double_t& x, Double_t& y ) const
{
- if ( upperHalf_ == kTRUE ) {
- if ( squareDP_ == kFALSE && x > y ) {
- Double_t temp = y;
- y = x;
- x = temp;
- } else if ( squareDP_ == kTRUE && y > 0.5 ) {
- y = 1.0 - y;
- }
- }
+ if ( upperHalf_ == kTRUE ) {
+ if ( squareDP_ == kFALSE && x > y ) {
+ Double_t temp = y;
+ y = x;
+ x = temp;
+ } else if ( squareDP_ == kTRUE && y > 0.5 ) {
+ y = 1.0 - y;
+ }
+ }
}
-
diff --git a/src/Lau2DAbsHistDPPdf.cc b/src/Lau2DAbsHistDPPdf.cc
index fec3c57..3b3bfb2 100644
--- a/src/Lau2DAbsHistDPPdf.cc
+++ b/src/Lau2DAbsHistDPPdf.cc
@@ -1,123 +1,127 @@
/*
Copyright 2014 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file Lau2DAbsHistDPPdf.cc
\brief File containing implementation of Lau2DAbsHistDPPdf class.
*/
-#include <iostream>
-
-#include "TAxis.h"
-#include "TH2.h"
-#include "TRandom.h"
-
#include "Lau2DAbsHistDPPdf.hh"
+
#include "LauKinematics.hh"
#include "LauRandom.hh"
#include "LauVetoes.hh"
+#include "TAxis.h"
+#include "TH2.h"
+#include "TRandom.h"
+#include <iostream>
-Lau2DAbsHistDPPdf::Lau2DAbsHistDPPdf(LauKinematics* kinematics, const LauVetoes* vetoes,
- Bool_t useUpperHalfOnly, Bool_t squareDP) :
- kinematics_(kinematics),
- vetoes_(vetoes),
- upperHalf_(useUpperHalfOnly),
- squareDP_(squareDP)
+Lau2DAbsHistDPPdf::Lau2DAbsHistDPPdf( LauKinematics* kinematics,
+ const LauVetoes* vetoes,
+ Bool_t useUpperHalfOnly,
+ Bool_t squareDP ) :
+ kinematics_( kinematics ),
+ vetoes_( vetoes ),
+ upperHalf_( useUpperHalfOnly ),
+ squareDP_( squareDP )
{
- if ( squareDP && ! kinematics->squareDP() ) {
- // The histogram provided is defined in the square DP but the
- // kinematics object has calculation of the square DP
- // co-ordinates disabled, so need to enable it,
- std::cerr << "WARNING in Lau2DAbsHistDPPdf constructor : forcing kinematics to calculate the required square DP co-ordinates" << std::endl;
- kinematics->squareDP(kTRUE);
- }
+ if ( squareDP && ! kinematics->squareDP() ) {
+ // The histogram provided is defined in the square DP but the
+ // kinematics object has calculation of the square DP
+ // co-ordinates disabled, so need to enable it,
+ std::cerr << "WARNING in Lau2DAbsHistDPPdf constructor : forcing kinematics to calculate the required square DP co-ordinates"
+ << std::endl;
+ kinematics->squareDP( kTRUE );
+ }
}
Lau2DAbsHistDPPdf::~Lau2DAbsHistDPPdf()
{
}
-void Lau2DAbsHistDPPdf::calcMaxHeight(TH2* hist)
+void Lau2DAbsHistDPPdf::calcMaxHeight( TH2* hist )
{
- // Get the maximum height of the 2D histogram
- maxHeight_ = 1.0;
- if ( hist ) {
- Int_t maxBin = hist->GetMaximumBin();
- maxHeight_ = hist->GetBinContent(maxBin);
- }
-
- std::cout << "INFO in Lau2DAbsHistDPPdf::calcMaxHeight : Max height = " << maxHeight_ << std::endl;
+ // Get the maximum height of the 2D histogram
+ maxHeight_ = 1.0;
+ if ( hist ) {
+ Int_t maxBin = hist->GetMaximumBin();
+ maxHeight_ = hist->GetBinContent( maxBin );
+ }
+
+ std::cout << "INFO in Lau2DAbsHistDPPdf::calcMaxHeight : Max height = " << maxHeight_
+ << std::endl;
}
-void Lau2DAbsHistDPPdf::doBinFluctuation(TH2* hist)
+void Lau2DAbsHistDPPdf::doBinFluctuation( TH2* hist )
{
- if ( !hist ) {
- return;
- }
-
- TRandom* random = LauRandom::randomFun();
-
- Int_t nBinsX = static_cast<Int_t>(hist->GetNbinsX());
- Int_t nBinsY = static_cast<Int_t>(hist->GetNbinsY());
-
- for (Int_t i(0); i<nBinsX; i++) {
- for (Int_t j(0); j<nBinsY; j++) {
- Double_t currentContent = hist->GetBinContent(i+1,j+1);
- Double_t currentError = hist->GetBinError(i+1,j+1);
- Double_t newContent = random->Gaus(currentContent,currentError);
- if (newContent<0.0) {
- hist->SetBinContent(i+1,j+1,0.0);
- } else {
- hist->SetBinContent(i+1,j+1,newContent);
- }
- }
- }
+ if ( ! hist ) {
+ return;
+ }
+
+ TRandom* random = LauRandom::randomFun();
+
+ Int_t nBinsX = static_cast<Int_t>( hist->GetNbinsX() );
+ Int_t nBinsY = static_cast<Int_t>( hist->GetNbinsY() );
+
+ for ( Int_t i( 0 ); i < nBinsX; i++ ) {
+ for ( Int_t j( 0 ); j < nBinsY; j++ ) {
+ Double_t currentContent = hist->GetBinContent( i + 1, j + 1 );
+ Double_t currentError = hist->GetBinError( i + 1, j + 1 );
+ Double_t newContent = random->Gaus( currentContent, currentError );
+ if ( newContent < 0.0 ) {
+ hist->SetBinContent( i + 1, j + 1, 0.0 );
+ } else {
+ hist->SetBinContent( i + 1, j + 1, newContent );
+ }
+ }
+ }
}
-Bool_t Lau2DAbsHistDPPdf::withinDPBoundaries(Double_t x, Double_t y) const
+Bool_t Lau2DAbsHistDPPdf::withinDPBoundaries( Double_t x, Double_t y ) const
{
- return squareDP_ ? kinematics_->withinSqDPLimits(x,y) : kinematics_->withinDPLimits(x,y);
+ return squareDP_ ? kinematics_->withinSqDPLimits( x, y ) : kinematics_->withinDPLimits( x, y );
}
-void Lau2DAbsHistDPPdf::getUpperHalf(Double_t& x, Double_t& y) const
+void Lau2DAbsHistDPPdf::getUpperHalf( Double_t& x, Double_t& y ) const
{
- if ( upperHalf_ == kTRUE ) {
- if ( squareDP_ == kFALSE && x > y ) {
- Double_t temp = y;
- y = x;
- x = temp;
- } else if ( squareDP_ == kTRUE && y > 0.5 ) {
- y = 1.0 - y;
- }
- }
+ if ( upperHalf_ == kTRUE ) {
+ if ( squareDP_ == kFALSE && x > y ) {
+ Double_t temp = y;
+ y = x;
+ x = temp;
+ } else if ( squareDP_ == kTRUE && y > 0.5 ) {
+ y = 1.0 - y;
+ }
+ }
}
-void Lau2DAbsHistDPPdf::updateKinematics(Double_t x, Double_t y) const {
- if (squareDP_ == kTRUE) {
- kinematics_->updateSqDPKinematics(x,y);
- } else {
- kinematics_->updateKinematics(x,y);
- }
+void Lau2DAbsHistDPPdf::updateKinematics( Double_t x, Double_t y ) const
+{
+ if ( squareDP_ == kTRUE ) {
+ kinematics_->updateSqDPKinematics( x, y );
+ } else {
+ kinematics_->updateKinematics( x, y );
+ }
}
diff --git a/src/Lau2DCubicSpline.cc b/src/Lau2DCubicSpline.cc
index 116f1e8..96eec9a 100644
--- a/src/Lau2DCubicSpline.cc
+++ b/src/Lau2DCubicSpline.cc
@@ -1,373 +1,372 @@
/*
Copyright 2013 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file Lau2DCubicSpline.cc
\brief File containing implementation of Lau2DCubicSpline class.
Class for defining a 2D cubic spline based on RooBinned2DBicubicBase by
Manuel Tobias Schiller <manuel.schiller@nikhef.nl> (2012-08-29).
*/
+#include "Lau2DCubicSpline.hh"
+
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <TH2.h>
#include <TSystem.h>
-#include "Lau2DCubicSpline.hh"
-
-
-
Lau2DCubicSpline::~Lau2DCubicSpline()
-{ }
+{
+}
-inline Double_t Lau2DCubicSpline::histcont(
- const TH2& h, Int_t xbin, Int_t ybin) const
+inline Double_t Lau2DCubicSpline::histcont( const TH2& h, Int_t xbin, Int_t ybin ) const
{
- //reflect until we're in range
- while(xbin < 0 || xbin >= nBinsX - 1) {
- if(xbin < 0) xbin = -xbin-1;
- if(xbin >= nBinsX -1) xbin = 2*(nBinsX-1) - xbin - 1;
- }
- while(ybin < 0 || ybin >= nBinsY - 1) {
- if(ybin < 0) ybin = -ybin-1;
- if(ybin >= nBinsY -1) ybin = 2*(nBinsY-1) - ybin - 1;
- }
+ //reflect until we're in range
+ while ( xbin < 0 || xbin >= nBinsX - 1 ) {
+ if ( xbin < 0 )
+ xbin = -xbin - 1;
+ if ( xbin >= nBinsX - 1 )
+ xbin = 2 * ( nBinsX - 1 ) - xbin - 1;
+ }
+ while ( ybin < 0 || ybin >= nBinsY - 1 ) {
+ if ( ybin < 0 )
+ ybin = -ybin - 1;
+ if ( ybin >= nBinsY - 1 )
+ ybin = 2 * ( nBinsY - 1 ) - ybin - 1;
+ }
- return h.GetBinContent(1 + xbin, 1 + ybin);
+ return h.GetBinContent( 1 + xbin, 1 + ybin );
}
-inline Double_t Lau2DCubicSpline::dhistdx(
- const TH2& h, Int_t xbin, Int_t ybin) const
+inline Double_t Lau2DCubicSpline::dhistdx( const TH2& h, Int_t xbin, Int_t ybin ) const
{
- return 0.5 * (histcont(h, xbin + 1, ybin) -
- histcont(h, xbin - 1, ybin));
+ return 0.5 * ( histcont( h, xbin + 1, ybin ) - histcont( h, xbin - 1, ybin ) );
}
-inline Double_t Lau2DCubicSpline::dhistdy(
- const TH2& h, Int_t xbin, Int_t ybin) const
+inline Double_t Lau2DCubicSpline::dhistdy( const TH2& h, Int_t xbin, Int_t ybin ) const
{
- return 0.5 * (histcont(h, xbin, ybin + 1) -
- histcont(h, xbin, ybin - 1));
+ return 0.5 * ( histcont( h, xbin, ybin + 1 ) - histcont( h, xbin, ybin - 1 ) );
}
-inline Double_t Lau2DCubicSpline::d2histdxdy(
- const TH2& h, Int_t xbin, Int_t ybin) const
+inline Double_t Lau2DCubicSpline::d2histdxdy( const TH2& h, Int_t xbin, Int_t ybin ) const
{
- return 0.5 * (histcont(h, xbin - 1, ybin - 1) -
- histcont(h, xbin + 1, ybin - 1) +
- histcont(h, xbin + 1, ybin + 1) -
- histcont(h, xbin - 1, ybin + 1));
+ return 0.5 * ( histcont( h, xbin - 1, ybin - 1 ) - histcont( h, xbin + 1, ybin - 1 ) +
+ histcont( h, xbin + 1, ybin + 1 ) - histcont( h, xbin - 1, ybin + 1 ) );
}
-Lau2DCubicSpline::Lau2DCubicSpline(const TH2& h) :
- nBinsX(1 + h.GetNbinsX()), nBinsY(1 + h.GetNbinsY()),
- binSizeX(h.GetXaxis()->GetBinWidth(1)),
- binSizeY(h.GetYaxis()->GetBinWidth(1)),
- xmin(h.GetXaxis()->GetBinCenter(1) - binSizeX),
- xmax(h.GetXaxis()->GetBinCenter(nBinsX - 1) + binSizeX),
- ymin(h.GetYaxis()->GetBinCenter(1) - binSizeY),
- ymax(h.GetYaxis()->GetBinCenter(nBinsY - 1) + binSizeY),
- coeffs(CoeffRecLen * nBinsX * nBinsY)
+Lau2DCubicSpline::Lau2DCubicSpline( const TH2& h ) :
+ nBinsX( 1 + h.GetNbinsX() ),
+ nBinsY( 1 + h.GetNbinsY() ),
+ binSizeX( h.GetXaxis()->GetBinWidth( 1 ) ),
+ binSizeY( h.GetYaxis()->GetBinWidth( 1 ) ),
+ xmin( h.GetXaxis()->GetBinCenter( 1 ) - binSizeX ),
+ xmax( h.GetXaxis()->GetBinCenter( nBinsX - 1 ) + binSizeX ),
+ ymin( h.GetYaxis()->GetBinCenter( 1 ) - binSizeY ),
+ ymax( h.GetYaxis()->GetBinCenter( nBinsY - 1 ) + binSizeY ),
+ coeffs( CoeffRecLen * nBinsX * nBinsY )
{
const TAxis* xaxis = h.GetXaxis();
const TAxis* yaxis = h.GetYaxis();
// verify that all bins have same size
- for (Int_t i = 1; i < nBinsX; ++i) {
- if (std::abs(xaxis->GetBinWidth(i) / binSizeX - 1.) > 1e-9) {
- std::cerr << "ERROR in Lau2DCubicSpline constructor : the histogram has variable bin sizes." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
+ for ( Int_t i = 1; i < nBinsX; ++i ) {
+ if ( std::abs( xaxis->GetBinWidth( i ) / binSizeX - 1. ) > 1e-9 ) {
+ std::cerr << "ERROR in Lau2DCubicSpline constructor : the histogram has variable bin sizes."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
}
- for (Int_t i = 1; i < nBinsY; ++i) {
- if (std::abs(yaxis->GetBinWidth(i) / binSizeY - 1.) > 1e-9) {
- std::cerr << "ERROR in Lau2DCubicSpline constructor : the histogram has variable bin sizes." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
+ for ( Int_t i = 1; i < nBinsY; ++i ) {
+ if ( std::abs( yaxis->GetBinWidth( i ) / binSizeY - 1. ) > 1e-9 ) {
+ std::cerr << "ERROR in Lau2DCubicSpline constructor : the histogram has variable bin sizes."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
}
// ok, go through histogram to precalculate the interpolation coefficients
// in rectangles between bin centres
//
// for that purpose, we map each of those rectangles to the unit square
- for (Int_t j = -1; j < nBinsY - 1; ++j) {
- for (Int_t i = -1; i < nBinsX - 1; ++i) {
- const Double_t rhs[NCoeff] = {
- // function values in bin centres
- histcont(h, i, j),
- histcont(h, i + 1, j),
- histcont(h, i, j + 1),
- histcont(h, i + 1, j + 1),
- // df/dx in bin centres (finite difference approximation)
- dhistdx(h, i, j),
- dhistdx(h, i + 1, j),
- dhistdx(h, i, j + 1),
- dhistdx(h, i + 1, j + 1),
- // df/dy in bin centres (finite difference approximation)
- dhistdy(h, i, j),
- dhistdy(h, i + 1, j),
- dhistdy(h, i, j + 1),
- dhistdy(h, i + 1, j + 1),
- // d^2f/dxdy in bin centres (finite difference approximation)
- d2histdxdy(h, i, j),
- d2histdxdy(h, i + 1, j),
- d2histdxdy(h, i, j + 1),
- d2histdxdy(h, i + 1, j + 1)
- };
- // work out solution - strange array placement is due to the fact
- // that terms with x/y to high powers can be small, so they should
- // be added up first during evaluation to avoid cancellation
- // issues; at the same time you want to access them in order to
- // not confuse the CPU cache, so they're stored back to front
- //
- // a_00 ... a_30
- coeff(1 + i, 1 + j, 15) = rhs[0];
- coeff(1 + i, 1 + j, 14) = rhs[4];
- coeff(1 + i, 1 + j, 13) =
- 3. * (-rhs[0] + rhs[1]) - 2. * rhs[4] - rhs[5];
- coeff(1 + i, 1 + j, 12) =
- 2. * (rhs[0] - rhs[1]) + rhs[4] + rhs[5];
- // a_31 ... a_31
- coeff(1 + i, 1 + j, 11) = rhs[8];
- coeff(1 + i, 1 + j, 10) = rhs[12];
- coeff(1 + i, 1 + j, 9) =
- 3. * (-rhs[8] + rhs[9]) - 2. * rhs[12] - rhs[13];
- coeff(1 + i, 1 + j, 8) =
- 2. * (rhs[8] - rhs[9]) + rhs[12] + rhs[13];
- // a_02 ... a_32
- coeff(1 + i, 1 + j, 7) =
- 3. * (-rhs[0] + rhs[2]) - 2. * rhs[8] - rhs[10];
- coeff(1 + i, 1 + j, 6) =
- 3. * (-rhs[4] + rhs[6]) - 2. * rhs[12] - rhs[14];
- coeff(1 + i, 1 + j, 5) =
- 9. * (rhs[0] - rhs[1] - rhs[2] + rhs[3]) +
- 6. * (rhs[4] - rhs[6] + rhs[8] - rhs[9]) + 4. * rhs[12] +
- 3. * (rhs[5] - rhs[7] + rhs[10] - rhs[11]) +
- 2. * (rhs[13] + rhs[14]) + rhs[15];
- coeff(1 + i, 1 + j, 4) =
- 6. * (-rhs[0] + rhs[1] + rhs[2] - rhs[3]) +
- 4. * (-rhs[8] + rhs[9]) +
- 3. * (-rhs[4] - rhs[5] + rhs[6] + rhs[7]) +
- 2. * (-rhs[10] + rhs[11] - rhs[12] - rhs[13]) -
- rhs[14] - rhs[15];
- // a_03 ... a_33
- coeff(1 + i, 1 + j, 3) =
- 2. * (rhs[0] - rhs[2]) + rhs[8] + rhs[10];
- coeff(1 + i, 1 + j, 2) =
- 2. * (rhs[4] - rhs[6]) + rhs[12] + rhs[14];
- coeff(1 + i, 1 + j, 1) =
- 6. * (-rhs[0] + rhs[1] + rhs[2] - rhs[3]) +
- 4. * (-rhs[4] + rhs[6]) +
- 3. * (-rhs[8] + rhs[9] - rhs[10] + rhs[11]) +
- 2. * (- rhs[5] + rhs[7] - rhs[12] - rhs[14]) -
- rhs[13] - rhs[15];
- coeff(1 + i, 1 + j, 0) =
- 4. * (rhs[0] - rhs[1] - rhs[2] + rhs[3]) +
- 2. * (rhs[4] + rhs[5] - rhs[6] - rhs[7] +
- rhs[8] - rhs[9] + rhs[10] - rhs[11]) +
- rhs[12] + rhs[13] + rhs[14] + rhs[15];
- // coeff(1 + i, 1 + j, 17) contains integral of function over the
- // square in "unit square coordinates", i.e. neglecting bin widths
- // this is done to help speed up calculations of 2D integrals
- Double_t sum = 0.;
- for (Int_t k = 0; k < NCoeff; ++k)
- sum += coeff(1 + i, 1 + j, k) /
- Double_t((4 - (k % 4)) * (4 - (k / 4)));
- coeff(1 + i, 1 + j, NCoeff) = sum;
- }
+ for ( Int_t j = -1; j < nBinsY - 1; ++j ) {
+ for ( Int_t i = -1; i < nBinsX - 1; ++i ) {
+ const Double_t rhs[NCoeff] = { // function values in bin centres
+ histcont( h, i, j ),
+ histcont( h, i + 1, j ),
+ histcont( h, i, j + 1 ),
+ histcont( h, i + 1, j + 1 ),
+ // df/dx in bin centres (finite difference approximation)
+ dhistdx( h, i, j ),
+ dhistdx( h, i + 1, j ),
+ dhistdx( h, i, j + 1 ),
+ dhistdx( h, i + 1, j + 1 ),
+ // df/dy in bin centres (finite difference approximation)
+ dhistdy( h, i, j ),
+ dhistdy( h, i + 1, j ),
+ dhistdy( h, i, j + 1 ),
+ dhistdy( h, i + 1, j + 1 ),
+ // d^2f/dxdy in bin centres (finite difference approximation)
+ d2histdxdy( h, i, j ),
+ d2histdxdy( h, i + 1, j ),
+ d2histdxdy( h, i, j + 1 ),
+ d2histdxdy( h, i + 1, j + 1 ) };
+ // work out solution - strange array placement is due to the fact
+ // that terms with x/y to high powers can be small, so they should
+ // be added up first during evaluation to avoid cancellation
+ // issues; at the same time you want to access them in order to
+ // not confuse the CPU cache, so they're stored back to front
+ //
+ // a_00 ... a_30
+ coeff( 1 + i, 1 + j, 15 ) = rhs[0];
+ coeff( 1 + i, 1 + j, 14 ) = rhs[4];
+ coeff( 1 + i, 1 + j, 13 ) = 3. * ( -rhs[0] + rhs[1] ) - 2. * rhs[4] - rhs[5];
+ coeff( 1 + i, 1 + j, 12 ) = 2. * ( rhs[0] - rhs[1] ) + rhs[4] + rhs[5];
+ // a_31 ... a_31
+ coeff( 1 + i, 1 + j, 11 ) = rhs[8];
+ coeff( 1 + i, 1 + j, 10 ) = rhs[12];
+ coeff( 1 + i, 1 + j, 9 ) = 3. * ( -rhs[8] + rhs[9] ) - 2. * rhs[12] - rhs[13];
+ coeff( 1 + i, 1 + j, 8 ) = 2. * ( rhs[8] - rhs[9] ) + rhs[12] + rhs[13];
+ // a_02 ... a_32
+ coeff( 1 + i, 1 + j, 7 ) = 3. * ( -rhs[0] + rhs[2] ) - 2. * rhs[8] - rhs[10];
+ coeff( 1 + i, 1 + j, 6 ) = 3. * ( -rhs[4] + rhs[6] ) - 2. * rhs[12] - rhs[14];
+ coeff( 1 + i, 1 + j, 5 ) = 9. * ( rhs[0] - rhs[1] - rhs[2] + rhs[3] ) +
+ 6. * ( rhs[4] - rhs[6] + rhs[8] - rhs[9] ) + 4. * rhs[12] +
+ 3. * ( rhs[5] - rhs[7] + rhs[10] - rhs[11] ) +
+ 2. * ( rhs[13] + rhs[14] ) + rhs[15];
+ coeff( 1 + i, 1 + j, 4 ) = 6. * ( -rhs[0] + rhs[1] + rhs[2] - rhs[3] ) +
+ 4. * ( -rhs[8] + rhs[9] ) +
+ 3. * ( -rhs[4] - rhs[5] + rhs[6] + rhs[7] ) +
+ 2. * ( -rhs[10] + rhs[11] - rhs[12] - rhs[13] ) - rhs[14] -
+ rhs[15];
+ // a_03 ... a_33
+ coeff( 1 + i, 1 + j, 3 ) = 2. * ( rhs[0] - rhs[2] ) + rhs[8] + rhs[10];
+ coeff( 1 + i, 1 + j, 2 ) = 2. * ( rhs[4] - rhs[6] ) + rhs[12] + rhs[14];
+ coeff( 1 + i, 1 + j, 1 ) = 6. * ( -rhs[0] + rhs[1] + rhs[2] - rhs[3] ) +
+ 4. * ( -rhs[4] + rhs[6] ) +
+ 3. * ( -rhs[8] + rhs[9] - rhs[10] + rhs[11] ) +
+ 2. * ( -rhs[5] + rhs[7] - rhs[12] - rhs[14] ) - rhs[13] -
+ rhs[15];
+ coeff( 1 + i, 1 + j, 0 ) = 4. * ( rhs[0] - rhs[1] - rhs[2] + rhs[3] ) +
+ 2. * ( rhs[4] + rhs[5] - rhs[6] - rhs[7] + rhs[8] - rhs[9] +
+ rhs[10] - rhs[11] ) +
+ rhs[12] + rhs[13] + rhs[14] + rhs[15];
+ // coeff(1 + i, 1 + j, 17) contains integral of function over the
+ // square in "unit square coordinates", i.e. neglecting bin widths
+ // this is done to help speed up calculations of 2D integrals
+ Double_t sum = 0.;
+ for ( Int_t k = 0; k < NCoeff; ++k )
+ sum += coeff( 1 + i, 1 + j, k ) / Double_t( ( 4 - ( k % 4 ) ) * ( 4 - ( k / 4 ) ) );
+ coeff( 1 + i, 1 + j, NCoeff ) = sum;
+ }
}
}
-Double_t Lau2DCubicSpline::evaluate(Double_t x, Double_t y) const
+Double_t Lau2DCubicSpline::evaluate( Double_t x, Double_t y ) const
{
// protect against NaN and out of range
- if (x <= xmin || x >= xmax || y <= ymin || y >= ymax || x != x || y != y)
- return 0.;
+ if ( x <= xmin || x >= xmax || y <= ymin || y >= ymax || x != x || y != y )
+ return 0.;
// find the bin in question
- const Int_t binx = Int_t(Double_t(nBinsX) * (x - xmin) / (xmax - xmin));
- const Int_t biny = Int_t(Double_t(nBinsY) * (y - ymin) / (ymax - ymin));
+ const Int_t binx = Int_t( Double_t( nBinsX ) * ( x - xmin ) / ( xmax - xmin ) );
+ const Int_t biny = Int_t( Double_t( nBinsY ) * ( y - ymin ) / ( ymax - ymin ) );
// get low edge of bin
- const Double_t xlo = Double_t(nBinsX - binx) / Double_t(nBinsX) * xmin +
- Double_t(binx) / Double_t(nBinsX) * xmax;
- const Double_t ylo = Double_t(nBinsY - biny) / Double_t(nBinsY) * ymin +
- Double_t(biny) / Double_t(nBinsY) * ymax;
+ const Double_t xlo = Double_t( nBinsX - binx ) / Double_t( nBinsX ) * xmin +
+ Double_t( binx ) / Double_t( nBinsX ) * xmax;
+ const Double_t ylo = Double_t( nBinsY - biny ) / Double_t( nBinsY ) * ymin +
+ Double_t( biny ) / Double_t( nBinsY ) * ymax;
// normalise to coordinates in unit sqare
- const Double_t hx = (x - xlo) / binSizeX;
- const Double_t hy = (y - ylo) / binSizeY;
+ const Double_t hx = ( x - xlo ) / binSizeX;
+ const Double_t hy = ( y - ylo ) / binSizeY;
// monomials
const Double_t hxton[4] = { hx * hx * hx, hx * hx, hx, 1. };
const Double_t hyton[4] = { hy * hy * hy, hy * hy, hy, 1. };
// sum up
Double_t retVal = 0.;
- for (Int_t k = 0; k < NCoeff; ++k)
- retVal += coeff(binx, biny, k) * hxton[k % 4] * hyton[k / 4];
+ for ( Int_t k = 0; k < NCoeff; ++k )
+ retVal += coeff( binx, biny, k ) * hxton[k % 4] * hyton[k / 4];
return retVal;
}
Double_t Lau2DCubicSpline::analyticalIntegral() const
{
- return evalXY(xmin,xmax,ymin,ymax);
+ return evalXY( xmin, xmax, ymin, ymax );
}
-Double_t Lau2DCubicSpline::analyticalIntegral(Double_t x1, Double_t x2, Double_t y1, Double_t y2) const
+Double_t Lau2DCubicSpline::analyticalIntegral( Double_t x1, Double_t x2, Double_t y1, Double_t y2 ) const
{
- if(y1==y2) return evalX(x1, x2, y1);
- if(x1==x2) return evalY(x1, y1, y2);
- return evalXY(x1, x2, y1, y2);
+ if ( y1 == y2 )
+ return evalX( x1, x2, y1 );
+ if ( x1 == x2 )
+ return evalY( x1, y1, y2 );
+ return evalXY( x1, x2, y1, y2 );
}
-Double_t Lau2DCubicSpline::evalX(Double_t x1, Double_t x2, Double_t y) const
+Double_t Lau2DCubicSpline::evalX( Double_t x1, Double_t x2, Double_t y ) const
{
// protect against NaN
- if (x1 != x1 || x2 != x2 || y != y) return 0.;
+ if ( x1 != x1 || x2 != x2 || y != y )
+ return 0.;
// find the bin in question
- const Int_t biny = Int_t(Double_t(nBinsY) * (y - ymin) / (ymax - ymin));
+ const Int_t biny = Int_t( Double_t( nBinsY ) * ( y - ymin ) / ( ymax - ymin ) );
// get low edge of bin
- const Double_t ylo = Double_t(nBinsY - biny) / Double_t(nBinsY) * ymin +
- Double_t(biny) / Double_t(nBinsY) * ymax;
+ const Double_t ylo = Double_t( nBinsY - biny ) / Double_t( nBinsY ) * ymin +
+ Double_t( biny ) / Double_t( nBinsY ) * ymax;
// normalise to coordinates in unit sqare
- const Double_t hy = (y - ylo) / binSizeY;
+ const Double_t hy = ( y - ylo ) / binSizeY;
// monomials
const Double_t hyton[4] = { hy * hy * hy, hy * hy, hy, 1. };
// integral
Double_t sum = 0.;
- for (Int_t binx = 0; binx < nBinsX; ++binx) {
- // get low/high edge of bin
- const Double_t xhi = Double_t(nBinsX - binx - 1) / Double_t(nBinsX) * xmin +
- Double_t(binx + 1) / Double_t(nBinsX) * xmax;
- if (xhi < x1) continue;
- const Double_t xlo = Double_t(nBinsX - binx) / Double_t(nBinsX) * xmin +
- Double_t(binx) / Double_t(nBinsX) * xmax;
- if (xlo > x2) break;
- // work out integration range
- const Double_t a = ((xlo > x1) ? 0. : (x1 - xlo)) / binSizeX;
- const Double_t b = ((xhi < x2) ? binSizeX : (x2 - xlo)) / binSizeX;
- // integrated monomials
- const Double_t hxton[4] = { 0.25 * (b * b * b * b - a * a * a * a),
- (b * b * b - a * a * a) / 3., 0.5 * (b * b - a * a), b - a };
- Double_t lsum = 0.;
- for (Int_t k = 0; k < NCoeff; ++k)
- lsum += coeff(binx, biny, k) * hxton[k % 4] * hyton[k / 4];
- sum += lsum;
+ for ( Int_t binx = 0; binx < nBinsX; ++binx ) {
+ // get low/high edge of bin
+ const Double_t xhi = Double_t( nBinsX - binx - 1 ) / Double_t( nBinsX ) * xmin +
+ Double_t( binx + 1 ) / Double_t( nBinsX ) * xmax;
+ if ( xhi < x1 )
+ continue;
+ const Double_t xlo = Double_t( nBinsX - binx ) / Double_t( nBinsX ) * xmin +
+ Double_t( binx ) / Double_t( nBinsX ) * xmax;
+ if ( xlo > x2 )
+ break;
+ // work out integration range
+ const Double_t a = ( ( xlo > x1 ) ? 0. : ( x1 - xlo ) ) / binSizeX;
+ const Double_t b = ( ( xhi < x2 ) ? binSizeX : ( x2 - xlo ) ) / binSizeX;
+ // integrated monomials
+ const Double_t hxton[4] = { 0.25 * ( b * b * b * b - a * a * a * a ),
+ ( b * b * b - a * a * a ) / 3.,
+ 0.5 * ( b * b - a * a ),
+ b - a };
+ Double_t lsum = 0.;
+ for ( Int_t k = 0; k < NCoeff; ++k )
+ lsum += coeff( binx, biny, k ) * hxton[k % 4] * hyton[k / 4];
+ sum += lsum;
}
// move from unit square coordinates to user coordinates
return sum * binSizeX;
}
-Double_t Lau2DCubicSpline::evalY(Double_t x, Double_t y1, Double_t y2) const
+Double_t Lau2DCubicSpline::evalY( Double_t x, Double_t y1, Double_t y2 ) const
{
// protect against NaN
- if (x != x || y1 != y1 || y2 != y2) return 0.;
+ if ( x != x || y1 != y1 || y2 != y2 )
+ return 0.;
// find the bin in question
- const Int_t binx = Int_t(Double_t(nBinsX) * (x - xmin) / (xmax - xmin));
+ const Int_t binx = Int_t( Double_t( nBinsX ) * ( x - xmin ) / ( xmax - xmin ) );
// get low edge of bin
- const Double_t xlo = Double_t(nBinsX - binx) / Double_t(nBinsX) * xmin +
- Double_t(binx) / Double_t(nBinsX) * xmax;
+ const Double_t xlo = Double_t( nBinsX - binx ) / Double_t( nBinsX ) * xmin +
+ Double_t( binx ) / Double_t( nBinsX ) * xmax;
// normalise to coordinates in unit sqare
- const Double_t hx = (x - xlo) / binSizeX;
+ const Double_t hx = ( x - xlo ) / binSizeX;
// monomials
const Double_t hxton[4] = { hx * hx * hx, hx * hx, hx, 1. };
// integral
Double_t sum = 0.;
- for (Int_t biny = 0; biny < nBinsY; ++biny) {
- // get low/high edge of bin
- const Double_t yhi = Double_t(nBinsY - biny - 1) / Double_t(nBinsY) * ymin +
- Double_t(biny + 1) / Double_t(nBinsY) * ymax;
- if (yhi < y1) continue;
- const Double_t ylo = Double_t(nBinsY - biny) / Double_t(nBinsY) * ymin +
- Double_t(biny) / Double_t(nBinsY) * ymax;
- if (ylo > y2) break;
- // work out integration range
- const Double_t a = ((ylo > y1) ? 0. : (y1 - ylo)) / binSizeY;
- const Double_t b = ((yhi < y2) ? binSizeY : (y2 - ylo)) / binSizeY;
- // integrated monomials
- const Double_t hyton[4] = { 0.25 * (b * b * b * b - a * a * a * a),
- (b * b * b - a * a * a) / 3., 0.5 * (b * b - a * a), b - a };
- Double_t lsum = 0.;
- for (Int_t k = 0; k < NCoeff; ++k)
- lsum += coeff(binx, biny, k) * hxton[k % 4] * hyton[k / 4];
- sum += lsum;
+ for ( Int_t biny = 0; biny < nBinsY; ++biny ) {
+ // get low/high edge of bin
+ const Double_t yhi = Double_t( nBinsY - biny - 1 ) / Double_t( nBinsY ) * ymin +
+ Double_t( biny + 1 ) / Double_t( nBinsY ) * ymax;
+ if ( yhi < y1 )
+ continue;
+ const Double_t ylo = Double_t( nBinsY - biny ) / Double_t( nBinsY ) * ymin +
+ Double_t( biny ) / Double_t( nBinsY ) * ymax;
+ if ( ylo > y2 )
+ break;
+ // work out integration range
+ const Double_t a = ( ( ylo > y1 ) ? 0. : ( y1 - ylo ) ) / binSizeY;
+ const Double_t b = ( ( yhi < y2 ) ? binSizeY : ( y2 - ylo ) ) / binSizeY;
+ // integrated monomials
+ const Double_t hyton[4] = { 0.25 * ( b * b * b * b - a * a * a * a ),
+ ( b * b * b - a * a * a ) / 3.,
+ 0.5 * ( b * b - a * a ),
+ b - a };
+ Double_t lsum = 0.;
+ for ( Int_t k = 0; k < NCoeff; ++k )
+ lsum += coeff( binx, biny, k ) * hxton[k % 4] * hyton[k / 4];
+ sum += lsum;
}
// move from unit square coordinates to user coordinates
return sum * binSizeY;
}
-Double_t Lau2DCubicSpline::evalXY(
- Double_t x1, Double_t x2, Double_t y1, Double_t y2) const
+Double_t Lau2DCubicSpline::evalXY( Double_t x1, Double_t x2, Double_t y1, Double_t y2 ) const
{
// protect against NaN
- if (x1 != x1 || x2 != x2 || y1 != y1 || y2 != y2) return 0.;
+ if ( x1 != x1 || x2 != x2 || y1 != y1 || y2 != y2 )
+ return 0.;
// integral
Double_t sum = 0.;
- for (Int_t biny = 0; biny < nBinsY; ++biny) {
- // get low/high edge of bin
- const Double_t yhi = Double_t(nBinsY - biny - 1) / Double_t(nBinsY) * ymin +
- Double_t(biny + 1) / Double_t(nBinsY) * ymax;
- if (yhi < y1) continue;
- const Double_t ylo = Double_t(nBinsY - biny) / Double_t(nBinsY) * ymin +
- Double_t(biny) / Double_t(nBinsY) * ymax;
- if (ylo > y2) break;
- // work out integration range
- const Double_t ay = ((ylo > y1) ? 0. : (y1 - ylo)) / binSizeY;
- const Double_t by = ((yhi < y2) ? binSizeY : (y2 - ylo)) / binSizeY;
- const Bool_t yFullyContained = std::abs(by - ay - 1.0) < 1e-15;
- // integrated monomials
- const Double_t hyton[4] = {
- 0.25 * (by * by * by * by - ay * ay * ay * ay),
- (by * by * by - ay * ay * ay) / 3., 0.5 * (by * by - ay * ay),
- by - ay };
- for (Int_t binx = 0; binx < nBinsX; ++binx) {
- // get low/high edge of bin
- const Double_t xhi = Double_t(nBinsX - binx - 1) / Double_t(nBinsX) * xmin +
- Double_t(binx + 1) / Double_t(nBinsX) * xmax;
- if (xhi < x1) continue;
- const Double_t xlo = Double_t(nBinsX - binx) / Double_t(nBinsX) * xmin +
- Double_t(binx) / Double_t(nBinsX) * xmax;
- if (xlo > x2) break;
- // work out integration range
- const Double_t ax = ((xlo > x1) ? 0. : (x1 - xlo)) / binSizeX;
- const Double_t bx = ((xhi < x2) ? binSizeX : (x2 - xlo)) / binSizeX;
- const Bool_t xFullyContained = std::abs(bx - ax - 1.0) < 1e-15;
- if (xFullyContained && yFullyContained) {
- // for fully contained bins, we have cached the integral
- sum += coeff(binx, biny, NCoeff);
- continue;
- }
- // integrated monomials
- const Double_t hxton[4] = {
- 0.25 * (bx * bx * bx * bx - ax * ax * ax * ax),
- (bx * bx * bx - ax * ax * ax) / 3., 0.5 * (bx * bx - ax * ax),
- bx - ax };
- // integrate over bin
+ for ( Int_t biny = 0; biny < nBinsY; ++biny ) {
+ // get low/high edge of bin
+ const Double_t yhi = Double_t( nBinsY - biny - 1 ) / Double_t( nBinsY ) * ymin +
+ Double_t( biny + 1 ) / Double_t( nBinsY ) * ymax;
+ if ( yhi < y1 )
+ continue;
+ const Double_t ylo = Double_t( nBinsY - biny ) / Double_t( nBinsY ) * ymin +
+ Double_t( biny ) / Double_t( nBinsY ) * ymax;
+ if ( ylo > y2 )
+ break;
+ // work out integration range
+ const Double_t ay = ( ( ylo > y1 ) ? 0. : ( y1 - ylo ) ) / binSizeY;
+ const Double_t by = ( ( yhi < y2 ) ? binSizeY : ( y2 - ylo ) ) / binSizeY;
+ const Bool_t yFullyContained = std::abs( by - ay - 1.0 ) < 1e-15;
+ // integrated monomials
+ const Double_t hyton[4] = { 0.25 * ( by * by * by * by - ay * ay * ay * ay ),
+ ( by * by * by - ay * ay * ay ) / 3.,
+ 0.5 * ( by * by - ay * ay ),
+ by - ay };
+ for ( Int_t binx = 0; binx < nBinsX; ++binx ) {
+ // get low/high edge of bin
+ const Double_t xhi = Double_t( nBinsX - binx - 1 ) / Double_t( nBinsX ) * xmin +
+ Double_t( binx + 1 ) / Double_t( nBinsX ) * xmax;
+ if ( xhi < x1 )
+ continue;
+ const Double_t xlo = Double_t( nBinsX - binx ) / Double_t( nBinsX ) * xmin +
+ Double_t( binx ) / Double_t( nBinsX ) * xmax;
+ if ( xlo > x2 )
+ break;
+ // work out integration range
+ const Double_t ax = ( ( xlo > x1 ) ? 0. : ( x1 - xlo ) ) / binSizeX;
+ const Double_t bx = ( ( xhi < x2 ) ? binSizeX : ( x2 - xlo ) ) / binSizeX;
+ const Bool_t xFullyContained = std::abs( bx - ax - 1.0 ) < 1e-15;
+ if ( xFullyContained && yFullyContained ) {
+ // for fully contained bins, we have cached the integral
+ sum += coeff( binx, biny, NCoeff );
+ continue;
+ }
+ // integrated monomials
+ const Double_t hxton[4] = { 0.25 * ( bx * bx * bx * bx - ax * ax * ax * ax ),
+ ( bx * bx * bx - ax * ax * ax ) / 3.,
+ 0.5 * ( bx * bx - ax * ax ),
+ bx - ax };
+ // integrate over bin
- Double_t lsum = 0.;
- for (Int_t k = 0; k < NCoeff; ++k)
- lsum += coeff(binx, biny, k) * hxton[k % 4] * hyton[k / 4];
- sum += lsum;
- }
+ Double_t lsum = 0.;
+ for ( Int_t k = 0; k < NCoeff; ++k )
+ lsum += coeff( binx, biny, k ) * hxton[k % 4] * hyton[k / 4];
+ sum += lsum;
+ }
}
// move from unit square coordinates to user coordinates
return sum * binSizeX * binSizeY;
}
diff --git a/src/Lau2DHistDP.cc b/src/Lau2DHistDP.cc
index 1148164..8c3dfb4 100644
--- a/src/Lau2DHistDP.cc
+++ b/src/Lau2DHistDP.cc
@@ -1,359 +1,397 @@
/*
Copyright 2004 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file Lau2DHistDP.cc
\brief File containing implementation of Lau2DHistDP class.
*/
-#include <iostream>
-
-#include "TAxis.h"
-#include "TH2.h"
-#include "TRandom.h"
-#include "TSystem.h"
-
#include "Lau2DHistDP.hh"
+
#include "LauDaughters.hh"
#include "LauKinematics.hh"
#include "LauRandom.hh"
+#include "TAxis.h"
+#include "TH2.h"
+#include "TRandom.h"
+#include "TSystem.h"
+#include <iostream>
-Lau2DHistDP::Lau2DHistDP(const TH2* hist, const LauDaughters* daughters,
- Bool_t useInterpolation, Bool_t fluctuateBins,
- Double_t avEff, Double_t avEffError, Bool_t useUpperHalfOnly, Bool_t squareDP) :
- Lau2DAbsHistDP(daughters,useUpperHalfOnly,squareDP),
- hist_(hist ? dynamic_cast<TH2*>(hist->Clone()) : 0),
- errorHi_(0), errorLo_(0),
- minX_(0.0), maxX_(0.0),
- minY_(0.0), maxY_(0.0),
- rangeX_(0.0), rangeY_(0.0),
- binXWidth_(0.0), binYWidth_(0.0),
- nBinsX_(0), nBinsY_(0),
- useInterpolation_(useInterpolation)
+Lau2DHistDP::Lau2DHistDP( const TH2* hist,
+ const LauDaughters* daughters,
+ Bool_t useInterpolation,
+ Bool_t fluctuateBins,
+ Double_t avEff,
+ Double_t avEffError,
+ Bool_t useUpperHalfOnly,
+ Bool_t squareDP ) :
+ Lau2DAbsHistDP( daughters, useUpperHalfOnly, squareDP ),
+ hist_( hist ? dynamic_cast<TH2*>( hist->Clone() ) : 0 ),
+ errorHi_( 0 ),
+ errorLo_( 0 ),
+ minX_( 0.0 ),
+ maxX_( 0.0 ),
+ minY_( 0.0 ),
+ maxY_( 0.0 ),
+ rangeX_( 0.0 ),
+ rangeY_( 0.0 ),
+ binXWidth_( 0.0 ),
+ binYWidth_( 0.0 ),
+ nBinsX_( 0 ),
+ nBinsY_( 0 ),
+ useInterpolation_( useInterpolation )
{
- if ( ! hist_ ) {
- std::cerr << "ERROR in Lau2DHistDP constructor : the histogram pointer is null." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // Save various attributes of the histogram
- // (axis ranges, number of bins, areas)
- TAxis* xAxis = hist_->GetXaxis();
- minX_ = static_cast<Double_t>(xAxis->GetXmin());
- maxX_ = static_cast<Double_t>(xAxis->GetXmax());
- rangeX_ = maxX_ - minX_;
-
- TAxis* yAxis = hist_->GetYaxis();
- minY_ = static_cast<Double_t>(yAxis->GetXmin());
- maxY_ = static_cast<Double_t>(yAxis->GetXmax());
- rangeY_ = maxY_ - minY_;
-
- nBinsX_ = static_cast<Int_t>(hist_->GetNbinsX());
- nBinsY_ = static_cast<Int_t>(hist_->GetNbinsY());
-
- binXWidth_ = static_cast<Double_t>(TMath::Abs(rangeX_)/(nBinsX_*1.0));
- binYWidth_ = static_cast<Double_t>(TMath::Abs(rangeY_)/(nBinsY_*1.0));
-
- if (fluctuateBins) {
- this->doBinFluctuation(hist_);
- }
- if (avEff > 0.0 && avEffError > 0.0) {
- this->raiseOrLowerBins(hist_,avEff,avEffError);
- }
+ if ( ! hist_ ) {
+ std::cerr << "ERROR in Lau2DHistDP constructor : the histogram pointer is null." << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // Save various attributes of the histogram
+ // (axis ranges, number of bins, areas)
+ TAxis* xAxis = hist_->GetXaxis();
+ minX_ = static_cast<Double_t>( xAxis->GetXmin() );
+ maxX_ = static_cast<Double_t>( xAxis->GetXmax() );
+ rangeX_ = maxX_ - minX_;
+
+ TAxis* yAxis = hist_->GetYaxis();
+ minY_ = static_cast<Double_t>( yAxis->GetXmin() );
+ maxY_ = static_cast<Double_t>( yAxis->GetXmax() );
+ rangeY_ = maxY_ - minY_;
+
+ nBinsX_ = static_cast<Int_t>( hist_->GetNbinsX() );
+ nBinsY_ = static_cast<Int_t>( hist_->GetNbinsY() );
+
+ binXWidth_ = static_cast<Double_t>( TMath::Abs( rangeX_ ) / ( nBinsX_ * 1.0 ) );
+ binYWidth_ = static_cast<Double_t>( TMath::Abs( rangeY_ ) / ( nBinsY_ * 1.0 ) );
+
+ if ( fluctuateBins ) {
+ this->doBinFluctuation( hist_ );
+ }
+ if ( avEff > 0.0 && avEffError > 0.0 ) {
+ this->raiseOrLowerBins( hist_, avEff, avEffError );
+ }
}
-Lau2DHistDP::Lau2DHistDP(const TH2* hist, const TH2* errorHi, const TH2* errorLo, const LauDaughters* daughters,
- Bool_t useInterpolation, Bool_t fluctuateBins,
- Double_t avEff, Double_t avEffError, Bool_t useUpperHalfOnly, Bool_t squareDP) :
- Lau2DAbsHistDP(daughters,useUpperHalfOnly,squareDP),
- hist_(hist ? dynamic_cast<TH2*>(hist->Clone()) : 0),
- errorHi_(errorHi ? dynamic_cast<TH2*>(errorHi->Clone()) : 0),
- errorLo_(errorLo ? dynamic_cast<TH2*>(errorLo->Clone()) : 0),
- minX_(0.0), maxX_(0.0),
- minY_(0.0), maxY_(0.0),
- rangeX_(0.0), rangeY_(0.0),
- binXWidth_(0.0), binYWidth_(0.0),
- nBinsX_(0), nBinsY_(0),
- useInterpolation_(useInterpolation)
+Lau2DHistDP::Lau2DHistDP( const TH2* hist,
+ const TH2* errorHi,
+ const TH2* errorLo,
+ const LauDaughters* daughters,
+ Bool_t useInterpolation,
+ Bool_t fluctuateBins,
+ Double_t avEff,
+ Double_t avEffError,
+ Bool_t useUpperHalfOnly,
+ Bool_t squareDP ) :
+ Lau2DAbsHistDP( daughters, useUpperHalfOnly, squareDP ),
+ hist_( hist ? dynamic_cast<TH2*>( hist->Clone() ) : 0 ),
+ errorHi_( errorHi ? dynamic_cast<TH2*>( errorHi->Clone() ) : 0 ),
+ errorLo_( errorLo ? dynamic_cast<TH2*>( errorLo->Clone() ) : 0 ),
+ minX_( 0.0 ),
+ maxX_( 0.0 ),
+ minY_( 0.0 ),
+ maxY_( 0.0 ),
+ rangeX_( 0.0 ),
+ rangeY_( 0.0 ),
+ binXWidth_( 0.0 ),
+ binYWidth_( 0.0 ),
+ nBinsX_( 0 ),
+ nBinsY_( 0 ),
+ useInterpolation_( useInterpolation )
{
- if ( ! hist_ ) {
- std::cerr << "ERROR in Lau2DHistDP constructor : the histogram pointer is null." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- if ( ! errorHi_ ) {
- std::cerr << "ERROR in Lau2DHistDP constructor : the upper error histogram pointer is null." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- if ( ! errorLo_ ) {
- std::cerr << "ERROR in Lau2DHistDP constructor : the lower error histogram pointer is null." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // Save various attributes of the histogram
- // (axis ranges, number of bins, areas)
- TAxis* xAxis = hist_->GetXaxis();
- minX_ = static_cast<Double_t>(xAxis->GetXmin());
- maxX_ = static_cast<Double_t>(xAxis->GetXmax());
- rangeX_ = maxX_ - minX_;
-
- TAxis* yAxis = hist_->GetYaxis();
- minY_ = static_cast<Double_t>(yAxis->GetXmin());
- maxY_ = static_cast<Double_t>(yAxis->GetXmax());
- rangeY_ = maxY_ - minY_;
-
- nBinsX_ = static_cast<Int_t>(hist_->GetNbinsX());
- nBinsY_ = static_cast<Int_t>(hist_->GetNbinsY());
-
- binXWidth_ = static_cast<Double_t>(TMath::Abs(rangeX_)/(nBinsX_*1.0));
- binYWidth_ = static_cast<Double_t>(TMath::Abs(rangeY_)/(nBinsY_*1.0));
-
- if(static_cast<Int_t>(errorLo_->GetNbinsX()) != nBinsX_ ||
- static_cast<Int_t>(errorLo_->GetNbinsY()) != nBinsY_) {
- std::cerr << "ERROR in Lau2DHistDP constructor : the lower error histogram has a different number of bins to the main histogram." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- if(static_cast<Int_t>(errorHi_->GetNbinsX()) != nBinsX_ ||
- static_cast<Int_t>(errorHi_->GetNbinsY()) != nBinsY_) {
- std::cerr << "ERROR in Lau2DHistDP constructor : the upper error histogram has a different number of bins to the main histogram." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- xAxis = errorLo_->GetXaxis();
- yAxis = errorLo_->GetYaxis();
-
- if(static_cast<Double_t>(xAxis->GetXmin()) != minX_ ||
- static_cast<Double_t>(xAxis->GetXmax()) != maxX_) {
- std::cerr << "ERROR in Lau2DHistDP constructor : the lower error histogram has a different x range to the main histogram." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- if(static_cast<Double_t>(yAxis->GetXmin()) != minY_ ||
- static_cast<Double_t>(yAxis->GetXmax()) != maxY_) {
- std::cerr << "ERROR in Lau2DHistDP constructor : the lower error histogram has a different y range to the main histogram." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- xAxis = errorHi_->GetXaxis();
- yAxis = errorHi_->GetYaxis();
-
- if(static_cast<Double_t>(xAxis->GetXmin()) != minX_ ||
- static_cast<Double_t>(xAxis->GetXmax()) != maxX_) {
- std::cerr << "ERROR in Lau2DHistDP constructor : the upper error histogram has a different x range to the main histogram." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- if(static_cast<Double_t>(yAxis->GetXmin()) != minY_ ||
- static_cast<Double_t>(yAxis->GetXmax()) != maxY_) {
- std::cerr << "ERROR in Lau2DHistDP constructor : the upper error histogram has a different y range to the main histogram." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- if (fluctuateBins) {
- this->doBinFluctuation(hist_,errorHi_,errorLo_);
- }
- if (avEff > 0.0 && avEffError > 0.0) {
- this->raiseOrLowerBins(hist_,avEff,avEffError);
- }
+ if ( ! hist_ ) {
+ std::cerr << "ERROR in Lau2DHistDP constructor : the histogram pointer is null." << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ if ( ! errorHi_ ) {
+ std::cerr << "ERROR in Lau2DHistDP constructor : the upper error histogram pointer is null."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ if ( ! errorLo_ ) {
+ std::cerr << "ERROR in Lau2DHistDP constructor : the lower error histogram pointer is null."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // Save various attributes of the histogram
+ // (axis ranges, number of bins, areas)
+ TAxis* xAxis = hist_->GetXaxis();
+ minX_ = static_cast<Double_t>( xAxis->GetXmin() );
+ maxX_ = static_cast<Double_t>( xAxis->GetXmax() );
+ rangeX_ = maxX_ - minX_;
+
+ TAxis* yAxis = hist_->GetYaxis();
+ minY_ = static_cast<Double_t>( yAxis->GetXmin() );
+ maxY_ = static_cast<Double_t>( yAxis->GetXmax() );
+ rangeY_ = maxY_ - minY_;
+
+ nBinsX_ = static_cast<Int_t>( hist_->GetNbinsX() );
+ nBinsY_ = static_cast<Int_t>( hist_->GetNbinsY() );
+
+ binXWidth_ = static_cast<Double_t>( TMath::Abs( rangeX_ ) / ( nBinsX_ * 1.0 ) );
+ binYWidth_ = static_cast<Double_t>( TMath::Abs( rangeY_ ) / ( nBinsY_ * 1.0 ) );
+
+ if ( static_cast<Int_t>( errorLo_->GetNbinsX() ) != nBinsX_ ||
+ static_cast<Int_t>( errorLo_->GetNbinsY() ) != nBinsY_ ) {
+ std::cerr << "ERROR in Lau2DHistDP constructor : the lower error histogram has a different number of bins to the main histogram."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ if ( static_cast<Int_t>( errorHi_->GetNbinsX() ) != nBinsX_ ||
+ static_cast<Int_t>( errorHi_->GetNbinsY() ) != nBinsY_ ) {
+ std::cerr << "ERROR in Lau2DHistDP constructor : the upper error histogram has a different number of bins to the main histogram."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ xAxis = errorLo_->GetXaxis();
+ yAxis = errorLo_->GetYaxis();
+
+ if ( static_cast<Double_t>( xAxis->GetXmin() ) != minX_ ||
+ static_cast<Double_t>( xAxis->GetXmax() ) != maxX_ ) {
+ std::cerr << "ERROR in Lau2DHistDP constructor : the lower error histogram has a different x range to the main histogram."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ if ( static_cast<Double_t>( yAxis->GetXmin() ) != minY_ ||
+ static_cast<Double_t>( yAxis->GetXmax() ) != maxY_ ) {
+ std::cerr << "ERROR in Lau2DHistDP constructor : the lower error histogram has a different y range to the main histogram."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ xAxis = errorHi_->GetXaxis();
+ yAxis = errorHi_->GetYaxis();
+
+ if ( static_cast<Double_t>( xAxis->GetXmin() ) != minX_ ||
+ static_cast<Double_t>( xAxis->GetXmax() ) != maxX_ ) {
+ std::cerr << "ERROR in Lau2DHistDP constructor : the upper error histogram has a different x range to the main histogram."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ if ( static_cast<Double_t>( yAxis->GetXmin() ) != minY_ ||
+ static_cast<Double_t>( yAxis->GetXmax() ) != maxY_ ) {
+ std::cerr << "ERROR in Lau2DHistDP constructor : the upper error histogram has a different y range to the main histogram."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ if ( fluctuateBins ) {
+ this->doBinFluctuation( hist_, errorHi_, errorLo_ );
+ }
+ if ( avEff > 0.0 && avEffError > 0.0 ) {
+ this->raiseOrLowerBins( hist_, avEff, avEffError );
+ }
}
Lau2DHistDP::~Lau2DHistDP()
{
- delete hist_;
- hist_ = 0;
- if(errorHi_) {
- delete errorHi_;
- errorHi_=0;
- }
- if(errorLo_) {
- delete errorLo_;
- errorLo_=0;
- }
+ delete hist_;
+ hist_ = 0;
+ if ( errorHi_ ) {
+ delete errorHi_;
+ errorHi_ = 0;
+ }
+ if ( errorLo_ ) {
+ delete errorLo_;
+ errorLo_ = 0;
+ }
}
-Double_t Lau2DHistDP::getBinHistValue(Int_t xBinNo, Int_t yBinNo) const
+Double_t Lau2DHistDP::getBinHistValue( Int_t xBinNo, Int_t yBinNo ) const
{
- if (xBinNo < 0) {
- xBinNo = 0;
- } else if (xBinNo >= nBinsX_) {
- return 0.0;
- }
-
- if (yBinNo < 0) {
- yBinNo = 0;
- } else if (yBinNo >= nBinsY_) {
- return 0.0;
- }
-
- Double_t value = hist_->GetBinContent(xBinNo+1, yBinNo+1);
- return value;
+ if ( xBinNo < 0 ) {
+ xBinNo = 0;
+ } else if ( xBinNo >= nBinsX_ ) {
+ return 0.0;
+ }
+
+ if ( yBinNo < 0 ) {
+ yBinNo = 0;
+ } else if ( yBinNo >= nBinsY_ ) {
+ return 0.0;
+ }
+
+ Double_t value = hist_->GetBinContent( xBinNo + 1, yBinNo + 1 );
+ return value;
}
-Double_t Lau2DHistDP::interpolateXY(Double_t x, Double_t y) const
+Double_t Lau2DHistDP::interpolateXY( Double_t x, Double_t y ) const
{
- // This function returns the interpolated value of the histogram function
- // for the given values of x and y by finding the adjacent bins and extrapolating
- // using weights based on the inverse distance of the point from the adajcent
- // bin centres.
- // Here, x = m13^2, y = m23^2, or m', theta' for square DP co-ordinates
-
- // If we're only using one half then flip co-ordinates
- // appropriately for conventional or square DP
- this->getUpperHalf(x,y);
+ // This function returns the interpolated value of the histogram function
+ // for the given values of x and y by finding the adjacent bins and extrapolating
+ // using weights based on the inverse distance of the point from the adajcent
+ // bin centres.
+ // Here, x = m13^2, y = m23^2, or m', theta' for square DP co-ordinates
- // First ask whether the point is inside the kinematic region.
- if (this->withinDPBoundaries(x,y) == kFALSE) {
- std::cerr << "WARNING in Lau2DHistDP::interpolateXY : Given position is outside the DP boundary, returning 0.0." << std::endl;
- return 0.0;
- }
+ // If we're only using one half then flip co-ordinates
+ // appropriately for conventional or square DP
+ this->getUpperHalf( x, y );
- // Find the 2D histogram bin for x and y
- Int_t i = Int_t((x - minX_)*nBinsX_/rangeX_);
- Int_t j = Int_t((y - minY_)*nBinsY_/rangeY_);
+ // First ask whether the point is inside the kinematic region.
+ if ( this->withinDPBoundaries( x, y ) == kFALSE ) {
+ std::cerr << "WARNING in Lau2DHistDP::interpolateXY : Given position is outside the DP boundary, returning 0.0."
+ << std::endl;
+ return 0.0;
+ }
- if (i >= nBinsX_) {i = nBinsX_ - 1;}
- if (j >= nBinsY_) {j = nBinsY_ - 1;}
+ // Find the 2D histogram bin for x and y
+ Int_t i = Int_t( ( x - minX_ ) * nBinsX_ / rangeX_ );
+ Int_t j = Int_t( ( y - minY_ ) * nBinsY_ / rangeY_ );
- // Ask whether we want to do the interpolation, since this method is
- // not reliable for low statistics histograms.
- if (useInterpolation_ == kFALSE) {return this->getBinHistValue(i,j);}
+ if ( i >= nBinsX_ ) {
+ i = nBinsX_ - 1;
+ }
+ if ( j >= nBinsY_ ) {
+ j = nBinsY_ - 1;
+ }
- // Find the bin centres (actual co-ordinate positions, not histogram indices)
- Double_t cbinx = Double_t(i+0.5)*rangeX_/nBinsX_ + minX_;
- Double_t cbiny = Double_t(j+0.5)*rangeY_/nBinsY_ + minY_;
+ // Ask whether we want to do the interpolation, since this method is
+ // not reliable for low statistics histograms.
+ if ( useInterpolation_ == kFALSE ) {
+ return this->getBinHistValue( i, j );
+ }
- // If bin centres are outside kinematic region, do not extrapolate
- if (this->withinDPBoundaries(cbinx,cbiny) == kFALSE) {return this->getBinHistValue(i,j);}
+ // Find the bin centres (actual co-ordinate positions, not histogram indices)
+ Double_t cbinx = Double_t( i + 0.5 ) * rangeX_ / nBinsX_ + minX_;
+ Double_t cbiny = Double_t( j + 0.5 ) * rangeY_ / nBinsY_ + minY_;
- // Find the adjacent bins
- Double_t deltax = x - cbinx;
- Double_t deltay = y - cbiny;
+ // If bin centres are outside kinematic region, do not extrapolate
+ if ( this->withinDPBoundaries( cbinx, cbiny ) == kFALSE ) {
+ return this->getBinHistValue( i, j );
+ }
- Int_t i_adj(0), j_adj(0);
- if (deltax > 0.0) {
- i_adj = i + 1;
- } else {
- i_adj = i - 1;
- }
- if (deltay > 0.0) {
- j_adj = j + 1;
- } else {
- j_adj = j - 1;
- }
+ // Find the adjacent bins
+ Double_t deltax = x - cbinx;
+ Double_t deltay = y - cbiny;
- Bool_t isXBoundary(kFALSE), isYBoundary(kFALSE);
+ Int_t i_adj( 0 ), j_adj( 0 );
+ if ( deltax > 0.0 ) {
+ i_adj = i + 1;
+ } else {
+ i_adj = i - 1;
+ }
+ if ( deltay > 0.0 ) {
+ j_adj = j + 1;
+ } else {
+ j_adj = j - 1;
+ }
- Double_t value(0.0);
+ Bool_t isXBoundary( kFALSE ), isYBoundary( kFALSE );
- if (i_adj >= nBinsX_ || i_adj < 0) {isYBoundary = kTRUE;}
- if (j_adj >= nBinsY_ || j_adj < 0) {isXBoundary = kTRUE;}
+ Double_t value( 0.0 );
- // In the corners, do no interpolation. Use entry in bin (i,j)
- if (isXBoundary == kTRUE && isYBoundary == kTRUE) {
+ if ( i_adj >= nBinsX_ || i_adj < 0 ) {
+ isYBoundary = kTRUE;
+ }
+ if ( j_adj >= nBinsY_ || j_adj < 0 ) {
+ isXBoundary = kTRUE;
+ }
- value = this->getBinHistValue(i,j);
+ // In the corners, do no interpolation. Use entry in bin (i,j)
+ if ( isXBoundary == kTRUE && isYBoundary == kTRUE ) {
- } else if (isXBoundary == kTRUE && isYBoundary == kFALSE) {
+ value = this->getBinHistValue( i, j );
- // Find the adjacent x bin centre
- Double_t cbinx_adj = Double_t(i_adj+0.5)*rangeX_/nBinsX_ + minX_;
+ } else if ( isXBoundary == kTRUE && isYBoundary == kFALSE ) {
- if (this->withinDPBoundaries(cbinx_adj, y) == kFALSE) {
+ // Find the adjacent x bin centre
+ Double_t cbinx_adj = Double_t( i_adj + 0.5 ) * rangeX_ / nBinsX_ + minX_;
- // The adjacent bin is outside the DP range. Don't extrapolate.
- value = this->getBinHistValue(i,j);
+ if ( this->withinDPBoundaries( cbinx_adj, y ) == kFALSE ) {
- } else {
+ // The adjacent bin is outside the DP range. Don't extrapolate.
+ value = this->getBinHistValue( i, j );
- Double_t dx0 = TMath::Abs(x - cbinx);
- Double_t dx1 = TMath::Abs(cbinx_adj - x);
- Double_t inter_denom = dx0 + dx1;
+ } else {
- Double_t value1 = this->getBinHistValue(i,j);
- Double_t value2 = this->getBinHistValue(i_adj,j);
+ Double_t dx0 = TMath::Abs( x - cbinx );
+ Double_t dx1 = TMath::Abs( cbinx_adj - x );
+ Double_t inter_denom = dx0 + dx1;
- value = (value1*dx1 + value2*dx0)/inter_denom;
+ Double_t value1 = this->getBinHistValue( i, j );
+ Double_t value2 = this->getBinHistValue( i_adj, j );
- }
+ value = ( value1 * dx1 + value2 * dx0 ) / inter_denom;
+ }
- } else if (isYBoundary == kTRUE && isXBoundary == kFALSE) {
+ } else if ( isYBoundary == kTRUE && isXBoundary == kFALSE ) {
- // Find the adjacent y bin centre
- Double_t cbiny_adj = Double_t(j_adj+0.5)*rangeY_/nBinsY_ + minY_;
+ // Find the adjacent y bin centre
+ Double_t cbiny_adj = Double_t( j_adj + 0.5 ) * rangeY_ / nBinsY_ + minY_;
- if (this->withinDPBoundaries(x, cbiny_adj) == kFALSE) {
+ if ( this->withinDPBoundaries( x, cbiny_adj ) == kFALSE ) {
- // The adjacent bin is outside the DP range. Don't extrapolate.
- value = this->getBinHistValue(i,j);
+ // The adjacent bin is outside the DP range. Don't extrapolate.
+ value = this->getBinHistValue( i, j );
- } else {
+ } else {
- Double_t dy0 = TMath::Abs(y - cbiny);
- Double_t dy1 = TMath::Abs(cbiny_adj - y);
- Double_t inter_denom = dy0 + dy1;
+ Double_t dy0 = TMath::Abs( y - cbiny );
+ Double_t dy1 = TMath::Abs( cbiny_adj - y );
+ Double_t inter_denom = dy0 + dy1;
- Double_t value1 = this->getBinHistValue(i,j);
- Double_t value2 = this->getBinHistValue(i,j_adj);
+ Double_t value1 = this->getBinHistValue( i, j );
+ Double_t value2 = this->getBinHistValue( i, j_adj );
- value = (value1*dy1 + value2*dy0)/inter_denom;
+ value = ( value1 * dy1 + value2 * dy0 ) / inter_denom;
+ }
- }
+ } else {
- } else {
+ // 2D linear interpolation using inverse distance as weights.
+ // Find the adjacent x and y bin centres
+ Double_t cbinx_adj = Double_t( i_adj + 0.5 ) * rangeX_ / nBinsX_ + minX_;
+ Double_t cbiny_adj = Double_t( j_adj + 0.5 ) * rangeY_ / nBinsY_ + minY_;
- // 2D linear interpolation using inverse distance as weights.
- // Find the adjacent x and y bin centres
- Double_t cbinx_adj = Double_t(i_adj+0.5)*rangeX_/nBinsX_ + minX_;
- Double_t cbiny_adj = Double_t(j_adj+0.5)*rangeY_/nBinsY_ + minY_;
+ if ( this->withinDPBoundaries( cbinx_adj, cbiny_adj ) == kFALSE ) {
- if (this->withinDPBoundaries(cbinx_adj, cbiny_adj) == kFALSE) {
+ // The adjacent bin is outside the DP range. Don't extrapolate.
+ value = this->getBinHistValue( i, j );
- // The adjacent bin is outside the DP range. Don't extrapolate.
- value = this->getBinHistValue(i,j);
+ } else {
- } else {
+ Double_t dx0 = TMath::Abs( x - cbinx );
+ Double_t dx1 = TMath::Abs( cbinx_adj - x );
+ Double_t dy0 = TMath::Abs( y - cbiny );
+ Double_t dy1 = TMath::Abs( cbiny_adj - y );
- Double_t dx0 = TMath::Abs(x - cbinx);
- Double_t dx1 = TMath::Abs(cbinx_adj - x);
- Double_t dy0 = TMath::Abs(y - cbiny);
- Double_t dy1 = TMath::Abs(cbiny_adj - y);
+ Double_t inter_denom = ( dx0 + dx1 ) * ( dy0 + dy1 );
- Double_t inter_denom = (dx0 + dx1)*(dy0 + dy1);
+ Double_t value1 = this->getBinHistValue( i, j );
+ Double_t value2 = this->getBinHistValue( i_adj, j );
+ Double_t value3 = this->getBinHistValue( i, j_adj );
+ Double_t value4 = this->getBinHistValue( i_adj, j_adj );
- Double_t value1 = this->getBinHistValue(i,j);
- Double_t value2 = this->getBinHistValue(i_adj,j);
- Double_t value3 = this->getBinHistValue(i,j_adj);
- Double_t value4 = this->getBinHistValue(i_adj,j_adj);
-
- value = value1*dx1*dy1 + value2*dx0*dy1 + value3*dx1*dy0 + value4*dx0*dy0;
- value /= inter_denom;
- }
-
- }
-
- return value;
+ value = value1 * dx1 * dy1 + value2 * dx0 * dy1 + value3 * dx1 * dy0 + value4 * dx0 * dy0;
+ value /= inter_denom;
+ }
+ }
+ return value;
}
-
diff --git a/src/Lau2DHistDPPdf.cc b/src/Lau2DHistDPPdf.cc
index 1fd4c8a..55f8733 100644
--- a/src/Lau2DHistDPPdf.cc
+++ b/src/Lau2DHistDPPdf.cc
@@ -1,370 +1,402 @@
/*
Copyright 2004 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file Lau2DHistDPPdf.cc
\brief File containing implementation of Lau2DHistDPPdf class.
*/
-#include <iostream>
-
-#include "TAxis.h"
-#include "TH2.h"
-#include "TRandom.h"
-
#include "Lau2DHistDPPdf.hh"
+
#include "LauKinematics.hh"
#include "LauRandom.hh"
#include "LauVetoes.hh"
+#include "TAxis.h"
+#include "TH2.h"
+#include "TRandom.h"
+#include <iostream>
-Lau2DHistDPPdf::Lau2DHistDPPdf(const TH2* hist, LauKinematics* kinematics, const LauVetoes* vetoes,
- Bool_t useInterpolation, Bool_t fluctuateBins, Bool_t useUpperHalfOnly, Bool_t squareDP) :
- Lau2DAbsHistDPPdf(kinematics,vetoes,useUpperHalfOnly,squareDP),
- hist_(hist ? dynamic_cast<TH2*>(hist->Clone()) : 0),
- minX_(0.0), maxX_(0.0), minY_(0.0), maxY_(0.0), rangeX_(0.0), rangeY_(0.0),
- binXWidth_(0.0), binYWidth_(0.0),
- invBinXWidth_(0.0), invBinYWidth_(0.0),
- nBinsX_(0), nBinsY_(0),
- norm_(0.0),
- useInterpolation_(useInterpolation)
+Lau2DHistDPPdf::Lau2DHistDPPdf( const TH2* hist,
+ LauKinematics* kinematics,
+ const LauVetoes* vetoes,
+ Bool_t useInterpolation,
+ Bool_t fluctuateBins,
+ Bool_t useUpperHalfOnly,
+ Bool_t squareDP ) :
+ Lau2DAbsHistDPPdf( kinematics, vetoes, useUpperHalfOnly, squareDP ),
+ hist_( hist ? dynamic_cast<TH2*>( hist->Clone() ) : 0 ),
+ minX_( 0.0 ),
+ maxX_( 0.0 ),
+ minY_( 0.0 ),
+ maxY_( 0.0 ),
+ rangeX_( 0.0 ),
+ rangeY_( 0.0 ),
+ binXWidth_( 0.0 ),
+ binYWidth_( 0.0 ),
+ invBinXWidth_( 0.0 ),
+ invBinYWidth_( 0.0 ),
+ nBinsX_( 0 ),
+ nBinsY_( 0 ),
+ norm_( 0.0 ),
+ useInterpolation_( useInterpolation )
{
- // For square Dalitz plots, the co-ordinates must be m', theta'
- // The input data to the fit is still in m13^2, m23^2 co-ords, and a
- // transformation is applied to go from one co-ordinate system to the
- // other.
-
- // Save various attributes of the histogram
- // (axis ranges, number of bins, areas)
- if ( hist_ ) {
- TAxis* xAxis = hist_->GetXaxis();
- minX_ = xAxis->GetXmin();
- maxX_ = xAxis->GetXmax();
-
- TAxis* yAxis = hist_->GetYaxis();
- minY_ = yAxis->GetXmin();
- maxY_ = yAxis->GetXmax();
-
- nBinsX_ = hist_->GetNbinsX();
- nBinsY_ = hist_->GetNbinsY();
- } else {
- minX_ = getKinematics()->getm13SqMin();
- maxX_ = getKinematics()->getm13SqMax();
-
- minY_ = getKinematics()->getm23SqMin();
- maxY_ = getKinematics()->getm23SqMax();
-
- nBinsX_ = 1;
- nBinsY_ = 1;
- }
-
- rangeX_ = maxX_ - minX_;
- rangeY_ = maxY_ - minY_;
- if (nBinsX_ > 0) { binXWidth_ = TMath::Abs(rangeX_)/(nBinsX_*1.0); }
- if (nBinsY_ > 0) { binYWidth_ = TMath::Abs(rangeY_)/(nBinsY_*1.0); }
- if (binXWidth_ > 1e-10) { invBinXWidth_ = 1.0/binXWidth_; }
- if (binYWidth_ > 1e-10) { invBinYWidth_ = 1.0/binYWidth_; }
-
- // If the bins are to be fluctuated then do so now before
- // calculating anything that depends on the bin content.
- if (fluctuateBins) {
- this->doBinFluctuation(hist_);
- }
-
- // Calculate the PDF normalisation.
- this->calcHistNorm();
-
- // And check it is OK.
- this->checkNormalisation();
-
- // Also obtain the maximum height
- this->calcMaxHeight(hist_);
+ // For square Dalitz plots, the co-ordinates must be m', theta'
+ // The input data to the fit is still in m13^2, m23^2 co-ords, and a
+ // transformation is applied to go from one co-ordinate system to the
+ // other.
+
+ // Save various attributes of the histogram
+ // (axis ranges, number of bins, areas)
+ if ( hist_ ) {
+ TAxis* xAxis = hist_->GetXaxis();
+ minX_ = xAxis->GetXmin();
+ maxX_ = xAxis->GetXmax();
+
+ TAxis* yAxis = hist_->GetYaxis();
+ minY_ = yAxis->GetXmin();
+ maxY_ = yAxis->GetXmax();
+
+ nBinsX_ = hist_->GetNbinsX();
+ nBinsY_ = hist_->GetNbinsY();
+ } else {
+ minX_ = getKinematics()->getm13SqMin();
+ maxX_ = getKinematics()->getm13SqMax();
+
+ minY_ = getKinematics()->getm23SqMin();
+ maxY_ = getKinematics()->getm23SqMax();
+
+ nBinsX_ = 1;
+ nBinsY_ = 1;
+ }
+
+ rangeX_ = maxX_ - minX_;
+ rangeY_ = maxY_ - minY_;
+ if ( nBinsX_ > 0 ) {
+ binXWidth_ = TMath::Abs( rangeX_ ) / ( nBinsX_ * 1.0 );
+ }
+ if ( nBinsY_ > 0 ) {
+ binYWidth_ = TMath::Abs( rangeY_ ) / ( nBinsY_ * 1.0 );
+ }
+ if ( binXWidth_ > 1e-10 ) {
+ invBinXWidth_ = 1.0 / binXWidth_;
+ }
+ if ( binYWidth_ > 1e-10 ) {
+ invBinYWidth_ = 1.0 / binYWidth_;
+ }
+
+ // If the bins are to be fluctuated then do so now before
+ // calculating anything that depends on the bin content.
+ if ( fluctuateBins ) {
+ this->doBinFluctuation( hist_ );
+ }
+
+ // Calculate the PDF normalisation.
+ this->calcHistNorm();
+
+ // And check it is OK.
+ this->checkNormalisation();
+
+ // Also obtain the maximum height
+ this->calcMaxHeight( hist_ );
}
Lau2DHistDPPdf::~Lau2DHistDPPdf()
{
- // Destructor
- delete hist_; hist_ = 0;
+ // Destructor
+ delete hist_;
+ hist_ = 0;
}
void Lau2DHistDPPdf::calcHistNorm()
{
- // Calculate the histogram normalisation. We must integrate
- // over the allowed kinematic DP region.
+ // Calculate the histogram normalisation. We must integrate
+ // over the allowed kinematic DP region.
- // Loop over the total x and y range to get the total area
- // under x and y. Just sum the contributions up using 1e-3 increments
- // of the range in x and y. Multiply the end result by dx and dy.
+ // Loop over the total x and y range to get the total area
+ // under x and y. Just sum the contributions up using 1e-3 increments
+ // of the range in x and y. Multiply the end result by dx and dy.
- const Double_t axisMin = TMath::Min( minX_, minY_ );
- const Double_t axisMax = TMath::Max( maxX_, maxY_ );
- const Double_t axisRange = axisMax - axisMin;
+ const Double_t axisMin = TMath::Min( minX_, minY_ );
+ const Double_t axisMax = TMath::Max( maxX_, maxY_ );
+ const Double_t axisRange = axisMax - axisMin;
- const Double_t dx(1e-3 * axisRange);
- const Double_t dy(dx);
+ const Double_t dx( 1e-3 * axisRange );
+ const Double_t dy( dx );
- Double_t area(0.0);
+ Double_t area( 0.0 );
- Double_t x(axisMin + dx/2.0);
- while (x < axisMax) {
- Double_t y(axisMin + dy/2.0);
- while (y < axisMax) {
- area += this->interpolateXY(x,y);
- y += dy;
- } // y while loop
- x += dx;
- } // x while loop
+ Double_t x( axisMin + dx / 2.0 );
+ while ( x < axisMax ) {
+ Double_t y( axisMin + dy / 2.0 );
+ while ( y < axisMax ) {
+ area += this->interpolateXY( x, y );
+ y += dy;
+ } // y while loop
+ x += dx;
+ } // x while loop
- norm_ = area*dx*dy;
+ norm_ = area * dx * dy;
- std::cout << "INFO in Lau2DHistDPPdf::calcHistNorm : Norm = " << norm_ << ", bX*bY = " << binXWidth_ << "*" << binYWidth_ << " = " << binXWidth_*binYWidth_ << std::endl;
+ std::cout << "INFO in Lau2DHistDPPdf::calcHistNorm : Norm = " << norm_
+ << ", bX*bY = " << binXWidth_ << "*" << binYWidth_ << " = " << binXWidth_ * binYWidth_
+ << std::endl;
}
-Double_t Lau2DHistDPPdf::getBinHistValue(Int_t xBinNo, Int_t yBinNo) const
+Double_t Lau2DHistDPPdf::getBinHistValue( Int_t xBinNo, Int_t yBinNo ) const
{
- if (xBinNo < 0) {
- xBinNo = 0;
- } else if (xBinNo >= nBinsX_) {
- return 0.0;
- }
-
- if (yBinNo < 0) {
- yBinNo = 0;
- } else if (yBinNo >= nBinsY_) {
- return 0.0;
- }
-
- if ( hist_ == 0 ) {
- return 1.0;
- }
-
- Double_t value = hist_->GetBinContent(xBinNo+1, yBinNo+1);
- return value;
+ if ( xBinNo < 0 ) {
+ xBinNo = 0;
+ } else if ( xBinNo >= nBinsX_ ) {
+ return 0.0;
+ }
+
+ if ( yBinNo < 0 ) {
+ yBinNo = 0;
+ } else if ( yBinNo >= nBinsY_ ) {
+ return 0.0;
+ }
+
+ if ( hist_ == 0 ) {
+ return 1.0;
+ }
+
+ Double_t value = hist_->GetBinContent( xBinNo + 1, yBinNo + 1 );
+ return value;
}
-Double_t Lau2DHistDPPdf::interpolateXYNorm(Double_t x, Double_t y) const
+Double_t Lau2DHistDPPdf::interpolateXYNorm( Double_t x, Double_t y ) const
{
- // Get the normalised interpolated value.
- Double_t value = this->interpolateXY(x,y);
- return value/norm_;
-
+ // Get the normalised interpolated value.
+ Double_t value = this->interpolateXY( x, y );
+ return value / norm_;
}
-Double_t Lau2DHistDPPdf::interpolateXY(Double_t x, Double_t y) const
+Double_t Lau2DHistDPPdf::interpolateXY( Double_t x, Double_t y ) const
{
- // This function returns the interpolated value of the histogram function
- // for the given values of x and y by finding the adjacent bins and extrapolating
- // using weights based on the inverse distance of the point from the adajcent
- // bin centres.
- // Here, x = m13^2, y = m23^2, or m', theta' for square DP co-ordinates
-
- // If we're only using one half then flip co-ordinates
- // appropriately for conventional or square DP
- getUpperHalf(x,y);
-
- // First ask whether the point is inside the kinematic region.
- if (withinDPBoundaries(x,y) == kFALSE) {return 0.0;}
-
- // Update the kinematics to the position of interest.
- updateKinematics(x,y);
+ // This function returns the interpolated value of the histogram function
+ // for the given values of x and y by finding the adjacent bins and extrapolating
+ // using weights based on the inverse distance of the point from the adajcent
+ // bin centres.
+ // Here, x = m13^2, y = m23^2, or m', theta' for square DP co-ordinates
+
+ // If we're only using one half then flip co-ordinates
+ // appropriately for conventional or square DP
+ getUpperHalf( x, y );
+
+ // First ask whether the point is inside the kinematic region.
+ if ( withinDPBoundaries( x, y ) == kFALSE ) {
+ return 0.0;
+ }
- // Check that we're not inside a veto
- Bool_t vetoOK(kTRUE);
- if (getVetoes()) {
- vetoOK = getVetoes()->passVeto(getKinematics());
- }
- if (vetoOK == kFALSE) {return 0.0;}
+ // Update the kinematics to the position of interest.
+ updateKinematics( x, y );
- // Find the 2D histogram bin for x and y
- Int_t i = TMath::FloorNint((x - minX_)*invBinXWidth_);
- Int_t j = TMath::FloorNint((y - minY_)*invBinYWidth_);
+ // Check that we're not inside a veto
+ Bool_t vetoOK( kTRUE );
+ if ( getVetoes() ) {
+ vetoOK = getVetoes()->passVeto( getKinematics() );
+ }
+ if ( vetoOK == kFALSE ) {
+ return 0.0;
+ }
- if (i >= nBinsX_) {i = nBinsX_ - 1;}
- if (j >= nBinsY_) {j = nBinsY_ - 1;}
+ // Find the 2D histogram bin for x and y
+ Int_t i = TMath::FloorNint( ( x - minX_ ) * invBinXWidth_ );
+ Int_t j = TMath::FloorNint( ( y - minY_ ) * invBinYWidth_ );
- // Ask whether we want to do the interpolation, since this method is
- // not reliable for low statistics histograms.
- if (useInterpolation_ == kFALSE) {
- return this->getBinHistValue(i,j);
- }
+ if ( i >= nBinsX_ ) {
+ i = nBinsX_ - 1;
+ }
+ if ( j >= nBinsY_ ) {
+ j = nBinsY_ - 1;
+ }
- // Find the bin centres (actual co-ordinate positions, not histogram indices)
- Double_t cbinx = (i+0.5)*binXWidth_ + minX_;
- Double_t cbiny = (j+0.5)*binYWidth_ + minY_;
+ // Ask whether we want to do the interpolation, since this method is
+ // not reliable for low statistics histograms.
+ if ( useInterpolation_ == kFALSE ) {
+ return this->getBinHistValue( i, j );
+ }
- // If bin centres are outside kinematic region, do not extrapolate
- if (withinDPBoundaries(cbinx, cbiny) == kFALSE) {
- return this->getBinHistValue(i,j);
- }
+ // Find the bin centres (actual co-ordinate positions, not histogram indices)
+ Double_t cbinx = ( i + 0.5 ) * binXWidth_ + minX_;
+ Double_t cbiny = ( j + 0.5 ) * binYWidth_ + minY_;
- // Find the adjacent bins
- Double_t deltax = x - cbinx;
- Double_t deltay = y - cbiny;
+ // If bin centres are outside kinematic region, do not extrapolate
+ if ( withinDPBoundaries( cbinx, cbiny ) == kFALSE ) {
+ return this->getBinHistValue( i, j );
+ }
- Int_t i_adj(0), j_adj(0);
- if (deltax > 0.0) {
- i_adj = i + 1;
- } else {
- i_adj = i - 1;
- }
- if (deltay > 0.0) {
- j_adj = j + 1;
- } else {
- j_adj = j - 1;
- }
+ // Find the adjacent bins
+ Double_t deltax = x - cbinx;
+ Double_t deltay = y - cbiny;
- Bool_t isXBoundary(kFALSE), isYBoundary(kFALSE);
+ Int_t i_adj( 0 ), j_adj( 0 );
+ if ( deltax > 0.0 ) {
+ i_adj = i + 1;
+ } else {
+ i_adj = i - 1;
+ }
+ if ( deltay > 0.0 ) {
+ j_adj = j + 1;
+ } else {
+ j_adj = j - 1;
+ }
- Double_t value(0.0);
+ Bool_t isXBoundary( kFALSE ), isYBoundary( kFALSE );
- if (i_adj >= nBinsX_ || i_adj < 0) {isYBoundary = kTRUE;}
- if (j_adj >= nBinsY_ || j_adj < 0) {isXBoundary = kTRUE;}
+ Double_t value( 0.0 );
- // In the corners, do no interpolation. Use entry in bin (i,j)
- if (isXBoundary == kTRUE && isYBoundary == kTRUE) {
+ if ( i_adj >= nBinsX_ || i_adj < 0 ) {
+ isYBoundary = kTRUE;
+ }
+ if ( j_adj >= nBinsY_ || j_adj < 0 ) {
+ isXBoundary = kTRUE;
+ }
- value = this->getBinHistValue(i,j);
+ // In the corners, do no interpolation. Use entry in bin (i,j)
+ if ( isXBoundary == kTRUE && isYBoundary == kTRUE ) {
- } else if (isXBoundary == kTRUE && isYBoundary == kFALSE) {
+ value = this->getBinHistValue( i, j );
- // Find the adjacent x bin centre
- Double_t cbinx_adj = Double_t(i_adj+0.5)*binXWidth_ + minX_;
+ } else if ( isXBoundary == kTRUE && isYBoundary == kFALSE ) {
- if (withinDPBoundaries(cbinx_adj, y) == kFALSE) {
+ // Find the adjacent x bin centre
+ Double_t cbinx_adj = Double_t( i_adj + 0.5 ) * binXWidth_ + minX_;
- // The adjacent bin is outside the DP range. Don't extrapolate.
- value = this->getBinHistValue(i,j);
+ if ( withinDPBoundaries( cbinx_adj, y ) == kFALSE ) {
- } else {
+ // The adjacent bin is outside the DP range. Don't extrapolate.
+ value = this->getBinHistValue( i, j );
- Double_t dx0 = TMath::Abs(x - cbinx);
- Double_t dx1 = TMath::Abs(cbinx_adj - x);
- Double_t inter_denom = dx0 + dx1;
+ } else {
- Double_t value1 = this->getBinHistValue(i,j);
- Double_t value2 = this->getBinHistValue(i_adj,j);
+ Double_t dx0 = TMath::Abs( x - cbinx );
+ Double_t dx1 = TMath::Abs( cbinx_adj - x );
+ Double_t inter_denom = dx0 + dx1;
- value = (value1*dx1 + value2*dx0)/inter_denom;
+ Double_t value1 = this->getBinHistValue( i, j );
+ Double_t value2 = this->getBinHistValue( i_adj, j );
- }
+ value = ( value1 * dx1 + value2 * dx0 ) / inter_denom;
+ }
- } else if (isYBoundary == kTRUE && isXBoundary == kFALSE) {
+ } else if ( isYBoundary == kTRUE && isXBoundary == kFALSE ) {
- // Find the adjacent y bin centre
- Double_t cbiny_adj = Double_t(j_adj+0.5)*binYWidth_ + minY_;
+ // Find the adjacent y bin centre
+ Double_t cbiny_adj = Double_t( j_adj + 0.5 ) * binYWidth_ + minY_;
- if (withinDPBoundaries(x, cbiny_adj) == kFALSE) {
+ if ( withinDPBoundaries( x, cbiny_adj ) == kFALSE ) {
- // The adjacent bin is outside the DP range. Don't extrapolate.
- value = this->getBinHistValue(i,j);
+ // The adjacent bin is outside the DP range. Don't extrapolate.
+ value = this->getBinHistValue( i, j );
- } else {
+ } else {
- Double_t dy0 = TMath::Abs(y - cbiny);
- Double_t dy1 = TMath::Abs(cbiny_adj - y);
- Double_t inter_denom = dy0 + dy1;
+ Double_t dy0 = TMath::Abs( y - cbiny );
+ Double_t dy1 = TMath::Abs( cbiny_adj - y );
+ Double_t inter_denom = dy0 + dy1;
- Double_t value1 = this->getBinHistValue(i,j);
- Double_t value2 = this->getBinHistValue(i,j_adj);
+ Double_t value1 = this->getBinHistValue( i, j );
+ Double_t value2 = this->getBinHistValue( i, j_adj );
- value = (value1*dy1 + value2*dy0)/inter_denom;
+ value = ( value1 * dy1 + value2 * dy0 ) / inter_denom;
+ }
- }
+ } else {
- } else {
+ // 2D linear interpolation using inverse distance as weights.
+ // Find the adjacent x and y bin centres
+ Double_t cbinx_adj = Double_t( i_adj + 0.5 ) * binXWidth_ + minX_;
+ Double_t cbiny_adj = Double_t( j_adj + 0.5 ) * binYWidth_ + minY_;
- // 2D linear interpolation using inverse distance as weights.
- // Find the adjacent x and y bin centres
- Double_t cbinx_adj = Double_t(i_adj+0.5)*binXWidth_ + minX_;
- Double_t cbiny_adj = Double_t(j_adj+0.5)*binYWidth_ + minY_;
+ if ( withinDPBoundaries( cbinx_adj, cbiny_adj ) == kFALSE ) {
- if (withinDPBoundaries(cbinx_adj, cbiny_adj) == kFALSE) {
+ // The adjacent bin is outside the DP range. Don't extrapolate.
+ value = this->getBinHistValue( i, j );
- // The adjacent bin is outside the DP range. Don't extrapolate.
- value = this->getBinHistValue(i,j);
+ } else {
- } else {
+ Double_t dx0 = TMath::Abs( x - cbinx );
+ Double_t dx1 = TMath::Abs( cbinx_adj - x );
+ Double_t dy0 = TMath::Abs( y - cbiny );
+ Double_t dy1 = TMath::Abs( cbiny_adj - y );
- Double_t dx0 = TMath::Abs(x - cbinx);
- Double_t dx1 = TMath::Abs(cbinx_adj - x);
- Double_t dy0 = TMath::Abs(y - cbiny);
- Double_t dy1 = TMath::Abs(cbiny_adj - y);
+ Double_t inter_denom = ( dx0 + dx1 ) * ( dy0 + dy1 );
- Double_t inter_denom = (dx0 + dx1)*(dy0 + dy1);
+ Double_t value1 = this->getBinHistValue( i, j );
+ Double_t value2 = this->getBinHistValue( i_adj, j );
+ Double_t value3 = this->getBinHistValue( i, j_adj );
+ Double_t value4 = this->getBinHistValue( i_adj, j_adj );
- Double_t value1 = this->getBinHistValue(i,j);
- Double_t value2 = this->getBinHistValue(i_adj,j);
- Double_t value3 = this->getBinHistValue(i,j_adj);
- Double_t value4 = this->getBinHistValue(i_adj,j_adj);
-
- value = value1*dx1*dy1 + value2*dx0*dy1 + value3*dx1*dy0 + value4*dx0*dy0;
- value /= inter_denom;
- }
-
- }
-
- return value;
+ value = value1 * dx1 * dy1 + value2 * dx0 * dy1 + value3 * dx1 * dy0 + value4 * dx0 * dy0;
+ value /= inter_denom;
+ }
+ }
+ return value;
}
void Lau2DHistDPPdf::checkNormalisation()
{
- // Loop over the total x and y range to get the total area
- // under x and y. Just sum the contributions up using 1e-3 increments
- // of the range in x and y. Multiply the end result by dx and dy.
-
- const Double_t axisMin = TMath::Min( minX_, minY_ );
- const Double_t axisMax = TMath::Max( maxX_, maxY_ );
- const Double_t axisRange = axisMax - axisMin;
-
- const Double_t dx(1e-3 * axisRange);
- const Double_t dy(dx);
-
- Double_t area(0.0);
- Double_t areaNoNorm(0.0);
-
- // Preserve the value of a variable we change temporarily
- Bool_t interpolate = useInterpolation_;
-
- Double_t x(axisMin + dx/2.0);
- while (x < axisMax) {
- Double_t y(axisMin + dy/2.0);
- while (y < axisMax) {
- area += this->interpolateXYNorm(x,y);
- useInterpolation_ = kFALSE;
- areaNoNorm += this->interpolateXY(x,y);
- useInterpolation_ = kTRUE;
- y += dy;
- } // y while loop
- x += dx;
- } // x while loop
- Double_t norm = area*dx*dy;
-
- useInterpolation_ = interpolate; //Restore old value
-
- std::cout << "INFO in Lau2DHistDPPdf::checkNormalisation : Area = " << area << ", dx = " << dx << ", dy = " << dy << ", dx*dy = " << dx*dy << std::endl;
- std::cout << " : Area with no norm = " << areaNoNorm << "*dx*dy = " << areaNoNorm*dx*dy << std::endl;
- std::cout << " : The total area of the normalised histogram PDF is " << norm << std::endl;
+ // Loop over the total x and y range to get the total area
+ // under x and y. Just sum the contributions up using 1e-3 increments
+ // of the range in x and y. Multiply the end result by dx and dy.
+
+ const Double_t axisMin = TMath::Min( minX_, minY_ );
+ const Double_t axisMax = TMath::Max( maxX_, maxY_ );
+ const Double_t axisRange = axisMax - axisMin;
+
+ const Double_t dx( 1e-3 * axisRange );
+ const Double_t dy( dx );
+
+ Double_t area( 0.0 );
+ Double_t areaNoNorm( 0.0 );
+
+ // Preserve the value of a variable we change temporarily
+ Bool_t interpolate = useInterpolation_;
+
+ Double_t x( axisMin + dx / 2.0 );
+ while ( x < axisMax ) {
+ Double_t y( axisMin + dy / 2.0 );
+ while ( y < axisMax ) {
+ area += this->interpolateXYNorm( x, y );
+ useInterpolation_ = kFALSE;
+ areaNoNorm += this->interpolateXY( x, y );
+ useInterpolation_ = kTRUE;
+ y += dy;
+ } // y while loop
+ x += dx;
+ } // x while loop
+ Double_t norm = area * dx * dy;
+
+ useInterpolation_ = interpolate; //Restore old value
+
+ std::cout << "INFO in Lau2DHistDPPdf::checkNormalisation : Area = " << area << ", dx = " << dx
+ << ", dy = " << dy << ", dx*dy = " << dx * dy << std::endl;
+ std::cout << " : Area with no norm = " << areaNoNorm
+ << "*dx*dy = " << areaNoNorm * dx * dy << std::endl;
+ std::cout << " : The total area of the normalised histogram PDF is "
+ << norm << std::endl;
}
-
diff --git a/src/Lau2DHistPdf.cc b/src/Lau2DHistPdf.cc
index b7c52d3..f999ef3 100644
--- a/src/Lau2DHistPdf.cc
+++ b/src/Lau2DHistPdf.cc
@@ -1,485 +1,525 @@
/*
Copyright 2008 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file Lau2DHistPdf.cc
\brief File containing implementation of Lau2DHistPdf class.
*/
-#include <cstdlib>
-#include <iostream>
-#include <vector>
+#include "Lau2DHistPdf.hh"
+
+#include "Lau1DHistPdf.hh"
+#include "LauRandom.hh"
#include "TAxis.h"
#include "TH2.h"
#include "TRandom.h"
#include "TSystem.h"
-#include "Lau1DHistPdf.hh"
-#include "Lau2DHistPdf.hh"
-#include "LauRandom.hh"
+#include <cstdlib>
+#include <iostream>
+#include <vector>
class LauParameter;
-
-
-Lau2DHistPdf::Lau2DHistPdf(const std::vector<TString>& theVarNames, const TH2* hist,
- const LauFitData& minVals, const LauFitData& maxVals,
- Bool_t useInterpolation, Bool_t fluctuateBins) :
- LauAbsPdf(theVarNames, std::vector<LauAbsRValue*>(), minVals, maxVals),
- hist_(hist ? dynamic_cast<TH2*>(hist->Clone()) : 0),
- xProj_(0),
- yProj_(0),
- xVarPdf_(0),
- yVarPdf_(0),
- xName_(""),
- yName_(""),
- nBinsX_(0),
- nBinsY_(0),
- minX_(0.0),
- maxX_(0.0),
- minY_(0.0),
- maxY_(0.0),
- rangeX_(0.0),
- rangeY_(0.0),
- binXWidth_(0.0),
- binYWidth_(0.0),
- invBinXWidth_(0.0),
- invBinYWidth_(0.0),
- useInterpolation_(useInterpolation),
- fluctuateBins_(fluctuateBins)
+Lau2DHistPdf::Lau2DHistPdf( const std::vector<TString>& theVarNames,
+ const TH2* hist,
+ const LauFitData& minVals,
+ const LauFitData& maxVals,
+ Bool_t useInterpolation,
+ Bool_t fluctuateBins ) :
+ LauAbsPdf( theVarNames, std::vector<LauAbsRValue*>(), minVals, maxVals ),
+ hist_( hist ? dynamic_cast<TH2*>( hist->Clone() ) : 0 ),
+ xProj_( 0 ),
+ yProj_( 0 ),
+ xVarPdf_( 0 ),
+ yVarPdf_( 0 ),
+ xName_( "" ),
+ yName_( "" ),
+ nBinsX_( 0 ),
+ nBinsY_( 0 ),
+ minX_( 0.0 ),
+ maxX_( 0.0 ),
+ minY_( 0.0 ),
+ maxY_( 0.0 ),
+ rangeX_( 0.0 ),
+ rangeY_( 0.0 ),
+ binXWidth_( 0.0 ),
+ binYWidth_( 0.0 ),
+ invBinXWidth_( 0.0 ),
+ invBinYWidth_( 0.0 ),
+ useInterpolation_( useInterpolation ),
+ fluctuateBins_( fluctuateBins )
{
- // Constructor
-
- // Check that we have two variables
- if ( this->nInputVars() != 2 ) {
- std::cerr << "ERROR in Lau2DHistPdf::Lau2DHistPdf : Have not been provided with exactly two variables." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // Set the variable names from the abstract class
- xName_ = this->varNames()[0];
- yName_ = this->varNames()[1];
-
- // Set the variable limits from the abstract class
- minX_ = this->getMinAbscissa(xName_);
- maxX_ = this->getMaxAbscissa(xName_);
- minY_ = this->getMinAbscissa(yName_);
- maxY_ = this->getMaxAbscissa(yName_);
- rangeX_ = maxX_ - minX_;
- rangeY_ = maxY_ - minY_;
-
- // Have we got a valid histogram
- if ( hist_ == 0 ) {
- std::cerr << "ERROR in Lau2DHistPdf::Lau2DHistPdf : Histogram pointer is null." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // Set the directory for the histogram
- hist_->SetDirectory(0);
-
- // Save various attributes of the histogram
- nBinsX_ = hist_->GetNbinsX();
- nBinsY_ = hist_->GetNbinsY();
-
- TAxis* xAxis = hist_->GetXaxis();
- Double_t xAxisMin = xAxis->GetXmin();
- Double_t xAxisMax = xAxis->GetXmax();
-
- TAxis* yAxis = hist_->GetYaxis();
- Double_t yAxisMin = yAxis->GetXmin();
- Double_t yAxisMax = yAxis->GetXmax();
-
- // Check that axis ranges corresponds to ranges of abscissas
- if (TMath::Abs(minX_ - xAxisMin)>1e-6) {
- std::cerr << "ERROR in Lau2DHistPdf::Lau2DHistPdf : Histogram x-axis minimum: " << xAxisMin <<
- " does not correspond to " << xName_ << " minimum: " << minX_ << "." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- if (TMath::Abs(maxX_ - xAxisMax)>1e-6) {
- std::cerr << "ERROR in Lau2DHistPdf::Lau2DHistPdf : Histogram x-axis maximum: " << xAxisMax <<
- " does not correspond to " << xName_ << " maximum: " << maxX_ << "." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- if (TMath::Abs(minY_ - yAxisMin)>1e-6) {
- std::cerr << "ERROR in Lau2DHistPdf::Lau2DHistPdf : Histogram y-axis minimum: " << yAxisMin <<
- " does not correspond to " << yName_ << " minimum: " << minY_ << "." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- if (TMath::Abs(maxY_ - yAxisMax)>1e-6) {
- std::cerr << "ERROR in Lau2DHistPdf::Lau2DHistPdf : Histogram y-axis maximum: " << yAxisMax <<
- " does not correspond to " << yName_ << " maximum: " << maxY_ << "." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // Calculate the bin widths and inverse bin widths
- binXWidth_ = static_cast<Double_t>(TMath::Abs(rangeX_)/(nBinsX_*1.0));
- binYWidth_ = static_cast<Double_t>(TMath::Abs(rangeY_)/(nBinsY_*1.0));
- if (binXWidth_ > 1e-10) {invBinXWidth_ = 1.0/binXWidth_;}
- if (binYWidth_ > 1e-10) {invBinYWidth_ = 1.0/binYWidth_;}
-
- // If the bins are to be fluctuated then do so now before
- // calculating anything that depends on the bin content.
- if (fluctuateBins) {
- this->doBinFluctuation();
- }
-
- // Create the projections and 1D PDFs from those
- xProj_ = hist_->ProjectionX();
- yProj_ = hist_->ProjectionY();
- if ( !xProj_ || !yProj_ ) {
- std::cerr << "ERROR in Lau2DHistPdf::Lau2DHistPdf : Can't get X or Y projection from 2D histogram." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- xVarPdf_ = new Lau1DHistPdf(xName_, xProj_, minX_, maxX_, useInterpolation_, fluctuateBins_);
- yVarPdf_ = new Lau1DHistPdf(yName_, yProj_, minY_, maxY_, useInterpolation_, fluctuateBins_);
-
- // Calculate the PDF normalisation.
- this->calcNorm();
-
- // And check it is OK.
- this->checkNormalisation();
+ // Constructor
+
+ // Check that we have two variables
+ if ( this->nInputVars() != 2 ) {
+ std::cerr << "ERROR in Lau2DHistPdf::Lau2DHistPdf : Have not been provided with exactly two variables."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // Set the variable names from the abstract class
+ xName_ = this->varNames()[0];
+ yName_ = this->varNames()[1];
+
+ // Set the variable limits from the abstract class
+ minX_ = this->getMinAbscissa( xName_ );
+ maxX_ = this->getMaxAbscissa( xName_ );
+ minY_ = this->getMinAbscissa( yName_ );
+ maxY_ = this->getMaxAbscissa( yName_ );
+ rangeX_ = maxX_ - minX_;
+ rangeY_ = maxY_ - minY_;
+
+ // Have we got a valid histogram
+ if ( hist_ == 0 ) {
+ std::cerr << "ERROR in Lau2DHistPdf::Lau2DHistPdf : Histogram pointer is null." << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // Set the directory for the histogram
+ hist_->SetDirectory( 0 );
+
+ // Save various attributes of the histogram
+ nBinsX_ = hist_->GetNbinsX();
+ nBinsY_ = hist_->GetNbinsY();
+
+ TAxis* xAxis = hist_->GetXaxis();
+ Double_t xAxisMin = xAxis->GetXmin();
+ Double_t xAxisMax = xAxis->GetXmax();
+
+ TAxis* yAxis = hist_->GetYaxis();
+ Double_t yAxisMin = yAxis->GetXmin();
+ Double_t yAxisMax = yAxis->GetXmax();
+
+ // Check that axis ranges corresponds to ranges of abscissas
+ if ( TMath::Abs( minX_ - xAxisMin ) > 1e-6 ) {
+ std::cerr << "ERROR in Lau2DHistPdf::Lau2DHistPdf : Histogram x-axis minimum: " << xAxisMin
+ << " does not correspond to " << xName_ << " minimum: " << minX_ << "."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ if ( TMath::Abs( maxX_ - xAxisMax ) > 1e-6 ) {
+ std::cerr << "ERROR in Lau2DHistPdf::Lau2DHistPdf : Histogram x-axis maximum: " << xAxisMax
+ << " does not correspond to " << xName_ << " maximum: " << maxX_ << "."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ if ( TMath::Abs( minY_ - yAxisMin ) > 1e-6 ) {
+ std::cerr << "ERROR in Lau2DHistPdf::Lau2DHistPdf : Histogram y-axis minimum: " << yAxisMin
+ << " does not correspond to " << yName_ << " minimum: " << minY_ << "."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ if ( TMath::Abs( maxY_ - yAxisMax ) > 1e-6 ) {
+ std::cerr << "ERROR in Lau2DHistPdf::Lau2DHistPdf : Histogram y-axis maximum: " << yAxisMax
+ << " does not correspond to " << yName_ << " maximum: " << maxY_ << "."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // Calculate the bin widths and inverse bin widths
+ binXWidth_ = static_cast<Double_t>( TMath::Abs( rangeX_ ) / ( nBinsX_ * 1.0 ) );
+ binYWidth_ = static_cast<Double_t>( TMath::Abs( rangeY_ ) / ( nBinsY_ * 1.0 ) );
+ if ( binXWidth_ > 1e-10 ) {
+ invBinXWidth_ = 1.0 / binXWidth_;
+ }
+ if ( binYWidth_ > 1e-10 ) {
+ invBinYWidth_ = 1.0 / binYWidth_;
+ }
+
+ // If the bins are to be fluctuated then do so now before
+ // calculating anything that depends on the bin content.
+ if ( fluctuateBins ) {
+ this->doBinFluctuation();
+ }
+
+ // Create the projections and 1D PDFs from those
+ xProj_ = hist_->ProjectionX();
+ yProj_ = hist_->ProjectionY();
+ if ( ! xProj_ || ! yProj_ ) {
+ std::cerr << "ERROR in Lau2DHistPdf::Lau2DHistPdf : Can't get X or Y projection from 2D histogram."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ xVarPdf_ = new Lau1DHistPdf( xName_, xProj_, minX_, maxX_, useInterpolation_, fluctuateBins_ );
+ yVarPdf_ = new Lau1DHistPdf( yName_, yProj_, minY_, maxY_, useInterpolation_, fluctuateBins_ );
+
+ // Calculate the PDF normalisation.
+ this->calcNorm();
+
+ // And check it is OK.
+ this->checkNormalisation();
}
Lau2DHistPdf::~Lau2DHistPdf()
{
- // Destructor
- delete hist_; hist_ = 0;
- delete xProj_; xProj_ = 0;
- delete yProj_; yProj_ = 0;
- delete xVarPdf_; xVarPdf_ = 0;
- delete yVarPdf_; yVarPdf_ = 0;
+ // Destructor
+ delete hist_;
+ hist_ = 0;
+ delete xProj_;
+ xProj_ = 0;
+ delete yProj_;
+ yProj_ = 0;
+ delete xVarPdf_;
+ xVarPdf_ = 0;
+ delete yVarPdf_;
+ yVarPdf_ = 0;
}
void Lau2DHistPdf::calcPDFHeight( const LauKinematics* /*kinematics*/ )
{
- if (this->heightUpToDate()) {
- return;
- }
-
- // Get the maximum height of the histogram
- Int_t maxBin = hist_->GetMaximumBin();
- Double_t height = hist_->GetBinContent(maxBin);
- this->setMaxHeight(height);
+ if ( this->heightUpToDate() ) {
+ return;
+ }
+
+ // Get the maximum height of the histogram
+ Int_t maxBin = hist_->GetMaximumBin();
+ Double_t height = hist_->GetBinContent( maxBin );
+ this->setMaxHeight( height );
}
void Lau2DHistPdf::calcNorm()
{
- // Calculate the histogram normalisation.
-
- // Loop over the total x and y range to get the total area under x
- // and y. Just sum the contributions up using 1e-3 increments of
- // the range in x and y. Multiply the end result by dx and dy.
-
- Double_t dx(1e-3*rangeX_), dy(1e-3*rangeY_);
- Double_t area(0.0);
-
- Double_t x(minX_ + dx/2.0);
- while (x > minX_ && x < maxX_) {
- Double_t y(minY_ + dy/2.0);
- while (y > minY_ && y < maxY_) {
- area += this->interpolateXY(x,y);
- y += dy;
- } // y while loop
- x += dx;
- } // x while loop
-
- Double_t norm = area*dx*dy;
- this->setNorm(norm);
+ // Calculate the histogram normalisation.
+
+ // Loop over the total x and y range to get the total area under x
+ // and y. Just sum the contributions up using 1e-3 increments of
+ // the range in x and y. Multiply the end result by dx and dy.
+
+ Double_t dx( 1e-3 * rangeX_ ), dy( 1e-3 * rangeY_ );
+ Double_t area( 0.0 );
+
+ Double_t x( minX_ + dx / 2.0 );
+ while ( x > minX_ && x < maxX_ ) {
+ Double_t y( minY_ + dy / 2.0 );
+ while ( y > minY_ && y < maxY_ ) {
+ area += this->interpolateXY( x, y );
+ y += dy;
+ } // y while loop
+ x += dx;
+ } // x while loop
+
+ Double_t norm = area * dx * dy;
+ this->setNorm( norm );
}
void Lau2DHistPdf::checkNormalisation()
{
- Double_t dx(1e-3*rangeX_), dy(1e-3*rangeY_);
- Double_t area(0.0);
- Double_t areaNoNorm(0.0);
-
- // Preserve the value of a variable we change temporarily
- Bool_t interpolate = useInterpolation_;
-
- Double_t x(minX_ + dx/2.0);
- while (x > minX_ && x < maxX_) {
- Double_t y(minY_ + dy/2.0);
- while (y > minY_ && y < maxY_) {
- area += this->interpolateXYNorm(x,y);
- useInterpolation_ = kFALSE;
- areaNoNorm += this->interpolateXY(x,y);
- useInterpolation_ = kTRUE;
- y += dy;
- } // y while loop
- x += dx;
- } // x while loop
- Double_t norm = area*dx*dy;
-
- useInterpolation_ = interpolate; //Restore old value
-
- std::cout << "INFO in Lau2DHistPdf::checkNormalisation : Area = " << area << ", dx = " << dx << ", dy = " << dy << ", dx*dy = " << dx*dy << std::endl;
- std::cout << " : Area with no norm = " << areaNoNorm << "*dx*dy = " << areaNoNorm*dx*dy << std::endl;
- std::cout << " : The total area of the normalised histogram PDF is " << norm << std::endl;
+ Double_t dx( 1e-3 * rangeX_ ), dy( 1e-3 * rangeY_ );
+ Double_t area( 0.0 );
+ Double_t areaNoNorm( 0.0 );
+
+ // Preserve the value of a variable we change temporarily
+ Bool_t interpolate = useInterpolation_;
+
+ Double_t x( minX_ + dx / 2.0 );
+ while ( x > minX_ && x < maxX_ ) {
+ Double_t y( minY_ + dy / 2.0 );
+ while ( y > minY_ && y < maxY_ ) {
+ area += this->interpolateXYNorm( x, y );
+ useInterpolation_ = kFALSE;
+ areaNoNorm += this->interpolateXY( x, y );
+ useInterpolation_ = kTRUE;
+ y += dy;
+ } // y while loop
+ x += dx;
+ } // x while loop
+ Double_t norm = area * dx * dy;
+
+ useInterpolation_ = interpolate; //Restore old value
+
+ std::cout << "INFO in Lau2DHistPdf::checkNormalisation : Area = " << area << ", dx = " << dx
+ << ", dy = " << dy << ", dx*dy = " << dx * dy << std::endl;
+ std::cout << " : Area with no norm = " << areaNoNorm
+ << "*dx*dy = " << areaNoNorm * dx * dy << std::endl;
+ std::cout << " : The total area of the normalised histogram PDF is "
+ << norm << std::endl;
}
-Double_t Lau2DHistPdf::getBinHistValue(Int_t i, Int_t j) const
+Double_t Lau2DHistPdf::getBinHistValue( Int_t i, Int_t j ) const
{
- // Check that x co-ord is in range [1 , nBinsX_]
- if ((i < 1) || (i > nBinsX_)) {
- return 0.0;
- }
- // Check that y co-ord is in range [1 , nBinsY_]
- if ((j < 1) || (j > nBinsY_)) {
- return 0.0;
- }
- Double_t value = hist_->GetBinContent(i,j);
- // protect against negative values
- if ( value < 0.0 ) {
- std::cerr << "WARNING in Lau2DHistPdf::getBinHistValue : Negative bin content set to zero!" << std::endl;
- value = 0.0;
- }
- return value;
+ // Check that x co-ord is in range [1 , nBinsX_]
+ if ( ( i < 1 ) || ( i > nBinsX_ ) ) {
+ return 0.0;
+ }
+ // Check that y co-ord is in range [1 , nBinsY_]
+ if ( ( j < 1 ) || ( j > nBinsY_ ) ) {
+ return 0.0;
+ }
+ Double_t value = hist_->GetBinContent( i, j );
+ // protect against negative values
+ if ( value < 0.0 ) {
+ std::cerr << "WARNING in Lau2DHistPdf::getBinHistValue : Negative bin content set to zero!"
+ << std::endl;
+ value = 0.0;
+ }
+ return value;
}
-Double_t Lau2DHistPdf::interpolateXYNorm(Double_t x, Double_t y) const
+Double_t Lau2DHistPdf::interpolateXYNorm( Double_t x, Double_t y ) const
{
- // Get the normalised interpolated value.
- Double_t value = this->interpolateXY(x,y);
- Double_t norm = this->getNorm();
- return value/norm;
+ // Get the normalised interpolated value.
+ Double_t value = this->interpolateXY( x, y );
+ Double_t norm = this->getNorm();
+ return value / norm;
}
-Double_t Lau2DHistPdf::interpolateXY(Double_t x, Double_t y) const
+Double_t Lau2DHistPdf::interpolateXY( Double_t x, Double_t y ) const
{
- // This function returns the interpolated value of the histogram
- // function for the given values of x and y by finding the adjacent
- // bins and extrapolating using weights based on the inverse
- // distance of the point from the adajcent bin centres.
+ // This function returns the interpolated value of the histogram
+ // function for the given values of x and y by finding the adjacent
+ // bins and extrapolating using weights based on the inverse
+ // distance of the point from the adajcent bin centres.
- // Find the 2D histogram bin for x and y
- Int_t i = static_cast<Int_t>((x - minX_)*invBinXWidth_)+1;
- Int_t j = static_cast<Int_t>((y - minY_)*invBinYWidth_)+1;
+ // Find the 2D histogram bin for x and y
+ Int_t i = static_cast<Int_t>( ( x - minX_ ) * invBinXWidth_ ) + 1;
+ Int_t j = static_cast<Int_t>( ( y - minY_ ) * invBinYWidth_ ) + 1;
- if (i > nBinsX_) {i = nBinsX_;}
- if (j > nBinsY_) {j = nBinsY_;}
+ if ( i > nBinsX_ ) {
+ i = nBinsX_;
+ }
+ if ( j > nBinsY_ ) {
+ j = nBinsY_;
+ }
- // Ask whether we want to do the interpolation, since this method is
- // not reliable for low statistics histograms.
- if (useInterpolation_ == kFALSE) {
- return this->getBinHistValue(i,j);
- }
+ // Ask whether we want to do the interpolation, since this method is
+ // not reliable for low statistics histograms.
+ if ( useInterpolation_ == kFALSE ) {
+ return this->getBinHistValue( i, j );
+ }
- // Find the bin centres (actual co-ordinate positions, not histogram indices)
- Double_t cbinx = static_cast<Double_t>(i-0.5)*binXWidth_ + minX_;
- Double_t cbiny = static_cast<Double_t>(j-0.5)*binYWidth_ + minY_;
+ // Find the bin centres (actual co-ordinate positions, not histogram indices)
+ Double_t cbinx = static_cast<Double_t>( i - 0.5 ) * binXWidth_ + minX_;
+ Double_t cbiny = static_cast<Double_t>( j - 0.5 ) * binYWidth_ + minY_;
- // Find the adjacent bins
- Double_t deltax = x - cbinx;
- Double_t deltay = y - cbiny;
+ // Find the adjacent bins
+ Double_t deltax = x - cbinx;
+ Double_t deltay = y - cbiny;
- Int_t i_adj(0), j_adj(0);
- if (deltax > 0.0) {
- i_adj = i + 1;
- } else {
- i_adj = i - 1;
- }
- if (deltay > 0.0) {
- j_adj = j + 1;
- } else {
- j_adj = j - 1;
- }
+ Int_t i_adj( 0 ), j_adj( 0 );
+ if ( deltax > 0.0 ) {
+ i_adj = i + 1;
+ } else {
+ i_adj = i - 1;
+ }
+ if ( deltay > 0.0 ) {
+ j_adj = j + 1;
+ } else {
+ j_adj = j - 1;
+ }
- Bool_t isXBoundary(kFALSE), isYBoundary(kFALSE);
+ Bool_t isXBoundary( kFALSE ), isYBoundary( kFALSE );
- Double_t value(0.0);
+ Double_t value( 0.0 );
- if (i_adj > nBinsX_ || i_adj < 1) {isYBoundary = kTRUE;}
- if (j_adj > nBinsY_ || j_adj < 1) {isXBoundary = kTRUE;}
+ if ( i_adj > nBinsX_ || i_adj < 1 ) {
+ isYBoundary = kTRUE;
+ }
+ if ( j_adj > nBinsY_ || j_adj < 1 ) {
+ isXBoundary = kTRUE;
+ }
- // In the corners, do no interpolation. Use entry in bin (i,j)
- if (isXBoundary == kTRUE && isYBoundary == kTRUE) {
+ // In the corners, do no interpolation. Use entry in bin (i,j)
+ if ( isXBoundary == kTRUE && isYBoundary == kTRUE ) {
- value = this->getBinHistValue(i,j);
+ value = this->getBinHistValue( i, j );
- } else if (isXBoundary == kTRUE && isYBoundary == kFALSE) {
+ } else if ( isXBoundary == kTRUE && isYBoundary == kFALSE ) {
- // Find the adjacent x bin centre
- Double_t cbinx_adj = static_cast<Double_t>(i_adj-0.5)*binXWidth_ + minX_;
+ // Find the adjacent x bin centre
+ Double_t cbinx_adj = static_cast<Double_t>( i_adj - 0.5 ) * binXWidth_ + minX_;
- Double_t dx0 = TMath::Abs(x - cbinx);
- Double_t dx1 = TMath::Abs(cbinx_adj - x);
- Double_t inter_denom = dx0 + dx1;
+ Double_t dx0 = TMath::Abs( x - cbinx );
+ Double_t dx1 = TMath::Abs( cbinx_adj - x );
+ Double_t inter_denom = dx0 + dx1;
- Double_t value1 = this->getBinHistValue(i,j);
- Double_t value2 = this->getBinHistValue(i_adj,j);
+ Double_t value1 = this->getBinHistValue( i, j );
+ Double_t value2 = this->getBinHistValue( i_adj, j );
- value = (value1*dx1 + value2*dx0)/inter_denom;
+ value = ( value1 * dx1 + value2 * dx0 ) / inter_denom;
- } else if (isYBoundary == kTRUE && isXBoundary == kFALSE) {
+ } else if ( isYBoundary == kTRUE && isXBoundary == kFALSE ) {
- // Find the adjacent y bin centre
- Double_t cbiny_adj = static_cast<Double_t>(j_adj-0.5)*binYWidth_ + minY_;
+ // Find the adjacent y bin centre
+ Double_t cbiny_adj = static_cast<Double_t>( j_adj - 0.5 ) * binYWidth_ + minY_;
- Double_t dy0 = TMath::Abs(y - cbiny);
- Double_t dy1 = TMath::Abs(cbiny_adj - y);
- Double_t inter_denom = dy0 + dy1;
+ Double_t dy0 = TMath::Abs( y - cbiny );
+ Double_t dy1 = TMath::Abs( cbiny_adj - y );
+ Double_t inter_denom = dy0 + dy1;
- Double_t value1 = this->getBinHistValue(i,j);
- Double_t value2 = this->getBinHistValue(i,j_adj);
+ Double_t value1 = this->getBinHistValue( i, j );
+ Double_t value2 = this->getBinHistValue( i, j_adj );
- value = (value1*dy1 + value2*dy0)/inter_denom;
+ value = ( value1 * dy1 + value2 * dy0 ) / inter_denom;
- } else {
+ } else {
- // 2D linear interpolation using inverse distance as weights.
- // Find the adjacent x and y bin centres
- Double_t cbinx_adj = static_cast<Double_t>(i_adj-0.5)*binXWidth_ + minX_;
- Double_t cbiny_adj = static_cast<Double_t>(j_adj-0.5)*binYWidth_ + minY_;
+ // 2D linear interpolation using inverse distance as weights.
+ // Find the adjacent x and y bin centres
+ Double_t cbinx_adj = static_cast<Double_t>( i_adj - 0.5 ) * binXWidth_ + minX_;
+ Double_t cbiny_adj = static_cast<Double_t>( j_adj - 0.5 ) * binYWidth_ + minY_;
- Double_t dx0 = TMath::Abs(x - cbinx);
- Double_t dx1 = TMath::Abs(cbinx_adj - x);
- Double_t dy0 = TMath::Abs(y - cbiny);
- Double_t dy1 = TMath::Abs(cbiny_adj - y);
+ Double_t dx0 = TMath::Abs( x - cbinx );
+ Double_t dx1 = TMath::Abs( cbinx_adj - x );
+ Double_t dy0 = TMath::Abs( y - cbiny );
+ Double_t dy1 = TMath::Abs( cbiny_adj - y );
- Double_t inter_denom = (dx0 + dx1)*(dy0 + dy1);
+ Double_t inter_denom = ( dx0 + dx1 ) * ( dy0 + dy1 );
- Double_t value1 = this->getBinHistValue(i,j);
- Double_t value2 = this->getBinHistValue(i_adj,j);
- Double_t value3 = this->getBinHistValue(i,j_adj);
- Double_t value4 = this->getBinHistValue(i_adj,j_adj);
+ Double_t value1 = this->getBinHistValue( i, j );
+ Double_t value2 = this->getBinHistValue( i_adj, j );
+ Double_t value3 = this->getBinHistValue( i, j_adj );
+ Double_t value4 = this->getBinHistValue( i_adj, j_adj );
- value = value1*dx1*dy1 + value2*dx0*dy1 + value3*dx1*dy0 + value4*dx0*dy0;
- value /= inter_denom;
- }
+ value = value1 * dx1 * dy1 + value2 * dx0 * dy1 + value3 * dx1 * dy0 + value4 * dx0 * dy0;
+ value /= inter_denom;
+ }
- return value;
+ return value;
}
-void Lau2DHistPdf::calcLikelihoodInfo(const LauAbscissas& abscissas)
+void Lau2DHistPdf::calcLikelihoodInfo( const LauAbscissas& abscissas )
{
- // Check that the given abscissa is within the allowed range
- if (!this->checkRange(abscissas)) {
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // Calculate the interpolated value
- Double_t x = abscissas[0];
- Double_t y = abscissas[1];
- Double_t value = this->interpolateXY(x,y);
- this->setUnNormPDFVal(value);
-
- // TODO - do we need this? I think probably not.
- // Have the 1D PDFs calculate their likelihoods as well
- //xVarPdf_->calcLikelihoodInfo(x);
- //yVarPdf_->calcLikelihoodInfo(y);
+ // Check that the given abscissa is within the allowed range
+ if ( ! this->checkRange( abscissas ) ) {
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // Calculate the interpolated value
+ Double_t x = abscissas[0];
+ Double_t y = abscissas[1];
+ Double_t value = this->interpolateXY( x, y );
+ this->setUnNormPDFVal( value );
+
+ // TODO - do we need this? I think probably not.
+ // Have the 1D PDFs calculate their likelihoods as well
+ //xVarPdf_->calcLikelihoodInfo(x);
+ //yVarPdf_->calcLikelihoodInfo(y);
}
-void Lau2DHistPdf::calcLikelihoodInfo(UInt_t iEvt)
+void Lau2DHistPdf::calcLikelihoodInfo( UInt_t iEvt )
{
- // Call the base class method
- this->LauAbsPdf::calcLikelihoodInfo(iEvt);
+ // Call the base class method
+ this->LauAbsPdf::calcLikelihoodInfo( iEvt );
- // Have the 1D PDFs retrieve their values as well
- xVarPdf_->calcLikelihoodInfo(iEvt);
- yVarPdf_->calcLikelihoodInfo(iEvt);
+ // Have the 1D PDFs retrieve their values as well
+ xVarPdf_->calcLikelihoodInfo( iEvt );
+ yVarPdf_->calcLikelihoodInfo( iEvt );
}
Double_t Lau2DHistPdf::getLikelihood( const TString& theVarName ) const
{
- if ( theVarName == xName_ ) {
- return xVarPdf_->getLikelihood();
- } else if ( theVarName == yName_ ) {
- return yVarPdf_->getLikelihood();
- } else {
- std::cerr << "ERROR in Lau2DHistPdf::getLikelihood : Unrecognised variable name \"" << theVarName << "\", cannot determine likelihood." << std::endl;
- return 0.0;
- }
+ if ( theVarName == xName_ ) {
+ return xVarPdf_->getLikelihood();
+ } else if ( theVarName == yName_ ) {
+ return yVarPdf_->getLikelihood();
+ } else {
+ std::cerr << "ERROR in Lau2DHistPdf::getLikelihood : Unrecognised variable name \""
+ << theVarName << "\", cannot determine likelihood." << std::endl;
+ return 0.0;
+ }
}
-void Lau2DHistPdf::cacheInfo(const LauFitDataTree& inputData)
+void Lau2DHistPdf::cacheInfo( const LauFitDataTree& inputData )
{
- // Call the base class method
- this->LauAbsPdf::cacheInfo(inputData);
+ // Call the base class method
+ this->LauAbsPdf::cacheInfo( inputData );
- // Have the 1D PDFs cache their info as well
- xVarPdf_->cacheInfo(inputData);
- yVarPdf_->cacheInfo(inputData);
+ // Have the 1D PDFs cache their info as well
+ xVarPdf_->cacheInfo( inputData );
+ yVarPdf_->cacheInfo( inputData );
}
void Lau2DHistPdf::doBinFluctuation()
{
- TRandom* random(LauRandom::randomFun());
- for (Int_t i(0); i<nBinsX_; i++) {
- for (Int_t j(0); j<nBinsY_; j++) {
- Double_t currentContent = hist_->GetBinContent(i+1,j+1);
- Double_t currentError = hist_->GetBinError(i+1,j+1);
- Double_t newContent = random->Gaus(currentContent,currentError);
- if (newContent<0.0) {
- hist_->SetBinContent(i+1,j+1,0.0);
- } else {
- hist_->SetBinContent(i+1,j+1,newContent);
- }
- }
- }
+ TRandom* random( LauRandom::randomFun() );
+ for ( Int_t i( 0 ); i < nBinsX_; i++ ) {
+ for ( Int_t j( 0 ); j < nBinsY_; j++ ) {
+ Double_t currentContent = hist_->GetBinContent( i + 1, j + 1 );
+ Double_t currentError = hist_->GetBinError( i + 1, j + 1 );
+ Double_t newContent = random->Gaus( currentContent, currentError );
+ if ( newContent < 0.0 ) {
+ hist_->SetBinContent( i + 1, j + 1, 0.0 );
+ } else {
+ hist_->SetBinContent( i + 1, j + 1, newContent );
+ }
+ }
+ }
}
-LauFitData Lau2DHistPdf::generate(const LauKinematics* kinematics)
+LauFitData Lau2DHistPdf::generate( const LauKinematics* kinematics )
{
- this->withinGeneration(kTRUE);
-
- // Check that the PDF height is up to date
- this->calcPDFHeight( kinematics );
-
- // Generate the value of the abscissa.
- Bool_t gotAbscissa(kFALSE);
- if (this->getRandomFun() == 0) {
- std::cerr << "ERROR in Lau2DHistPdf::generate : Please set the random number generator for this PDF by using the setRandomFun(TRandom*) function." << std::endl;
- this->withinGeneration(kFALSE);
- gSystem->Exit(EXIT_FAILURE);
- }
-
- Double_t genPDFVal(0.0);
- LauAbscissas genAbscissas(2);
-
- Double_t PDFheight = this->getMaxHeight()*(1.0+1e-11);
- while (!gotAbscissa) {
-
- genAbscissas[0] = this->getRandomFun()->Rndm()*this->getRange(xName_) + this->getMinAbscissa(xName_);
- genAbscissas[1] = this->getRandomFun()->Rndm()*this->getRange(yName_) + this->getMinAbscissa(yName_);
-
- this->calcLikelihoodInfo(genAbscissas);
- genPDFVal = this->getUnNormLikelihood();
-
- if (this->getRandomFun()->Rndm() <= genPDFVal/PDFheight) {gotAbscissa = kTRUE;}
-
- if (genPDFVal > PDFheight) {
- std::cerr << "WARNING in LauAbsPdf::generate : genPDFVal = " << genPDFVal << " is larger than the specified PDF height " << this->getMaxHeight() << " for (x,y) = (" << genAbscissas[0] << "," << genAbscissas[1] << ")." << std::endl;
- std::cerr << " : Need to reset height to be larger than " << genPDFVal << " by using the setMaxHeight(Double_t) function and re-run the Monte Carlo generation!" << std::endl;
- }
- }
-
- LauFitData genData;
- genData[ xName_ ] = genAbscissas[0];
- genData[ yName_ ] = genAbscissas[1];
-
- this->withinGeneration(kFALSE);
-
- return genData;
+ this->withinGeneration( kTRUE );
+
+ // Check that the PDF height is up to date
+ this->calcPDFHeight( kinematics );
+
+ // Generate the value of the abscissa.
+ Bool_t gotAbscissa( kFALSE );
+ if ( this->getRandomFun() == 0 ) {
+ std::cerr << "ERROR in Lau2DHistPdf::generate : Please set the random number generator for this PDF by using the setRandomFun(TRandom*) function."
+ << std::endl;
+ this->withinGeneration( kFALSE );
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ Double_t genPDFVal( 0.0 );
+ LauAbscissas genAbscissas( 2 );
+
+ Double_t PDFheight = this->getMaxHeight() * ( 1.0 + 1e-11 );
+ while ( ! gotAbscissa ) {
+
+ genAbscissas[0] = this->getRandomFun()->Rndm() * this->getRange( xName_ ) +
+ this->getMinAbscissa( xName_ );
+ genAbscissas[1] = this->getRandomFun()->Rndm() * this->getRange( yName_ ) +
+ this->getMinAbscissa( yName_ );
+
+ this->calcLikelihoodInfo( genAbscissas );
+ genPDFVal = this->getUnNormLikelihood();
+
+ if ( this->getRandomFun()->Rndm() <= genPDFVal / PDFheight ) {
+ gotAbscissa = kTRUE;
+ }
+
+ if ( genPDFVal > PDFheight ) {
+ std::cerr << "WARNING in LauAbsPdf::generate : genPDFVal = " << genPDFVal
+ << " is larger than the specified PDF height " << this->getMaxHeight()
+ << " for (x,y) = (" << genAbscissas[0] << "," << genAbscissas[1] << ")."
+ << std::endl;
+ std::cerr << " : Need to reset height to be larger than "
+ << genPDFVal
+ << " by using the setMaxHeight(Double_t) function and re-run the Monte Carlo generation!"
+ << std::endl;
+ }
+ }
+
+ LauFitData genData;
+ genData[xName_] = genAbscissas[0];
+ genData[yName_] = genAbscissas[1];
+
+ this->withinGeneration( kFALSE );
+
+ return genData;
}
-
diff --git a/src/Lau2DSplineDP.cc b/src/Lau2DSplineDP.cc
index a21edd5..dbecc95 100644
--- a/src/Lau2DSplineDP.cc
+++ b/src/Lau2DSplineDP.cc
@@ -1,188 +1,206 @@
/*
Copyright 2013 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file Lau2DSplineDP.cc
\brief File containing implementation of Lau2DSplineDP class.
*/
-#include <iostream>
-
-#include "TAxis.h"
-#include "TH2.h"
-#include "TRandom.h"
-#include "TSystem.h"
-
#include "Lau2DSplineDP.hh"
+
#include "Lau2DCubicSpline.hh"
#include "LauDaughters.hh"
#include "LauKinematics.hh"
#include "LauRandom.hh"
+#include "TAxis.h"
+#include "TH2.h"
+#include "TRandom.h"
+#include "TSystem.h"
+#include <iostream>
-Lau2DSplineDP::Lau2DSplineDP(const TH2* hist, const LauDaughters* daughters,
- Bool_t fluctuateBins, Double_t avEff, Double_t avEffError,
- Bool_t useUpperHalfOnly, Bool_t squareDP) :
- Lau2DAbsHistDP(daughters,useUpperHalfOnly,squareDP),
- spline_(0)
+Lau2DSplineDP::Lau2DSplineDP( const TH2* hist,
+ const LauDaughters* daughters,
+ Bool_t fluctuateBins,
+ Double_t avEff,
+ Double_t avEffError,
+ Bool_t useUpperHalfOnly,
+ Bool_t squareDP ) :
+ Lau2DAbsHistDP( daughters, useUpperHalfOnly, squareDP ),
+ spline_( 0 )
{
- //We may need to modify the histogram so clone it
- TH2* tempHist(hist ? dynamic_cast<TH2*>(hist->Clone()) : 0);
+ //We may need to modify the histogram so clone it
+ TH2* tempHist( hist ? dynamic_cast<TH2*>( hist->Clone() ) : 0 );
- if ( ! tempHist ) {
- std::cerr << "ERROR in Lau2DSplineDP constructor : the histogram pointer is null." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
+ if ( ! tempHist ) {
+ std::cerr << "ERROR in Lau2DSplineDP constructor : the histogram pointer is null."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
- if (fluctuateBins) {
- this->doBinFluctuation(tempHist);
- }
- if (avEff > 0.0 && avEffError > 0.0) {
- this->raiseOrLowerBins(tempHist,avEff,avEffError);
- }
+ if ( fluctuateBins ) {
+ this->doBinFluctuation( tempHist );
+ }
+ if ( avEff > 0.0 && avEffError > 0.0 ) {
+ this->raiseOrLowerBins( tempHist, avEff, avEffError );
+ }
- spline_ = new Lau2DCubicSpline(*tempHist);
+ spline_ = new Lau2DCubicSpline( *tempHist );
- delete tempHist;
+ delete tempHist;
}
-Lau2DSplineDP::Lau2DSplineDP(const TH2* hist, const TH2* errorHi, const TH2* errorLo, const LauDaughters* daughters,
- Bool_t fluctuateBins, Double_t avEff, Double_t avEffError,
- Bool_t useUpperHalfOnly, Bool_t squareDP) :
- Lau2DAbsHistDP(daughters,useUpperHalfOnly,squareDP),
- spline_(0)
+Lau2DSplineDP::Lau2DSplineDP( const TH2* hist,
+ const TH2* errorHi,
+ const TH2* errorLo,
+ const LauDaughters* daughters,
+ Bool_t fluctuateBins,
+ Double_t avEff,
+ Double_t avEffError,
+ Bool_t useUpperHalfOnly,
+ Bool_t squareDP ) :
+ Lau2DAbsHistDP( daughters, useUpperHalfOnly, squareDP ),
+ spline_( 0 )
{
- //We may need to modify the histogram so clone it
- TH2* tempHist(hist ? dynamic_cast<TH2*>(hist->Clone()) : 0);
- TH2* tempErrorHi(errorHi ? dynamic_cast<TH2*>(errorHi->Clone()) : 0);
- TH2* tempErrorLo(errorLo ? dynamic_cast<TH2*>(errorLo->Clone()) : 0);
-
- if ( ! tempHist ) {
- std::cerr << "ERROR in Lau2DSplineDP constructor : the histogram pointer is null." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- if ( ! tempErrorHi ) {
- std::cerr << "ERROR in Lau2DHistDP constructor : the upper error histogram pointer is null." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- if ( ! tempErrorLo ) {
- std::cerr << "ERROR in Lau2DHistDP constructor : the lower error histogram pointer is null." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- TAxis* xAxis = tempHist->GetXaxis();
- Double_t minX = static_cast<Double_t>(xAxis->GetXmin());
- Double_t maxX = static_cast<Double_t>(xAxis->GetXmax());
-
- TAxis* yAxis = tempHist->GetYaxis();
- Double_t minY = static_cast<Double_t>(yAxis->GetXmin());
- Double_t maxY = static_cast<Double_t>(yAxis->GetXmax());
-
- Int_t nBinsX = static_cast<Int_t>(tempHist->GetNbinsX());
- Int_t nBinsY = static_cast<Int_t>(tempHist->GetNbinsY());
-
- if(static_cast<Int_t>(tempErrorLo->GetNbinsX()) != nBinsX ||
- static_cast<Int_t>(tempErrorLo->GetNbinsY()) != nBinsY) {
- std::cerr << "ERROR in Lau2DHistDP constructor : the lower error histogram has a different number of bins to the main histogram." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- if(static_cast<Int_t>(tempErrorHi->GetNbinsX()) != nBinsX ||
- static_cast<Int_t>(tempErrorHi->GetNbinsY()) != nBinsY) {
- std::cerr << "ERROR in Lau2DHistDP constructor : the upper error histogram has a different number of bins to the main histogram." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- xAxis = tempErrorLo->GetXaxis();
- yAxis = tempErrorLo->GetYaxis();
-
- if(static_cast<Double_t>(xAxis->GetXmin()) != minX ||
- static_cast<Double_t>(xAxis->GetXmax()) != maxX) {
- std::cerr << "ERROR in Lau2DHistDP constructor : the lower error histogram has a different x range to the main histogram." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- if(static_cast<Double_t>(yAxis->GetXmin()) != minY ||
- static_cast<Double_t>(yAxis->GetXmax()) != maxY) {
- std::cerr << "ERROR in Lau2DHistDP constructor : the lower error histogram has a different y range to the main histogram." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- xAxis = tempErrorHi->GetXaxis();
- yAxis = tempErrorHi->GetYaxis();
-
- if(static_cast<Double_t>(xAxis->GetXmin()) != minX ||
- static_cast<Double_t>(xAxis->GetXmax()) != maxX) {
- std::cerr << "ERROR in Lau2DHistDP constructor : the upper error histogram has a different x range to the main histogram." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- if(static_cast<Double_t>(yAxis->GetXmin()) != minY ||
- static_cast<Double_t>(yAxis->GetXmax()) != maxY) {
- std::cerr << "ERROR in Lau2DHistDP constructor : the upper error histogram has a different y range to the main histogram." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
-
- if (fluctuateBins) {
- this->doBinFluctuation(tempHist,tempErrorHi,tempErrorLo);
- }
- if (avEff > 0.0 && avEffError > 0.0) {
- this->raiseOrLowerBins(tempHist,avEff,avEffError);
- }
-
- spline_ = new Lau2DCubicSpline(*tempHist);
-
- delete tempHist;
- delete tempErrorHi;
- delete tempErrorLo;
+ //We may need to modify the histogram so clone it
+ TH2* tempHist( hist ? dynamic_cast<TH2*>( hist->Clone() ) : 0 );
+ TH2* tempErrorHi( errorHi ? dynamic_cast<TH2*>( errorHi->Clone() ) : 0 );
+ TH2* tempErrorLo( errorLo ? dynamic_cast<TH2*>( errorLo->Clone() ) : 0 );
+
+ if ( ! tempHist ) {
+ std::cerr << "ERROR in Lau2DSplineDP constructor : the histogram pointer is null."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ if ( ! tempErrorHi ) {
+ std::cerr << "ERROR in Lau2DHistDP constructor : the upper error histogram pointer is null."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ if ( ! tempErrorLo ) {
+ std::cerr << "ERROR in Lau2DHistDP constructor : the lower error histogram pointer is null."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ TAxis* xAxis = tempHist->GetXaxis();
+ Double_t minX = static_cast<Double_t>( xAxis->GetXmin() );
+ Double_t maxX = static_cast<Double_t>( xAxis->GetXmax() );
+
+ TAxis* yAxis = tempHist->GetYaxis();
+ Double_t minY = static_cast<Double_t>( yAxis->GetXmin() );
+ Double_t maxY = static_cast<Double_t>( yAxis->GetXmax() );
+
+ Int_t nBinsX = static_cast<Int_t>( tempHist->GetNbinsX() );
+ Int_t nBinsY = static_cast<Int_t>( tempHist->GetNbinsY() );
+
+ if ( static_cast<Int_t>( tempErrorLo->GetNbinsX() ) != nBinsX ||
+ static_cast<Int_t>( tempErrorLo->GetNbinsY() ) != nBinsY ) {
+ std::cerr << "ERROR in Lau2DHistDP constructor : the lower error histogram has a different number of bins to the main histogram."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ if ( static_cast<Int_t>( tempErrorHi->GetNbinsX() ) != nBinsX ||
+ static_cast<Int_t>( tempErrorHi->GetNbinsY() ) != nBinsY ) {
+ std::cerr << "ERROR in Lau2DHistDP constructor : the upper error histogram has a different number of bins to the main histogram."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ xAxis = tempErrorLo->GetXaxis();
+ yAxis = tempErrorLo->GetYaxis();
+
+ if ( static_cast<Double_t>( xAxis->GetXmin() ) != minX ||
+ static_cast<Double_t>( xAxis->GetXmax() ) != maxX ) {
+ std::cerr << "ERROR in Lau2DHistDP constructor : the lower error histogram has a different x range to the main histogram."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ if ( static_cast<Double_t>( yAxis->GetXmin() ) != minY ||
+ static_cast<Double_t>( yAxis->GetXmax() ) != maxY ) {
+ std::cerr << "ERROR in Lau2DHistDP constructor : the lower error histogram has a different y range to the main histogram."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ xAxis = tempErrorHi->GetXaxis();
+ yAxis = tempErrorHi->GetYaxis();
+
+ if ( static_cast<Double_t>( xAxis->GetXmin() ) != minX ||
+ static_cast<Double_t>( xAxis->GetXmax() ) != maxX ) {
+ std::cerr << "ERROR in Lau2DHistDP constructor : the upper error histogram has a different x range to the main histogram."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ if ( static_cast<Double_t>( yAxis->GetXmin() ) != minY ||
+ static_cast<Double_t>( yAxis->GetXmax() ) != maxY ) {
+ std::cerr << "ERROR in Lau2DHistDP constructor : the upper error histogram has a different y range to the main histogram."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ if ( fluctuateBins ) {
+ this->doBinFluctuation( tempHist, tempErrorHi, tempErrorLo );
+ }
+ if ( avEff > 0.0 && avEffError > 0.0 ) {
+ this->raiseOrLowerBins( tempHist, avEff, avEffError );
+ }
+
+ spline_ = new Lau2DCubicSpline( *tempHist );
+
+ delete tempHist;
+ delete tempErrorHi;
+ delete tempErrorLo;
}
Lau2DSplineDP::~Lau2DSplineDP()
{
- delete spline_;
- spline_ = 0;
+ delete spline_;
+ spline_ = 0;
}
-Double_t Lau2DSplineDP::interpolateXY(Double_t x, Double_t y) const
+Double_t Lau2DSplineDP::interpolateXY( Double_t x, Double_t y ) const
{
- // This function returns the interpolated value of the histogram function
- // for the given values of x and y by finding the adjacent bins and extrapolating
- // using weights based on the inverse distance of the point from the adajcent
- // bin centres.
- // Here, x = m13^2, y = m23^2, or m', theta' for square DP co-ordinates
-
- // If we're only using one half then flip co-ordinates
- // appropriately for conventional or square DP
- this->getUpperHalf(x,y);
-
- // First ask whether the point is inside the kinematic region.
- if (this->withinDPBoundaries(x,y) == kFALSE) {
- std::cerr << "WARNING in Lau2DSplineDP::interpolateXY : Given position is outside the DP boundary, returning 0.0." << std::endl;
- return 0.0;
- }
-
- return spline_->evaluate(x,y);
-
+ // This function returns the interpolated value of the histogram function
+ // for the given values of x and y by finding the adjacent bins and extrapolating
+ // using weights based on the inverse distance of the point from the adajcent
+ // bin centres.
+ // Here, x = m13^2, y = m23^2, or m', theta' for square DP co-ordinates
+
+ // If we're only using one half then flip co-ordinates
+ // appropriately for conventional or square DP
+ this->getUpperHalf( x, y );
+
+ // First ask whether the point is inside the kinematic region.
+ if ( this->withinDPBoundaries( x, y ) == kFALSE ) {
+ std::cerr << "WARNING in Lau2DSplineDP::interpolateXY : Given position is outside the DP boundary, returning 0.0."
+ << std::endl;
+ return 0.0;
+ }
+
+ return spline_->evaluate( x, y );
}
diff --git a/src/Lau2DSplineDPPdf.cc b/src/Lau2DSplineDPPdf.cc
index 86327b9..799a2ae 100644
--- a/src/Lau2DSplineDPPdf.cc
+++ b/src/Lau2DSplineDPPdf.cc
@@ -1,111 +1,114 @@
/*
Copyright 2014 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file Lau2DSplineDPPdf.cc
\brief File containing implementation of Lau2DSplineDPPdf class.
*/
-#include <iostream>
-
-#include "TAxis.h"
-#include "TH2.h"
-#include "TRandom.h"
-#include "TSystem.h"
-
#include "Lau2DSplineDPPdf.hh"
+
#include "Lau2DCubicSpline.hh"
#include "LauDaughters.hh"
#include "LauKinematics.hh"
#include "LauRandom.hh"
+#include "TAxis.h"
+#include "TH2.h"
+#include "TRandom.h"
+#include "TSystem.h"
+#include <iostream>
-Lau2DSplineDPPdf::Lau2DSplineDPPdf(const TH2* hist, LauKinematics* kinematics, const LauVetoes* vetoes,
- Bool_t fluctuateBins, Bool_t useUpperHalfOnly, Bool_t squareDP) :
- Lau2DAbsHistDPPdf(kinematics,vetoes,useUpperHalfOnly,squareDP),
- spline_(0)
+Lau2DSplineDPPdf::Lau2DSplineDPPdf( const TH2* hist,
+ LauKinematics* kinematics,
+ const LauVetoes* vetoes,
+ Bool_t fluctuateBins,
+ Bool_t useUpperHalfOnly,
+ Bool_t squareDP ) :
+ Lau2DAbsHistDPPdf( kinematics, vetoes, useUpperHalfOnly, squareDP ),
+ spline_( 0 )
{
- //We may need to modify the histogram so clone it
- TH2* tempHist(hist ? dynamic_cast<TH2*>(hist->Clone()) : 0);
+ //We may need to modify the histogram so clone it
+ TH2* tempHist( hist ? dynamic_cast<TH2*>( hist->Clone() ) : 0 );
- if ( ! tempHist ) {
- std::cerr << "ERROR in Lau2DSplineDPPdf constructor : the histogram pointer is null." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
+ if ( ! tempHist ) {
+ std::cerr << "ERROR in Lau2DSplineDPPdf constructor : the histogram pointer is null."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
- if (fluctuateBins) {
- this->doBinFluctuation(tempHist);
- }
+ if ( fluctuateBins ) {
+ this->doBinFluctuation( tempHist );
+ }
- spline_ = new Lau2DCubicSpline(*tempHist);
+ spline_ = new Lau2DCubicSpline( *tempHist );
- // Calculate the PDF normalisation.
- this->calcHistNorm();
+ // Calculate the PDF normalisation.
+ this->calcHistNorm();
- // Also obtain the maximum height
- this->calcMaxHeight(tempHist);
+ // Also obtain the maximum height
+ this->calcMaxHeight( tempHist );
- delete tempHist;
+ delete tempHist;
}
Lau2DSplineDPPdf::~Lau2DSplineDPPdf()
{
- delete spline_;
- spline_ = 0;
+ delete spline_;
+ spline_ = 0;
}
-Double_t Lau2DSplineDPPdf::interpolateXYNorm(Double_t x, Double_t y) const
+Double_t Lau2DSplineDPPdf::interpolateXYNorm( Double_t x, Double_t y ) const
{
- // Get the normalised interpolated value.
- Double_t value = this->interpolateXY(x,y);
- return value/norm_;
-
+ // Get the normalised interpolated value.
+ Double_t value = this->interpolateXY( x, y );
+ return value / norm_;
}
-Double_t Lau2DSplineDPPdf::interpolateXY(Double_t x, Double_t y) const
+Double_t Lau2DSplineDPPdf::interpolateXY( Double_t x, Double_t y ) const
{
- // This function returns the interpolated value of the histogram function
- // for the given values of x and y by finding the adjacent bins and extrapolating
- // using weights based on the inverse distance of the point from the adajcent
- // bin centres.
- // Here, x = m13^2, y = m23^2, or m', theta' for square DP co-ordinates
-
- // If we're only using one half then flip co-ordinates
- // appropriately for conventional or square DP
- getUpperHalf(x,y);
-
- // First ask whether the point is inside the kinematic region.
- if (withinDPBoundaries(x,y) == kFALSE) {
- std::cerr << "WARNING in Lau2DSplineDPPdf::interpolateXY : Given position is outside the DP boundary, returning 0.0." << std::endl;
- return 0.0;
- }
-
- return spline_->evaluate(x,y);
-
+ // This function returns the interpolated value of the histogram function
+ // for the given values of x and y by finding the adjacent bins and extrapolating
+ // using weights based on the inverse distance of the point from the adajcent
+ // bin centres.
+ // Here, x = m13^2, y = m23^2, or m', theta' for square DP co-ordinates
+
+ // If we're only using one half then flip co-ordinates
+ // appropriately for conventional or square DP
+ getUpperHalf( x, y );
+
+ // First ask whether the point is inside the kinematic region.
+ if ( withinDPBoundaries( x, y ) == kFALSE ) {
+ std::cerr << "WARNING in Lau2DSplineDPPdf::interpolateXY : Given position is outside the DP boundary, returning 0.0."
+ << std::endl;
+ return 0.0;
+ }
+
+ return spline_->evaluate( x, y );
}
void Lau2DSplineDPPdf::calcHistNorm()
{
- norm_ = spline_->analyticalIntegral();
+ norm_ = spline_->analyticalIntegral();
}
diff --git a/src/LauASqMaxFinder.cc b/src/LauASqMaxFinder.cc
index eb5a2f0..15053fb 100644
--- a/src/LauASqMaxFinder.cc
+++ b/src/LauASqMaxFinder.cc
@@ -1,171 +1,181 @@
/*
Copyright 2022 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauASqMaxFinder.cc
\brief File containing implementation of LauASqMaxFinder class.
*/
#include "LauASqMaxFinder.hh"
#include "LauAbsResonance.hh"
#include "LauFitter.hh"
#include "LauIsobarDynamics.hh"
#include "LauKinematics.hh"
#include "LauParameter.hh"
#include "TSystem.h"
#include <array>
#include <iostream>
#include <memory>
-
-LauASqMaxFinder::LauASqMaxFinder(LauIsobarDynamics& iso) :
- iso_{iso}
+LauASqMaxFinder::LauASqMaxFinder( LauIsobarDynamics& iso ) :
+ iso_ { iso }
{
- const LauKinematics* kinematics { iso_.getKinematics() };
- const Double_t m13SqMin{kinematics->getm13SqMin()};
- const Double_t m13SqMax{kinematics->getm13SqMax()};
- const Double_t m23SqMin{kinematics->getm23SqMin()};
- const Double_t m23SqMax{kinematics->getm23SqMax()};
-
- ownedParams_.resize(2);
- ownedParams_[0] = std::make_unique<LauParameter>("m13Sq", 0.5*(m13SqMin+m13SqMax), m13SqMin, m13SqMax, kFALSE );
- ownedParams_[1] = std::make_unique<LauParameter>("m23Sq", 0.5*(m23SqMin+m23SqMax), m23SqMin, m23SqMax, kFALSE );
-
- params_.resize(2);
- params_[0] = ownedParams_[0].get();
- params_[1] = ownedParams_[1].get();
+ const LauKinematics* kinematics { iso_.getKinematics() };
+ const Double_t m13SqMin { kinematics->getm13SqMin() };
+ const Double_t m13SqMax { kinematics->getm13SqMax() };
+ const Double_t m23SqMin { kinematics->getm23SqMin() };
+ const Double_t m23SqMax { kinematics->getm23SqMax() };
+
+ ownedParams_.resize( 2 );
+ ownedParams_[0] = std::make_unique<LauParameter>( "m13Sq",
+ 0.5 * ( m13SqMin + m13SqMax ),
+ m13SqMin,
+ m13SqMax,
+ kFALSE );
+ ownedParams_[1] = std::make_unique<LauParameter>( "m23Sq",
+ 0.5 * ( m23SqMin + m23SqMax ),
+ m23SqMin,
+ m23SqMax,
+ kFALSE );
+
+ params_.resize( 2 );
+ params_[0] = ownedParams_[0].get();
+ params_[1] = ownedParams_[1].get();
}
-void LauASqMaxFinder::setParsFromMinuit(Double_t* par, Int_t npar)
+void LauASqMaxFinder::setParsFromMinuit( Double_t* par, Int_t npar )
{
- if ( static_cast<std::size_t>(npar) != params_.size() ) {
- std::cerr << "ERROR in LauASqMaxFinder::setParsFromMinuit : Unexpected number of free parameters: " << npar << ".\n";
- std::cerr << " Expected: " << params_.size() << ".\n" << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- for ( Int_t i{0}; i < npar; ++i ) {
- params_[i]->value( par[i] );
- }
-
- return;
+ if ( static_cast<std::size_t>( npar ) != params_.size() ) {
+ std::cerr << "ERROR in LauASqMaxFinder::setParsFromMinuit : Unexpected number of free parameters: "
+ << npar << ".\n";
+ std::cerr << " Expected: " << params_.size()
+ << ".\n"
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ for ( Int_t i { 0 }; i < npar; ++i ) {
+ params_[i]->value( par[i] );
+ }
+
+ return;
}
Double_t LauASqMaxFinder::getTotNegLogLikelihood()
{
- const Double_t m13Sq { params_[0]->unblindValue() };
- const Double_t m23Sq { params_[1]->unblindValue() };
-
- if ( ! iso_.getKinematics()->withinDPLimits(m13Sq, m23Sq) ) {
- if ( printMinimisationWarnings_ ) {
- std::cerr << "WARNING in LauASqMaxFinder::getTotNegLogLikelihood : Fit has wandered outside the phase space boundary\n";
- std::cerr << " : Returning 0.0 value (further warnings of this type will be suppressed)" << std::endl;
- printMinimisationWarnings_ = kFALSE;
- }
- return 0.0;
- }
-
- iso_.calcLikelihoodInfo( m13Sq, m23Sq );
- return -iso_.getEvtIntensity();
+ const Double_t m13Sq { params_[0]->unblindValue() };
+ const Double_t m23Sq { params_[1]->unblindValue() };
+
+ if ( ! iso_.getKinematics()->withinDPLimits( m13Sq, m23Sq ) ) {
+ if ( printMinimisationWarnings_ ) {
+ std::cerr << "WARNING in LauASqMaxFinder::getTotNegLogLikelihood : Fit has wandered outside the phase space boundary\n";
+ std::cerr << " : Returning 0.0 value (further warnings of this type will be suppressed)"
+ << std::endl;
+ printMinimisationWarnings_ = kFALSE;
+ }
+ return 0.0;
+ }
+
+ iso_.calcLikelihoodInfo( m13Sq, m23Sq );
+ return -iso_.getEvtIntensity();
}
Double_t LauASqMaxFinder::find()
{
- Double_t ASqMax{-1.0};
-
- const LauKinematics* kinematics { iso_.getKinematics() };
- LauKinematics localKin {
- kinematics->getm1(),
- kinematics->getm2(),
- kinematics->getm3(),
- kinematics->getmParent()
- };
-
- const Double_t m13SqMin { localKin.getm13Min() };
- const Double_t m13SqMax { localKin.getm13Max() };
- const Double_t m23SqMin { localKin.getm23Min() };
- const Double_t m23SqMax { localKin.getm23Max() };
-
- LauFitter::setFitterMaxPars( 2 );
- LauFitter::setFitterVerbosity( LauOutputLevel::None );
-
- for ( UInt_t iRes{0}; iRes < iso_.getnTotAmp(); ++iRes ) {
- // Find the center of the resonance and set that as the start of the search
- const LauAbsResonance* res { const_cast<const LauIsobarDynamics&>(iso_).getResonance(iRes) };
- const Int_t bachelor { res->getPairInt() };
- const Double_t mass { res->getMass() };
- const Double_t width { res->getWidth() };
-
- const std::array<Double_t,3> massVals { mass - width, mass, mass + width };
- const std::array<Double_t,3> cosHelVals { -1.0, 0.0, 1.0 };
- for ( Double_t massVal : massVals ) {
- for ( Double_t cosHel : cosHelVals ) {
-
- switch ( bachelor ) {
- case 0 :
- localKin.updateKinematics( 0.5*(m13SqMax+m13SqMin), 0.5*(m23SqMax+m23SqMin) );
- break;
- case 1 :
- localKin.updateKinematicsFrom23( massVal, cosHel );
- break;
- case 2 :
- localKin.updateKinematicsFrom13( massVal, cosHel );
- break;
- case 3 :
- localKin.updateKinematicsFrom12( massVal, cosHel );
- break;
-
- default :
- break;
- }
-
- params_[0]->initValue( localKin.getm13Sq() );
- params_[1]->initValue( localKin.getm23Sq() );
-
- params_[0]->error(0.1);
- params_[1]->error(0.1);
-
- LauFitter::fitter().initialise( this, params_ );
-
- const LauAbsFitter::FitStatus fitResult { LauFitter::fitter().minimise() };
-
- if ( fitResult.status != 0 and -fitResult.NLL > ASqMax ) {
- ASqMax = -fitResult.NLL;
- }
-
- }
- }
- }
-
- LauFitter::destroyFitter();
-
- if ( ASqMax < 0.0 ) {
- std::cerr << "WARNING in LauASqMaxFinder::find : Could not find ASqMax\n";
- std::cerr << " : Returning -1.0" << std::endl;
- }
-
- return ASqMax;
+ Double_t ASqMax { -1.0 };
+
+ const LauKinematics* kinematics { iso_.getKinematics() };
+ LauKinematics localKin { kinematics->getm1(),
+ kinematics->getm2(),
+ kinematics->getm3(),
+ kinematics->getmParent() };
+
+ const Double_t m13SqMin { localKin.getm13Min() };
+ const Double_t m13SqMax { localKin.getm13Max() };
+ const Double_t m23SqMin { localKin.getm23Min() };
+ const Double_t m23SqMax { localKin.getm23Max() };
+
+ LauFitter::setFitterMaxPars( 2 );
+ LauFitter::setFitterVerbosity( LauOutputLevel::None );
+
+ for ( UInt_t iRes { 0 }; iRes < iso_.getnTotAmp(); ++iRes ) {
+ // Find the center of the resonance and set that as the start of the search
+ const LauAbsResonance* res {
+ const_cast<const LauIsobarDynamics&>( iso_ ).getResonance( iRes ) };
+ const Int_t bachelor { res->getPairInt() };
+ const Double_t mass { res->getMass() };
+ const Double_t width { res->getWidth() };
+
+ const std::array<Double_t, 3> massVals { mass - width, mass, mass + width };
+ const std::array<Double_t, 3> cosHelVals { -1.0, 0.0, 1.0 };
+ for ( Double_t massVal : massVals ) {
+ for ( Double_t cosHel : cosHelVals ) {
+
+ switch ( bachelor ) {
+ case 0 :
+ localKin.updateKinematics( 0.5 * ( m13SqMax + m13SqMin ),
+ 0.5 * ( m23SqMax + m23SqMin ) );
+ break;
+ case 1 :
+ localKin.updateKinematicsFrom23( massVal, cosHel );
+ break;
+ case 2 :
+ localKin.updateKinematicsFrom13( massVal, cosHel );
+ break;
+ case 3 :
+ localKin.updateKinematicsFrom12( massVal, cosHel );
+ break;
+
+ default :
+ break;
+ }
+
+ params_[0]->initValue( localKin.getm13Sq() );
+ params_[1]->initValue( localKin.getm23Sq() );
+
+ params_[0]->error( 0.1 );
+ params_[1]->error( 0.1 );
+
+ LauFitter::fitter().initialise( this, params_ );
+
+ const LauAbsFitter::FitStatus fitResult { LauFitter::fitter().minimise() };
+
+ if ( fitResult.status != 0 and -fitResult.NLL > ASqMax ) {
+ ASqMax = -fitResult.NLL;
+ }
+ }
+ }
+ }
+
+ LauFitter::destroyFitter();
+
+ if ( ASqMax < 0.0 ) {
+ std::cerr << "WARNING in LauASqMaxFinder::find : Could not find ASqMax\n";
+ std::cerr << " : Returning -1.0" << std::endl;
+ }
+
+ return ASqMax;
}
diff --git a/src/LauAbsBkgndDPModel.cc b/src/LauAbsBkgndDPModel.cc
index 86f56d1..f143077 100644
--- a/src/LauAbsBkgndDPModel.cc
+++ b/src/LauAbsBkgndDPModel.cc
@@ -1,40 +1,38 @@
/*
Copyright 2004 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauAbsBkgndDPModel.cc
\brief File containing implementation of LauAbsBkgndDPModel class.
*/
#include "LauAbsBkgndDPModel.hh"
-#include "LauDaughters.hh"
-
+#include "LauDaughters.hh"
-LauAbsBkgndDPModel::LauAbsBkgndDPModel(LauDaughters* daughters, LauVetoes* vetoes) :
- daughters_(daughters),
- kinematics_(daughters ? daughters->getKinematics() : 0),
- vetoes_(vetoes)
+LauAbsBkgndDPModel::LauAbsBkgndDPModel( LauDaughters* daughters, LauVetoes* vetoes ) :
+ daughters_( daughters ),
+ kinematics_( daughters ? daughters->getKinematics() : 0 ),
+ vetoes_( vetoes )
{
}
-
diff --git a/src/LauAbsCoeffSet.cc b/src/LauAbsCoeffSet.cc
index 3a86174..cbc4635 100644
--- a/src/LauAbsCoeffSet.cc
+++ b/src/LauAbsCoeffSet.cc
@@ -1,210 +1,220 @@
/*
Copyright 2006 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauAbsCoeffSet.cc
\brief File containing implementation of LauAbsCoeffSet class.
*/
-#include <iostream>
-
-#include "TString.h"
-
#include "LauAbsCoeffSet.hh"
+
#include "LauConstants.hh"
#include "LauParameter.hh"
#include "LauRandom.hh"
+#include "TString.h"
+
+#include <iostream>
-TRandom* LauAbsCoeffSet::randomiser_ = 0;
-Double_t LauAbsCoeffSet::minMagnitude_ = -10.0;
-Double_t LauAbsCoeffSet::maxMagnitude_ = 10.0;
-Double_t LauAbsCoeffSet::minPhase_ = -LauConstants::threePi;
-Double_t LauAbsCoeffSet::maxPhase_ = LauConstants::threePi;
+TRandom* LauAbsCoeffSet::randomiser_ = 0;
+Double_t LauAbsCoeffSet::minMagnitude_ = -10.0;
+Double_t LauAbsCoeffSet::maxMagnitude_ = 10.0;
+Double_t LauAbsCoeffSet::minPhase_ = -LauConstants::threePi;
+Double_t LauAbsCoeffSet::maxPhase_ = LauConstants::threePi;
Double_t LauAbsCoeffSet::minRealImagPart_ = -10.0;
-Double_t LauAbsCoeffSet::maxRealImagPart_ = 10.0;
-Double_t LauAbsCoeffSet::minDelta_ = -2.0;
-Double_t LauAbsCoeffSet::maxDelta_ = 2.0;
-
-LauAbsCoeffSet::LauAbsCoeffSet(const TString& theName, const TString& theBaseName) :
- name_(theName),
- basename_(theBaseName),
- index_(0)
+Double_t LauAbsCoeffSet::maxRealImagPart_ = 10.0;
+Double_t LauAbsCoeffSet::minDelta_ = -2.0;
+Double_t LauAbsCoeffSet::maxDelta_ = 2.0;
+
+LauAbsCoeffSet::LauAbsCoeffSet( const TString& theName, const TString& theBaseName ) :
+ name_( theName ),
+ basename_( theBaseName ),
+ index_( 0 )
{
}
-LauAbsCoeffSet::LauAbsCoeffSet(const LauAbsCoeffSet& rhs) :
- name_(rhs.name_),
- basename_(rhs.basename_),
- index_(rhs.index_)
+LauAbsCoeffSet::LauAbsCoeffSet( const LauAbsCoeffSet& rhs ) :
+ name_( rhs.name_ ),
+ basename_( rhs.basename_ ),
+ index_( rhs.index_ )
{
}
-LauAbsCoeffSet& LauAbsCoeffSet::operator=(const LauAbsCoeffSet& rhs)
+LauAbsCoeffSet& LauAbsCoeffSet::operator=( const LauAbsCoeffSet& rhs )
{
- if ( &rhs != this ) {
- name_ = rhs.name_;
- basename_ = rhs.basename_;
- index_ = rhs.index_;
- }
- return *this;
+ if ( &rhs != this ) {
+ name_ = rhs.name_;
+ basename_ = rhs.basename_;
+ index_ = rhs.index_;
+ }
+ return *this;
}
TRandom* LauAbsCoeffSet::getRandomiser()
{
- if ( randomiser_ == 0 ) {
- randomiser_ = LauRandom::zeroSeedRandom();
- }
- return randomiser_;
+ if ( randomiser_ == 0 ) {
+ randomiser_ = LauRandom::zeroSeedRandom();
+ }
+ return randomiser_;
}
-void LauAbsCoeffSet::index(UInt_t newIndex)
+void LauAbsCoeffSet::index( UInt_t newIndex )
{
- index_ = newIndex;
-
- const TString oldBaseName( this->baseName() );
- TString basename( oldBaseName );
- if ( basename.Length() != 1 ) {
- basename.Remove(1);
- }
- basename += newIndex;
- basename += "_";
- this->baseName(basename);
-
- std::vector<LauParameter*> pars = this->getParameters();
- for ( std::vector<LauParameter*>::iterator iter = pars.begin(); iter != pars.end(); ++iter ) {
- this->adjustName( *iter, oldBaseName );
- }
+ index_ = newIndex;
+
+ const TString oldBaseName( this->baseName() );
+ TString basename( oldBaseName );
+ if ( basename.Length() != 1 ) {
+ basename.Remove( 1 );
+ }
+ basename += newIndex;
+ basename += "_";
+ this->baseName( basename );
+
+ std::vector<LauParameter*> pars = this->getParameters();
+ for ( std::vector<LauParameter*>::iterator iter = pars.begin(); iter != pars.end(); ++iter ) {
+ this->adjustName( *iter, oldBaseName );
+ }
}
-void LauAbsCoeffSet::adjustName(LauParameter* par, const TString& oldBaseName)
+void LauAbsCoeffSet::adjustName( LauParameter* par, const TString& oldBaseName )
{
- TString theName(par->name());
- if ( theName.BeginsWith( oldBaseName ) && theName != oldBaseName ) {
- theName.Remove(0,oldBaseName.Length());
- }
- theName.Prepend(this->baseName());
- par->name(theName);
+ TString theName( par->name() );
+ if ( theName.BeginsWith( oldBaseName ) && theName != oldBaseName ) {
+ theName.Remove( 0, oldBaseName.Length() );
+ }
+ theName.Prepend( this->baseName() );
+ par->name( theName );
}
-void LauAbsCoeffSet::setParameterValue(const TString& parName, Double_t value, Bool_t init)
+void LauAbsCoeffSet::setParameterValue( const TString& parName, Double_t value, Bool_t init )
{
- LauParameter* par = this->findParameter( parName );
- if ( par == 0 ) {
- std::cerr << "ERROR in LauAbsCoeffSet::setParameterValue : Unable to find parameter \"" << parName << "\"" << std::endl;
- return;
- }
-
- par->value( value );
- if ( init ) {
- par->genValue( value );
- par->initValue( value );
- }
+ LauParameter* par = this->findParameter( parName );
+ if ( par == 0 ) {
+ std::cerr << "ERROR in LauAbsCoeffSet::setParameterValue : Unable to find parameter \""
+ << parName << "\"" << std::endl;
+ return;
+ }
+
+ par->value( value );
+ if ( init ) {
+ par->genValue( value );
+ par->initValue( value );
+ }
}
-void LauAbsCoeffSet::setParameterError(const TString& parName, Double_t error)
+void LauAbsCoeffSet::setParameterError( const TString& parName, Double_t error )
{
- LauParameter* par = this->findParameter( parName );
- if ( par == 0 ) {
- std::cerr << "ERROR in LauAbsCoeffSet::setParameterError : Unable to find parameter \"" << parName << "\"" << std::endl;
- return;
- }
-
- par->error( error );
+ LauParameter* par = this->findParameter( parName );
+ if ( par == 0 ) {
+ std::cerr << "ERROR in LauAbsCoeffSet::setParameterError : Unable to find parameter \""
+ << parName << "\"" << std::endl;
+ return;
+ }
+
+ par->error( error );
}
-void LauAbsCoeffSet::fixParameter(const TString& parName)
+void LauAbsCoeffSet::fixParameter( const TString& parName )
{
- LauParameter* par = this->findParameter( parName );
- if ( par == 0 ) {
- std::cerr << "ERROR in LauAbsCoeffSet::fixParameter : Unable to find parameter \"" << parName << "\"" << std::endl;
- return;
- }
-
- par->fixed( kTRUE );
+ LauParameter* par = this->findParameter( parName );
+ if ( par == 0 ) {
+ std::cerr << "ERROR in LauAbsCoeffSet::fixParameter : Unable to find parameter \""
+ << parName << "\"" << std::endl;
+ return;
+ }
+
+ par->fixed( kTRUE );
}
-void LauAbsCoeffSet::floatParameter(const TString& parName)
+void LauAbsCoeffSet::floatParameter( const TString& parName )
{
- LauParameter* par = this->findParameter( parName );
- if ( par == 0 ) {
- std::cerr << "ERROR in LauAbsCoeffSet::floatParameter : Unable to find parameter \"" << parName << "\"" << std::endl;
- return;
- }
-
- par->fixed( kFALSE );
+ LauParameter* par = this->findParameter( parName );
+ if ( par == 0 ) {
+ std::cerr << "ERROR in LauAbsCoeffSet::floatParameter : Unable to find parameter \""
+ << parName << "\"" << std::endl;
+ return;
+ }
+
+ par->fixed( kFALSE );
}
-void LauAbsCoeffSet::blindParameter(const TString& parName, const TString& blindingString, const Double_t width)
+void LauAbsCoeffSet::blindParameter( const TString& parName,
+ const TString& blindingString,
+ const Double_t width )
{
- LauParameter* par = this->findParameter( parName );
- if ( par == 0 ) {
- std::cerr << "ERROR in LauAbsCoeffSet::blindParameter : Unable to find parameter \"" << parName << "\"" << std::endl;
- return;
- }
-
- par->blindParameter( blindingString, width );
+ LauParameter* par = this->findParameter( parName );
+ if ( par == 0 ) {
+ std::cerr << "ERROR in LauAbsCoeffSet::blindParameter : Unable to find parameter \""
+ << parName << "\"" << std::endl;
+ return;
+ }
+
+ par->blindParameter( blindingString, width );
}
-void LauAbsCoeffSet::addGaussianConstraint(const TString& parName, const Double_t mean, const Double_t width)
+void LauAbsCoeffSet::addGaussianConstraint( const TString& parName,
+ const Double_t mean,
+ const Double_t width )
{
- LauParameter* par = this->findParameter( parName );
- if ( par == 0 ) {
- std::cerr << "ERROR in LauAbsCoeffSet::addGaussianConstraint : Unable to find parameter \"" << parName << "\"" << std::endl;
- return;
- }
-
- par->addGaussianConstraint( mean, width );
+ LauParameter* par = this->findParameter( parName );
+ if ( par == 0 ) {
+ std::cerr << "ERROR in LauAbsCoeffSet::addGaussianConstraint : Unable to find parameter \""
+ << parName << "\"" << std::endl;
+ return;
+ }
+
+ par->addGaussianConstraint( mean, width );
}
-void LauAbsCoeffSet::addSuffixToParameterName(const TString& parName, const TString& suffix)
+void LauAbsCoeffSet::addSuffixToParameterName( const TString& parName, const TString& suffix )
{
- LauParameter* par = this->findParameter( parName );
- if ( par == 0 ) {
- std::cerr << "ERROR in LauAbsCoeffSet::addSuffixToParameterName : Unable to find parameter \"" << parName << "\"" << std::endl;
- return;
- }
-
- TString newName( par->name() );
- if ( ! suffix.BeginsWith('_') ) {
- newName += "_";
- }
- newName += suffix;
- par->name( newName );
+ LauParameter* par = this->findParameter( parName );
+ if ( par == 0 ) {
+ std::cerr << "ERROR in LauAbsCoeffSet::addSuffixToParameterName : Unable to find parameter \""
+ << parName << "\"" << std::endl;
+ return;
+ }
+
+ TString newName( par->name() );
+ if ( ! suffix.BeginsWith( '_' ) ) {
+ newName += "_";
+ }
+ newName += suffix;
+ par->name( newName );
}
-LauParameter* LauAbsCoeffSet::findParameter(const TString& parName)
+LauParameter* LauAbsCoeffSet::findParameter( const TString& parName )
{
- std::vector<LauParameter*> pars = this->getParameters();
- for ( std::vector<LauParameter*>::iterator iter = pars.begin(); iter != pars.end(); ++iter ) {
+ std::vector<LauParameter*> pars = this->getParameters();
+ for ( std::vector<LauParameter*>::iterator iter = pars.begin(); iter != pars.end(); ++iter ) {
- const TString& iName = (*iter)->name();
+ const TString& iName = ( *iter )->name();
- if ( iName.EndsWith( parName ) ) {
- return (*iter);
- }
- }
+ if ( iName.EndsWith( parName ) ) {
+ return ( *iter );
+ }
+ }
- return 0;
+ return 0;
}
-
diff --git a/src/LauAbsFitModel.cc b/src/LauAbsFitModel.cc
index 0b28930..8793558 100644
--- a/src/LauAbsFitModel.cc
+++ b/src/LauAbsFitModel.cc
@@ -1,1180 +1,1284 @@
/*
Copyright 2004 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauAbsFitModel.cc
- \brief File containing implementation of LauAbsFitModel class.
- */
-
-#include <iostream>
-#include <limits>
-#include <vector>
-
-#include "TMessage.h"
-#include "TMonitor.h"
-#include "TSystem.h"
-#include "TVirtualFitter.h"
+ \brief File containing implementation of LauAbsFitModel class.
+*/
#include "LauAbsFitModel.hh"
+
#include "LauAbsFitter.hh"
#include "LauAbsPdf.hh"
#include "LauComplex.hh"
-#include "LauFitter.hh"
#include "LauFitDataTree.hh"
+#include "LauFitter.hh"
#include "LauGenNtuple.hh"
-#include "LauParameter.hh"
#include "LauParamFixed.hh"
+#include "LauParameter.hh"
#include "LauPrint.hh"
#include "LauSPlot.hh"
+#include "TMessage.h"
+#include "TMonitor.h"
+#include "TSystem.h"
+#include "TVirtualFitter.h"
+#include <iostream>
+#include <limits>
+#include <vector>
LauAbsFitModel::LauAbsFitModel() :
- fixParams_(kFALSE),
- compareFitData_(kFALSE),
- savePDF_(kFALSE),
- writeLatexTable_(kFALSE),
- writeSPlotData_(kFALSE),
- storeDPEff_(kFALSE),
- randomFit_(kFALSE),
- emlFit_(kFALSE),
- poissonSmear_(kFALSE),
- enableEmbedding_(kFALSE),
- usingDP_(kTRUE),
- pdfsDependOnDP_(kFALSE),
- inputFitData_(0),
- genNtuple_(0),
- sPlotNtuple_(0),
- nullString_(""),
- doSFit_(kFALSE),
- sWeightBranchName_(""),
- sWeightScaleFactor_(1.0),
- outputTableName_(""),
- fitToyMCFileName_("fitToyMC.root"),
- fitToyMCTableName_("fitToyMCTable"),
- fitToyMCScale_(10),
- fitToyMCPoissonSmear_(kFALSE),
- sPlotFileName_(""),
- sPlotTreeName_(""),
- sPlotVerbosity_("")
+ fixParams_( kFALSE ),
+ compareFitData_( kFALSE ),
+ savePDF_( kFALSE ),
+ writeLatexTable_( kFALSE ),
+ writeSPlotData_( kFALSE ),
+ storeDPEff_( kFALSE ),
+ randomFit_( kFALSE ),
+ emlFit_( kFALSE ),
+ poissonSmear_( kFALSE ),
+ enableEmbedding_( kFALSE ),
+ usingDP_( kTRUE ),
+ pdfsDependOnDP_( kFALSE ),
+ inputFitData_( 0 ),
+ genNtuple_( 0 ),
+ sPlotNtuple_( 0 ),
+ nullString_( "" ),
+ doSFit_( kFALSE ),
+ sWeightBranchName_( "" ),
+ sWeightScaleFactor_( 1.0 ),
+ outputTableName_( "" ),
+ fitToyMCFileName_( "fitToyMC.root" ),
+ fitToyMCTableName_( "fitToyMCTable" ),
+ fitToyMCScale_( 10 ),
+ fitToyMCPoissonSmear_( kFALSE ),
+ sPlotFileName_( "" ),
+ sPlotTreeName_( "" ),
+ sPlotVerbosity_( "" )
{
}
-
LauAbsFitModel::~LauAbsFitModel()
{
- delete inputFitData_; inputFitData_ = 0;
- delete genNtuple_; genNtuple_ = 0;
- delete sPlotNtuple_; sPlotNtuple_ = 0;
+ delete inputFitData_;
+ inputFitData_ = 0;
+ delete genNtuple_;
+ genNtuple_ = 0;
+ delete sPlotNtuple_;
+ sPlotNtuple_ = 0;
}
-void LauAbsFitModel::run(const TString& applicationCode, const TString& dataFileName, const TString& dataTreeName,
- const TString& histFileName, const TString& tableFileName)
+void LauAbsFitModel::run( const TString& applicationCode,
+ const TString& dataFileName,
+ const TString& dataTreeName,
+ const TString& histFileName,
+ const TString& tableFileName )
{
- // Chose whether you want to generate or fit events in the Dalitz plot.
- // To generate events choose applicationCode = "gen", to fit events choose
- // applicationCode = "fit".
+ // Chose whether you want to generate or fit events in the Dalitz plot.
+ // To generate events choose applicationCode = "gen", to fit events choose
+ // applicationCode = "fit".
- TString runCode(applicationCode);
- runCode.ToLower();
+ TString runCode( applicationCode );
+ runCode.ToLower();
- TString histFileNameCopy(histFileName);
- TString tableFileNameCopy(tableFileName);
- TString dataFileNameCopy(dataFileName);
- TString dataTreeNameCopy(dataTreeName);
+ TString histFileNameCopy( histFileName );
+ TString tableFileNameCopy( tableFileName );
+ TString dataFileNameCopy( dataFileName );
+ TString dataTreeNameCopy( dataTreeName );
- // Initialise the fit par vectors. Each class that inherits from this one
- // must implement this sensibly for all vectors specified in clearFitParVectors,
- // i.e. specify parameter names, initial, min, max and fixed values
- this->initialise();
+ // Initialise the fit par vectors. Each class that inherits from this one
+ // must implement this sensibly for all vectors specified in clearFitParVectors,
+ // i.e. specify parameter names, initial, min, max and fixed values
+ this->initialise();
- // Add variables to Gaussian constrain to a list
- this->addConParameters();
+ // Add variables to Gaussian constrain to a list
+ this->addConParameters();
- if (dataFileNameCopy == "") {dataFileNameCopy = "data.root";}
- if (dataTreeNameCopy == "") {dataTreeNameCopy = "genResults";}
+ if ( dataFileNameCopy == "" ) {
+ dataFileNameCopy = "data.root";
+ }
+ if ( dataTreeNameCopy == "" ) {
+ dataTreeNameCopy = "genResults";
+ }
- if (runCode.Contains("gen")) {
+ if ( runCode.Contains( "gen" ) ) {
- if (histFileNameCopy == "") {histFileNameCopy = "parInfo.root";}
- if (tableFileNameCopy == "") {tableFileNameCopy = "genResults";}
+ if ( histFileNameCopy == "" ) {
+ histFileNameCopy = "parInfo.root";
+ }
+ if ( tableFileNameCopy == "" ) {
+ tableFileNameCopy = "genResults";
+ }
- this->setGenValues();
- this->generate(dataFileNameCopy, dataTreeNameCopy, histFileNameCopy, tableFileNameCopy);
+ this->setGenValues();
+ this->generate( dataFileNameCopy, dataTreeNameCopy, histFileNameCopy, tableFileNameCopy );
- } else if (runCode.Contains("fit")) {
+ } else if ( runCode.Contains( "fit" ) ) {
- if (histFileNameCopy == "") {histFileNameCopy = "parInfo.root";}
- if (tableFileNameCopy == "") {tableFileNameCopy = "fitResults";}
+ if ( histFileNameCopy == "" ) {
+ histFileNameCopy = "parInfo.root";
+ }
+ if ( tableFileNameCopy == "" ) {
+ tableFileNameCopy = "fitResults";
+ }
- this->fit(dataFileNameCopy, dataTreeNameCopy, histFileNameCopy, tableFileNameCopy);
+ this->fit( dataFileNameCopy, dataTreeNameCopy, histFileNameCopy, tableFileNameCopy );
- } else if (runCode.Contains("plot")) {
+ } else if ( runCode.Contains( "plot" ) ) {
- this->savePDFPlots("plot");
+ this->savePDFPlots( "plot" );
- } else if (runCode.Contains("weight")) {
+ } else if ( runCode.Contains( "weight" ) ) {
- this->weightEvents(dataFileNameCopy, dataTreeNameCopy);
- }
+ this->weightEvents( dataFileNameCopy, dataTreeNameCopy );
+ }
}
void LauAbsFitModel::doSFit( const TString& sWeightBranchName, Double_t scaleFactor )
{
- if ( sWeightBranchName == "" ) {
- std::cerr << "WARNING in LauAbsFitModel::doSFit : sWeight branch name is empty string, not setting-up sFit." << std::endl;
- return;
- }
-
- doSFit_ = kTRUE;
- sWeightBranchName_ = sWeightBranchName;
- sWeightScaleFactor_ = scaleFactor;
+ if ( sWeightBranchName == "" ) {
+ std::cerr << "WARNING in LauAbsFitModel::doSFit : sWeight branch name is empty string, not setting-up sFit."
+ << std::endl;
+ return;
+ }
+
+ doSFit_ = kTRUE;
+ sWeightBranchName_ = sWeightBranchName;
+ sWeightScaleFactor_ = scaleFactor;
}
void LauAbsFitModel::setBkgndClassNames( const std::vector<TString>& names )
{
- if ( !bkgndClassNames_.empty() ) {
- std::cerr << "WARNING in LauAbsFitModel::setBkgndClassNames : Names already stored, not changing them." << std::endl;
- return;
- }
-
- UInt_t nBkgnds = names.size();
- for ( UInt_t i(0); i < nBkgnds; ++i ) {
- bkgndClassNames_.insert( std::make_pair( i, names[i] ) );
- }
-
- this->setupBkgndVectors();
+ if ( ! bkgndClassNames_.empty() ) {
+ std::cerr << "WARNING in LauAbsFitModel::setBkgndClassNames : Names already stored, not changing them."
+ << std::endl;
+ return;
+ }
+
+ UInt_t nBkgnds = names.size();
+ for ( UInt_t i( 0 ); i < nBkgnds; ++i ) {
+ bkgndClassNames_.insert( std::make_pair( i, names[i] ) );
+ }
+
+ this->setupBkgndVectors();
}
Bool_t LauAbsFitModel::validBkgndClass( const TString& className ) const
{
- if ( bkgndClassNames_.empty() ) {
- return kFALSE;
- }
-
- Bool_t found(kFALSE);
- for ( LauBkgndClassMap::const_iterator iter = bkgndClassNames_.begin(); iter != bkgndClassNames_.end(); ++iter ) {
- if ( iter->second == className ) {
- found = kTRUE;
- break;
- }
- }
-
- return found;
+ if ( bkgndClassNames_.empty() ) {
+ return kFALSE;
+ }
+
+ Bool_t found( kFALSE );
+ for ( LauBkgndClassMap::const_iterator iter = bkgndClassNames_.begin();
+ iter != bkgndClassNames_.end();
+ ++iter ) {
+ if ( iter->second == className ) {
+ found = kTRUE;
+ break;
+ }
+ }
+
+ return found;
}
UInt_t LauAbsFitModel::bkgndClassID( const TString& className ) const
{
- if ( ! this->validBkgndClass( className ) ) {
- std::cerr << "ERROR in LauAbsFitModel::bkgndClassID : Request for ID for invalid background class \"" << className << "\"." << std::endl;
- return (bkgndClassNames_.size() + 1);
- }
-
- UInt_t bgID(0);
- for ( LauBkgndClassMap::const_iterator iter = bkgndClassNames_.begin(); iter != bkgndClassNames_.end(); ++iter ) {
- if ( iter->second == className ) {
- bgID = iter->first;
- break;
- }
- }
-
- return bgID;
+ if ( ! this->validBkgndClass( className ) ) {
+ std::cerr << "ERROR in LauAbsFitModel::bkgndClassID : Request for ID for invalid background class \""
+ << className << "\"." << std::endl;
+ return ( bkgndClassNames_.size() + 1 );
+ }
+
+ UInt_t bgID( 0 );
+ for ( LauBkgndClassMap::const_iterator iter = bkgndClassNames_.begin();
+ iter != bkgndClassNames_.end();
+ ++iter ) {
+ if ( iter->second == className ) {
+ bgID = iter->first;
+ break;
+ }
+ }
+
+ return bgID;
}
const TString& LauAbsFitModel::bkgndClassName( UInt_t classID ) const
{
- LauBkgndClassMap::const_iterator iter = bkgndClassNames_.find( classID );
+ LauBkgndClassMap::const_iterator iter = bkgndClassNames_.find( classID );
- if ( iter == bkgndClassNames_.end() ) {
- std::cerr << "ERROR in LauAbsFitModel::bkgndClassName : Request for name of invalid background class ID " << classID << "." << std::endl;
- return nullString_;
- }
+ if ( iter == bkgndClassNames_.end() ) {
+ std::cerr << "ERROR in LauAbsFitModel::bkgndClassName : Request for name of invalid background class ID "
+ << classID << "." << std::endl;
+ return nullString_;
+ }
- return iter->second;
+ return iter->second;
}
void LauAbsFitModel::clearFitParVectors()
{
- std::cout << "INFO in LauAbsFitModel::clearFitParVectors : Clearing fit variable vectors" << std::endl;
+ std::cout << "INFO in LauAbsFitModel::clearFitParVectors : Clearing fit variable vectors"
+ << std::endl;
- conVars_.clear();
- resVars_.clear();
- fitVars_.clear();
+ conVars_.clear();
+ resVars_.clear();
+ fitVars_.clear();
}
void LauAbsFitModel::clearExtraVarVectors()
{
- std::cout << "INFO in LauAbsFitModel::clearExtraVarVectors : Clearing extra ntuple variable vectors" << std::endl;
- extraVars_.clear();
+ std::cout << "INFO in LauAbsFitModel::clearExtraVarVectors : Clearing extra ntuple variable vectors"
+ << std::endl;
+ extraVars_.clear();
}
void LauAbsFitModel::setGenValues()
{
- // makes sure each parameter holds its genValue as its current value
- for (LauParameterPList::iterator iter = fitVars_.begin(); iter != fitVars_.end(); ++iter) {
- (*iter)->value((*iter)->genValue());
- }
- this->propagateParUpdates();
+ // makes sure each parameter holds its genValue as its current value
+ for ( LauParameterPList::iterator iter = fitVars_.begin(); iter != fitVars_.end(); ++iter ) {
+ ( *iter )->value( ( *iter )->genValue() );
+ }
+ this->propagateParUpdates();
}
-void LauAbsFitModel::writeSPlotData(const TString& fileName, const TString& treeName, Bool_t storeDPEfficiency, const TString& verbosity)
+void LauAbsFitModel::writeSPlotData( const TString& fileName,
+ const TString& treeName,
+ Bool_t storeDPEfficiency,
+ const TString& verbosity )
{
- if (this->writeSPlotData()) {
- std::cerr << "ERROR in LauAbsFitModel::writeSPlotData : Already have an sPlot ntuple setup, not doing it again." << std::endl;
- return;
- }
- writeSPlotData_ = kTRUE;
- sPlotFileName_ = fileName;
- sPlotTreeName_ = treeName;
- sPlotVerbosity_ = verbosity;
- storeDPEff_ = storeDPEfficiency;
+ if ( this->writeSPlotData() ) {
+ std::cerr << "ERROR in LauAbsFitModel::writeSPlotData : Already have an sPlot ntuple setup, not doing it again."
+ << std::endl;
+ return;
+ }
+ writeSPlotData_ = kTRUE;
+ sPlotFileName_ = fileName;
+ sPlotTreeName_ = treeName;
+ sPlotVerbosity_ = verbosity;
+ storeDPEff_ = storeDPEfficiency;
}
// TODO : histFileName isn't used here at the moment but could be used for
// storing the values of the parameters used in the generation.
// These could then be read and used for setting the "true" values
// in a subsequent fit.
-void LauAbsFitModel::generate(const TString& dataFileName, const TString& dataTreeName, const TString& /*histFileName*/, const TString& tableFileNameBase)
+void LauAbsFitModel::generate( const TString& dataFileName,
+ const TString& dataTreeName,
+ const TString& /*histFileName*/,
+ const TString& tableFileNameBase )
{
- // Create the ntuple for storing the results
- std::cout << "INFO in LauAbsFitModel::generate : Creating generation ntuple." << std::endl;
- if (genNtuple_ != 0) {delete genNtuple_; genNtuple_ = 0;}
- genNtuple_ = new LauGenNtuple(dataFileName,dataTreeName);
-
- // add branches for storing the experiment number and the number of
- // the event within the current experiment
- this->addGenNtupleIntegerBranch("iExpt");
- this->addGenNtupleIntegerBranch("iEvtWithinExpt");
- this->setupGenNtupleBranches();
-
- // Start the cumulative timer
- cumulTimer_.Start();
-
- const UInt_t firstExp = this->firstExpt();
- const UInt_t nExp = this->nExpt();
-
- Bool_t genOK(kTRUE);
- do {
- // Loop over the number of experiments
- for (UInt_t iExp = firstExp; iExp < (firstExp+nExp); ++iExp) {
-
- // Start the timer to see how long each experiment takes to generate
- timer_.Start();
-
- // Store the experiment number in the ntuple
- this->setGenNtupleIntegerBranchValue("iExpt",iExp);
-
- // Do the generation for this experiment
- std::cout << "INFO in LauAbsFitModel::generate : Generating experiment number " << iExp << std::endl;
- genOK = this->genExpt();
-
- // Stop the timer and see how long the program took so far
- timer_.Stop();
- timer_.Print();
-
- if (!genOK) {
- // delete and recreate an empty tree
- genNtuple_->deleteAndRecreateTree();
-
- // then break out of the experiment loop
- std::cerr << "WARNING in LauAbsFitModel::generate : Problem in toy MC generation. Starting again with updated parameters..." << std::endl;
- break;
- }
-
- if (this->writeLatexTable()) {
- TString tableFileName(tableFileNameBase);
- tableFileName += "_";
- tableFileName += iExp;
- tableFileName += ".tex";
- this->writeOutTable(tableFileName);
- }
-
- } // Loop over number of experiments
- } while (!genOK);
-
- // Print out total timing info.
- cumulTimer_.Stop();
- std::cout << "INFO in LauAbsFitModel::generate : Finished generating all experiments." << std::endl;
- std::cout << "INFO in LauAbsFitModel::generate : Cumulative timing:" << std::endl;
- cumulTimer_.Print();
-
- // Build the event index
- std::cout << "INFO in LauAbsFitModel::generate : Building experiment:event index." << std::endl;
- // TODO - can test this return value?
- //Int_t nIndexEntries =
- genNtuple_->buildIndex("iExpt","iEvtWithinExpt");
-
- // Write out toy MC ntuple
- std::cout << "INFO in LauAbsFitModel::generate : Writing data to file " << dataFileName << "." << std::endl;
- genNtuple_->writeOutGenResults();
+ // Create the ntuple for storing the results
+ std::cout << "INFO in LauAbsFitModel::generate : Creating generation ntuple." << std::endl;
+ if ( genNtuple_ != 0 ) {
+ delete genNtuple_;
+ genNtuple_ = 0;
+ }
+ genNtuple_ = new LauGenNtuple( dataFileName, dataTreeName );
+
+ // add branches for storing the experiment number and the number of
+ // the event within the current experiment
+ this->addGenNtupleIntegerBranch( "iExpt" );
+ this->addGenNtupleIntegerBranch( "iEvtWithinExpt" );
+ this->setupGenNtupleBranches();
+
+ // Start the cumulative timer
+ cumulTimer_.Start();
+
+ const UInt_t firstExp = this->firstExpt();
+ const UInt_t nExp = this->nExpt();
+
+ Bool_t genOK( kTRUE );
+ do {
+ // Loop over the number of experiments
+ for ( UInt_t iExp = firstExp; iExp < ( firstExp + nExp ); ++iExp ) {
+
+ // Start the timer to see how long each experiment takes to generate
+ timer_.Start();
+
+ // Store the experiment number in the ntuple
+ this->setGenNtupleIntegerBranchValue( "iExpt", iExp );
+
+ // Do the generation for this experiment
+ std::cout << "INFO in LauAbsFitModel::generate : Generating experiment number " << iExp
+ << std::endl;
+ genOK = this->genExpt();
+
+ // Stop the timer and see how long the program took so far
+ timer_.Stop();
+ timer_.Print();
+
+ if ( ! genOK ) {
+ // delete and recreate an empty tree
+ genNtuple_->deleteAndRecreateTree();
+
+ // then break out of the experiment loop
+ std::cerr << "WARNING in LauAbsFitModel::generate : Problem in toy MC generation. Starting again with updated parameters..."
+ << std::endl;
+ break;
+ }
+
+ if ( this->writeLatexTable() ) {
+ TString tableFileName( tableFileNameBase );
+ tableFileName += "_";
+ tableFileName += iExp;
+ tableFileName += ".tex";
+ this->writeOutTable( tableFileName );
+ }
+
+ } // Loop over number of experiments
+ } while ( ! genOK );
+
+ // Print out total timing info.
+ cumulTimer_.Stop();
+ std::cout << "INFO in LauAbsFitModel::generate : Finished generating all experiments."
+ << std::endl;
+ std::cout << "INFO in LauAbsFitModel::generate : Cumulative timing:" << std::endl;
+ cumulTimer_.Print();
+
+ // Build the event index
+ std::cout << "INFO in LauAbsFitModel::generate : Building experiment:event index." << std::endl;
+ // TODO - can test this return value?
+ //Int_t nIndexEntries =
+ genNtuple_->buildIndex( "iExpt", "iEvtWithinExpt" );
+
+ // Write out toy MC ntuple
+ std::cout << "INFO in LauAbsFitModel::generate : Writing data to file " << dataFileName << "."
+ << std::endl;
+ genNtuple_->writeOutGenResults();
}
-void LauAbsFitModel::addGenNtupleIntegerBranch(const TString& name)
+void LauAbsFitModel::addGenNtupleIntegerBranch( const TString& name )
{
- genNtuple_->addIntegerBranch(name);
+ genNtuple_->addIntegerBranch( name );
}
-void LauAbsFitModel::addGenNtupleDoubleBranch(const TString& name)
+void LauAbsFitModel::addGenNtupleDoubleBranch( const TString& name )
{
- genNtuple_->addDoubleBranch(name);
+ genNtuple_->addDoubleBranch( name );
}
-void LauAbsFitModel::setGenNtupleIntegerBranchValue(const TString& name, Int_t value)
+void LauAbsFitModel::setGenNtupleIntegerBranchValue( const TString& name, Int_t value )
{
- genNtuple_->setIntegerBranchValue(name,value);
+ genNtuple_->setIntegerBranchValue( name, value );
}
-void LauAbsFitModel::setGenNtupleDoubleBranchValue(const TString& name, Double_t value)
+void LauAbsFitModel::setGenNtupleDoubleBranchValue( const TString& name, Double_t value )
{
- genNtuple_->setDoubleBranchValue(name,value);
+ genNtuple_->setDoubleBranchValue( name, value );
}
-Int_t LauAbsFitModel::getGenNtupleIntegerBranchValue(const TString& name) const
+Int_t LauAbsFitModel::getGenNtupleIntegerBranchValue( const TString& name ) const
{
- return genNtuple_->getIntegerBranchValue(name);
+ return genNtuple_->getIntegerBranchValue( name );
}
-Double_t LauAbsFitModel::getGenNtupleDoubleBranchValue(const TString& name) const
+Double_t LauAbsFitModel::getGenNtupleDoubleBranchValue( const TString& name ) const
{
- return genNtuple_->getDoubleBranchValue(name);
+ return genNtuple_->getDoubleBranchValue( name );
}
void LauAbsFitModel::fillGenNtupleBranches()
{
- genNtuple_->fillBranches();
+ genNtuple_->fillBranches();
}
-void LauAbsFitModel::addSPlotNtupleIntegerBranch(const TString& name)
+void LauAbsFitModel::addSPlotNtupleIntegerBranch( const TString& name )
{
- sPlotNtuple_->addIntegerBranch(name);
+ sPlotNtuple_->addIntegerBranch( name );
}
-void LauAbsFitModel::addSPlotNtupleDoubleBranch(const TString& name)
+void LauAbsFitModel::addSPlotNtupleDoubleBranch( const TString& name )
{
- sPlotNtuple_->addDoubleBranch(name);
+ sPlotNtuple_->addDoubleBranch( name );
}
-void LauAbsFitModel::setSPlotNtupleIntegerBranchValue(const TString& name, Int_t value)
+void LauAbsFitModel::setSPlotNtupleIntegerBranchValue( const TString& name, Int_t value )
{
- sPlotNtuple_->setIntegerBranchValue(name,value);
+ sPlotNtuple_->setIntegerBranchValue( name, value );
}
-void LauAbsFitModel::setSPlotNtupleDoubleBranchValue(const TString& name, Double_t value)
+void LauAbsFitModel::setSPlotNtupleDoubleBranchValue( const TString& name, Double_t value )
{
- sPlotNtuple_->setDoubleBranchValue(name,value);
+ sPlotNtuple_->setDoubleBranchValue( name, value );
}
void LauAbsFitModel::fillSPlotNtupleBranches()
{
- sPlotNtuple_->fillBranches();
+ sPlotNtuple_->fillBranches();
}
-void LauAbsFitModel::fit(const TString& dataFileName, const TString& dataTreeName, const TString& histFileName, const TString& tableFileNameBase)
+void LauAbsFitModel::fit( const TString& dataFileName,
+ const TString& dataTreeName,
+ const TString& histFileName,
+ const TString& tableFileNameBase )
{
- // Routine to perform the total fit.
-
- const UInt_t firstExp = this->firstExpt();
- const UInt_t nExp = this->nExpt();
-
- std::cout << "INFO in LauAbsFitModel::fit : First experiment = " << firstExp << std::endl;
- std::cout << "INFO in LauAbsFitModel::fit : Number of experiments = " << nExp << std::endl;
-
- // Start the cumulative timer
- cumulTimer_.Start();
-
- this->resetFitCounters();
-
- // Create and setup the fit results ntuple
- this->setupResultsOutputs( histFileName, tableFileNameBase );
-
- // Create and setup the sPlot ntuple
- if (this->writeSPlotData()) {
- std::cout << "INFO in LauAbsFitModel::fit : Creating sPlot ntuple." << std::endl;
- if (sPlotNtuple_ != 0) {delete sPlotNtuple_; sPlotNtuple_ = 0;}
- sPlotNtuple_ = new LauGenNtuple(sPlotFileName_,sPlotTreeName_);
- this->setupSPlotNtupleBranches();
- }
-
- // This reads in the given dataFile and creates an input
- // fit data tree that stores them for all events and experiments.
- Bool_t dataOK = this->verifyFitData(dataFileName,dataTreeName);
- if (!dataOK) {
- std::cerr << "ERROR in LauAbsFitModel::fit : Problem caching the fit data." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // Loop over the number of experiments
- for (UInt_t iExp = firstExp; iExp < (firstExp+nExp); ++iExp) {
-
- // Start the timer to see how long each fit takes
- timer_.Start();
-
- this->setCurrentExperiment( iExp );
-
- UInt_t nEvents = this->readExperimentData();
- if (nEvents < 1) {
- std::cerr << "WARNING in LauAbsFitModel::fit : Zero events in experiment " << iExp << ", skipping..." << std::endl;
- timer_.Stop();
- continue;
- }
-
- // Now the sub-classes must implement whatever they need to do
- // to cache any more input fit data they need in order to
- // calculate the likelihoods during the fit.
- // They need to use the inputFitData_ tree as input. For example,
- // inputFitData_ contains m13Sq and m23Sq. The appropriate fit model
- // then caches the resonance dynamics for the signal model, as
- // well as the background likelihood values in the Dalitz plot
- this->cacheInputFitVars();
- if ( this->doSFit() ) {
- this->cacheInputSWeights();
- }
-
- // If we're fitting toy experiments then re-generate the means of any constraints
- this->generateConstraintMeans( conVars_ );
-
- // Do the fit for this experiment
- this->fitExpt();
-
- // Write the results into the ntuple
- this->finaliseFitResults( outputTableName_ );
-
- // Stop the timer and see how long the program took so far
- timer_.Stop();
- timer_.Print();
-
- // Store the per-event likelihood values
- if ( this->writeSPlotData() ) {
- this->storePerEvtLlhds();
- }
-
- // Create a toy MC sample using the fitted parameters so that
- // the user can compare the fit to the data.
- if (compareFitData_ == kTRUE && this->statusCode() == 3) {
- this->createFitToyMC(fitToyMCFileName_, fitToyMCTableName_);
- }
-
- } // Loop over number of experiments
-
- // Print out total timing info.
- cumulTimer_.Stop();
- std::cout << "INFO in LauAbsFitModel::fit : Cumulative timing:" << std::endl;
- cumulTimer_.Print();
-
- // Print out stats on OK fits.
- const UInt_t nOKFits = this->numberOKFits();
- const UInt_t nBadFits = this->numberBadFits();
- std::cout << "INFO in LauAbsFitModel::fit : Number of OK Fits = " << nOKFits << std::endl;
- std::cout << "INFO in LauAbsFitModel::fit : Number of Failed Fits = " << nBadFits << std::endl;
- Double_t fitEff(0.0);
- if (nExp != 0) {fitEff = nOKFits/(1.0*nExp);}
- std::cout << "INFO in LauAbsFitModel::fit : Fit efficiency = " << fitEff*100.0 << "%." << std::endl;
-
- // Write out any fit results (ntuples etc...).
- this->writeOutAllFitResults();
- if ( this->writeSPlotData() ) {
- this->calculateSPlotData();
- }
+ // Routine to perform the total fit.
+
+ const UInt_t firstExp = this->firstExpt();
+ const UInt_t nExp = this->nExpt();
+
+ std::cout << "INFO in LauAbsFitModel::fit : First experiment = " << firstExp << std::endl;
+ std::cout << "INFO in LauAbsFitModel::fit : Number of experiments = " << nExp << std::endl;
+
+ // Start the cumulative timer
+ cumulTimer_.Start();
+
+ this->resetFitCounters();
+
+ // Create and setup the fit results ntuple
+ this->setupResultsOutputs( histFileName, tableFileNameBase );
+
+ // Create and setup the sPlot ntuple
+ if ( this->writeSPlotData() ) {
+ std::cout << "INFO in LauAbsFitModel::fit : Creating sPlot ntuple." << std::endl;
+ if ( sPlotNtuple_ != 0 ) {
+ delete sPlotNtuple_;
+ sPlotNtuple_ = 0;
+ }
+ sPlotNtuple_ = new LauGenNtuple( sPlotFileName_, sPlotTreeName_ );
+ this->setupSPlotNtupleBranches();
+ }
+
+ // This reads in the given dataFile and creates an input
+ // fit data tree that stores them for all events and experiments.
+ Bool_t dataOK = this->verifyFitData( dataFileName, dataTreeName );
+ if ( ! dataOK ) {
+ std::cerr << "ERROR in LauAbsFitModel::fit : Problem caching the fit data." << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // Loop over the number of experiments
+ for ( UInt_t iExp = firstExp; iExp < ( firstExp + nExp ); ++iExp ) {
+
+ // Start the timer to see how long each fit takes
+ timer_.Start();
+
+ this->setCurrentExperiment( iExp );
+
+ UInt_t nEvents = this->readExperimentData();
+ if ( nEvents < 1 ) {
+ std::cerr << "WARNING in LauAbsFitModel::fit : Zero events in experiment " << iExp
+ << ", skipping..." << std::endl;
+ timer_.Stop();
+ continue;
+ }
+
+ // Now the sub-classes must implement whatever they need to do
+ // to cache any more input fit data they need in order to
+ // calculate the likelihoods during the fit.
+ // They need to use the inputFitData_ tree as input. For example,
+ // inputFitData_ contains m13Sq and m23Sq. The appropriate fit model
+ // then caches the resonance dynamics for the signal model, as
+ // well as the background likelihood values in the Dalitz plot
+ this->cacheInputFitVars();
+ if ( this->doSFit() ) {
+ this->cacheInputSWeights();
+ }
+
+ // If we're fitting toy experiments then re-generate the means of any constraints
+ this->generateConstraintMeans( conVars_ );
+
+ // Do the fit for this experiment
+ this->fitExpt();
+
+ // Write the results into the ntuple
+ this->finaliseFitResults( outputTableName_ );
+
+ // Stop the timer and see how long the program took so far
+ timer_.Stop();
+ timer_.Print();
+
+ // Store the per-event likelihood values
+ if ( this->writeSPlotData() ) {
+ this->storePerEvtLlhds();
+ }
+
+ // Create a toy MC sample using the fitted parameters so that
+ // the user can compare the fit to the data.
+ if ( compareFitData_ == kTRUE && this->statusCode() == 3 ) {
+ this->createFitToyMC( fitToyMCFileName_, fitToyMCTableName_ );
+ }
+
+ } // Loop over number of experiments
+
+ // Print out total timing info.
+ cumulTimer_.Stop();
+ std::cout << "INFO in LauAbsFitModel::fit : Cumulative timing:" << std::endl;
+ cumulTimer_.Print();
+
+ // Print out stats on OK fits.
+ const UInt_t nOKFits = this->numberOKFits();
+ const UInt_t nBadFits = this->numberBadFits();
+ std::cout << "INFO in LauAbsFitModel::fit : Number of OK Fits = " << nOKFits << std::endl;
+ std::cout << "INFO in LauAbsFitModel::fit : Number of Failed Fits = " << nBadFits << std::endl;
+ Double_t fitEff( 0.0 );
+ if ( nExp != 0 ) {
+ fitEff = nOKFits / ( 1.0 * nExp );
+ }
+ std::cout << "INFO in LauAbsFitModel::fit : Fit efficiency = " << fitEff * 100.0 << "%."
+ << std::endl;
+
+ // Write out any fit results (ntuples etc...).
+ this->writeOutAllFitResults();
+ if ( this->writeSPlotData() ) {
+ this->calculateSPlotData();
+ }
}
void LauAbsFitModel::setupResultsOutputs( const TString& histFileName, const TString& tableFileName )
{
- this->LauSimFitTask::setupResultsOutputs( histFileName, tableFileName );
+ this->LauSimFitTask::setupResultsOutputs( histFileName, tableFileName );
- outputTableName_ = tableFileName;
+ outputTableName_ = tableFileName;
}
-Bool_t LauAbsFitModel::verifyFitData(const TString& dataFileName, const TString& dataTreeName)
+Bool_t LauAbsFitModel::verifyFitData( const TString& dataFileName, const TString& dataTreeName )
{
- // From the input data stream, store the variables into the
- // internal tree inputFitData_ that can be used by the sub-classes
- // in calculating their likelihood functions for the fit
- delete inputFitData_;
- inputFitData_ = new LauFitDataTree(dataFileName,dataTreeName);
- Bool_t dataOK = inputFitData_->findBranches();
-
- if (!dataOK) {
- delete inputFitData_; inputFitData_ = 0;
- }
-
- return dataOK;
+ // From the input data stream, store the variables into the
+ // internal tree inputFitData_ that can be used by the sub-classes
+ // in calculating their likelihood functions for the fit
+ delete inputFitData_;
+ inputFitData_ = new LauFitDataTree( dataFileName, dataTreeName );
+ Bool_t dataOK = inputFitData_->findBranches();
+
+ if ( ! dataOK ) {
+ delete inputFitData_;
+ inputFitData_ = 0;
+ }
+
+ return dataOK;
}
void LauAbsFitModel::cacheInputSWeights()
{
- Bool_t hasBranch = inputFitData_->haveBranch( sWeightBranchName_ );
- if ( ! hasBranch ) {
- std::cerr << "ERROR in LauAbsFitModel::cacheInputSWeights : Input data does not contain variable \"" << sWeightBranchName_ << "\".\n";
- std::cerr << " : Turning off sFit!" << std::endl;
- doSFit_ = kFALSE;
- return;
- }
+ Bool_t hasBranch = inputFitData_->haveBranch( sWeightBranchName_ );
+ if ( ! hasBranch ) {
+ std::cerr << "ERROR in LauAbsFitModel::cacheInputSWeights : Input data does not contain variable \""
+ << sWeightBranchName_ << "\".\n";
+ std::cerr << " : Turning off sFit!" << std::endl;
+ doSFit_ = kFALSE;
+ return;
+ }
- UInt_t nEvents = this->eventsPerExpt();
- sWeights_.clear();
- sWeights_.reserve( nEvents );
+ UInt_t nEvents = this->eventsPerExpt();
+ sWeights_.clear();
+ sWeights_.reserve( nEvents );
- for (UInt_t iEvt = 0; iEvt < nEvents; ++iEvt) {
+ for ( UInt_t iEvt = 0; iEvt < nEvents; ++iEvt ) {
- const LauFitData& dataValues = inputFitData_->getData(iEvt);
+ const LauFitData& dataValues = inputFitData_->getData( iEvt );
- LauFitData::const_iterator iter = dataValues.find( sWeightBranchName_ );
+ LauFitData::const_iterator iter = dataValues.find( sWeightBranchName_ );
- sWeights_.push_back( iter->second * sWeightScaleFactor_ );
- }
+ sWeights_.push_back( iter->second * sWeightScaleFactor_ );
+ }
}
void LauAbsFitModel::fitExpt()
{
- // Routine to perform the actual fit for the given experiment
-
- // Update initial fit parameters if required (e.g. if using random numbers).
- this->checkInitFitParams();
-
- // Initialise the fitter
- LauFitter::fitter().useAsymmFitErrors( this->useAsymmFitErrors() );
- LauFitter::fitter().twoStageFit( this->twoStageFit() );
- LauFitter::fitter().initialise( this, fitVars_ );
-
- this->startNewFit( LauFitter::fitter().nParameters(), LauFitter::fitter().nFreeParameters() );
-
- // Now ready for minimisation step
- std::cout << "\nINFO in LauAbsFitModel::fitExpt : Start minimisation...\n";
- LauAbsFitter::FitStatus fitResult = LauFitter::fitter().minimise();
-
- // If we're doing a two stage fit we can now release (i.e. float)
- // the 2nd stage parameters and re-fit
- if (this->twoStageFit()) {
- if ( fitResult.status != 3 ) {
- std::cerr << "WARNING in LauAbsFitModel:fitExpt : Not running second stage fit since first stage failed." << std::endl;
- LauFitter::fitter().releaseSecondStageParameters();
- } else {
- LauFitter::fitter().releaseSecondStageParameters();
- this->startNewFit( LauFitter::fitter().nParameters(), LauFitter::fitter().nFreeParameters() );
- fitResult = LauFitter::fitter().minimise();
- }
- }
-
- const TMatrixD& covMat = LauFitter::fitter().covarianceMatrix();
- this->storeFitStatus( fitResult, covMat );
-
- // Store the final fit results and errors into protected internal vectors that
- // all sub-classes can use within their own finalFitResults implementation
- // used below (e.g. putting them into an ntuple in a root file)
- LauFitter::fitter().updateParameters();
+ // Routine to perform the actual fit for the given experiment
+
+ // Update initial fit parameters if required (e.g. if using random numbers).
+ this->checkInitFitParams();
+
+ // Initialise the fitter
+ LauFitter::fitter().useAsymmFitErrors( this->useAsymmFitErrors() );
+ LauFitter::fitter().twoStageFit( this->twoStageFit() );
+ LauFitter::fitter().initialise( this, fitVars_ );
+
+ this->startNewFit( LauFitter::fitter().nParameters(), LauFitter::fitter().nFreeParameters() );
+
+ // Now ready for minimisation step
+ std::cout << "\nINFO in LauAbsFitModel::fitExpt : Start minimisation...\n";
+ LauAbsFitter::FitStatus fitResult = LauFitter::fitter().minimise();
+
+ // If we're doing a two stage fit we can now release (i.e. float)
+ // the 2nd stage parameters and re-fit
+ if ( this->twoStageFit() ) {
+ if ( fitResult.status != 3 ) {
+ std::cerr << "WARNING in LauAbsFitModel:fitExpt : Not running second stage fit since first stage failed."
+ << std::endl;
+ LauFitter::fitter().releaseSecondStageParameters();
+ } else {
+ LauFitter::fitter().releaseSecondStageParameters();
+ this->startNewFit( LauFitter::fitter().nParameters(),
+ LauFitter::fitter().nFreeParameters() );
+ fitResult = LauFitter::fitter().minimise();
+ }
+ }
+
+ const TMatrixD& covMat = LauFitter::fitter().covarianceMatrix();
+ this->storeFitStatus( fitResult, covMat );
+
+ // Store the final fit results and errors into protected internal vectors that
+ // all sub-classes can use within their own finalFitResults implementation
+ // used below (e.g. putting them into an ntuple in a root file)
+ LauFitter::fitter().updateParameters();
}
void LauAbsFitModel::calculateSPlotData()
{
- if (sPlotNtuple_ != 0) {
- sPlotNtuple_->addFriendTree(inputFitData_->fileName(), inputFitData_->treeName());
- sPlotNtuple_->writeOutGenResults();
- LauSPlot splot(sPlotNtuple_->fileName(), sPlotNtuple_->treeName(), this->firstExpt(), this->nExpt(),
- this->variableNames(), this->freeSpeciesNames(), this->fixdSpeciesNames(), this->twodimPDFs(),
- this->splitSignal(), this->scfDPSmear());
- splot.runCalculations(sPlotVerbosity_);
- splot.writeOutResults();
- }
+ if ( sPlotNtuple_ != 0 ) {
+ sPlotNtuple_->addFriendTree( inputFitData_->fileName(), inputFitData_->treeName() );
+ sPlotNtuple_->writeOutGenResults();
+ LauSPlot splot( sPlotNtuple_->fileName(),
+ sPlotNtuple_->treeName(),
+ this->firstExpt(),
+ this->nExpt(),
+ this->variableNames(),
+ this->freeSpeciesNames(),
+ this->fixdSpeciesNames(),
+ this->twodimPDFs(),
+ this->splitSignal(),
+ this->scfDPSmear() );
+ splot.runCalculations( sPlotVerbosity_ );
+ splot.writeOutResults();
+ }
}
-void LauAbsFitModel::compareFitData(UInt_t toyMCScale, const TString& mcFileName, const TString& tableFileName, Bool_t poissonSmearing)
+void LauAbsFitModel::compareFitData( UInt_t toyMCScale,
+ const TString& mcFileName,
+ const TString& tableFileName,
+ Bool_t poissonSmearing )
{
- compareFitData_ = kTRUE;
- fitToyMCScale_ = toyMCScale;
- fitToyMCFileName_ = mcFileName;
- fitToyMCTableName_ = tableFileName;
- fitToyMCPoissonSmear_ = poissonSmearing;
+ compareFitData_ = kTRUE;
+ fitToyMCScale_ = toyMCScale;
+ fitToyMCFileName_ = mcFileName;
+ fitToyMCTableName_ = tableFileName;
+ fitToyMCPoissonSmear_ = poissonSmearing;
}
-void LauAbsFitModel::createFitToyMC(const TString& mcFileName, const TString& tableFileName)
+void LauAbsFitModel::createFitToyMC( const TString& mcFileName, const TString& tableFileName )
{
- // Create a toy MC sample so that the user can compare the fitted
- // result with the data.
- // Generate more toy MC to reduce statistical fluctuations:
- // - use the rescaling value fitToyMCScale_
-
- // Store the info on the number of experiments, first expt and current expt
- const UInt_t oldNExpt(this->nExpt());
- const UInt_t oldFirstExpt(this->firstExpt());
- const UInt_t oldIExpt(this->iExpt());
- const Bool_t oldToyExpt(this->toyExpts());
-
- // Turn off Poisson smearing if required
- const Bool_t poissonSmearing(this->doPoissonSmearing());
- this->doPoissonSmearing(fitToyMCPoissonSmear_);
-
- // Turn off embedding, since we need toy MC, not reco'ed events
- const Bool_t enableEmbeddingOrig(this->enableEmbedding());
- this->enableEmbedding(kFALSE);
-
- // Need to make sure that the generation of the DP co-ordinates is
- // switched on if any of our PDFs depend on it
- const Bool_t origUseDP = this->useDP();
- if ( !origUseDP && this->pdfsDependOnDP() ) {
- this->useDP( kTRUE );
- this->initialiseDPModels();
- }
-
- // Construct a unique filename for this experiment
- TString exptString("_expt");
- exptString += oldIExpt;
- TString fileName( mcFileName );
- fileName.Insert( fileName.Last('.'), exptString );
-
- // Generate the toy MC
- std::cout << "INFO in LauAbsFitModel::createFitToyMC : Generating toy MC in " << fileName << " to compare fit with data..." << std::endl;
- std::cout << " : Number of experiments to generate = " << fitToyMCScale_ << "." << std::endl;
- std::cout << " : This is to allow the toy MC to be made with reduced statistical fluctuations." << std::endl;
-
- // Set the genValue of each parameter to its current (fitted) value
- // but first store the original genValues for restoring later
- std::vector<Double_t> origGenValues; origGenValues.reserve(this->nTotParams());
- Bool_t blind(kFALSE);
- for (LauParameterPList::iterator iter = fitVars_.begin(); iter != fitVars_.end(); ++iter) {
- origGenValues.push_back((*iter)->genValue());
- (*iter)->genValue((*iter)->unblindValue());
- if ( (*iter)->blind() ) {
- blind = kTRUE;
- }
- }
- if ( blind ) {
- std::cerr << "WARNING in LauAbsFitModel::createFitToyMC : One or more parameters are blind but the toy will be created using the unblind values - use with caution!!" << std::endl;
- }
-
- // If we're asked to generate more than 100 experiments then split it
- // up into multiple files since otherwise can run into memory issues
- // when building the index
- // TODO - this obviously depends on the number of events per experiment as well, so should do this properly
-
- UInt_t totalExpts = fitToyMCScale_;
- if ( totalExpts > 100 ) {
- UInt_t nFiles = totalExpts/100;
- if ( totalExpts%100 ) {
- nFiles += 1;
- }
- TString fileNameBase {fileName};
- for ( UInt_t iFile(0); iFile < nFiles; ++iFile ) {
-
- UInt_t firstExp( iFile*100 );
-
- // Set number of experiments and first experiment to generate
- UInt_t nExp = ((firstExp + 100)>totalExpts) ? totalExpts-firstExp : 100;
- this->setNExpts(nExp, firstExp, kTRUE);
-
- // Create a unique filename and generate the events
- fileName = fileNameBase;
- TString extraname = "_file";
- extraname += iFile;
- fileName.Insert( fileName.Last('.'), extraname );
- this->generate(fileName, "genResults", "dummy.root", tableFileName);
- }
- } else {
- // Set number of experiments to new value
- this->setNExpts(fitToyMCScale_, 0, kTRUE);
- // Generate the toy
- this->generate(fileName, "genResults", "dummy.root", tableFileName);
- }
-
- // Reset number of experiments to original value
- this->setNExpts(oldNExpt, oldFirstExpt, oldToyExpt);
- this->setCurrentExperiment(oldIExpt);
-
- // Restore the Poisson smearing to its former value
- this->doPoissonSmearing(poissonSmearing);
-
- // Restore the embedding status
- this->enableEmbedding(enableEmbeddingOrig);
-
- // Restore "useDP" to its former status
- this->useDP( origUseDP );
-
- // Restore the original genValue to each parameter
- for (UInt_t i(0); i<this->nTotParams(); ++i) {
- fitVars_[i]->genValue(origGenValues[i]);
- }
-
- std::cout << "INFO in LauAbsFitModel::createFitToyMC : Finished in createFitToyMC." << std::endl;
+ // Create a toy MC sample so that the user can compare the fitted
+ // result with the data.
+ // Generate more toy MC to reduce statistical fluctuations:
+ // - use the rescaling value fitToyMCScale_
+
+ // Store the info on the number of experiments, first expt and current expt
+ const UInt_t oldNExpt( this->nExpt() );
+ const UInt_t oldFirstExpt( this->firstExpt() );
+ const UInt_t oldIExpt( this->iExpt() );
+ const Bool_t oldToyExpt( this->toyExpts() );
+
+ // Turn off Poisson smearing if required
+ const Bool_t poissonSmearing( this->doPoissonSmearing() );
+ this->doPoissonSmearing( fitToyMCPoissonSmear_ );
+
+ // Turn off embedding, since we need toy MC, not reco'ed events
+ const Bool_t enableEmbeddingOrig( this->enableEmbedding() );
+ this->enableEmbedding( kFALSE );
+
+ // Need to make sure that the generation of the DP co-ordinates is
+ // switched on if any of our PDFs depend on it
+ const Bool_t origUseDP = this->useDP();
+ if ( ! origUseDP && this->pdfsDependOnDP() ) {
+ this->useDP( kTRUE );
+ this->initialiseDPModels();
+ }
+
+ // Construct a unique filename for this experiment
+ TString exptString( "_expt" );
+ exptString += oldIExpt;
+ TString fileName( mcFileName );
+ fileName.Insert( fileName.Last( '.' ), exptString );
+
+ // Generate the toy MC
+ std::cout << "INFO in LauAbsFitModel::createFitToyMC : Generating toy MC in " << fileName
+ << " to compare fit with data..." << std::endl;
+ std::cout << " : Number of experiments to generate = "
+ << fitToyMCScale_ << "." << std::endl;
+ std::cout << " : This is to allow the toy MC to be made with reduced statistical fluctuations."
+ << std::endl;
+
+ // Set the genValue of each parameter to its current (fitted) value
+ // but first store the original genValues for restoring later
+ std::vector<Double_t> origGenValues;
+ origGenValues.reserve( this->nTotParams() );
+ Bool_t blind( kFALSE );
+ for ( LauParameterPList::iterator iter = fitVars_.begin(); iter != fitVars_.end(); ++iter ) {
+ origGenValues.push_back( ( *iter )->genValue() );
+ ( *iter )->genValue( ( *iter )->unblindValue() );
+ if ( ( *iter )->blind() ) {
+ blind = kTRUE;
+ }
+ }
+ if ( blind ) {
+ std::cerr << "WARNING in LauAbsFitModel::createFitToyMC : One or more parameters are blind but the toy will be created using the unblind values - use with caution!!"
+ << std::endl;
+ }
+
+ // If we're asked to generate more than 100 experiments then split it
+ // up into multiple files since otherwise can run into memory issues
+ // when building the index
+ // TODO - this obviously depends on the number of events per experiment as well, so should do this properly
+
+ UInt_t totalExpts = fitToyMCScale_;
+ if ( totalExpts > 100 ) {
+ UInt_t nFiles = totalExpts / 100;
+ if ( totalExpts % 100 ) {
+ nFiles += 1;
+ }
+ TString fileNameBase { fileName };
+ for ( UInt_t iFile( 0 ); iFile < nFiles; ++iFile ) {
+
+ UInt_t firstExp( iFile * 100 );
+
+ // Set number of experiments and first experiment to generate
+ UInt_t nExp = ( ( firstExp + 100 ) > totalExpts ) ? totalExpts - firstExp : 100;
+ this->setNExpts( nExp, firstExp, kTRUE );
+
+ // Create a unique filename and generate the events
+ fileName = fileNameBase;
+ TString extraname = "_file";
+ extraname += iFile;
+ fileName.Insert( fileName.Last( '.' ), extraname );
+ this->generate( fileName, "genResults", "dummy.root", tableFileName );
+ }
+ } else {
+ // Set number of experiments to new value
+ this->setNExpts( fitToyMCScale_, 0, kTRUE );
+ // Generate the toy
+ this->generate( fileName, "genResults", "dummy.root", tableFileName );
+ }
+
+ // Reset number of experiments to original value
+ this->setNExpts( oldNExpt, oldFirstExpt, oldToyExpt );
+ this->setCurrentExperiment( oldIExpt );
+
+ // Restore the Poisson smearing to its former value
+ this->doPoissonSmearing( poissonSmearing );
+
+ // Restore the embedding status
+ this->enableEmbedding( enableEmbeddingOrig );
+
+ // Restore "useDP" to its former status
+ this->useDP( origUseDP );
+
+ // Restore the original genValue to each parameter
+ for ( UInt_t i( 0 ); i < this->nTotParams(); ++i ) {
+ fitVars_[i]->genValue( origGenValues[i] );
+ }
+
+ std::cout << "INFO in LauAbsFitModel::createFitToyMC : Finished in createFitToyMC." << std::endl;
}
Double_t LauAbsFitModel::getTotNegLogLikelihood()
{
- // Calculate the total negative log-likelihood over all events.
- // This function assumes that the fit parameters and data tree have
- // already been set-up correctly.
-
- // Loop over the data points to calculate the log likelihood
- Double_t logLike = this->getLogLikelihood( 0, this->eventsPerExpt() );
-
- // Include the Poisson term in the extended likelihood if required
- if (this->doEMLFit()) {
- logLike -= this->getEventSum();
- }
-
- // Calculate any penalty terms from Gaussian constrained variables
- const auto& multiDimCons = this->multiDimConstraints();
- if ( ! conVars_.empty() || ! multiDimCons.empty() ){
- logLike -= this->getLogLikelihoodPenalty();
- }
-
- Double_t totNegLogLike = -logLike;
- return totNegLogLike;
+ // Calculate the total negative log-likelihood over all events.
+ // This function assumes that the fit parameters and data tree have
+ // already been set-up correctly.
+
+ // Loop over the data points to calculate the log likelihood
+ Double_t logLike = this->getLogLikelihood( 0, this->eventsPerExpt() );
+
+ // Include the Poisson term in the extended likelihood if required
+ if ( this->doEMLFit() ) {
+ logLike -= this->getEventSum();
+ }
+
+ // Calculate any penalty terms from Gaussian constrained variables
+ const auto& multiDimCons = this->multiDimConstraints();
+ if ( ! conVars_.empty() || ! multiDimCons.empty() ) {
+ logLike -= this->getLogLikelihoodPenalty();
+ }
+
+ Double_t totNegLogLike = -logLike;
+ return totNegLogLike;
}
Double_t LauAbsFitModel::getLogLikelihoodPenalty()
{
- Double_t penalty{0.0};
+ Double_t penalty { 0.0 };
- for ( LauAbsRValue* par : conVars_ ) {
- penalty += par->constraintPenalty();
- }
+ for ( LauAbsRValue* par : conVars_ ) {
+ penalty += par->constraintPenalty();
+ }
- auto& multiDimCons = this->multiDimConstraints();
- for ( auto& constraint : multiDimCons ) {
- penalty += constraint.constraintPenalty();
- }
+ auto& multiDimCons = this->multiDimConstraints();
+ for ( auto& constraint : multiDimCons ) {
+ penalty += constraint.constraintPenalty();
+ }
- return penalty;
+ return penalty;
}
Double_t LauAbsFitModel::getLogLikelihood( UInt_t iStart, UInt_t iEnd )
{
- // Calculate the total negative log-likelihood over all events.
- // This function assumes that the fit parameters and data tree have
- // already been set-up correctly.
-
- // Loop over the data points to calculate the log likelihood
- Double_t logLike(0.0);
- const Double_t worstLL = this->worstLogLike();
-
- // Loop over the number of events in this experiment
- Bool_t ok(kTRUE);
- for (UInt_t iEvt = iStart; iEvt < iEnd; ++iEvt) {
-
- Double_t likelihood = this->getTotEvtLikelihood(iEvt);
-
- if (likelihood > std::numeric_limits<Double_t>::min()) { // Is the likelihood zero?
- Double_t evtLogLike = TMath::Log(likelihood);
- if ( doSFit_ ) {
- evtLogLike *= sWeights_[iEvt];
- }
- logLike += evtLogLike;
- } else {
- ok = kFALSE;
- std::cerr << "WARNING in LauAbsFitModel::getLogLikelihood : Strange likelihood value for event " << iEvt << ": " << likelihood << "\n";
- this->printEventInfo(iEvt);
- this->printVarsInfo(); //Write the values of the floated variables for which the likelihood is zero
- break;
- }
- }
-
- if (!ok) {
- std::cerr << " : Returning worst NLL found so far to force MINUIT out of this region." << std::endl;
- logLike = worstLL;
- } else if (logLike < worstLL) {
- this->worstLogLike( logLike );
- }
-
- return logLike;
+ // Calculate the total negative log-likelihood over all events.
+ // This function assumes that the fit parameters and data tree have
+ // already been set-up correctly.
+
+ // Loop over the data points to calculate the log likelihood
+ Double_t logLike( 0.0 );
+ const Double_t worstLL = this->worstLogLike();
+
+ // Loop over the number of events in this experiment
+ Bool_t ok( kTRUE );
+ for ( UInt_t iEvt = iStart; iEvt < iEnd; ++iEvt ) {
+
+ Double_t likelihood = this->getTotEvtLikelihood( iEvt );
+
+ if ( likelihood > std::numeric_limits<Double_t>::min() ) { // Is the likelihood zero?
+ Double_t evtLogLike = TMath::Log( likelihood );
+ if ( doSFit_ ) {
+ evtLogLike *= sWeights_[iEvt];
+ }
+ logLike += evtLogLike;
+ } else {
+ ok = kFALSE;
+ std::cerr << "WARNING in LauAbsFitModel::getLogLikelihood : Strange likelihood value for event "
+ << iEvt << ": " << likelihood << "\n";
+ this->printEventInfo( iEvt );
+ this->printVarsInfo(); //Write the values of the floated variables for which the likelihood is zero
+ break;
+ }
+ }
+
+ if ( ! ok ) {
+ std::cerr << " : Returning worst NLL found so far to force MINUIT out of this region."
+ << std::endl;
+ logLike = worstLL;
+ } else if ( logLike < worstLL ) {
+ this->worstLogLike( logLike );
+ }
+
+ return logLike;
}
-void LauAbsFitModel::setParsFromMinuit(Double_t* par, Int_t npar)
+void LauAbsFitModel::setParsFromMinuit( Double_t* par, Int_t npar )
{
- // This function sets the internal parameters based on the values
- // that Minuit is using when trying to minimise the total likelihood function.
-
- // MINOS reports different numbers of free parameters depending on the
- // situation, so disable this check
- if ( ! this->withinAsymErrorCalc() ) {
- const UInt_t nFreePars = this->nFreeParams();
- if (static_cast<UInt_t>(npar) != nFreePars) {
- std::cerr << "ERROR in LauAbsFitModel::setParsFromMinuit : Unexpected number of free parameters: " << npar << ".\n";
- std::cerr << " Expected: " << nFreePars << ".\n" << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- }
-
- // Despite npar being the number of free parameters
- // the par array actually contains all the parameters,
- // free and floating...
-
- // Update all the floating ones with their new values
- // Also check if we have any parameters on which the DP integrals depend
- // and whether they have changed since the last iteration
- Bool_t recalcNorm(kFALSE);
- const LauParameterPSet::const_iterator resVarsEnd = resVars_.end();
- for (UInt_t i(0); i<this->nTotParams(); ++i) {
- if (!fitVars_[i]->fixed()) {
- if ( resVars_.find( fitVars_[i] ) != resVarsEnd ) {
- if ( fitVars_[i]->value() != par[i] ) {
- recalcNorm = kTRUE;
- }
- }
- fitVars_[i]->value(par[i]);
- }
- }
-
- // If so, then recalculate the normalisation
- if (recalcNorm) {
- this->recalculateNormalisation();
- }
-
- this->propagateParUpdates();
+ // This function sets the internal parameters based on the values
+ // that Minuit is using when trying to minimise the total likelihood function.
+
+ // MINOS reports different numbers of free parameters depending on the
+ // situation, so disable this check
+ if ( ! this->withinAsymErrorCalc() ) {
+ const UInt_t nFreePars = this->nFreeParams();
+ if ( static_cast<UInt_t>( npar ) != nFreePars ) {
+ std::cerr << "ERROR in LauAbsFitModel::setParsFromMinuit : Unexpected number of free parameters: "
+ << npar << ".\n";
+ std::cerr << " Expected: " << nFreePars
+ << ".\n"
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ }
+
+ // Despite npar being the number of free parameters
+ // the par array actually contains all the parameters,
+ // free and floating...
+
+ // Update all the floating ones with their new values
+ // Also check if we have any parameters on which the DP integrals depend
+ // and whether they have changed since the last iteration
+ Bool_t recalcNorm( kFALSE );
+ const LauParameterPSet::const_iterator resVarsEnd = resVars_.end();
+ for ( UInt_t i( 0 ); i < this->nTotParams(); ++i ) {
+ if ( ! fitVars_[i]->fixed() ) {
+ if ( resVars_.find( fitVars_[i] ) != resVarsEnd ) {
+ if ( fitVars_[i]->value() != par[i] ) {
+ recalcNorm = kTRUE;
+ }
+ }
+ fitVars_[i]->value( par[i] );
+ }
+ }
+
+ // If so, then recalculate the normalisation
+ if ( recalcNorm ) {
+ this->recalculateNormalisation();
+ }
+
+ this->propagateParUpdates();
}
-UInt_t LauAbsFitModel::addFitParameters(LauParameter* param, const Bool_t addFixed)
+UInt_t LauAbsFitModel::addFitParameters( LauParameter* param, const Bool_t addFixed )
{
- UInt_t nParsAdded{0};
-
- // if we're dealing with a clone,
- // we should instead deal with its parent
- if ( param->clone() ) {
- param = param->parent();
- }
-
- // we need to include the parameter if it is either:
- // - floating
- // - currently fixed but will float in the second stage of a two-stage fit
- if ( addFixed || ! param->fixed() || ( this->twoStageFit() && param->secondStage() ) ) {
- // check whether we already have this parameter stored
- auto [ _, addedOK ] { fitVarsSet_.insert( param ) };
- if ( addedOK ) {
- // if not, add it to the list
- fitVars_.push_back( param );
- ++nParsAdded;
- }
- }
-
- return nParsAdded;
+ UInt_t nParsAdded { 0 };
+
+ // if we're dealing with a clone,
+ // we should instead deal with its parent
+ if ( param->clone() ) {
+ param = param->parent();
+ }
+
+ // we need to include the parameter if it is either:
+ // - floating
+ // - currently fixed but will float in the second stage of a two-stage fit
+ if ( addFixed || ! param->fixed() || ( this->twoStageFit() && param->secondStage() ) ) {
+ // check whether we already have this parameter stored
+ auto [_, addedOK] { fitVarsSet_.insert( param ) };
+ if ( addedOK ) {
+ // if not, add it to the list
+ fitVars_.push_back( param );
+ ++nParsAdded;
+ }
+ }
+
+ return nParsAdded;
}
-UInt_t LauAbsFitModel::addFitParameters(LauParameterPList& paramList, const Bool_t addFixed)
+UInt_t LauAbsFitModel::addFitParameters( LauParameterPList& paramList, const Bool_t addFixed )
{
- UInt_t nParsAdded{0};
+ UInt_t nParsAdded { 0 };
- for ( auto param : paramList ) {
- nParsAdded += this->addFitParameters( param, addFixed );
- }
+ for ( auto param : paramList ) {
+ nParsAdded += this->addFitParameters( param, addFixed );
+ }
- return nParsAdded;
+ return nParsAdded;
}
-UInt_t LauAbsFitModel::addFitParameters(LauAbsRValue* param, const Bool_t addFixed)
+UInt_t LauAbsFitModel::addFitParameters( LauAbsRValue* param, const Bool_t addFixed )
{
- UInt_t nParsAdded{0};
+ UInt_t nParsAdded { 0 };
- LauParameterPList pars { param->getPars() };
- for ( auto par : pars ) {
- nParsAdded += this->addFitParameters( par, addFixed );
- }
+ LauParameterPList pars { param->getPars() };
+ for ( auto par : pars ) {
+ nParsAdded += this->addFitParameters( par, addFixed );
+ }
- return nParsAdded;
+ return nParsAdded;
}
-UInt_t LauAbsFitModel::addFitParameters(LauAbsRValuePList& paramList, const Bool_t addFixed)
+UInt_t LauAbsFitModel::addFitParameters( LauAbsRValuePList& paramList, const Bool_t addFixed )
{
- UInt_t nParsAdded{0};
+ UInt_t nParsAdded { 0 };
- for ( auto param : paramList ) {
- nParsAdded += this->addFitParameters( param, addFixed );
- }
+ for ( auto param : paramList ) {
+ nParsAdded += this->addFitParameters( param, addFixed );
+ }
- return nParsAdded;
+ return nParsAdded;
}
-UInt_t LauAbsFitModel::addFitParameters(LauPdfPList& pdfList, const Bool_t addFixed)
+UInt_t LauAbsFitModel::addFitParameters( LauPdfPList& pdfList, const Bool_t addFixed )
{
- UInt_t nParsAdded{0};
+ UInt_t nParsAdded { 0 };
- for ( auto pdf : pdfList ) {
- if ( pdf->isDPDependent() ) {
- this->pdfsDependOnDP( kTRUE );
- }
+ for ( auto pdf : pdfList ) {
+ if ( pdf->isDPDependent() ) {
+ this->pdfsDependOnDP( kTRUE );
+ }
- LauAbsRValuePList& pars = pdf->getParameters();
- nParsAdded += this->addFitParameters( pars, addFixed );
- }
+ LauAbsRValuePList& pars = pdf->getParameters();
+ nParsAdded += this->addFitParameters( pars, addFixed );
+ }
- return nParsAdded;
+ return nParsAdded;
}
-UInt_t LauAbsFitModel::addResonanceParameters(LauParameter* param)
+UInt_t LauAbsFitModel::addResonanceParameters( LauParameter* param )
{
- UInt_t nParsAdded{0};
+ UInt_t nParsAdded { 0 };
- // first check if we have this parameter in the set of resonance parameters
- auto [ _, addedOK ] { resVars_.insert( param ) };
+ // first check if we have this parameter in the set of resonance parameters
+ auto [_, addedOK] { resVars_.insert( param ) };
- if ( addedOK ) {
- nParsAdded += this->addFitParameters( param );
- }
+ if ( addedOK ) {
+ nParsAdded += this->addFitParameters( param );
+ }
- return nParsAdded;
+ return nParsAdded;
}
-UInt_t LauAbsFitModel::addResonanceParameters(LauParameterPList& paramList)
+UInt_t LauAbsFitModel::addResonanceParameters( LauParameterPList& paramList )
{
- UInt_t nParsAdded{0};
+ UInt_t nParsAdded { 0 };
- for ( auto param : paramList ) {
- nParsAdded += this->addResonanceParameters( param );
- }
+ for ( auto param : paramList ) {
+ nParsAdded += this->addResonanceParameters( param );
+ }
- return nParsAdded;
+ return nParsAdded;
}
void LauAbsFitModel::addConParameters()
{
- // Add penalties from the constraints to fit parameters
-
- // First, constraints on the fit parameters themselves
- for ( LauParameter* param : fitVars_ ) {
- if ( param->gaussConstraint() ) {
- conVars_.push_back( param );
- std::cout << "INFO in LauAbsFitModel::addConParameters : Added Gaussian constraint to parameter "<< param->name() << std::endl;
- }
- }
-
- // Second, constraints on arbitrary combinations
- auto& conStore = this->formulaConstraints();
- for ( auto& constraint : conStore ) {
- std::vector<LauParameter*> params;
- for ( const auto& name : constraint.conPars_ ) {
- for ( LauParameter* par : fitVars_ ) {
- if ( par->name() == name ){
- params.push_back( par );
- }
- }
- }
-
- // If the parameters are not found, skip it
- if ( params.size() != constraint.conPars_.size() ) {
- std::cerr << "WARNING in LauAbsFitModel::addConParameters: Could not find parameters to constrain in the formula... skipping" << std::endl;
- continue;
- }
-
- constraint.formulaPar_ = std::make_unique<LauFormulaPar>( constraint.formula_, constraint.formula_, params );
- constraint.formulaPar_->addGaussianConstraint( constraint.mean_, constraint.width_ );
-
- conVars_.push_back( constraint.formulaPar_.get() );
-
- std::cout << "INFO in LauAbsFitModel::addConParameters : Added Gaussian constraint to formula\n";
- std::cout << " : Formula: " << constraint.formula_ << std::endl;
- for ( LauParameter* param : params ) {
- std::cout << " : Parameter: " << param->name() << std::endl;
- }
- }
-
- // Add n-dimensional constraints
- auto& multiDimCons = this->multiDimConstraints();
- for ( auto& constraint : multiDimCons ){
- for ( auto& parname : constraint.conPars_ ){
- for ( auto& fitPar : fitVars_ ){
- if ( parname == fitPar->name() ){
- // Check parameters do not have a 1D Gaussian constraint applied
- if ( fitPar->gaussConstraint() ){
- std::cerr << "ERROR in LauAbsFitModel::addConParameters: parameter in n-dimensional constraint already has a 1d constraint applied" << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- constraint.conLauPars_.push_back(fitPar);
- }
- }
- }
- if ( constraint.conLauPars_.size() != constraint.conPars_.size() ){
- std::cerr << "Error in LauAbsFitModel::addConParameters : Could not match parameter names for n-dimensional constraint" << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- }
+ // Add penalties from the constraints to fit parameters
+
+ // First, constraints on the fit parameters themselves
+ for ( LauParameter* param : fitVars_ ) {
+ if ( param->gaussConstraint() ) {
+ conVars_.push_back( param );
+ std::cout << "INFO in LauAbsFitModel::addConParameters : Added Gaussian constraint to parameter "
+ << param->name() << std::endl;
+ }
+ }
+
+ // Second, constraints on arbitrary combinations
+ auto& conStore = this->formulaConstraints();
+ for ( auto& constraint : conStore ) {
+ std::vector<LauParameter*> params;
+ for ( const auto& name : constraint.conPars_ ) {
+ for ( LauParameter* par : fitVars_ ) {
+ if ( par->name() == name ) {
+ params.push_back( par );
+ }
+ }
+ }
+
+ // If the parameters are not found, skip it
+ if ( params.size() != constraint.conPars_.size() ) {
+ std::cerr << "WARNING in LauAbsFitModel::addConParameters: Could not find parameters to constrain in the formula... skipping"
+ << std::endl;
+ continue;
+ }
+
+ constraint.formulaPar_ =
+ std::make_unique<LauFormulaPar>( constraint.formula_, constraint.formula_, params );
+ constraint.formulaPar_->addGaussianConstraint( constraint.mean_, constraint.width_ );
+
+ conVars_.push_back( constraint.formulaPar_.get() );
+
+ std::cout << "INFO in LauAbsFitModel::addConParameters : Added Gaussian constraint to formula\n";
+ std::cout << " : Formula: " << constraint.formula_
+ << std::endl;
+ for ( LauParameter* param : params ) {
+ std::cout << " : Parameter: " << param->name()
+ << std::endl;
+ }
+ }
+
+ // Add n-dimensional constraints
+ auto& multiDimCons = this->multiDimConstraints();
+ for ( auto& constraint : multiDimCons ) {
+ for ( auto& parname : constraint.conPars_ ) {
+ for ( auto& fitPar : fitVars_ ) {
+ if ( parname == fitPar->name() ) {
+ // Check parameters do not have a 1D Gaussian constraint applied
+ if ( fitPar->gaussConstraint() ) {
+ std::cerr << "ERROR in LauAbsFitModel::addConParameters: parameter in n-dimensional constraint already has a 1d constraint applied"
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ constraint.conLauPars_.push_back( fitPar );
+ }
+ }
+ }
+ if ( constraint.conLauPars_.size() != constraint.conPars_.size() ) {
+ std::cerr << "Error in LauAbsFitModel::addConParameters : Could not match parameter names for n-dimensional constraint"
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ }
}
-void LauAbsFitModel::updateFitParameters(LauPdfPList& pdfList)
+void LauAbsFitModel::updateFitParameters( LauPdfPList& pdfList )
{
- for (LauPdfPList::iterator pdf_iter = pdfList.begin(); pdf_iter != pdfList.end(); ++pdf_iter) {
- (*pdf_iter)->updatePulls();
- }
+ for ( LauPdfPList::iterator pdf_iter = pdfList.begin(); pdf_iter != pdfList.end(); ++pdf_iter ) {
+ ( *pdf_iter )->updatePulls();
+ }
}
-void LauAbsFitModel::printFitParameters(const LauPdfPList& pdfList, std::ostream& fout) const
+void LauAbsFitModel::printFitParameters( const LauPdfPList& pdfList, std::ostream& fout ) const
{
- LauPrint print;
- for (LauPdfPList::const_iterator pdf_iter = pdfList.begin(); pdf_iter != pdfList.end(); ++pdf_iter) {
- const LauAbsRValuePList& pars = (*pdf_iter)->getParameters();
- for (LauAbsRValuePList::const_iterator pars_iter = pars.begin(); pars_iter != pars.end(); ++pars_iter) {
- LauParameterPList params = (*pars_iter)->getPars();
- for (LauParameterPList::iterator params_iter = params.begin(); params_iter != params.end(); ++params_iter) {
- if (!(*params_iter)->clone()) {
- fout << (*params_iter)->name() << " & $";
- print.printFormat(fout, (*params_iter)->value());
- if ((*params_iter)->fixed() == kTRUE) {
- fout << "$ (fixed) \\\\";
- } else {
- fout << " \\pm ";
- print.printFormat(fout, (*params_iter)->error());
- fout << "$ \\\\" << std::endl;
- }
- }
- }
- }
- }
+ LauPrint print;
+ for ( LauPdfPList::const_iterator pdf_iter = pdfList.begin(); pdf_iter != pdfList.end();
+ ++pdf_iter ) {
+ const LauAbsRValuePList& pars = ( *pdf_iter )->getParameters();
+ for ( LauAbsRValuePList::const_iterator pars_iter = pars.begin(); pars_iter != pars.end();
+ ++pars_iter ) {
+ LauParameterPList params = ( *pars_iter )->getPars();
+ for ( LauParameterPList::iterator params_iter = params.begin();
+ params_iter != params.end();
+ ++params_iter ) {
+ if ( ! ( *params_iter )->clone() ) {
+ fout << ( *params_iter )->name() << " & $";
+ print.printFormat( fout, ( *params_iter )->value() );
+ if ( ( *params_iter )->fixed() == kTRUE ) {
+ fout << "$ (fixed) \\\\";
+ } else {
+ fout << " \\pm ";
+ print.printFormat( fout, ( *params_iter )->error() );
+ fout << "$ \\\\" << std::endl;
+ }
+ }
+ }
+ }
+ }
}
-void LauAbsFitModel::cacheInfo(LauPdfPList& pdfList, const LauFitDataTree& theData)
+void LauAbsFitModel::cacheInfo( LauPdfPList& pdfList, const LauFitDataTree& theData )
{
- for (LauPdfPList::iterator pdf_iter = pdfList.begin(); pdf_iter != pdfList.end(); ++pdf_iter) {
- (*pdf_iter)->cacheInfo(theData);
- }
+ for ( LauPdfPList::iterator pdf_iter = pdfList.begin(); pdf_iter != pdfList.end(); ++pdf_iter ) {
+ ( *pdf_iter )->cacheInfo( theData );
+ }
}
-Double_t LauAbsFitModel::prodPdfValue(LauPdfPList& pdfList, UInt_t iEvt)
+Double_t LauAbsFitModel::prodPdfValue( LauPdfPList& pdfList, UInt_t iEvt )
{
- Double_t pdfVal = 1.0;
- for (LauPdfPList::iterator pdf_iter = pdfList.begin(); pdf_iter != pdfList.end(); ++pdf_iter) {
- (*pdf_iter)->calcLikelihoodInfo(iEvt);
- pdfVal *= (*pdf_iter)->getLikelihood();
- }
- return pdfVal;
+ Double_t pdfVal = 1.0;
+ for ( LauPdfPList::iterator pdf_iter = pdfList.begin(); pdf_iter != pdfList.end(); ++pdf_iter ) {
+ ( *pdf_iter )->calcLikelihoodInfo( iEvt );
+ pdfVal *= ( *pdf_iter )->getLikelihood();
+ }
+ return pdfVal;
}
-void LauAbsFitModel::printEventInfo(UInt_t iEvt) const
+void LauAbsFitModel::printEventInfo( UInt_t iEvt ) const
{
- const LauFitData& data = inputFitData_->getData(iEvt);
- std::cerr << " : Input data values for this event:" << std::endl;
- for (LauFitData::const_iterator iter = data.begin(); iter != data.end(); ++iter) {
- std::cerr << " " << iter->first << " = " << iter->second << std::endl;
- }
+ const LauFitData& data = inputFitData_->getData( iEvt );
+ std::cerr << " : Input data values for this event:"
+ << std::endl;
+ for ( LauFitData::const_iterator iter = data.begin(); iter != data.end(); ++iter ) {
+ std::cerr << " " << iter->first << " = " << iter->second << std::endl;
+ }
}
void LauAbsFitModel::printVarsInfo() const
{
- std::cerr << " : Current values of fit parameters:" << std::endl;
- for (UInt_t i(0); i<this->nTotParams(); ++i) {
- std::cerr << " " << (fitVars_[i]->name()).Data() << " = " << fitVars_[i]->value() << std::endl;
- }
+ std::cerr << " : Current values of fit parameters:"
+ << std::endl;
+ for ( UInt_t i( 0 ); i < this->nTotParams(); ++i ) {
+ std::cerr << " " << ( fitVars_[i]->name() ).Data() << " = " << fitVars_[i]->value()
+ << std::endl;
+ }
}
void LauAbsFitModel::prepareInitialParArray( TObjArray& array )
{
- // Update initial fit parameters if required (e.g. if using random numbers).
- this->checkInitFitParams();
-
- // Store the total number of parameters and the number of free parameters
- UInt_t nPars = fitVars_.size();
- UInt_t nFreePars = 0;
-
- // Send the fit parameters
- for ( LauParameterPList::iterator iter = fitVars_.begin(); iter != fitVars_.end(); ++iter ) {
- if ( ! (*iter)->fixed() ) {
- ++nFreePars;
- }
- array.Add( *iter );
- }
-
- this->startNewFit( nPars, nFreePars );
+ // Update initial fit parameters if required (e.g. if using random numbers).
+ this->checkInitFitParams();
+
+ // Store the total number of parameters and the number of free parameters
+ UInt_t nPars = fitVars_.size();
+ UInt_t nFreePars = 0;
+
+ // Send the fit parameters
+ for ( LauParameterPList::iterator iter = fitVars_.begin(); iter != fitVars_.end(); ++iter ) {
+ if ( ! ( *iter )->fixed() ) {
+ ++nFreePars;
+ }
+ array.Add( *iter );
+ }
+
+ this->startNewFit( nPars, nFreePars );
}
-void LauAbsFitModel::finaliseExperiment( const LauAbsFitter::FitStatus& fitStat, const TObjArray* parsFromCoordinator, const TMatrixD* covMat, TObjArray& parsToCoordinator )
+void LauAbsFitModel::finaliseExperiment( const LauAbsFitter::FitStatus& fitStat,
+ const TObjArray* parsFromCoordinator,
+ const TMatrixD* covMat,
+ TObjArray& parsToCoordinator )
{
- // Copy the fit status information
- this->storeFitStatus( fitStat, *covMat );
-
- // Now process the parameters
- const UInt_t nPars = this->nTotParams();
- UInt_t nParsFromCoordinator = parsFromCoordinator->GetEntries();
- if ( nParsFromCoordinator != nPars ) {
- std::cerr << "ERROR in LauAbsFitModel::finaliseExperiment : Unexpected number of parameters received from coordinator" << std::endl;
- std::cerr << " : Received " << nParsFromCoordinator << " when expecting " << nPars << std::endl;
- gSystem->Exit( EXIT_FAILURE );
- }
-
- for ( UInt_t iPar(0); iPar < nParsFromCoordinator; ++iPar ) {
- LauParameter* parameter = dynamic_cast<LauParameter*>( (*parsFromCoordinator)[iPar] );
- if ( ! parameter ) {
- std::cerr << "ERROR in LauAbsFitModel::finaliseExperiment : Error reading parameter from coordinator" << std::endl;
- gSystem->Exit( EXIT_FAILURE );
- }
-
- if ( parameter->name() != fitVars_[iPar]->name() ) {
- std::cerr << "ERROR in LauAbsFitModel::finaliseExperiment : Error reading parameter from coordinator" << std::endl;
- gSystem->Exit( EXIT_FAILURE );
- }
-
- *(fitVars_[iPar]) = *parameter;
- }
-
- // Write the results into the ntuple
- this->finaliseFitResults( outputTableName_ );
-
- // Store the per-event likelihood values
- if ( this->writeSPlotData() ) {
- this->storePerEvtLlhds();
- }
-
- // Create a toy MC sample using the fitted parameters so that
- // the user can compare the fit to the data.
- if (compareFitData_ == kTRUE && fitStat.status == 3) {
- this->createFitToyMC(fitToyMCFileName_, fitToyMCTableName_);
- }
-
- // Send the finalised fit parameters
- for ( LauParameterPList::iterator iter = fitVars_.begin(); iter != fitVars_.end(); ++iter ) {
- parsToCoordinator.Add( *iter );
- }
+ // Copy the fit status information
+ this->storeFitStatus( fitStat, *covMat );
+
+ // Now process the parameters
+ const UInt_t nPars = this->nTotParams();
+ UInt_t nParsFromCoordinator = parsFromCoordinator->GetEntries();
+ if ( nParsFromCoordinator != nPars ) {
+ std::cerr << "ERROR in LauAbsFitModel::finaliseExperiment : Unexpected number of parameters received from coordinator"
+ << std::endl;
+ std::cerr << " : Received "
+ << nParsFromCoordinator << " when expecting " << nPars << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ for ( UInt_t iPar( 0 ); iPar < nParsFromCoordinator; ++iPar ) {
+ LauParameter* parameter = dynamic_cast<LauParameter*>( ( *parsFromCoordinator )[iPar] );
+ if ( ! parameter ) {
+ std::cerr << "ERROR in LauAbsFitModel::finaliseExperiment : Error reading parameter from coordinator"
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ if ( parameter->name() != fitVars_[iPar]->name() ) {
+ std::cerr << "ERROR in LauAbsFitModel::finaliseExperiment : Error reading parameter from coordinator"
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ *( fitVars_[iPar] ) = *parameter;
+ }
+
+ // Write the results into the ntuple
+ this->finaliseFitResults( outputTableName_ );
+
+ // Store the per-event likelihood values
+ if ( this->writeSPlotData() ) {
+ this->storePerEvtLlhds();
+ }
+
+ // Create a toy MC sample using the fitted parameters so that
+ // the user can compare the fit to the data.
+ if ( compareFitData_ == kTRUE && fitStat.status == 3 ) {
+ this->createFitToyMC( fitToyMCFileName_, fitToyMCTableName_ );
+ }
+
+ // Send the finalised fit parameters
+ for ( LauParameterPList::iterator iter = fitVars_.begin(); iter != fitVars_.end(); ++iter ) {
+ parsToCoordinator.Add( *iter );
+ }
}
UInt_t LauAbsFitModel::readExperimentData()
{
- // retrieve the data and find out how many events have been read
- const UInt_t exptIndex = this->iExpt();
- inputFitData_->readExperimentData( exptIndex );
- const UInt_t nEvent = inputFitData_->nEvents();
- this->eventsPerExpt( nEvent );
- return nEvent;
+ // retrieve the data and find out how many events have been read
+ const UInt_t exptIndex = this->iExpt();
+ inputFitData_->readExperimentData( exptIndex );
+ const UInt_t nEvent = inputFitData_->nEvents();
+ this->eventsPerExpt( nEvent );
+ return nEvent;
}
-void LauAbsFitModel::setParametersFromFile(const TString& fileName, const TString& treeName, const Bool_t fix)
+void LauAbsFitModel::setParametersFromFile( const TString& fileName,
+ const TString& treeName,
+ const Bool_t fix )
{
- fixParamFileName_ = fileName;
- fixParamTreeName_ = treeName;
- fixParams_ = fix;
+ fixParamFileName_ = fileName;
+ fixParamTreeName_ = treeName;
+ fixParams_ = fix;
}
-void LauAbsFitModel::setParametersFromMap(const std::map<TString, Double_t>& parameters, const Bool_t fix)
+void LauAbsFitModel::setParametersFromMap( const std::map<TString, Double_t>& parameters,
+ const Bool_t fix )
{
- fixParamMap_ = parameters;
- fixParams_ = fix;
+ fixParamMap_ = parameters;
+ fixParams_ = fix;
}
-void LauAbsFitModel::setNamedParameters(const TString& fileName, const TString& treeName, const std::set<TString>& parameters, const Bool_t fix)
+void LauAbsFitModel::setNamedParameters( const TString& fileName,
+ const TString& treeName,
+ const std::set<TString>& parameters,
+ const Bool_t fix )
{
- fixParamFileName_ = fileName;
- fixParamTreeName_ = treeName;
- fixParamNames_ = parameters;
- fixParams_ = fix;
+ fixParamFileName_ = fileName;
+ fixParamTreeName_ = treeName;
+ fixParamNames_ = parameters;
+ fixParams_ = fix;
}
-void LauAbsFitModel::setParametersFileFallback(const TString& fileName, const TString& treeName, const std::map<TString, Double_t>& parameters, const Bool_t fix)
+void LauAbsFitModel::setParametersFileFallback( const TString& fileName,
+ const TString& treeName,
+ const std::map<TString, Double_t>& parameters,
+ const Bool_t fix )
{
- fixParamFileName_ = fileName;
- fixParamTreeName_ = treeName;
- fixParamMap_ = parameters;
- fixParams_ = fix;
+ fixParamFileName_ = fileName;
+ fixParamTreeName_ = treeName;
+ fixParamMap_ = parameters;
+ fixParams_ = fix;
}
diff --git a/src/LauAbsIncohRes.cc b/src/LauAbsIncohRes.cc
index f7e2559..3c360c0 100644
--- a/src/LauAbsIncohRes.cc
+++ b/src/LauAbsIncohRes.cc
@@ -1,48 +1,50 @@
/*
Copyright 2014 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauAbsIncohRes.cc
- \brief File containing implementation of LauAbsIncohRes class.
- */
+ \brief File containing implementation of LauAbsIncohRes class.
+*/
#include "LauAbsIncohRes.hh"
+
#include "LauDaughters.hh"
#include "LauResonanceInfo.hh"
-
-
// Constructor
-LauAbsIncohRes::LauAbsIncohRes(LauResonanceInfo* resInfo, const Int_t resPairAmpInt, const LauDaughters* daughters) :
- LauAbsResonance(resInfo, resPairAmpInt, daughters)
- {}
+LauAbsIncohRes::LauAbsIncohRes( LauResonanceInfo* resInfo,
+ const Int_t resPairAmpInt,
+ const LauDaughters* daughters ) :
+ LauAbsResonance( resInfo, resPairAmpInt, daughters )
+{
+}
// Destructor
LauAbsIncohRes::~LauAbsIncohRes()
{
}
-LauComplex LauAbsIncohRes::resAmp(Double_t /*mass*/, Double_t spinTerm)
+LauComplex LauAbsIncohRes::resAmp( Double_t /*mass*/, Double_t spinTerm )
{
- return LauComplex(spinTerm, 0.0);
+ return LauComplex( spinTerm, 0.0 );
}
diff --git a/src/LauAbsModIndPartWave.cc b/src/LauAbsModIndPartWave.cc
index 3fa1732..e7e6205 100644
--- a/src/LauAbsModIndPartWave.cc
+++ b/src/LauAbsModIndPartWave.cc
@@ -1,248 +1,272 @@
/*
Copyright 2014 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauAbsModIndPartWave.cc
\brief File containing implementation of LauAbsModIndPartWave class.
*/
-#include <cstdlib>
-#include <iostream>
+#include "LauAbsModIndPartWave.hh"
#include "LauConstants.hh"
#include "LauKinematics.hh"
-#include "LauAbsModIndPartWave.hh"
#include "LauResonanceInfo.hh"
+#include <cstdlib>
+#include <iostream>
-
-LauAbsModIndPartWave::LauAbsModIndPartWave(LauResonanceInfo* resInfo, Int_t resPairAmpInt, const LauDaughters* daughters) :
- LauAbsResonance(resInfo, resPairAmpInt, daughters),
- nKnots_(0),
- spline1_(0),
- spline2_(0),
- type1_(Lau1DCubicSpline::StandardSpline),
- type2_(Lau1DCubicSpline::StandardSpline),
- leftBound1_(Lau1DCubicSpline::NotAKnot),
- rightBound1_(Lau1DCubicSpline::NotAKnot),
- leftBound2_(Lau1DCubicSpline::NotAKnot),
- rightBound2_(Lau1DCubicSpline::NotAKnot),
- leftGrad1_(0.),
- rightGrad1_(0.),
- leftGrad2_(0.),
- rightGrad2_(0.),
- secondStage_(kFALSE)
+LauAbsModIndPartWave::LauAbsModIndPartWave( LauResonanceInfo* resInfo,
+ Int_t resPairAmpInt,
+ const LauDaughters* daughters ) :
+ LauAbsResonance( resInfo, resPairAmpInt, daughters ),
+ nKnots_( 0 ),
+ spline1_( 0 ),
+ spline2_( 0 ),
+ type1_( Lau1DCubicSpline::StandardSpline ),
+ type2_( Lau1DCubicSpline::StandardSpline ),
+ leftBound1_( Lau1DCubicSpline::NotAKnot ),
+ rightBound1_( Lau1DCubicSpline::NotAKnot ),
+ leftBound2_( Lau1DCubicSpline::NotAKnot ),
+ rightBound2_( Lau1DCubicSpline::NotAKnot ),
+ leftGrad1_( 0. ),
+ rightGrad1_( 0. ),
+ leftGrad2_( 0. ),
+ rightGrad2_( 0. ),
+ secondStage_( kFALSE )
{
}
LauAbsModIndPartWave::~LauAbsModIndPartWave()
{
- delete spline1_;
- delete spline2_;
+ delete spline1_;
+ delete spline2_;
}
-void LauAbsModIndPartWave::floatKnotsSecondStage(const Bool_t secondStage)
+void LauAbsModIndPartWave::floatKnotsSecondStage( const Bool_t secondStage )
{
- secondStage_ = secondStage;
-
- // if the parameters have not yet been created we can now just return
- if ( amp1Pars_.size() != nKnots_ ) {
- return;
- }
-
- // otherwise we need to toggle their second-stage parameter
- for ( UInt_t i(0); i < nKnots_; ++i ) {
- amp1Pars_[i]->secondStage(secondStage_);
- amp2Pars_[i]->secondStage(secondStage_);
- }
+ secondStage_ = secondStage;
+
+ // if the parameters have not yet been created we can now just return
+ if ( amp1Pars_.size() != nKnots_ ) {
+ return;
+ }
+
+ // otherwise we need to toggle their second-stage parameter
+ for ( UInt_t i( 0 ); i < nKnots_; ++i ) {
+ amp1Pars_[i]->secondStage( secondStage_ );
+ amp2Pars_[i]->secondStage( secondStage_ );
+ }
}
-std::set<Double_t> LauAbsModIndPartWave::checkKnots(const std::set<Double_t>& masses)
+std::set<Double_t> LauAbsModIndPartWave::checkKnots( const std::set<Double_t>& masses )
{
- std::set<Double_t> knots = masses;
-
- const std::set<Double_t>::const_iterator first = knots.begin();
- const std::set<Double_t>::const_reverse_iterator last = knots.rbegin();
-
- const Double_t lower_limit = this->getMassDaug1() + this->getMassDaug2();
- const Double_t upper_limit = this->getMassParent() - this->getMassBachelor();
-
- // check whether we have been given knots at unphysical masses
- if ( *first < lower_limit ) {
- std::cerr << "WARNING in LauAbsModIndPartWave::checkKnots : Knot found at mass " << *first << " is below the lower kinematic limit." << std::endl;
- std::cerr << " : Lower kinematic limit is at mass " << lower_limit << std::endl;
- std::cerr << " : Aborting definition of knot positions." << std::endl;
- knots.clear();
- return knots;
- }
- if ( *last > upper_limit ) {
- std::cerr << "WARNING in LauAbsModIndPartWave::checkKnots : Knot found at mass " << *last << " is above the upper kinematic limit." << std::endl;
- std::cerr << " : Upper kinematic limit is at mass " << upper_limit << std::endl;
- std::cerr << " : Aborting definition of knot positions." << std::endl;
- knots.clear();
- return knots;
- }
-
- // check if we have knots at each extreme - if not, add them in
- if ( (*first) != lower_limit ) {
- knots.insert( lower_limit );
- }
- if ( (*last) != upper_limit ) {
- knots.insert( upper_limit );
- }
-
- return knots;
+ std::set<Double_t> knots = masses;
+
+ const std::set<Double_t>::const_iterator first = knots.begin();
+ const std::set<Double_t>::const_reverse_iterator last = knots.rbegin();
+
+ const Double_t lower_limit = this->getMassDaug1() + this->getMassDaug2();
+ const Double_t upper_limit = this->getMassParent() - this->getMassBachelor();
+
+ // check whether we have been given knots at unphysical masses
+ if ( *first < lower_limit ) {
+ std::cerr << "WARNING in LauAbsModIndPartWave::checkKnots : Knot found at mass " << *first
+ << " is below the lower kinematic limit." << std::endl;
+ std::cerr << " : Lower kinematic limit is at mass "
+ << lower_limit << std::endl;
+ std::cerr << " : Aborting definition of knot positions."
+ << std::endl;
+ knots.clear();
+ return knots;
+ }
+ if ( *last > upper_limit ) {
+ std::cerr << "WARNING in LauAbsModIndPartWave::checkKnots : Knot found at mass " << *last
+ << " is above the upper kinematic limit." << std::endl;
+ std::cerr << " : Upper kinematic limit is at mass "
+ << upper_limit << std::endl;
+ std::cerr << " : Aborting definition of knot positions."
+ << std::endl;
+ knots.clear();
+ return knots;
+ }
+
+ // check if we have knots at each extreme - if not, add them in
+ if ( ( *first ) != lower_limit ) {
+ knots.insert( lower_limit );
+ }
+ if ( ( *last ) != upper_limit ) {
+ knots.insert( upper_limit );
+ }
+
+ return knots;
}
-void LauAbsModIndPartWave::defineKnots(const std::set<Double_t>& masses)
+void LauAbsModIndPartWave::defineKnots( const std::set<Double_t>& masses )
{
- if ( ! masses_.empty() ) {
- std::cerr << "WARNING in LauAbsModIndPartWave::defineKnots : Knot positions have already been defined, not making any changes." << std::endl;
- return;
- }
-
- const std::set<Double_t> knots = this->checkKnots( masses );
-
- nKnots_ = knots.size();
- if ( nKnots_ == 0 ) {
- return;
- }
-
- masses_.reserve(nKnots_);
- amp1Vals_.reserve(nKnots_);
- amp2Vals_.reserve(nKnots_);
- amp1Pars_.reserve(nKnots_);
- amp2Pars_.reserve(nKnots_);
-
- UInt_t counter(0);
- for ( std::set<Double_t>::const_iterator iter = knots.begin(); iter != knots.end(); ++iter ) {
- masses_.push_back( *iter );
- amp1Vals_.push_back(1.0);
- amp2Vals_.push_back(1.0);
- this->createAmpParameters(counter);
- ++counter;
- }
-
- for ( std::vector<Double_t>::const_iterator iter = masses_.begin(); iter != masses_.end(); ++iter ) {
- std::cout << "INFO in LauAbsModIndPartWave::defineKnots : Knot added to resonance " << this->getResonanceName() << " at mass " << *iter << std::endl;
- }
+ if ( ! masses_.empty() ) {
+ std::cerr << "WARNING in LauAbsModIndPartWave::defineKnots : Knot positions have already been defined, not making any changes."
+ << std::endl;
+ return;
+ }
+
+ const std::set<Double_t> knots = this->checkKnots( masses );
+
+ nKnots_ = knots.size();
+ if ( nKnots_ == 0 ) {
+ return;
+ }
+
+ masses_.reserve( nKnots_ );
+ amp1Vals_.reserve( nKnots_ );
+ amp2Vals_.reserve( nKnots_ );
+ amp1Pars_.reserve( nKnots_ );
+ amp2Pars_.reserve( nKnots_ );
+
+ UInt_t counter( 0 );
+ for ( std::set<Double_t>::const_iterator iter = knots.begin(); iter != knots.end(); ++iter ) {
+ masses_.push_back( *iter );
+ amp1Vals_.push_back( 1.0 );
+ amp2Vals_.push_back( 1.0 );
+ this->createAmpParameters( counter );
+ ++counter;
+ }
+
+ for ( std::vector<Double_t>::const_iterator iter = masses_.begin(); iter != masses_.end();
+ ++iter ) {
+ std::cout << "INFO in LauAbsModIndPartWave::defineKnots : Knot added to resonance "
+ << this->getResonanceName() << " at mass " << *iter << std::endl;
+ }
}
void LauAbsModIndPartWave::initialise()
{
- if ( spline1_ != 0 ) {
- delete spline1_;
- spline1_ = 0;
- }
- if ( spline2_ != 0 ) {
- delete spline2_;
- spline2_ = 0;
- }
-
- for ( UInt_t i(0); i < nKnots_; ++i ) {
- amp1Vals_[i] = amp1Pars_[i]->unblindValue();
- amp2Vals_[i] = amp2Pars_[i]->unblindValue();
- }
-
- spline1_ = new Lau1DCubicSpline(masses_, amp1Vals_, type1_, leftBound1_, rightBound1_, leftGrad1_, rightGrad1_);
- spline2_ = new Lau1DCubicSpline(masses_, amp2Vals_, type2_, leftBound2_, rightBound2_, leftGrad2_, rightGrad2_);
+ if ( spline1_ != 0 ) {
+ delete spline1_;
+ spline1_ = 0;
+ }
+ if ( spline2_ != 0 ) {
+ delete spline2_;
+ spline2_ = 0;
+ }
+
+ for ( UInt_t i( 0 ); i < nKnots_; ++i ) {
+ amp1Vals_[i] = amp1Pars_[i]->unblindValue();
+ amp2Vals_[i] = amp2Pars_[i]->unblindValue();
+ }
+
+ spline1_ = new Lau1DCubicSpline( masses_,
+ amp1Vals_,
+ type1_,
+ leftBound1_,
+ rightBound1_,
+ leftGrad1_,
+ rightGrad1_ );
+ spline2_ = new Lau1DCubicSpline( masses_,
+ amp2Vals_,
+ type2_,
+ leftBound2_,
+ rightBound2_,
+ leftGrad2_,
+ rightGrad2_ );
}
-LauComplex LauAbsModIndPartWave::resAmp(Double_t mass, Double_t spinTerm)
+LauComplex LauAbsModIndPartWave::resAmp( Double_t mass, Double_t spinTerm )
{
- amp_.zero();
+ amp_.zero();
- Bool_t paramChanged1(kFALSE), paramChanged2(kFALSE);
+ Bool_t paramChanged1( kFALSE ), paramChanged2( kFALSE );
- for ( UInt_t i(0); i < nKnots_; ++i ) {
- if ( !amp1Pars_[i]->fixed() && amp1Pars_[i]->unblindValue() != amp1Vals_[i] ) {
- paramChanged1 = kTRUE;
- amp1Vals_[i] = amp1Pars_[i]->unblindValue();
- }
- if ( !amp2Pars_[i]->fixed() && amp2Pars_[i]->unblindValue() != amp2Vals_[i] ) {
- paramChanged2 = kTRUE;
- amp2Vals_[i] = amp2Pars_[i]->unblindValue();
- }
- }
+ for ( UInt_t i( 0 ); i < nKnots_; ++i ) {
+ if ( ! amp1Pars_[i]->fixed() && amp1Pars_[i]->unblindValue() != amp1Vals_[i] ) {
+ paramChanged1 = kTRUE;
+ amp1Vals_[i] = amp1Pars_[i]->unblindValue();
+ }
+ if ( ! amp2Pars_[i]->fixed() && amp2Pars_[i]->unblindValue() != amp2Vals_[i] ) {
+ paramChanged2 = kTRUE;
+ amp2Vals_[i] = amp2Pars_[i]->unblindValue();
+ }
+ }
- if ( spline1_ == 0 || spline2_ == 0) {
- std::cerr << "ERROR in LauAbsModIndPartWave::resAmp : One of the splines is null" << std::endl;
- return amp_;
- }
+ if ( spline1_ == 0 || spline2_ == 0 ) {
+ std::cerr << "ERROR in LauAbsModIndPartWave::resAmp : One of the splines is null"
+ << std::endl;
+ return amp_;
+ }
- if ( paramChanged1 ) {
- spline1_->updateYValues(amp1Vals_);
- }
+ if ( paramChanged1 ) {
+ spline1_->updateYValues( amp1Vals_ );
+ }
- if ( paramChanged2 ) {
- spline2_->updateYValues(amp2Vals_);
- }
+ if ( paramChanged2 ) {
+ spline2_->updateYValues( amp2Vals_ );
+ }
- this->evaluateAmplitude( mass );
+ this->evaluateAmplitude( mass );
- amp_.rescale( spinTerm );
+ amp_.rescale( spinTerm );
- return amp_;
+ return amp_;
}
-void LauAbsModIndPartWave::setSplineType(Lau1DCubicSpline::LauSplineType type1, Lau1DCubicSpline::LauSplineType type2)
+void LauAbsModIndPartWave::setSplineType( Lau1DCubicSpline::LauSplineType type1,
+ Lau1DCubicSpline::LauSplineType type2 )
{
- type1_ = type1;
- type2_ = type2;
+ type1_ = type1;
+ type2_ = type2;
}
-void LauAbsModIndPartWave::setSplineBoundaryConditions(Lau1DCubicSpline::LauSplineBoundaryType leftBound1,
- Lau1DCubicSpline::LauSplineBoundaryType rightBound1,
- Lau1DCubicSpline::LauSplineBoundaryType leftBound2,
- Lau1DCubicSpline::LauSplineBoundaryType rightBound2,
- Double_t leftGrad1,
- Double_t rightGrad1,
- Double_t leftGrad2,
- Double_t rightGrad2)
+void LauAbsModIndPartWave::setSplineBoundaryConditions(
+ Lau1DCubicSpline::LauSplineBoundaryType leftBound1,
+ Lau1DCubicSpline::LauSplineBoundaryType rightBound1,
+ Lau1DCubicSpline::LauSplineBoundaryType leftBound2,
+ Lau1DCubicSpline::LauSplineBoundaryType rightBound2,
+ Double_t leftGrad1,
+ Double_t rightGrad1,
+ Double_t leftGrad2,
+ Double_t rightGrad2 )
{
- leftBound1_ = leftBound1;
- rightBound1_ = rightBound1;
- leftBound2_ = leftBound2;
- rightBound2_ = rightBound2;
- leftGrad1_ = leftGrad1;
- rightGrad1_ = rightGrad1;
- leftGrad2_ = leftGrad2;
- rightGrad2_ = rightGrad2;
+ leftBound1_ = leftBound1;
+ rightBound1_ = rightBound1;
+ leftBound2_ = leftBound2;
+ rightBound2_ = rightBound2;
+ leftGrad1_ = leftGrad1;
+ rightGrad1_ = rightGrad1;
+ leftGrad2_ = leftGrad2;
+ rightGrad2_ = rightGrad2;
}
const std::vector<LauParameter*>& LauAbsModIndPartWave::getFloatingParameters()
{
- this->clearFloatingParameters();
-
- for ( UInt_t i(0); i < nKnots_; ++i ) {
- if ( !amp1Pars_[i]->fixed() ) {
- this->addFloatingParameter( amp1Pars_[i] );
- }
- if ( !amp2Pars_[i]->fixed() ) {
- this->addFloatingParameter( amp2Pars_[i] );
- }
- }
-
- return this->getParameters();
+ this->clearFloatingParameters();
+
+ for ( UInt_t i( 0 ); i < nKnots_; ++i ) {
+ if ( ! amp1Pars_[i]->fixed() ) {
+ this->addFloatingParameter( amp1Pars_[i] );
+ }
+ if ( ! amp2Pars_[i]->fixed() ) {
+ this->addFloatingParameter( amp2Pars_[i] );
+ }
+ }
+
+ return this->getParameters();
}
-
diff --git a/src/LauAbsPdf.cc b/src/LauAbsPdf.cc
index ed3c8bb..227528d 100644
--- a/src/LauAbsPdf.cc
+++ b/src/LauAbsPdf.cc
@@ -1,576 +1,622 @@
/*
Copyright 2004 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauAbsPdf.cc
- \brief File containing implementation of LauAbsPdf class.
- */
-
-#include <algorithm>
-#include <iostream>
-#include <map>
-#include <vector>
-
-#include "TSystem.h"
+ \brief File containing implementation of LauAbsPdf class.
+*/
#include "LauAbsPdf.hh"
-#include "LauRandom.hh"
+
#include "LauIntegrals.hh"
#include "LauKinematics.hh"
+#include "LauRandom.hh"
+
+#include "TSystem.h"
+#include <algorithm>
+#include <iostream>
+#include <map>
+#include <vector>
// Constructor for the abstract PDF class.
-LauAbsPdf::LauAbsPdf(const TString& theVarName, const std::vector<LauAbsRValue*>& params,
- Double_t minAbscissa, Double_t maxAbscissa) :
- varNames_(),
- param_(params),
- norm_(0.0),
- maxHeight_(0.0),
- heightUpToDate_(kFALSE),
- minAbscissas_(),
- maxAbscissas_(),
- randomFun_(LauRandom::randomFun()),
- cachePDF_(kFALSE),
- unNormPDFVal_(0.0),
- nNormPoints_(50),
- integMethod_(GaussLegendre),
- withinNormCalc_(kFALSE),
- withinGeneration_(kFALSE),
- normWeightsDone_(kFALSE)
+LauAbsPdf::LauAbsPdf( const TString& theVarName,
+ const std::vector<LauAbsRValue*>& params,
+ Double_t minAbscissa,
+ Double_t maxAbscissa ) :
+ varNames_(),
+ param_( params ),
+ norm_( 0.0 ),
+ maxHeight_( 0.0 ),
+ heightUpToDate_( kFALSE ),
+ minAbscissas_(),
+ maxAbscissas_(),
+ randomFun_( LauRandom::randomFun() ),
+ cachePDF_( kFALSE ),
+ unNormPDFVal_( 0.0 ),
+ nNormPoints_( 50 ),
+ integMethod_( GaussLegendre ),
+ withinNormCalc_( kFALSE ),
+ withinGeneration_( kFALSE ),
+ normWeightsDone_( kFALSE )
{
- // Store the variable name
- varNames_.insert( std::make_pair( 0, theVarName ) );
+ // Store the variable name
+ varNames_.insert( std::make_pair( 0, theVarName ) );
- // Store the min and max values
- minAbscissas_.push_back( minAbscissa );
- maxAbscissas_.push_back( maxAbscissa );
+ // Store the min and max values
+ minAbscissas_.push_back( minAbscissa );
+ maxAbscissas_.push_back( maxAbscissa );
}
-LauAbsPdf::LauAbsPdf(const std::vector<TString>& theVarNames, const std::vector<LauAbsRValue*>& params,
- const LauFitData& minAbscissas, const LauFitData& maxAbscissas) :
- varNames_(),
- param_(params),
- norm_(0.0),
- maxHeight_(0.0),
- heightUpToDate_(kFALSE),
- minAbscissas_(),
- maxAbscissas_(),
- randomFun_(LauRandom::randomFun()),
- cachePDF_(kFALSE),
- unNormPDFVal_(0.0),
- nNormPoints_(50),
- integMethod_(GaussLegendre),
- withinNormCalc_(kFALSE),
- withinGeneration_(kFALSE),
- normWeightsDone_(kFALSE)
+LauAbsPdf::LauAbsPdf( const std::vector<TString>& theVarNames,
+ const std::vector<LauAbsRValue*>& params,
+ const LauFitData& minAbscissas,
+ const LauFitData& maxAbscissas ) :
+ varNames_(),
+ param_( params ),
+ norm_( 0.0 ),
+ maxHeight_( 0.0 ),
+ heightUpToDate_( kFALSE ),
+ minAbscissas_(),
+ maxAbscissas_(),
+ randomFun_( LauRandom::randomFun() ),
+ cachePDF_( kFALSE ),
+ unNormPDFVal_( 0.0 ),
+ nNormPoints_( 50 ),
+ integMethod_( GaussLegendre ),
+ withinNormCalc_( kFALSE ),
+ withinGeneration_( kFALSE ),
+ normWeightsDone_( kFALSE )
{
- // Check that we have at least one variable
- if ( theVarNames.empty() ) {
- std::cerr << "ERROR in LauAbsPdf::LauAbsPdf : No variables supplied." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // Store the variable names
- for ( UInt_t i(0); i < theVarNames.size(); ++i ) {
- varNames_.insert( std::make_pair( i, theVarNames[i] ) );
- }
-
- // Store the min and max abcissas for every variable
- UInt_t nVars = varNames_.size();
- minAbscissas_.resize( nVars );
- maxAbscissas_.resize( nVars );
- for ( std::map<UInt_t,TString>::const_iterator iter = varNames_.begin(); iter != varNames_.end(); ++iter ) {
- UInt_t varIndex = iter->first;
- const TString& theVarName = iter->second;
- LauFitData::const_iterator min_iter = minAbscissas.find( theVarName );
- LauFitData::const_iterator max_iter = maxAbscissas.find( theVarName );
- if ( min_iter == minAbscissas.end() || max_iter == maxAbscissas.end() ) {
- std::cerr << "ERROR in LauAbsPdf::LauAbsPdf : Either min or max abscissa not provided for variable \"" << theVarName << "\"." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- minAbscissas_[ varIndex ] = min_iter->second;
- maxAbscissas_[ varIndex ] = max_iter->second;
- }
+ // Check that we have at least one variable
+ if ( theVarNames.empty() ) {
+ std::cerr << "ERROR in LauAbsPdf::LauAbsPdf : No variables supplied." << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // Store the variable names
+ for ( UInt_t i( 0 ); i < theVarNames.size(); ++i ) {
+ varNames_.insert( std::make_pair( i, theVarNames[i] ) );
+ }
+
+ // Store the min and max abcissas for every variable
+ UInt_t nVars = varNames_.size();
+ minAbscissas_.resize( nVars );
+ maxAbscissas_.resize( nVars );
+ for ( std::map<UInt_t, TString>::const_iterator iter = varNames_.begin(); iter != varNames_.end();
+ ++iter ) {
+ UInt_t varIndex = iter->first;
+ const TString& theVarName = iter->second;
+ LauFitData::const_iterator min_iter = minAbscissas.find( theVarName );
+ LauFitData::const_iterator max_iter = maxAbscissas.find( theVarName );
+ if ( min_iter == minAbscissas.end() || max_iter == maxAbscissas.end() ) {
+ std::cerr << "ERROR in LauAbsPdf::LauAbsPdf : Either min or max abscissa not provided for variable \""
+ << theVarName << "\"." << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ minAbscissas_[varIndex] = min_iter->second;
+ maxAbscissas_[varIndex] = max_iter->second;
+ }
}
std::vector<TString> LauAbsPdf::varNames() const
{
- std::vector<TString> theVarNames;
- theVarNames.reserve( varNames_.size() );
- for ( std::map<UInt_t,TString>::const_iterator iter = varNames_.begin(); iter != varNames_.end(); ++iter ) {
- theVarNames.push_back( iter->second );
- }
- return theVarNames;
+ std::vector<TString> theVarNames;
+ theVarNames.reserve( varNames_.size() );
+ for ( std::map<UInt_t, TString>::const_iterator iter = varNames_.begin(); iter != varNames_.end();
+ ++iter ) {
+ theVarNames.push_back( iter->second );
+ }
+ return theVarNames;
}
UInt_t LauAbsPdf::nFixedParameters() const
{
- LauParamFixed pred;
- return std::count_if(param_.begin(),param_.end(),pred);
+ LauParamFixed pred;
+ return std::count_if( param_.begin(), param_.end(), pred );
}
Double_t LauAbsPdf::getMinAbscissa( const TString& theVarName ) const
{
- for ( std::map<UInt_t,TString>::const_iterator iter = varNames_.begin(); iter != varNames_.end(); ++iter ) {
- UInt_t index = iter->first;
- const TString& name = iter->second;
- if ( name == theVarName ) {
- return minAbscissas_[ index ];
- }
- }
-
- std::cerr << "ERROR in LauAbsPdf::getMinAbscissa : Variable \"" << theVarName << "\" not found." << std::endl;
- return 0.0;
+ for ( std::map<UInt_t, TString>::const_iterator iter = varNames_.begin(); iter != varNames_.end();
+ ++iter ) {
+ UInt_t index = iter->first;
+ const TString& name = iter->second;
+ if ( name == theVarName ) {
+ return minAbscissas_[index];
+ }
+ }
+
+ std::cerr << "ERROR in LauAbsPdf::getMinAbscissa : Variable \"" << theVarName << "\" not found."
+ << std::endl;
+ return 0.0;
}
Double_t LauAbsPdf::getMaxAbscissa( const TString& theVarName ) const
{
- for ( std::map<UInt_t,TString>::const_iterator iter = varNames_.begin(); iter != varNames_.end(); ++iter ) {
- UInt_t index = iter->first;
- const TString& name = iter->second;
- if ( name == theVarName ) {
- return maxAbscissas_[ index ];
- }
- }
-
- std::cerr << "ERROR in LauAbsPdf::getMaxAbscissa : Variable \"" << theVarName << "\" not found." << std::endl;
- return 0.0;
+ for ( std::map<UInt_t, TString>::const_iterator iter = varNames_.begin(); iter != varNames_.end();
+ ++iter ) {
+ UInt_t index = iter->first;
+ const TString& name = iter->second;
+ if ( name == theVarName ) {
+ return maxAbscissas_[index];
+ }
+ }
+
+ std::cerr << "ERROR in LauAbsPdf::getMaxAbscissa : Variable \"" << theVarName << "\" not found."
+ << std::endl;
+ return 0.0;
}
LauFitData LauAbsPdf::getMinAbscissas() const
{
- LauFitData minAbscissas;
- for ( std::map<UInt_t,TString>::const_iterator iter = varNames_.begin(); iter != varNames_.end(); ++iter ) {
- UInt_t varIndex = iter->first;
- const TString& theVarName = iter->second;
- minAbscissas[ theVarName ] = minAbscissas_[ varIndex ];
- }
- return minAbscissas;
+ LauFitData minAbscissas;
+ for ( std::map<UInt_t, TString>::const_iterator iter = varNames_.begin(); iter != varNames_.end();
+ ++iter ) {
+ UInt_t varIndex = iter->first;
+ const TString& theVarName = iter->second;
+ minAbscissas[theVarName] = minAbscissas_[varIndex];
+ }
+ return minAbscissas;
}
LauFitData LauAbsPdf::getMaxAbscissas() const
{
- LauFitData maxAbscissas;
- for ( std::map<UInt_t,TString>::const_iterator iter = varNames_.begin(); iter != varNames_.end(); ++iter ) {
- UInt_t varIndex = iter->first;
- const TString& theVarName = iter->second;
- maxAbscissas[ theVarName ] = maxAbscissas_[ varIndex ];
- }
- return maxAbscissas;
+ LauFitData maxAbscissas;
+ for ( std::map<UInt_t, TString>::const_iterator iter = varNames_.begin(); iter != varNames_.end();
+ ++iter ) {
+ UInt_t varIndex = iter->first;
+ const TString& theVarName = iter->second;
+ maxAbscissas[theVarName] = maxAbscissas_[varIndex];
+ }
+ return maxAbscissas;
}
LauFitData LauAbsPdf::getRanges() const
{
- LauFitData minVals = this->getMinAbscissas();
- LauFitData maxVals = this->getMaxAbscissas();
- LauFitData range;
-
- for ( LauFitData::const_iterator iter = maxVals.begin(); iter != maxVals.end(); ++iter ) {
- const TString& theVarName = iter->first;
- Double_t maxVal = iter->second;
- Double_t minVal = minVals.find(theVarName)->second;
- range[theVarName] = maxVal - minVal;
- }
-
- return range;
+ LauFitData minVals = this->getMinAbscissas();
+ LauFitData maxVals = this->getMaxAbscissas();
+ LauFitData range;
+
+ for ( LauFitData::const_iterator iter = maxVals.begin(); iter != maxVals.end(); ++iter ) {
+ const TString& theVarName = iter->first;
+ Double_t maxVal = iter->second;
+ Double_t minVal = minVals.find( theVarName )->second;
+ range[theVarName] = maxVal - minVal;
+ }
+
+ return range;
}
-void LauAbsPdf::setMinAbscissa(const TString& theVarName, Double_t minAbscissa)
+void LauAbsPdf::setMinAbscissa( const TString& theVarName, Double_t minAbscissa )
{
- for ( std::map<UInt_t,TString>::const_iterator iter = varNames_.begin(); iter != varNames_.end(); ++iter ) {
- UInt_t index = iter->first;
- const TString& name = iter->second;
- if ( name == theVarName ) {
- minAbscissas_[ index ] = minAbscissa;
- return;
- }
- }
-
- std::cerr << "ERROR in LauAbsPdf::setMinAbscissa : Variable \"" << theVarName << "\" not found." << std::endl;
+ for ( std::map<UInt_t, TString>::const_iterator iter = varNames_.begin(); iter != varNames_.end();
+ ++iter ) {
+ UInt_t index = iter->first;
+ const TString& name = iter->second;
+ if ( name == theVarName ) {
+ minAbscissas_[index] = minAbscissa;
+ return;
+ }
+ }
+
+ std::cerr << "ERROR in LauAbsPdf::setMinAbscissa : Variable \"" << theVarName << "\" not found."
+ << std::endl;
}
-void LauAbsPdf::setMaxAbscissa(const TString& theVarName, Double_t maxAbscissa)
+void LauAbsPdf::setMaxAbscissa( const TString& theVarName, Double_t maxAbscissa )
{
- for ( std::map<UInt_t,TString>::const_iterator iter = varNames_.begin(); iter != varNames_.end(); ++iter ) {
- UInt_t index = iter->first;
- const TString& name = iter->second;
- if ( name == theVarName ) {
- maxAbscissas_[ index ] = maxAbscissa;
- return;
- }
- }
-
- std::cerr << "ERROR in LauAbsPdf::setMaxAbscissa : Variable \"" << theVarName << "\" not found." << std::endl;
+ for ( std::map<UInt_t, TString>::const_iterator iter = varNames_.begin(); iter != varNames_.end();
+ ++iter ) {
+ UInt_t index = iter->first;
+ const TString& name = iter->second;
+ if ( name == theVarName ) {
+ maxAbscissas_[index] = maxAbscissa;
+ return;
+ }
+ }
+
+ std::cerr << "ERROR in LauAbsPdf::setMaxAbscissa : Variable \"" << theVarName << "\" not found."
+ << std::endl;
}
-Bool_t LauAbsPdf::checkRange(const LauAbscissas& abscissas) const
+Bool_t LauAbsPdf::checkRange( const LauAbscissas& abscissas ) const
{
- // This method assumes the ordering of the abscissas provided match
- // those of the min and max vectors
-
- // check that the size is correct
- UInt_t nVars = abscissas.size();
- if ( this->isDPDependent() ) {
- nVars = abscissas.size() - 2; // if we depend on the DP we'll have been provided with the DP co-ordinates as well
- }
- if ( nVars != minAbscissas_.size() || nVars != maxAbscissas_.size() ) {
- std::cerr << "ERROR in LauAbsPdf::checkRange : Unexpected number of absicssas: " << nVars << std::endl;
- std::cerr << " : " << this->IsA()->GetName() << " expects " << minAbscissas_.size() << std::endl;
- return kFALSE;
- }
-
- for ( UInt_t i(0); i < nVars; ++i ) {
- Double_t abscissa = abscissas[i];
- Double_t minVal = minAbscissas_[i];
- Double_t maxVal = maxAbscissas_[i];
- if ( (abscissa < minVal) || (abscissa > maxVal) ) {
- std::cerr << "ERROR in LauAbsPdf::checkRange : " << abscissa << " outside allowed range: [" << minVal << "," << maxVal << "]" << std::endl;
- return kFALSE;
- }
- }
- return kTRUE;
+ // This method assumes the ordering of the abscissas provided match
+ // those of the min and max vectors
+
+ // check that the size is correct
+ UInt_t nVars = abscissas.size();
+ if ( this->isDPDependent() ) {
+ nVars = abscissas.size() -
+ 2; // if we depend on the DP we'll have been provided with the DP co-ordinates as well
+ }
+ if ( nVars != minAbscissas_.size() || nVars != maxAbscissas_.size() ) {
+ std::cerr << "ERROR in LauAbsPdf::checkRange : Unexpected number of absicssas: " << nVars
+ << std::endl;
+ std::cerr << " : " << this->IsA()->GetName() << " expects "
+ << minAbscissas_.size() << std::endl;
+ return kFALSE;
+ }
+
+ for ( UInt_t i( 0 ); i < nVars; ++i ) {
+ Double_t abscissa = abscissas[i];
+ Double_t minVal = minAbscissas_[i];
+ Double_t maxVal = maxAbscissas_[i];
+ if ( ( abscissa < minVal ) || ( abscissa > maxVal ) ) {
+ std::cerr << "ERROR in LauAbsPdf::checkRange : " << abscissa
+ << " outside allowed range: [" << minVal << "," << maxVal << "]" << std::endl;
+ return kFALSE;
+ }
+ }
+ return kTRUE;
}
-void LauAbsPdf::cacheInfo(const LauFitDataTree& inputData)
+void LauAbsPdf::cacheInfo( const LauFitDataTree& inputData )
{
- Bool_t hasBranch(kTRUE);
- for ( std::map<UInt_t,TString>::const_iterator iter = varNames_.begin(); iter != varNames_.end(); ++iter ) {
- hasBranch &= inputData.haveBranch( iter->second );
- if (!hasBranch) {
- std::cerr << "ERROR in LauAbsPdf::cacheInfo : Input data does not contain variable \"" << iter->second << "\"." << std::endl;
- return;
- }
- }
-
- // determine whether we are caching our PDF value
- Bool_t doCaching( this->nFixedParameters() == this->nParameters() );
- this->cachePDF( doCaching );
-
- // clear the vectors and reserve enough space
- UInt_t nEvents = inputData.nEvents();
- abscissas_.clear(); abscissas_.reserve(nEvents);
- unNormPDFValues_.clear(); unNormPDFValues_.reserve(nEvents);
-
- for (UInt_t iEvt = 0; iEvt < nEvents; ++iEvt) {
-
- const LauFitData& dataValues = inputData.getData(iEvt);
-
- LauAbscissas myData;
- // add all our variables into the data
- for ( std::map<UInt_t,TString>::const_iterator var_iter = varNames_.begin(); var_iter != varNames_.end(); ++var_iter ) {
- LauFitData::const_iterator iter = dataValues.find( var_iter->second );
- myData.push_back( iter->second );
- }
- // if we're DP dependent then we'll need the DP co-ordinates as well
- if ( this->isDPDependent() ) {
- LauFitData::const_iterator iter = dataValues.find( "m13Sq" );
- myData.push_back( iter->second );
- iter = dataValues.find( "m23Sq" );
- myData.push_back( iter->second );
- }
-
- if (!this->checkRange(myData)) {
- gSystem->Exit(EXIT_FAILURE);
- }
-
- abscissas_.push_back( myData );
-
- if (this->cachePDF()) {
- this->calcLikelihoodInfo( myData );
- unNormPDFValues_.push_back( this->getUnNormLikelihood() );
- }
- }
-
- if (!this->cachePDF()) {
- // in this case we seem to be doing a fit where the parameters are floating
- // so need to mark that the PDF height is no longer up to date
- this->heightUpToDate(kFALSE);
- }
+ Bool_t hasBranch( kTRUE );
+ for ( std::map<UInt_t, TString>::const_iterator iter = varNames_.begin(); iter != varNames_.end();
+ ++iter ) {
+ hasBranch &= inputData.haveBranch( iter->second );
+ if ( ! hasBranch ) {
+ std::cerr << "ERROR in LauAbsPdf::cacheInfo : Input data does not contain variable \""
+ << iter->second << "\"." << std::endl;
+ return;
+ }
+ }
+
+ // determine whether we are caching our PDF value
+ Bool_t doCaching( this->nFixedParameters() == this->nParameters() );
+ this->cachePDF( doCaching );
+
+ // clear the vectors and reserve enough space
+ UInt_t nEvents = inputData.nEvents();
+ abscissas_.clear();
+ abscissas_.reserve( nEvents );
+ unNormPDFValues_.clear();
+ unNormPDFValues_.reserve( nEvents );
+
+ for ( UInt_t iEvt = 0; iEvt < nEvents; ++iEvt ) {
+
+ const LauFitData& dataValues = inputData.getData( iEvt );
+
+ LauAbscissas myData;
+ // add all our variables into the data
+ for ( std::map<UInt_t, TString>::const_iterator var_iter = varNames_.begin();
+ var_iter != varNames_.end();
+ ++var_iter ) {
+ LauFitData::const_iterator iter = dataValues.find( var_iter->second );
+ myData.push_back( iter->second );
+ }
+ // if we're DP dependent then we'll need the DP co-ordinates as well
+ if ( this->isDPDependent() ) {
+ LauFitData::const_iterator iter = dataValues.find( "m13Sq" );
+ myData.push_back( iter->second );
+ iter = dataValues.find( "m23Sq" );
+ myData.push_back( iter->second );
+ }
+
+ if ( ! this->checkRange( myData ) ) {
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ abscissas_.push_back( myData );
+
+ if ( this->cachePDF() ) {
+ this->calcLikelihoodInfo( myData );
+ unNormPDFValues_.push_back( this->getUnNormLikelihood() );
+ }
+ }
+
+ if ( ! this->cachePDF() ) {
+ // in this case we seem to be doing a fit where the parameters are floating
+ // so need to mark that the PDF height is no longer up to date
+ this->heightUpToDate( kFALSE );
+ }
}
-LauFitData LauAbsPdf::generate(const LauKinematics* kinematics)
+LauFitData LauAbsPdf::generate( const LauKinematics* kinematics )
{
- this->withinGeneration(kTRUE);
-
- // Check that the PDF height is up to date
- // N.B. this must now called every time (the method will simply
- // return if there is nothing to do)
- this->calcPDFHeight( kinematics );
-
- Bool_t gotAbscissa(kFALSE);
- if (randomFun_ == 0) {
- std::cerr << "ERROR in LauAbsPdf::generate : Please set the random number generator for this PDF by using the setRandomFun(TRandom*) function." << std::endl;
- this->withinGeneration(kFALSE);
- gSystem->Exit(EXIT_FAILURE);
- }
-
- if ( this->isDPDependent() && !kinematics ) {
- std::cerr << "ERROR in LauAbsPdf::generate : PDF depends on the DP and an invalid kinematics pointer has been provided." << std::endl;
- this->withinGeneration(kFALSE);
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // container for holding the generated abscissa(s)
- LauAbscissas genAbscissa(1);
-
- // Generate the value of the abscissa.
- Double_t genPDFVal(0.0);
- Double_t PDFheight = this->getMaxHeight()*(1.0+1e-11);
- while (!gotAbscissa) {
-
- if ( this->isDPDependent() ) {
- genAbscissa.resize(3);
- genAbscissa[1] = kinematics->getm13Sq();
- genAbscissa[2] = kinematics->getm23Sq();
- }
- genAbscissa[0] = randomFun_->Rndm()*this->getRange() + this->getMinAbscissa();
-
- this->calcLikelihoodInfo(genAbscissa);
- genPDFVal = this->getUnNormLikelihood();
-
- if (randomFun_->Rndm() <= genPDFVal/PDFheight) {gotAbscissa = kTRUE;}
-
- if (genPDFVal > PDFheight) {
- std::cerr << "WARNING in LauAbsPdf::generate : genPDFVal = " << genPDFVal << " is larger than the maximum PDF height " << this->getMaxHeight() << " for the abscissa = " << genAbscissa[0] << "." << std::endl;
- std::cerr << " : Need to reset height to be larger than " << genPDFVal << " by using the setMaxHeight(Double_t) function and re-run the Monte Carlo generation!" << std::endl;
- }
- }
-
- LauFitData genData;
- genData[ this->varName() ] = genAbscissa[0];
-
- this->withinGeneration(kFALSE);
-
- return genData;
+ this->withinGeneration( kTRUE );
+
+ // Check that the PDF height is up to date
+ // N.B. this must now called every time (the method will simply
+ // return if there is nothing to do)
+ this->calcPDFHeight( kinematics );
+
+ Bool_t gotAbscissa( kFALSE );
+ if ( randomFun_ == 0 ) {
+ std::cerr << "ERROR in LauAbsPdf::generate : Please set the random number generator for this PDF by using the setRandomFun(TRandom*) function."
+ << std::endl;
+ this->withinGeneration( kFALSE );
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ if ( this->isDPDependent() && ! kinematics ) {
+ std::cerr << "ERROR in LauAbsPdf::generate : PDF depends on the DP and an invalid kinematics pointer has been provided."
+ << std::endl;
+ this->withinGeneration( kFALSE );
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // container for holding the generated abscissa(s)
+ LauAbscissas genAbscissa( 1 );
+
+ // Generate the value of the abscissa.
+ Double_t genPDFVal( 0.0 );
+ Double_t PDFheight = this->getMaxHeight() * ( 1.0 + 1e-11 );
+ while ( ! gotAbscissa ) {
+
+ if ( this->isDPDependent() ) {
+ genAbscissa.resize( 3 );
+ genAbscissa[1] = kinematics->getm13Sq();
+ genAbscissa[2] = kinematics->getm23Sq();
+ }
+ genAbscissa[0] = randomFun_->Rndm() * this->getRange() + this->getMinAbscissa();
+
+ this->calcLikelihoodInfo( genAbscissa );
+ genPDFVal = this->getUnNormLikelihood();
+
+ if ( randomFun_->Rndm() <= genPDFVal / PDFheight ) {
+ gotAbscissa = kTRUE;
+ }
+
+ if ( genPDFVal > PDFheight ) {
+ std::cerr << "WARNING in LauAbsPdf::generate : genPDFVal = " << genPDFVal
+ << " is larger than the maximum PDF height " << this->getMaxHeight()
+ << " for the abscissa = " << genAbscissa[0] << "." << std::endl;
+ std::cerr << " : Need to reset height to be larger than "
+ << genPDFVal
+ << " by using the setMaxHeight(Double_t) function and re-run the Monte Carlo generation!"
+ << std::endl;
+ }
+ }
+
+ LauFitData genData;
+ genData[this->varName()] = genAbscissa[0];
+
+ this->withinGeneration( kFALSE );
+
+ return genData;
}
Double_t LauAbsPdf::getLikelihood() const
{
- if (TMath::Abs(norm_) > 1e-10) {
- return unNormPDFVal_/norm_;
- } else {
- return 0.0;
- }
+ if ( TMath::Abs( norm_ ) > 1e-10 ) {
+ return unNormPDFVal_ / norm_;
+ } else {
+ return 0.0;
+ }
}
Double_t LauAbsPdf::getLikelihood( const TString& theVarName ) const
{
- if ( theVarName != this->varName() ) {
- std::cerr << "ERROR in LauAbsPdf::getLikelihood : Unrecognised variable name \"" << theVarName << "\", cannot determine likelihood." << std::endl;
- return 0.0;
- }
- return this->getLikelihood();
+ if ( theVarName != this->varName() ) {
+ std::cerr << "ERROR in LauAbsPdf::getLikelihood : Unrecognised variable name \""
+ << theVarName << "\", cannot determine likelihood." << std::endl;
+ return 0.0;
+ }
+ return this->getLikelihood();
}
-void LauAbsPdf::calcLikelihoodInfo(UInt_t iEvt)
+void LauAbsPdf::calcLikelihoodInfo( UInt_t iEvt )
{
- if (this->cachePDF() && (unNormPDFValues_.size() == abscissas_.size())) {
- unNormPDFVal_ = unNormPDFValues_[iEvt];
- } else {
- this->calcLikelihoodInfo( abscissas_[iEvt] );
- }
+ if ( this->cachePDF() && ( unNormPDFValues_.size() == abscissas_.size() ) ) {
+ unNormPDFVal_ = unNormPDFValues_[iEvt];
+ } else {
+ this->calcLikelihoodInfo( abscissas_[iEvt] );
+ }
}
-LauAbsRValue* LauAbsPdf::findParameter(const TString& parName)
+LauAbsRValue* LauAbsPdf::findParameter( const TString& parName )
{
- for ( std::vector<LauAbsRValue*>::iterator iter = param_.begin(); iter != param_.end(); ++iter ) {
- // std::vector<LauParameter*> params = (*iter)->getPars();
- // for (std::vector<LauParameter*>::iterator params_iter = params.begin(); params_iter != params.end(); ++params_iter ) {
- if ((*iter)->name().Contains(parName)) {
- return (*iter);
- }
- // }
- }
-
- std::cerr << "ERROR in LauAbsPdf::findParameter : Parameter \"" << parName << "\" not found." << std::endl;
- return 0;
+ for ( std::vector<LauAbsRValue*>::iterator iter = param_.begin(); iter != param_.end(); ++iter ) {
+ // std::vector<LauParameter*> params = (*iter)->getPars();
+ // for (std::vector<LauParameter*>::iterator params_iter = params.begin(); params_iter != params.end(); ++params_iter ) {
+ if ( ( *iter )->name().Contains( parName ) ) {
+ return ( *iter );
+ }
+ // }
+ }
+
+ std::cerr << "ERROR in LauAbsPdf::findParameter : Parameter \"" << parName << "\" not found."
+ << std::endl;
+ return 0;
}
-const LauAbsRValue* LauAbsPdf::findParameter(const TString& parName) const
+const LauAbsRValue* LauAbsPdf::findParameter( const TString& parName ) const
{
- for ( std::vector<LauAbsRValue*>::const_iterator iter = param_.begin(); iter != param_.end(); ++iter ) {
- // std::vector<LauParameter*> params = (*iter)->getPars();
- // for (std::vector<LauParameter*>::iterator params_iter = params.begin(); params_iter != params.end(); ++params_iter ) {
- if ((*iter)->name().Contains(parName)) {
- return (*iter);
- // }
- }
- }
-
- std::cerr << "ERROR in LauAbsPdf::findParameter : Parameter \"" << parName << "\" not found." << std::endl;
- return 0;
+ for ( std::vector<LauAbsRValue*>::const_iterator iter = param_.begin(); iter != param_.end();
+ ++iter ) {
+ // std::vector<LauParameter*> params = (*iter)->getPars();
+ // for (std::vector<LauParameter*>::iterator params_iter = params.begin(); params_iter != params.end(); ++params_iter ) {
+ if ( ( *iter )->name().Contains( parName ) ) {
+ return ( *iter );
+ // }
+ }
+ }
+
+ std::cerr << "ERROR in LauAbsPdf::findParameter : Parameter \"" << parName << "\" not found."
+ << std::endl;
+ return 0;
}
void LauAbsPdf::updatePulls()
{
- for ( std::vector<LauAbsRValue*>::iterator iter = param_.begin(); iter != param_.end(); ++iter ) {
- std::vector<LauParameter*> params = (*iter)->getPars();
- for (std::vector<LauParameter*>::iterator params_iter = params.begin(); params_iter != params.end(); ++params_iter ) {
- if (!(*iter)->fixed()) {
- (*params_iter)->updatePull();
- }
- }
- }
+ for ( std::vector<LauAbsRValue*>::iterator iter = param_.begin(); iter != param_.end(); ++iter ) {
+ std::vector<LauParameter*> params = ( *iter )->getPars();
+ for ( std::vector<LauParameter*>::iterator params_iter = params.begin();
+ params_iter != params.end();
+ ++params_iter ) {
+ if ( ! ( *iter )->fixed() ) {
+ ( *params_iter )->updatePull();
+ }
+ }
+ }
}
-void LauAbsPdf::addParameters(std::vector<LauAbsRValue*>& params)
+void LauAbsPdf::addParameters( std::vector<LauAbsRValue*>& params )
{
- for ( std::vector<LauAbsRValue*>::iterator iter = params.begin(); iter != params.end(); ++iter ) {
- param_.push_back(*iter);
- }
+ for ( std::vector<LauAbsRValue*>::iterator iter = params.begin(); iter != params.end(); ++iter ) {
+ param_.push_back( *iter );
+ }
}
void LauAbsPdf::calcNorm()
{
- this->withinNormCalc(kTRUE);
+ this->withinNormCalc( kTRUE );
- if ( this->nInputVars() > 1 ) {
- std::cerr << "ERROR in LauAbsPdf::calcNorm : Numeric integration only works for 1D PDFs." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
+ if ( this->nInputVars() > 1 ) {
+ std::cerr << "ERROR in LauAbsPdf::calcNorm : Numeric integration only works for 1D PDFs."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
- IntMethod sumMethod = this->integMethod();
+ IntMethod sumMethod = this->integMethod();
- Double_t normFac = (sumMethod == GaussLegendre) ? this->integrGaussLegendre() : this->integTrapezoid();
+ Double_t normFac = ( sumMethod == GaussLegendre ) ? this->integrGaussLegendre()
+ : this->integTrapezoid();
- this->setNorm(normFac);
+ this->setNorm( normFac );
- this->withinNormCalc(kFALSE);
-}
+ this->withinNormCalc( kFALSE );
+}
Double_t LauAbsPdf::integrGaussLegendre()
{
- if (!this->normWeightsDone()) {
- this->getNormWeights();
- }
-
- // Now compute the integral
- Double_t norm(0.0);
- for (UInt_t i = 0; i < normWeights_.size(); i++) {
- this->calcLikelihoodInfo(normAbscissas_[i]);
- Double_t fun = this->getUnNormLikelihood();
- Double_t intFactor = 0.5 * this->getRange();
- norm += normWeights_[i]*intFactor*fun;
- }
-
- //std::cout<<"====================================================="<<std::endl;
- //std::cout<<"NORM = "<<norm<<std::endl;
-
- //std::cout<<"====================================================="<<std::endl;
- return norm;
+ if ( ! this->normWeightsDone() ) {
+ this->getNormWeights();
+ }
+
+ // Now compute the integral
+ Double_t norm( 0.0 );
+ for ( UInt_t i = 0; i < normWeights_.size(); i++ ) {
+ this->calcLikelihoodInfo( normAbscissas_[i] );
+ Double_t fun = this->getUnNormLikelihood();
+ Double_t intFactor = 0.5 * this->getRange();
+ norm += normWeights_[i] * intFactor * fun;
+ }
+
+ //std::cout<<"====================================================="<<std::endl;
+ //std::cout<<"NORM = "<<norm<<std::endl;
+
+ //std::cout<<"====================================================="<<std::endl;
+ return norm;
}
void LauAbsPdf::getNormWeights()
{
- // Check whether we've already calculated the weights
- if (this->normWeightsDone()) {
- std::cerr << "WARNING in LauAbsPdf::getNormWeights : Already calculated weights, not doing it again." << std::endl;
- return;
- }
+ // Check whether we've already calculated the weights
+ if ( this->normWeightsDone() ) {
+ std::cerr << "WARNING in LauAbsPdf::getNormWeights : Already calculated weights, not doing it again."
+ << std::endl;
+ return;
+ }
- // Avoid integral if we have no points in x space
- if (nNormPoints_ == 0) {
- std::cerr << "ERROR in LauAbsPdf::getNormWeights : Zero points specified, this is daft!" << std::endl;
- return;
- }
+ // Avoid integral if we have no points in x space
+ if ( nNormPoints_ == 0 ) {
+ std::cerr << "ERROR in LauAbsPdf::getNormWeights : Zero points specified, this is daft!"
+ << std::endl;
+ return;
+ }
- // Calculate the normalisation weights and abscissas
- Double_t precision(1e-6);
+ // Calculate the normalisation weights and abscissas
+ Double_t precision( 1e-6 );
- Double_t intMean = 0.5*(this->getMaxAbscissa() + this->getMinAbscissa());
- Double_t range = this->getMaxAbscissa() - this->getMinAbscissa();
- Double_t halfRange = 0.5*range;
+ Double_t intMean = 0.5 * ( this->getMaxAbscissa() + this->getMinAbscissa() );
+ Double_t range = this->getMaxAbscissa() - this->getMinAbscissa();
+ Double_t halfRange = 0.5 * range;
- std::vector<Double_t> abscissas;
- LauIntegrals funIntegrals(precision);
- funIntegrals.calcGaussLegendreWeights(nNormPoints_, abscissas, normWeights_);
+ std::vector<Double_t> abscissas;
+ LauIntegrals funIntegrals( precision );
+ funIntegrals.calcGaussLegendreWeights( nNormPoints_, abscissas, normWeights_ );
- //std::cout<<"====================================================="<<std::endl;
- //std::cout<<"NORM POINTS = "<<nNormPoints_<<std::endl;
+ //std::cout<<"====================================================="<<std::endl;
+ //std::cout<<"NORM POINTS = "<<nNormPoints_<<std::endl;
- //std::cout<<"====================================================="<<std::endl;
+ //std::cout<<"====================================================="<<std::endl;
- Int_t nWeights = static_cast<Int_t>(normWeights_.size());
- normAbscissas_.resize(nWeights);
+ Int_t nWeights = static_cast<Int_t>( normWeights_.size() );
+ normAbscissas_.resize( nWeights );
- // Use same number of abscissas for x and y co-ordinates
- Int_t m = (nWeights + 1)/2;
- for (Int_t i = 0; i < m; ++i) {
+ // Use same number of abscissas for x and y co-ordinates
+ Int_t m = ( nWeights + 1 ) / 2;
+ for ( Int_t i = 0; i < m; ++i ) {
- Int_t ii = nWeights - 1 - i; // symmetric i index
+ Int_t ii = nWeights - 1 - i; // symmetric i index
- Double_t dx = halfRange*abscissas[i];
- Double_t tmpVal = intMean - dx;
- normAbscissas_[i].push_back( tmpVal );
+ Double_t dx = halfRange * abscissas[i];
+ Double_t tmpVal = intMean - dx;
+ normAbscissas_[i].push_back( tmpVal );
- tmpVal = intMean + dx;
- normAbscissas_[ii].push_back( tmpVal );
+ tmpVal = intMean + dx;
+ normAbscissas_[ii].push_back( tmpVal );
+ }
- }
-
- this->normWeightsDone(kTRUE);
+ this->normWeightsDone( kTRUE );
}
Double_t LauAbsPdf::integTrapezoid()
{
- Double_t abscVal, tnm, sum, del;
- Int_t it, j;
+ Double_t abscVal, tnm, sum, del;
+ Int_t it, j;
- static Double_t norm(0.0);
- Double_t range = this->getRange();
+ static Double_t norm( 0.0 );
+ Double_t range = this->getRange();
- if (this->nNormPoints()==1){
+ if ( this->nNormPoints() == 1 ) {
- LauAbscissas abscissa(1);
- abscissa[0] = this->getMinAbscissa();
- this->calcLikelihoodInfo(abscissa);
- Double_t funAbsMin = this->getUnNormLikelihood();
+ LauAbscissas abscissa( 1 );
+ abscissa[0] = this->getMinAbscissa();
+ this->calcLikelihoodInfo( abscissa );
+ Double_t funAbsMin = this->getUnNormLikelihood();
- abscissa[0] = this->getMinAbscissa();
- this->calcLikelihoodInfo(abscissa);
- Double_t funAbsMax = this->getUnNormLikelihood();
+ abscissa[0] = this->getMinAbscissa();
+ this->calcLikelihoodInfo( abscissa );
+ Double_t funAbsMax = this->getUnNormLikelihood();
- norm = 0.5*range*(funAbsMin+funAbsMax);
- return norm;
+ norm = 0.5 * range * ( funAbsMin + funAbsMax );
+ return norm;
- } else {
- for (it=1, j=1; j< this->nNormPoints()-1; j++) {it<<=1;}
- tnm=it;
- del=range/tnm;
- abscVal= this->getMinAbscissa()+ 0.5*del;
+ } else {
+ for ( it = 1, j = 1; j < this->nNormPoints() - 1; j++ ) {
+ it <<= 1;
+ }
+ tnm = it;
+ del = range / tnm;
+ abscVal = this->getMinAbscissa() + 0.5 * del;
- for (sum = 0.0, j=1; j<it; j++, abscVal+=del) {
+ for ( sum = 0.0, j = 1; j < it; j++, abscVal += del ) {
- LauAbscissas abscissa(1);
- abscissa[0] = abscVal;
- this->calcLikelihoodInfo(abscissa);
- Double_t funVal = this->getUnNormLikelihood();
+ LauAbscissas abscissa( 1 );
+ abscissa[0] = abscVal;
+ this->calcLikelihoodInfo( abscissa );
+ Double_t funVal = this->getUnNormLikelihood();
- sum+=funVal;
- }
+ sum += funVal;
+ }
- norm = 0.5*(norm + sum*range/tnm);
- return norm;
- }
+ norm = 0.5 * ( norm + sum * range / tnm );
+ return norm;
+ }
}
-
diff --git a/src/LauAbsResonance.cc b/src/LauAbsResonance.cc
index 699ecd4..1009949 100644
--- a/src/LauAbsResonance.cc
+++ b/src/LauAbsResonance.cc
@@ -1,681 +1,719 @@
/*
Copyright 2004 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauAbsResonance.cc
- \brief File containing implementation of LauAbsResonance class.
+ \brief File containing implementation of LauAbsResonance class.
*/
-#include <iostream>
-
-#include "TSystem.h"
-
#include "LauAbsResonance.hh"
+
#include "LauConstants.hh"
#include "LauDaughters.hh"
#include "LauKinematics.hh"
#include "LauParameter.hh"
#include "LauResonanceInfo.hh"
+#include "TSystem.h"
-bool LauAbsResonance::isIncoherentModel(LauResonanceModel model) {
- switch(model) {
- case BW:
- case RelBW:
- case GS:
- case Flatte:
- case Sigma:
- case Kappa:
- case Dabba:
- case LASS:
- case LASS_BW:
- case LASS_NR:
- case EFKLLM:
- case KMatrix:
- case FlatNR:
- case NRModel:
- case BelleNR:
- case PowerLawNR:
- case BelleSymNR:
- case BelleSymNRNoInter:
- case TaylorNR:
- case PolNR:
- case Pole:
- case PolarFFNR:
- case PolarFFSymNR:
- case PolarFFSymNRNoInter:
- case Rescattering:
- case Rescattering2:
- case RescatteringNoInter:
- case MIPW_MagPhase:
- case MIPW_RealImag:
- case RhoOmegaMix_GS:
- case RhoOmegaMix_RBW:
- case RhoOmegaMix_GS_1:
- case RhoOmegaMix_RBW_1:
- break;
- case GaussIncoh:
- return true;
- }
- return false;
+#include <iostream>
+
+bool LauAbsResonance::isIncoherentModel( LauResonanceModel model )
+{
+ switch ( model ) {
+ case BW :
+ case RelBW :
+ case GS :
+ case Flatte :
+ case Sigma :
+ case Kappa :
+ case Dabba :
+ case LASS :
+ case LASS_BW :
+ case LASS_NR :
+ case EFKLLM :
+ case KMatrix :
+ case FlatNR :
+ case NRModel :
+ case BelleNR :
+ case PowerLawNR :
+ case BelleSymNR :
+ case BelleSymNRNoInter :
+ case TaylorNR :
+ case PolNR :
+ case Pole :
+ case PolarFFNR :
+ case PolarFFSymNR :
+ case PolarFFSymNRNoInter :
+ case Rescattering :
+ case Rescattering2 :
+ case RescatteringNoInter :
+ case MIPW_MagPhase :
+ case MIPW_RealImag :
+ case RhoOmegaMix_GS :
+ case RhoOmegaMix_RBW :
+ case RhoOmegaMix_GS_1 :
+ case RhoOmegaMix_RBW_1 :
+ break;
+ case GaussIncoh :
+ return true;
+ }
+ return false;
}
// Constructor
-LauAbsResonance::LauAbsResonance(LauResonanceInfo* resInfo, const Int_t resPairAmpInt, const LauDaughters* daughters) :
- resInfo_(resInfo),
- daughters_(daughters),
- resName_( (resInfo!=0) ? resInfo->getName() : "" ),
- sanitisedName_( (resInfo!=0) ? resInfo->getSanitisedName() : "" ),
- resMass_( (resInfo!=0) ? resInfo->getMass() : 0 ),
- resWidth_( (resInfo!=0) ? resInfo->getWidth() : 0 ),
- resSpin_( (resInfo!=0) ? resInfo->getSpin() : 0 ),
- resCharge_( (resInfo!=0) ? resInfo->getCharge() : 0 ),
- resPairAmpInt_(resPairAmpInt)
-{
- if ( resInfo == 0 ) {
- std::cerr << "ERROR in LauAbsResonance constructor : null LauResonanceInfo object provided" << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- if ( daughters_ == 0 ) {
- std::cerr << "ERROR in LauAbsResonance constructor : null LauDaughters object provided" << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- nameParent_ = this->getNameParent();
- nameDaug1_ = this->getNameDaug1();
- nameDaug2_ = this->getNameDaug2();
- nameBachelor_ = this->getNameBachelor();
- massParent_ = this->getMassParent();
- massDaug1_ = this->getMassDaug1();
- massDaug2_ = this->getMassDaug2();
- massBachelor_ = this->getMassBachelor();
- chargeParent_ = this->getChargeParent();
- chargeDaug1_ = this->getChargeDaug1();
- chargeDaug2_ = this->getChargeDaug2();
- chargeBachelor_ = this->getChargeBachelor();
-
- // check that the total charge adds up to that of the resonance
- Int_t totalCharge = chargeDaug1_ + chargeDaug2_;
- if ( (totalCharge != resCharge_) && (resPairAmpInt_ != 0) ) {
- std::cerr << "ERROR in LauAbsResonance : Total charge of daughters = " << totalCharge << ". Resonance charge = " << resCharge_ << "." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
+LauAbsResonance::LauAbsResonance( LauResonanceInfo* resInfo,
+ const Int_t resPairAmpInt,
+ const LauDaughters* daughters ) :
+ resInfo_( resInfo ),
+ daughters_( daughters ),
+ resName_( ( resInfo != 0 ) ? resInfo->getName() : "" ),
+ sanitisedName_( ( resInfo != 0 ) ? resInfo->getSanitisedName() : "" ),
+ resMass_( ( resInfo != 0 ) ? resInfo->getMass() : 0 ),
+ resWidth_( ( resInfo != 0 ) ? resInfo->getWidth() : 0 ),
+ resSpin_( ( resInfo != 0 ) ? resInfo->getSpin() : 0 ),
+ resCharge_( ( resInfo != 0 ) ? resInfo->getCharge() : 0 ),
+ resPairAmpInt_( resPairAmpInt )
+{
+ if ( resInfo == 0 ) {
+ std::cerr << "ERROR in LauAbsResonance constructor : null LauResonanceInfo object provided"
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ if ( daughters_ == 0 ) {
+ std::cerr << "ERROR in LauAbsResonance constructor : null LauDaughters object provided"
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ nameParent_ = this->getNameParent();
+ nameDaug1_ = this->getNameDaug1();
+ nameDaug2_ = this->getNameDaug2();
+ nameBachelor_ = this->getNameBachelor();
+ massParent_ = this->getMassParent();
+ massDaug1_ = this->getMassDaug1();
+ massDaug2_ = this->getMassDaug2();
+ massBachelor_ = this->getMassBachelor();
+ chargeParent_ = this->getChargeParent();
+ chargeDaug1_ = this->getChargeDaug1();
+ chargeDaug2_ = this->getChargeDaug2();
+ chargeBachelor_ = this->getChargeBachelor();
+
+ // check that the total charge adds up to that of the resonance
+ Int_t totalCharge = chargeDaug1_ + chargeDaug2_;
+ if ( ( totalCharge != resCharge_ ) && ( resPairAmpInt_ != 0 ) ) {
+ std::cerr << "ERROR in LauAbsResonance : Total charge of daughters = " << totalCharge
+ << ". Resonance charge = " << resCharge_ << "." << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
}
// Constructor
-LauAbsResonance::LauAbsResonance(const TString& resName, const Int_t resPairAmpInt, const LauDaughters* daughters, const Int_t resSpin) :
- daughters_(daughters),
- resName_(resName),
- sanitisedName_(resName),
- resSpin_(resSpin),
- resPairAmpInt_(resPairAmpInt)
-{
- if ( daughters_ == 0 ) {
- std::cerr << "ERROR in LauAbsResonance constructor : null LauDaughters object provided" << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- nameParent_ = this->getNameParent();
- nameDaug1_ = this->getNameDaug1();
- nameDaug2_ = this->getNameDaug2();
- nameBachelor_ = this->getNameBachelor();
- massParent_ = this->getMassParent();
- massDaug1_ = this->getMassDaug1();
- massDaug2_ = this->getMassDaug2();
- massBachelor_ = this->getMassBachelor();
- chargeParent_ = this->getChargeParent();
- chargeDaug1_ = this->getChargeDaug1();
- chargeDaug2_ = this->getChargeDaug2();
- chargeBachelor_ = this->getChargeBachelor();
-
- // Since we haven't been provided with a LauResonanceInfo object we can just
- // set the change of the resonance to be the sum of the daughter charges
- resCharge_ = chargeDaug1_ + chargeDaug2_;
+LauAbsResonance::LauAbsResonance( const TString& resName,
+ const Int_t resPairAmpInt,
+ const LauDaughters* daughters,
+ const Int_t resSpin ) :
+ daughters_( daughters ),
+ resName_( resName ),
+ sanitisedName_( resName ),
+ resSpin_( resSpin ),
+ resPairAmpInt_( resPairAmpInt )
+{
+ if ( daughters_ == 0 ) {
+ std::cerr << "ERROR in LauAbsResonance constructor : null LauDaughters object provided"
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ nameParent_ = this->getNameParent();
+ nameDaug1_ = this->getNameDaug1();
+ nameDaug2_ = this->getNameDaug2();
+ nameBachelor_ = this->getNameBachelor();
+ massParent_ = this->getMassParent();
+ massDaug1_ = this->getMassDaug1();
+ massDaug2_ = this->getMassDaug2();
+ massBachelor_ = this->getMassBachelor();
+ chargeParent_ = this->getChargeParent();
+ chargeDaug1_ = this->getChargeDaug1();
+ chargeDaug2_ = this->getChargeDaug2();
+ chargeBachelor_ = this->getChargeBachelor();
+
+ // Since we haven't been provided with a LauResonanceInfo object we can just
+ // set the change of the resonance to be the sum of the daughter charges
+ resCharge_ = chargeDaug1_ + chargeDaug2_;
}
// Destructor
LauAbsResonance::~LauAbsResonance()
{
}
-LauComplex LauAbsResonance::amplitude(const LauKinematics* kinematics)
+LauComplex LauAbsResonance::amplitude( const LauKinematics* kinematics )
{
- // Use LauKinematics interface for amplitude
+ // Use LauKinematics interface for amplitude
- // For resonance made from tracks i, j, we need the momenta
- // of tracks i and k in the i-j rest frame for spin helicity calculations
- // in the Zemach tensor formalism.
- // Also need the momentum of track k in the parent rest-frame for
- // calculation of the Blatt-Weisskopf factors.
- mass_ = 0.0; cosHel_ = 0.0;
- q_ = 0.0; p_ = 0.0; pstar_ = 0.0;
- erm_ = 1.0; covFactor_ = 1.0;
+ // For resonance made from tracks i, j, we need the momenta
+ // of tracks i and k in the i-j rest frame for spin helicity calculations
+ // in the Zemach tensor formalism.
+ // Also need the momentum of track k in the parent rest-frame for
+ // calculation of the Blatt-Weisskopf factors.
+ mass_ = 0.0;
+ cosHel_ = 0.0;
+ q_ = 0.0;
+ p_ = 0.0;
+ pstar_ = 0.0;
+ erm_ = 1.0;
+ covFactor_ = 1.0;
- if (resPairAmpInt_ == 1) {
+ if ( resPairAmpInt_ == 1 ) {
- mass_ = kinematics->getm23();
- cosHel_ = kinematics->getc23();
- q_ = kinematics->getp2_23();
- p_ = kinematics->getp1_23();
- pstar_ = kinematics->getp1_Parent();
- erm_ = kinematics->getcov23();
+ mass_ = kinematics->getm23();
+ cosHel_ = kinematics->getc23();
+ q_ = kinematics->getp2_23();
+ p_ = kinematics->getp1_23();
+ pstar_ = kinematics->getp1_Parent();
+ erm_ = kinematics->getcov23();
- } else if (resPairAmpInt_ == 2) {
+ } else if ( resPairAmpInt_ == 2 ) {
- mass_ = kinematics->getm13();
- cosHel_ = kinematics->getc13();
- q_ = kinematics->getp1_13();
- p_ = kinematics->getp2_13();
- pstar_ = kinematics->getp2_Parent();
- erm_ = kinematics->getcov13();
+ mass_ = kinematics->getm13();
+ cosHel_ = kinematics->getc13();
+ q_ = kinematics->getp1_13();
+ p_ = kinematics->getp2_13();
+ pstar_ = kinematics->getp2_Parent();
+ erm_ = kinematics->getcov13();
- } else if (resPairAmpInt_ == 3) {
+ } else if ( resPairAmpInt_ == 3 ) {
- mass_ = kinematics->getm12();
- cosHel_ = kinematics->getc12();
- q_ = kinematics->getp1_12();
- p_ = kinematics->getp3_12();
- pstar_ = kinematics->getp3_Parent();
- erm_ = kinematics->getcov12();
+ mass_ = kinematics->getm12();
+ cosHel_ = kinematics->getc12();
+ q_ = kinematics->getp1_12();
+ p_ = kinematics->getp3_12();
+ pstar_ = kinematics->getp3_Parent();
+ erm_ = kinematics->getcov12();
- } else {
- std::cerr << "ERROR in LauAbsResonance::amplitude : Nonsense setup of resPairAmp array." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
+ } else {
+ std::cerr << "ERROR in LauAbsResonance::amplitude : Nonsense setup of resPairAmp array."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
- if (this->flipHelicity()) {
- cosHel_ *= -1.0;
- }
+ if ( this->flipHelicity() ) {
+ cosHel_ *= -1.0;
+ }
- if (this->ignoreMomenta()) {
- q_ = 1.0;
- p_ = 1.0;
- pstar_ = 1.0;
- erm_ = 1.0;
- }
+ if ( this->ignoreMomenta() ) {
+ q_ = 1.0;
+ p_ = 1.0;
+ pstar_ = 1.0;
+ erm_ = 1.0;
+ }
- // Calculate the spin factors
- Double_t spinTerm(1.0);
- Double_t pProd(1.0);
+ // Calculate the spin factors
+ Double_t spinTerm( 1.0 );
+ Double_t pProd( 1.0 );
- if (!this->ignoreSpin()) {
- switch ( this->getSpinType() ) {
+ if ( ! this->ignoreSpin() ) {
+ switch ( this->getSpinType() ) {
- case Zemach_P:
- pProd = q_*p_;
- spinTerm = this->calcZemachSpinFactor( pProd );
- break;
+ case Zemach_P :
+ pProd = q_ * p_;
+ spinTerm = this->calcZemachSpinFactor( pProd );
+ break;
- case Zemach_Pstar:
- pProd = q_*pstar_;
- spinTerm = this->calcZemachSpinFactor( pProd );
- break;
+ case Zemach_Pstar :
+ pProd = q_ * pstar_;
+ spinTerm = this->calcZemachSpinFactor( pProd );
+ break;
- case Covariant:
- pProd = q_*pstar_;
- spinTerm = this->calcCovSpinFactor( pProd );
- break;
+ case Covariant :
+ pProd = q_ * pstar_;
+ spinTerm = this->calcCovSpinFactor( pProd );
+ break;
- case Legendre:
- spinTerm = this->calcLegendrePoly();
- break;
- }
- }
+ case Legendre :
+ spinTerm = this->calcLegendrePoly();
+ break;
+ }
+ }
- // Calculate the full amplitude
- LauComplex resAmplitude = this->resAmp(mass_, spinTerm);
+ // Calculate the full amplitude
+ LauComplex resAmplitude = this->resAmp( mass_, spinTerm );
- return resAmplitude;
+ return resAmplitude;
}
void LauAbsResonance::calcCovFactor( const Double_t erm )
{
- if (resSpin_ == 0) {
- covFactor_ = 1.0;
- } else if (resSpin_ == 1) {
- covFactor_ = erm;
- } else if (resSpin_ == 2) {
- covFactor_ = erm*erm + 0.5;
- } else if (resSpin_ == 3) {
- covFactor_ = erm*(erm*erm + 1.5);
- } else if (resSpin_ == 4) {
- covFactor_ = (8.*erm*erm*erm*erm + 24.*erm*erm + 3.)/35.;
- } else if (resSpin_ > 4) {
- std::cerr << "WARNING in LauAbsResonance::calcCovFactor : covariant spin factor cannot (yet) be fully calculated for spin >= 5" << std::endl;
- std::cerr << " : the function of sqrt(1 + (p/mParent)^2) part will be missing" << std::endl;
- covFactor_ = 1.0;
- }
+ if ( resSpin_ == 0 ) {
+ covFactor_ = 1.0;
+ } else if ( resSpin_ == 1 ) {
+ covFactor_ = erm;
+ } else if ( resSpin_ == 2 ) {
+ covFactor_ = erm * erm + 0.5;
+ } else if ( resSpin_ == 3 ) {
+ covFactor_ = erm * ( erm * erm + 1.5 );
+ } else if ( resSpin_ == 4 ) {
+ covFactor_ = ( 8. * erm * erm * erm * erm + 24. * erm * erm + 3. ) / 35.;
+ } else if ( resSpin_ > 4 ) {
+ std::cerr << "WARNING in LauAbsResonance::calcCovFactor : covariant spin factor cannot (yet) be fully calculated for spin >= 5"
+ << std::endl;
+ std::cerr << " : the function of sqrt(1 + (p/mParent)^2) part will be missing"
+ << std::endl;
+ covFactor_ = 1.0;
+ }
}
Double_t LauAbsResonance::calcCovSpinFactor( const Double_t pProd )
{
- if (resSpin_ == 0) {
- covFactor_ = 1.0;
- return 1.0;
- }
+ if ( resSpin_ == 0 ) {
+ covFactor_ = 1.0;
+ return 1.0;
+ }
- // Covariant spin factor is (p* q)^L * f_L(erm) * P_L(cosHel)
- Double_t spinFactor(pProd);
- for ( Int_t i(1); i < resSpin_; ++i ) {
- spinFactor *= pProd;
- }
+ // Covariant spin factor is (p* q)^L * f_L(erm) * P_L(cosHel)
+ Double_t spinFactor( pProd );
+ for ( Int_t i( 1 ); i < resSpin_; ++i ) {
+ spinFactor *= pProd;
+ }
- this->calcCovFactor( erm_ );
+ this->calcCovFactor( erm_ );
- spinFactor *= covFactor_;
+ spinFactor *= covFactor_;
- spinFactor *= this->calcLegendrePoly();
+ spinFactor *= this->calcLegendrePoly();
- return spinFactor;
+ return spinFactor;
}
Double_t LauAbsResonance::calcZemachSpinFactor( const Double_t pProd ) const
{
- // Calculate the spin factors
- //
- // These are calculated as follows
- //
- // -2^j * (q*p)^j * cj * Pj(cosHel)
- //
- // where Pj(coshHel) is the jth order Legendre polynomial and
- //
- // cj = j! / (2j-1)!!
+ // Calculate the spin factors
+ //
+ // These are calculated as follows
+ //
+ // -2^j * (q*p)^j * cj * Pj(cosHel)
+ //
+ // where Pj(coshHel) is the jth order Legendre polynomial and
+ //
+ // cj = j! / (2j-1)!!
- if (resSpin_ == 0) {
- return 1.0;
- }
+ if ( resSpin_ == 0 ) {
+ return 1.0;
+ }
- Double_t spinFactor(pProd);
- for ( Int_t i(1); i < resSpin_; ++i ) {
- spinFactor *= pProd;
- }
+ Double_t spinFactor( pProd );
+ for ( Int_t i( 1 ); i < resSpin_; ++i ) {
+ spinFactor *= pProd;
+ }
- spinFactor *= this->calcLegendrePoly();
+ spinFactor *= this->calcLegendrePoly();
- return spinFactor;
+ return spinFactor;
}
Double_t LauAbsResonance::calcLegendrePoly( const Double_t cosHel )
{
- cosHel_ = cosHel;
- return this->calcLegendrePoly();
+ cosHel_ = cosHel;
+ return this->calcLegendrePoly();
}
Double_t LauAbsResonance::calcLegendrePoly() const
{
- Double_t legPol = 1.0;
-
- if (resSpin_ == 1) {
- // Calculate vector resonance Legendre polynomial
- legPol = -2.0*cosHel_;
- } else if (resSpin_ == 2) {
- // Calculate tensor resonance Legendre polynomial
- legPol = 4.0*(3.0*cosHel_*cosHel_ - 1.0)/3.0;
- } else if (resSpin_ == 3) {
- // Calculate spin 3 resonance Legendre polynomial
- legPol = -8.0*(5.0*cosHel_*cosHel_*cosHel_ - 3.0*cosHel_)/5.0;
- } else if (resSpin_ == 4) {
- // Calculate spin 4 resonance Legendre polynomial
- legPol = 16.0*(35.0*cosHel_*cosHel_*cosHel_*cosHel_ - 30.0*cosHel_*cosHel_ + 3.0)/35.0;
- } else if (resSpin_ == 5) {
- // Calculate spin 5 resonance Legendre polynomial
- legPol = -32.0*(63.0*cosHel_*cosHel_*cosHel_*cosHel_*cosHel_ - 70.0*cosHel_*cosHel_*cosHel_ + 15.0*cosHel_)/63.0;
- } else if (resSpin_ > 5) {
- std::cerr << "WARNING in LauAbsResonance::calcLegendrePoly : Legendre polynomials not (yet) implemented for spin > 5" << std::endl;
- }
-
- return legPol;
-}
-
-void LauAbsResonance::changeResonance(const Double_t newMass, const Double_t newWidth, const Int_t newSpin)
-{
- if (newMass > 0.0) {
- resMass_->valueAndRange(newMass,0.0,3.0*newMass);
- resMass_->initValue(newMass);
- resMass_->genValue(newMass);
- std::cout << "INFO in LauAbsResonance::changeResonance : Setting mass to " << resMass_->value() << std::endl;
- }
- if (newWidth > 0.0) {
- resWidth_->valueAndRange(newWidth,0.0,3.0*newWidth);
- resWidth_->initValue(newWidth);
- resWidth_->genValue(newWidth);
- std::cout << "INFO in LauAbsResonance::changeResonance : Setting width to " << resWidth_->value() << std::endl;
- }
- if (newSpin > -1) {
- resSpin_ = newSpin;
- std::cout << "INFO in LauAbsResonance::changeResonance : Setting spin to " << resSpin_ << std::endl;
- }
-}
-
-void LauAbsResonance::changeBWBarrierRadii(const Double_t resRadius, const Double_t parRadius)
-{
- if ( resRadius >= 0.0 && resBWFactor_ != 0 ) {
- LauParameter* resBWRadius = resBWFactor_->getRadiusParameter();
- resBWRadius->value(resRadius);
- resBWRadius->initValue(resRadius);
- resBWRadius->genValue(resRadius);
- std::cout << "INFO in LauAbsResonance::changeBWBarrierRadii : Setting resonance factor radius to " << resBWRadius->value() << std::endl;
- }
- if ( parRadius >= 0.0 && parBWFactor_ != 0 ) {
- LauParameter* parBWRadius = parBWFactor_->getRadiusParameter();
- parBWRadius->value(parRadius);
- parBWRadius->initValue(parRadius);
- parBWRadius->genValue(parRadius);
- std::cout << "INFO in LauAbsResonance::changeBWBarrierRadii : Setting parent factor radius to " << parBWRadius->value() << std::endl;
- }
-}
-
-void LauAbsResonance::setResonanceParameter(const TString& name, const Double_t value)
-{
- //This function should always be overwritten if needed in classes inheriting from LauAbsResonance.
- std::cerr << "WARNING in LauAbsResonance::setResonanceParameter : Unable to set parameter \"" << name << "\" to value: " << value << "." << std::endl;
-}
-
-void LauAbsResonance::floatResonanceParameter(const TString& name)
-{
- //This function should always be overwritten if needed in classes inheriting from LauAbsResonance.
- std::cerr << "WARNING in LauAbsResonance::floatResonanceParameter : Unable to release parameter \"" << name << "\"." << std::endl;
-}
-
-LauParameter* LauAbsResonance::getResonanceParameter(const TString& name)
-{
- //This function should always be overwritten if needed in classes inheriting from LauAbsResonance.
- std::cerr << "WARNING in LauAbsResonance::getResonanceParameter : Unable to get parameter \"" << name << "\"." << std::endl;
- return 0;
+ Double_t legPol = 1.0;
+
+ if ( resSpin_ == 1 ) {
+ // Calculate vector resonance Legendre polynomial
+ legPol = -2.0 * cosHel_;
+ } else if ( resSpin_ == 2 ) {
+ // Calculate tensor resonance Legendre polynomial
+ legPol = 4.0 * ( 3.0 * cosHel_ * cosHel_ - 1.0 ) / 3.0;
+ } else if ( resSpin_ == 3 ) {
+ // Calculate spin 3 resonance Legendre polynomial
+ legPol = -8.0 * ( 5.0 * cosHel_ * cosHel_ * cosHel_ - 3.0 * cosHel_ ) / 5.0;
+ } else if ( resSpin_ == 4 ) {
+ // Calculate spin 4 resonance Legendre polynomial
+ legPol = 16.0 *
+ ( 35.0 * cosHel_ * cosHel_ * cosHel_ * cosHel_ - 30.0 * cosHel_ * cosHel_ + 3.0 ) /
+ 35.0;
+ } else if ( resSpin_ == 5 ) {
+ // Calculate spin 5 resonance Legendre polynomial
+ legPol = -32.0 *
+ ( 63.0 * cosHel_ * cosHel_ * cosHel_ * cosHel_ * cosHel_ -
+ 70.0 * cosHel_ * cosHel_ * cosHel_ + 15.0 * cosHel_ ) /
+ 63.0;
+ } else if ( resSpin_ > 5 ) {
+ std::cerr << "WARNING in LauAbsResonance::calcLegendrePoly : Legendre polynomials not (yet) implemented for spin > 5"
+ << std::endl;
+ }
+
+ return legPol;
+}
+
+void LauAbsResonance::changeResonance( const Double_t newMass,
+ const Double_t newWidth,
+ const Int_t newSpin )
+{
+ if ( newMass > 0.0 ) {
+ resMass_->valueAndRange( newMass, 0.0, 3.0 * newMass );
+ resMass_->initValue( newMass );
+ resMass_->genValue( newMass );
+ std::cout << "INFO in LauAbsResonance::changeResonance : Setting mass to "
+ << resMass_->value() << std::endl;
+ }
+ if ( newWidth > 0.0 ) {
+ resWidth_->valueAndRange( newWidth, 0.0, 3.0 * newWidth );
+ resWidth_->initValue( newWidth );
+ resWidth_->genValue( newWidth );
+ std::cout << "INFO in LauAbsResonance::changeResonance : Setting width to "
+ << resWidth_->value() << std::endl;
+ }
+ if ( newSpin > -1 ) {
+ resSpin_ = newSpin;
+ std::cout << "INFO in LauAbsResonance::changeResonance : Setting spin to " << resSpin_
+ << std::endl;
+ }
+}
+
+void LauAbsResonance::changeBWBarrierRadii( const Double_t resRadius, const Double_t parRadius )
+{
+ if ( resRadius >= 0.0 && resBWFactor_ != 0 ) {
+ LauParameter* resBWRadius = resBWFactor_->getRadiusParameter();
+ resBWRadius->value( resRadius );
+ resBWRadius->initValue( resRadius );
+ resBWRadius->genValue( resRadius );
+ std::cout << "INFO in LauAbsResonance::changeBWBarrierRadii : Setting resonance factor radius to "
+ << resBWRadius->value() << std::endl;
+ }
+ if ( parRadius >= 0.0 && parBWFactor_ != 0 ) {
+ LauParameter* parBWRadius = parBWFactor_->getRadiusParameter();
+ parBWRadius->value( parRadius );
+ parBWRadius->initValue( parRadius );
+ parBWRadius->genValue( parRadius );
+ std::cout << "INFO in LauAbsResonance::changeBWBarrierRadii : Setting parent factor radius to "
+ << parBWRadius->value() << std::endl;
+ }
+}
+
+void LauAbsResonance::setResonanceParameter( const TString& name, const Double_t value )
+{
+ //This function should always be overwritten if needed in classes inheriting from LauAbsResonance.
+ std::cerr << "WARNING in LauAbsResonance::setResonanceParameter : Unable to set parameter \""
+ << name << "\" to value: " << value << "." << std::endl;
+}
+
+void LauAbsResonance::floatResonanceParameter( const TString& name )
+{
+ //This function should always be overwritten if needed in classes inheriting from LauAbsResonance.
+ std::cerr << "WARNING in LauAbsResonance::floatResonanceParameter : Unable to release parameter \""
+ << name << "\"." << std::endl;
+}
+
+LauParameter* LauAbsResonance::getResonanceParameter( const TString& name )
+{
+ //This function should always be overwritten if needed in classes inheriting from LauAbsResonance.
+ std::cerr << "WARNING in LauAbsResonance::getResonanceParameter : Unable to get parameter \""
+ << name << "\"." << std::endl;
+ return 0;
}
void LauAbsResonance::addFloatingParameter( LauParameter* param )
{
- if ( param == 0 ) {
- return;
- }
+ if ( param == 0 ) {
+ return;
+ }
- if ( param->clone() ) {
- resParameters_.push_back( param->parent() );
- } else {
- resParameters_.push_back( param );
- }
+ if ( param->clone() ) {
+ resParameters_.push_back( param->parent() );
+ } else {
+ resParameters_.push_back( param );
+ }
}
-void LauAbsResonance::fixBarrierRadii(const Bool_t fixResRad, const Bool_t fixParRad)
+void LauAbsResonance::fixBarrierRadii( const Bool_t fixResRad, const Bool_t fixParRad )
{
- if ( resBWFactor_ == 0 ) {
- std::cerr << "WARNING in LauAbsResonance::fixBarrierRadii : resonance barrier factor not present, cannot fix/float it" << std::endl;
- return;
- }
+ if ( resBWFactor_ == 0 ) {
+ std::cerr << "WARNING in LauAbsResonance::fixBarrierRadii : resonance barrier factor not present, cannot fix/float it"
+ << std::endl;
+ return;
+ }
- if ( parBWFactor_ == 0 ) {
- std::cerr << "WARNING in LauAbsResonance::fixBarrierRadii : parent barrier factor not present, cannot fix/float it" << std::endl;
- return;
- }
+ if ( parBWFactor_ == 0 ) {
+ std::cerr << "WARNING in LauAbsResonance::fixBarrierRadii : parent barrier factor not present, cannot fix/float it"
+ << std::endl;
+ return;
+ }
- LauParameter* resBWRadius = resBWFactor_->getRadiusParameter();
- resBWRadius->fixed(fixResRad);
+ LauParameter* resBWRadius = resBWFactor_->getRadiusParameter();
+ resBWRadius->fixed( fixResRad );
- LauParameter* parBWRadius = parBWFactor_->getRadiusParameter();
- parBWRadius->fixed(fixParRad);
+ LauParameter* parBWRadius = parBWFactor_->getRadiusParameter();
+ parBWRadius->fixed( fixParRad );
}
Bool_t LauAbsResonance::fixResRadius() const
{
- if ( resBWFactor_ == 0 ) {
- std::cerr << "WARNING in LauAbsResonance::fixResRadius : resonance barrier factor not present" << std::endl;
- return kTRUE;
- }
+ if ( resBWFactor_ == 0 ) {
+ std::cerr << "WARNING in LauAbsResonance::fixResRadius : resonance barrier factor not present"
+ << std::endl;
+ return kTRUE;
+ }
- LauParameter* bwRadius = resBWFactor_->getRadiusParameter();
- return bwRadius->fixed();
+ LauParameter* bwRadius = resBWFactor_->getRadiusParameter();
+ return bwRadius->fixed();
}
Bool_t LauAbsResonance::fixParRadius() const
{
- if ( parBWFactor_ == 0 ) {
- std::cerr << "WARNING in LauAbsResonance::fixParRadius : parent barrier factor not present" << std::endl;
- return kTRUE;
- }
+ if ( parBWFactor_ == 0 ) {
+ std::cerr << "WARNING in LauAbsResonance::fixParRadius : parent barrier factor not present"
+ << std::endl;
+ return kTRUE;
+ }
- LauParameter* bwRadius = parBWFactor_->getRadiusParameter();
- return bwRadius->fixed();
+ LauParameter* bwRadius = parBWFactor_->getRadiusParameter();
+ return bwRadius->fixed();
}
Double_t LauAbsResonance::getResRadius() const
{
- if ( resBWFactor_ == 0 ) {
- std::cerr << "WARNING in LauAbsResonance::getResRadius : resonance barrier factor not present" << std::endl;
- return -1.0;
- }
+ if ( resBWFactor_ == 0 ) {
+ std::cerr << "WARNING in LauAbsResonance::getResRadius : resonance barrier factor not present"
+ << std::endl;
+ return -1.0;
+ }
- LauParameter* bwRadius = resBWFactor_->getRadiusParameter();
- return bwRadius->unblindValue();
+ LauParameter* bwRadius = resBWFactor_->getRadiusParameter();
+ return bwRadius->unblindValue();
}
Double_t LauAbsResonance::getParRadius() const
{
- if ( parBWFactor_ == 0 ) {
- std::cerr << "WARNING in LauAbsResonance::getParRadius : parent barrier factor not present" << std::endl;
- return -1.0;
- }
+ if ( parBWFactor_ == 0 ) {
+ std::cerr << "WARNING in LauAbsResonance::getParRadius : parent barrier factor not present"
+ << std::endl;
+ return -1.0;
+ }
- LauParameter* bwRadius = parBWFactor_->getRadiusParameter();
- return bwRadius->unblindValue();
+ LauParameter* bwRadius = parBWFactor_->getRadiusParameter();
+ return bwRadius->unblindValue();
}
Double_t LauAbsResonance::getMassParent() const
{
- // Get the parent mass
- Double_t mass(LauConstants::mB);
+ // Get the parent mass
+ Double_t mass( LauConstants::mB );
- if (daughters_) {
- mass = daughters_->getMassParent();
- }
+ if ( daughters_ ) {
+ mass = daughters_->getMassParent();
+ }
- return mass;
+ return mass;
}
Double_t LauAbsResonance::getMassDaug1() const
{
- // Get the daughter mass
- Double_t mass(LauConstants::mPi);
+ // Get the daughter mass
+ Double_t mass( LauConstants::mPi );
- if (daughters_) {
- if (resPairAmpInt_ == 1) {
- mass = daughters_->getMassDaug2();
- } else if (resPairAmpInt_ == 2) {
- mass = daughters_->getMassDaug1();
- } else if (resPairAmpInt_ == 3) {
- mass = daughters_->getMassDaug1();
- }
- }
+ if ( daughters_ ) {
+ if ( resPairAmpInt_ == 1 ) {
+ mass = daughters_->getMassDaug2();
+ } else if ( resPairAmpInt_ == 2 ) {
+ mass = daughters_->getMassDaug1();
+ } else if ( resPairAmpInt_ == 3 ) {
+ mass = daughters_->getMassDaug1();
+ }
+ }
- return mass;
+ return mass;
}
Double_t LauAbsResonance::getMassDaug2() const
{
- // Get the daughter mass
- Double_t mass(LauConstants::mPi);
+ // Get the daughter mass
+ Double_t mass( LauConstants::mPi );
- if (daughters_) {
- if (resPairAmpInt_ == 1) {
- mass = daughters_->getMassDaug3();
- } else if (resPairAmpInt_ == 2) {
- mass = daughters_->getMassDaug3();
- } else if (resPairAmpInt_ == 3) {
- mass = daughters_->getMassDaug2();
- }
- }
+ if ( daughters_ ) {
+ if ( resPairAmpInt_ == 1 ) {
+ mass = daughters_->getMassDaug3();
+ } else if ( resPairAmpInt_ == 2 ) {
+ mass = daughters_->getMassDaug3();
+ } else if ( resPairAmpInt_ == 3 ) {
+ mass = daughters_->getMassDaug2();
+ }
+ }
- return mass;
+ return mass;
}
Double_t LauAbsResonance::getMassBachelor() const
{
- // Get the bachelor mass
- Double_t mass(LauConstants::mPi);
+ // Get the bachelor mass
+ Double_t mass( LauConstants::mPi );
- if (daughters_) {
- if (resPairAmpInt_ == 1) {
- mass = daughters_->getMassDaug1();
- } else if (resPairAmpInt_ == 2) {
- mass = daughters_->getMassDaug2();
- } else if (resPairAmpInt_ == 3) {
- mass = daughters_->getMassDaug3();
- }
- }
+ if ( daughters_ ) {
+ if ( resPairAmpInt_ == 1 ) {
+ mass = daughters_->getMassDaug1();
+ } else if ( resPairAmpInt_ == 2 ) {
+ mass = daughters_->getMassDaug2();
+ } else if ( resPairAmpInt_ == 3 ) {
+ mass = daughters_->getMassDaug3();
+ }
+ }
- return mass;
+ return mass;
}
Int_t LauAbsResonance::getChargeParent() const
{
- // Get the parent charge
- Int_t charge(0);
+ // Get the parent charge
+ Int_t charge( 0 );
- if (daughters_) {
- charge = daughters_->getChargeParent();
- }
+ if ( daughters_ ) {
+ charge = daughters_->getChargeParent();
+ }
- return charge;
+ return charge;
}
Int_t LauAbsResonance::getChargeDaug1() const
{
- // Get the daughter charge
- Int_t charge(0);
+ // Get the daughter charge
+ Int_t charge( 0 );
- if (daughters_) {
- if (resPairAmpInt_ == 1) {
- charge = daughters_->getChargeDaug2();
- } else if (resPairAmpInt_ == 2) {
- charge = daughters_->getChargeDaug1();
- } else if (resPairAmpInt_ == 3) {
- charge = daughters_->getChargeDaug1();
- }
- }
+ if ( daughters_ ) {
+ if ( resPairAmpInt_ == 1 ) {
+ charge = daughters_->getChargeDaug2();
+ } else if ( resPairAmpInt_ == 2 ) {
+ charge = daughters_->getChargeDaug1();
+ } else if ( resPairAmpInt_ == 3 ) {
+ charge = daughters_->getChargeDaug1();
+ }
+ }
- return charge;
+ return charge;
}
Int_t LauAbsResonance::getChargeDaug2() const
{
- // Get the daughter charge
- Int_t charge(0);
+ // Get the daughter charge
+ Int_t charge( 0 );
- if (daughters_) {
- if (resPairAmpInt_ == 1) {
- charge = daughters_->getChargeDaug3();
- } else if (resPairAmpInt_ == 2) {
- charge = daughters_->getChargeDaug3();
- } else if (resPairAmpInt_ == 3) {
- charge = daughters_->getChargeDaug2();
- }
- }
+ if ( daughters_ ) {
+ if ( resPairAmpInt_ == 1 ) {
+ charge = daughters_->getChargeDaug3();
+ } else if ( resPairAmpInt_ == 2 ) {
+ charge = daughters_->getChargeDaug3();
+ } else if ( resPairAmpInt_ == 3 ) {
+ charge = daughters_->getChargeDaug2();
+ }
+ }
- return charge;
+ return charge;
}
Int_t LauAbsResonance::getChargeBachelor() const
{
- // Get the bachelor charge
- Int_t charge(0);
+ // Get the bachelor charge
+ Int_t charge( 0 );
- if (daughters_) {
- if (resPairAmpInt_ == 1) {
- charge = daughters_->getChargeDaug1();
- } else if (resPairAmpInt_ == 2) {
- charge = daughters_->getChargeDaug2();
- } else if (resPairAmpInt_ == 3) {
- charge = daughters_->getChargeDaug3();
- }
- }
+ if ( daughters_ ) {
+ if ( resPairAmpInt_ == 1 ) {
+ charge = daughters_->getChargeDaug1();
+ } else if ( resPairAmpInt_ == 2 ) {
+ charge = daughters_->getChargeDaug2();
+ } else if ( resPairAmpInt_ == 3 ) {
+ charge = daughters_->getChargeDaug3();
+ }
+ }
- return charge;
+ return charge;
}
TString LauAbsResonance::getNameParent() const
{
- // Get the parent name
- TString name("");
+ // Get the parent name
+ TString name( "" );
- if (daughters_) {
- name = daughters_->getNameParent();
- }
+ if ( daughters_ ) {
+ name = daughters_->getNameParent();
+ }
- return name;
+ return name;
}
TString LauAbsResonance::getNameDaug1() const
{
- // Get the daughter name
- TString name("");
+ // Get the daughter name
+ TString name( "" );
- if (daughters_) {
- if (resPairAmpInt_ == 1) {
- name = daughters_->getNameDaug2();
- } else if (resPairAmpInt_ == 2) {
- name = daughters_->getNameDaug1();
- } else if (resPairAmpInt_ == 3) {
- name = daughters_->getNameDaug1();
- }
- }
+ if ( daughters_ ) {
+ if ( resPairAmpInt_ == 1 ) {
+ name = daughters_->getNameDaug2();
+ } else if ( resPairAmpInt_ == 2 ) {
+ name = daughters_->getNameDaug1();
+ } else if ( resPairAmpInt_ == 3 ) {
+ name = daughters_->getNameDaug1();
+ }
+ }
- return name;
+ return name;
}
TString LauAbsResonance::getNameDaug2() const
{
- // Get the daughter name
- TString name("");
+ // Get the daughter name
+ TString name( "" );
- if (daughters_) {
- if (resPairAmpInt_ == 1) {
- name = daughters_->getNameDaug3();
- } else if (resPairAmpInt_ == 2) {
- name = daughters_->getNameDaug3();
- } else if (resPairAmpInt_ == 3) {
- name = daughters_->getNameDaug2();
- }
- }
+ if ( daughters_ ) {
+ if ( resPairAmpInt_ == 1 ) {
+ name = daughters_->getNameDaug3();
+ } else if ( resPairAmpInt_ == 2 ) {
+ name = daughters_->getNameDaug3();
+ } else if ( resPairAmpInt_ == 3 ) {
+ name = daughters_->getNameDaug2();
+ }
+ }
- return name;
+ return name;
}
TString LauAbsResonance::getNameBachelor() const
{
- // Get the bachelor name
- TString name("");
+ // Get the bachelor name
+ TString name( "" );
- if (daughters_) {
- if (resPairAmpInt_ == 1) {
- name = daughters_->getNameDaug1();
- } else if (resPairAmpInt_ == 2) {
- name = daughters_->getNameDaug2();
- } else if (resPairAmpInt_ == 3) {
- name = daughters_->getNameDaug3();
- }
- }
+ if ( daughters_ ) {
+ if ( resPairAmpInt_ == 1 ) {
+ name = daughters_->getNameDaug1();
+ } else if ( resPairAmpInt_ == 2 ) {
+ name = daughters_->getNameDaug2();
+ } else if ( resPairAmpInt_ == 3 ) {
+ name = daughters_->getNameDaug3();
+ }
+ }
- return name;
+ return name;
}
-
diff --git a/src/LauArgusPdf.cc b/src/LauArgusPdf.cc
index 87b7a9f..52905a5 100644
--- a/src/LauArgusPdf.cc
+++ b/src/LauArgusPdf.cc
@@ -1,148 +1,155 @@
/*
Copyright 2006 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauArgusPdf.cc
\brief File containing implementation of LauArgusPdf class.
*/
-#include <iostream>
-#include <vector>
-
-#include "TMath.h"
-#include "TSystem.h"
-
#include "LauArgusPdf.hh"
+
#include "LauConstants.hh"
+#include "TMath.h"
+#include "TSystem.h"
+#include <iostream>
+#include <vector>
-LauArgusPdf::LauArgusPdf(const TString& theVarName, const std::vector<LauAbsRValue*>& params, Double_t minAbscissa, Double_t maxAbscissa) :
- LauAbsPdf(theVarName, params, minAbscissa, maxAbscissa),
- xi_(0),
- m0_(0)
+LauArgusPdf::LauArgusPdf( const TString& theVarName,
+ const std::vector<LauAbsRValue*>& params,
+ Double_t minAbscissa,
+ Double_t maxAbscissa ) :
+ LauAbsPdf( theVarName, params, minAbscissa, maxAbscissa ),
+ xi_( 0 ),
+ m0_( 0 )
{
- // Constructor for the ARGUS PDF.
- //
- // The parameters in params are the shape, xi, and the end-point of the curve.
- // The last two arguments specify the range in which the PDF is defined, and the PDF
- // will be normalised w.r.t. these limits.
-
- xi_ = this->findParameter("xi");
- m0_ = this->findParameter("m0");
-
- if ((this->nParameters() != 2) || (xi_ == 0) || (m0_ == 0)) {
- std::cerr << "ERROR in LauArgusPdf constructor: LauArgusPdf requires 2 parameters: argus shape parameter, \"xi\", and end-point, \"m0\"." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // Cache the normalisation factor.
- this->calcNorm();
+ // Constructor for the ARGUS PDF.
+ //
+ // The parameters in params are the shape, xi, and the end-point of the curve.
+ // The last two arguments specify the range in which the PDF is defined, and the PDF
+ // will be normalised w.r.t. these limits.
+
+ xi_ = this->findParameter( "xi" );
+ m0_ = this->findParameter( "m0" );
+
+ if ( ( this->nParameters() != 2 ) || ( xi_ == 0 ) || ( m0_ == 0 ) ) {
+ std::cerr << "ERROR in LauArgusPdf constructor: LauArgusPdf requires 2 parameters: argus shape parameter, \"xi\", and end-point, \"m0\"."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // Cache the normalisation factor.
+ this->calcNorm();
}
-LauArgusPdf::~LauArgusPdf()
+LauArgusPdf::~LauArgusPdf()
{
- // Destructor
+ // Destructor
}
-void LauArgusPdf::calcLikelihoodInfo(const LauAbscissas& abscissas)
+void LauArgusPdf::calcLikelihoodInfo( const LauAbscissas& abscissas )
{
- // Check that the given abscissa is within the allowed range
- if (!this->checkRange(abscissas)) {
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // Get our abscissa
- Double_t abscissa = abscissas[0];
-
- // Get the up to date parameter values
- Double_t xi = xi_->unblindValue();
- Double_t m0 = m0_->unblindValue();
-
- // Calculate the value of the ARGUS function for the given value of the abscissa.
- Double_t x = abscissa/m0;
-
- Double_t term = 1.0 - x*x;
- if (term < 0.0) {term = 0.0;} // In case |x| > 1.0 (which should happen rarely).
-
- Double_t value = abscissa*TMath::Sqrt(term)*TMath::Exp(-xi*term);
- this->setUnNormPDFVal(value);
-
- // if the parameters are floating then we
- // need to recalculate the normalisation
- if (!this->cachePDF() && !this->withinNormCalc() && !this->withinGeneration()) {
- this->calcNorm();
- }
+ // Check that the given abscissa is within the allowed range
+ if ( ! this->checkRange( abscissas ) ) {
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // Get our abscissa
+ Double_t abscissa = abscissas[0];
+
+ // Get the up to date parameter values
+ Double_t xi = xi_->unblindValue();
+ Double_t m0 = m0_->unblindValue();
+
+ // Calculate the value of the ARGUS function for the given value of the abscissa.
+ Double_t x = abscissa / m0;
+
+ Double_t term = 1.0 - x * x;
+ if ( term < 0.0 ) {
+ term = 0.0;
+ } // In case |x| > 1.0 (which should happen rarely).
+
+ Double_t value = abscissa * TMath::Sqrt( term ) * TMath::Exp( -xi * term );
+ this->setUnNormPDFVal( value );
+
+ // if the parameters are floating then we
+ // need to recalculate the normalisation
+ if ( ! this->cachePDF() && ! this->withinNormCalc() && ! this->withinGeneration() ) {
+ this->calcNorm();
+ }
}
-void LauArgusPdf::calcNorm()
+void LauArgusPdf::calcNorm()
{
- // Calculate the PDF normalisation and cache it
+ // Calculate the PDF normalisation and cache it
- // Get the up to date parameter values
- Double_t xi = xi_->unblindValue();
- Double_t m0 = m0_->unblindValue();
+ // Get the up to date parameter values
+ Double_t xi = xi_->unblindValue();
+ Double_t m0 = m0_->unblindValue();
- // Since the PDF is 0 above m0 by definition need to check whether m0 is within the range, above it or below it
- Double_t min = (this->getMinAbscissa() < m0) ? this->getMinAbscissa() : m0;
- Double_t max = (this->getMaxAbscissa() < m0) ? this->getMaxAbscissa() : m0;
+ // Since the PDF is 0 above m0 by definition need to check whether m0 is within the range, above it or below it
+ Double_t min = ( this->getMinAbscissa() < m0 ) ? this->getMinAbscissa() : m0;
+ Double_t max = ( this->getMaxAbscissa() < m0 ) ? this->getMaxAbscissa() : m0;
- // Define variables equivalent to "term" in calcLikelihoodInfo above but at the min and max points
- Double_t termMin = 1.0 - (min/m0)*(min/m0);
- Double_t termMax = 1.0 - (max/m0)*(max/m0);
+ // Define variables equivalent to "term" in calcLikelihoodInfo above but at the min and max points
+ Double_t termMin = 1.0 - ( min / m0 ) * ( min / m0 );
+ Double_t termMax = 1.0 - ( max / m0 ) * ( max / m0 );
- // Calculate the various terms in the integrals
- Double_t norm1 = TMath::Sqrt(termMax)*TMath::Exp(-xi*termMax) - TMath::Sqrt(termMin)*TMath::Exp(-xi*termMin);
- Double_t norm2 = LauConstants::rootPi/(2.0*TMath::Sqrt(xi)) * ( TMath::Erf(TMath::Sqrt(xi*termMax)) - TMath::Erf(TMath::Sqrt(xi*termMin)) );
+ // Calculate the various terms in the integrals
+ Double_t norm1 = TMath::Sqrt( termMax ) * TMath::Exp( -xi * termMax ) -
+ TMath::Sqrt( termMin ) * TMath::Exp( -xi * termMin );
+ Double_t norm2 = LauConstants::rootPi / ( 2.0 * TMath::Sqrt( xi ) ) *
+ ( TMath::Erf( TMath::Sqrt( xi * termMax ) ) -
+ TMath::Erf( TMath::Sqrt( xi * termMin ) ) );
- // Combine them and set the normalisation
- Double_t norm = m0*m0*(norm1 - norm2)/(2.0*xi);
+ // Combine them and set the normalisation
+ Double_t norm = m0 * m0 * ( norm1 - norm2 ) / ( 2.0 * xi );
- this->setNorm(norm);
+ this->setNorm( norm );
}
void LauArgusPdf::calcPDFHeight( const LauKinematics* /*kinematics*/ )
{
- if (this->heightUpToDate()) {
- return;
- }
-
- // Calculate the PDF height of the ARGUS function.
- // Get the up to date parameter values
- Double_t xi = xi_->unblindValue();
- Double_t m0 = m0_->unblindValue();
-
- // First make sure that the limits are not larger than the end-point.
- // (Btw, use the logarithmic derivative to derive this formula)
- Double_t term = xi*xi + 1.0;
- Double_t x = TMath::Sqrt((TMath::Sqrt(term) - 1.0 + xi)/(2.0*xi));
- x = (x*m0 >= this->getMinAbscissa()) ? x*m0 : this->getMinAbscissa();
-
- LauAbscissas abscissa(1);
- abscissa[0] = x;
- this->calcLikelihoodInfo(abscissa);
-
- Double_t height = this->getUnNormLikelihood();
- this->setMaxHeight(height);
+ if ( this->heightUpToDate() ) {
+ return;
+ }
+
+ // Calculate the PDF height of the ARGUS function.
+ // Get the up to date parameter values
+ Double_t xi = xi_->unblindValue();
+ Double_t m0 = m0_->unblindValue();
+
+ // First make sure that the limits are not larger than the end-point.
+ // (Btw, use the logarithmic derivative to derive this formula)
+ Double_t term = xi * xi + 1.0;
+ Double_t x = TMath::Sqrt( ( TMath::Sqrt( term ) - 1.0 + xi ) / ( 2.0 * xi ) );
+ x = ( x * m0 >= this->getMinAbscissa() ) ? x * m0 : this->getMinAbscissa();
+
+ LauAbscissas abscissa( 1 );
+ abscissa[0] = x;
+ this->calcLikelihoodInfo( abscissa );
+
+ Double_t height = this->getUnNormLikelihood();
+ this->setMaxHeight( height );
}
-
diff --git a/src/LauAsymmCalc.cc b/src/LauAsymmCalc.cc
index cee5894..072a4d4 100644
--- a/src/LauAsymmCalc.cc
+++ b/src/LauAsymmCalc.cc
@@ -1,75 +1,72 @@
/*
Copyright 2004 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauAsymmCalc.cc
\brief File containing implementation of LauAsymmCalc class.
*/
-#include "TMath.h"
-
#include "LauAsymmCalc.hh"
+#include "TMath.h"
-
-LauAsymmCalc::LauAsymmCalc(Double_t negValue, Double_t posValue) :
- negValue_(negValue),
- posValue_(posValue),
- asymm_(0.0)
+LauAsymmCalc::LauAsymmCalc( Double_t negValue, Double_t posValue ) :
+ negValue_( negValue ),
+ posValue_( posValue ),
+ asymm_( 0.0 )
{
- asymm_ = calcAsymmetry();
+ asymm_ = calcAsymmetry();
}
-LauAsymmCalc::LauAsymmCalc(const LauAsymmCalc& rhs) :
- negValue_(rhs.negValue_),
- posValue_(rhs.posValue_),
- asymm_(rhs.asymm_)
+LauAsymmCalc::LauAsymmCalc( const LauAsymmCalc& rhs ) :
+ negValue_( rhs.negValue_ ),
+ posValue_( rhs.posValue_ ),
+ asymm_( rhs.asymm_ )
{
}
-LauAsymmCalc& LauAsymmCalc::operator=(const LauAsymmCalc& rhs)
+LauAsymmCalc& LauAsymmCalc::operator=( const LauAsymmCalc& rhs )
{
- if ( &rhs != this ) {
- negValue_ = rhs.negValue_;
- posValue_ = rhs.posValue_;
- asymm_ = rhs.asymm_;
- }
- return *this;
+ if ( &rhs != this ) {
+ negValue_ = rhs.negValue_;
+ posValue_ = rhs.posValue_;
+ asymm_ = rhs.asymm_;
+ }
+ return *this;
}
LauAsymmCalc::~LauAsymmCalc()
{
}
Double_t LauAsymmCalc::calcAsymmetry()
{
- Double_t num = negValue_ - posValue_;
- Double_t denom = negValue_ + posValue_;
- Double_t asymm(0.0);
- if (TMath::Abs(denom) > 1e-10) {
- asymm = num/denom;
- }
-
- return asymm;
+ Double_t num = negValue_ - posValue_;
+ Double_t denom = negValue_ + posValue_;
+ Double_t asymm( 0.0 );
+ if ( TMath::Abs( denom ) > 1e-10 ) {
+ asymm = num / denom;
+ }
+
+ return asymm;
}
-
diff --git a/src/LauBelleCPCoeffSet.cc b/src/LauBelleCPCoeffSet.cc
index edfe493..00902cb 100644
--- a/src/LauBelleCPCoeffSet.cc
+++ b/src/LauBelleCPCoeffSet.cc
@@ -1,348 +1,381 @@
/*
Copyright 2006 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauBelleCPCoeffSet.cc
\brief File containing implementation of LauBelleCPCoeffSet class.
*/
-#include <iostream>
-#include <fstream>
-#include <vector>
-
-#include "TMath.h"
-#include "TRandom.h"
+#include "LauBelleCPCoeffSet.hh"
#include "LauComplex.hh"
#include "LauConstants.hh"
-#include "LauBelleCPCoeffSet.hh"
#include "LauParameter.hh"
#include "LauPrint.hh"
+#include "TMath.h"
+#include "TRandom.h"
+#include <fstream>
+#include <iostream>
+#include <vector>
-LauBelleCPCoeffSet::LauBelleCPCoeffSet(const TString& compName, Double_t a, Double_t delta, Double_t b, Double_t phi,
- Bool_t aFixed, Bool_t deltaFixed, Bool_t bFixed, Bool_t phiFixed, Bool_t bSecondStage, Bool_t phiSecondStage) :
- LauAbsCoeffSet(compName),
- a_(new LauParameter("A", a, minMagnitude_, maxMagnitude_, aFixed)),
- b_(new LauParameter("B", b, minMagnitude_, maxMagnitude_, bFixed)),
- delta_(new LauParameter("Delta", delta, minPhase_, maxPhase_, deltaFixed)),
- phi_(new LauParameter("Phi", phi, minPhase_, maxPhase_, phiFixed)),
- particleCoeff_(0.0,0.0),
- antiparticleCoeff_(0.0,0.0),
- acp_("ACP", (-2.0*b*TMath::Cos(phi))/(1.0+b*b), -1.0, 1.0, bFixed&&phiFixed)
+LauBelleCPCoeffSet::LauBelleCPCoeffSet( const TString& compName,
+ Double_t a,
+ Double_t delta,
+ Double_t b,
+ Double_t phi,
+ Bool_t aFixed,
+ Bool_t deltaFixed,
+ Bool_t bFixed,
+ Bool_t phiFixed,
+ Bool_t bSecondStage,
+ Bool_t phiSecondStage ) :
+ LauAbsCoeffSet( compName ),
+ a_( new LauParameter( "A", a, minMagnitude_, maxMagnitude_, aFixed ) ),
+ b_( new LauParameter( "B", b, minMagnitude_, maxMagnitude_, bFixed ) ),
+ delta_( new LauParameter( "Delta", delta, minPhase_, maxPhase_, deltaFixed ) ),
+ phi_( new LauParameter( "Phi", phi, minPhase_, maxPhase_, phiFixed ) ),
+ particleCoeff_( 0.0, 0.0 ),
+ antiparticleCoeff_( 0.0, 0.0 ),
+ acp_( "ACP", ( -2.0 * b * TMath::Cos( phi ) ) / ( 1.0 + b * b ), -1.0, 1.0, bFixed && phiFixed )
{
- if (bSecondStage && !bFixed) {
- b_->secondStage(kTRUE);
- b_->initValue(0.0);
- }
- if (phiSecondStage && !phiFixed) {
- phi_->secondStage(kTRUE);
- phi_->initValue(0.0);
- }
+ if ( bSecondStage && ! bFixed ) {
+ b_->secondStage( kTRUE );
+ b_->initValue( 0.0 );
+ }
+ if ( phiSecondStage && ! phiFixed ) {
+ phi_->secondStage( kTRUE );
+ phi_->initValue( 0.0 );
+ }
}
-LauBelleCPCoeffSet::LauBelleCPCoeffSet(const LauBelleCPCoeffSet& rhs, CloneOption cloneOption, Double_t constFactor) : LauAbsCoeffSet(rhs.name()),
- a_(0),
- b_(0),
- delta_(0),
- phi_(0),
- particleCoeff_( rhs.particleCoeff_ ),
- antiparticleCoeff_( rhs.antiparticleCoeff_ ),
- acp_( rhs.acp_ )
+LauBelleCPCoeffSet::LauBelleCPCoeffSet( const LauBelleCPCoeffSet& rhs,
+ CloneOption cloneOption,
+ Double_t constFactor ) :
+ LauAbsCoeffSet( rhs.name() ),
+ a_( 0 ),
+ b_( 0 ),
+ delta_( 0 ),
+ phi_( 0 ),
+ particleCoeff_( rhs.particleCoeff_ ),
+ antiparticleCoeff_( rhs.antiparticleCoeff_ ),
+ acp_( rhs.acp_ )
{
- if ( cloneOption == All || cloneOption == TieMagnitude ) {
- a_ = rhs.a_->createClone(constFactor);
- } else {
- a_ = new LauParameter("A", rhs.a_->value(), minMagnitude_, maxMagnitude_, rhs.a_->fixed());
- if ( rhs.a_->blind() ) {
- const LauBlind* blinder = rhs.a_->blinder();
- a_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
- }
- }
-
- if ( cloneOption == All || cloneOption == TieCPPars ) {
- b_ = rhs.b_->createClone(constFactor);
- } else {
- b_ = new LauParameter("B", rhs.b_->value(), minMagnitude_, maxMagnitude_, rhs.b_->fixed());
- if ( rhs.b_->blind() ) {
- const LauBlind* blinder = rhs.b_->blinder();
- b_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
- }
- }
-
- if ( cloneOption == All || cloneOption == TiePhase ) {
- delta_ = rhs.delta_->createClone(constFactor);
- } else {
- delta_ = new LauParameter("Delta", rhs.delta_->value(), minPhase_, maxPhase_, rhs.delta_->fixed());
- if ( rhs.delta_->blind() ) {
- const LauBlind* blinder = rhs.delta_->blinder();
- delta_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
- }
- }
-
- if ( cloneOption == All || cloneOption == TieCPPars ) {
- phi_ = rhs.phi_->createClone(constFactor);
- } else {
- phi_ = new LauParameter("Phi", rhs.phi_->value(), minPhase_, maxPhase_, rhs.phi_->fixed());
- if ( rhs.phi_->blind() ) {
- const LauBlind* blinder = rhs.phi_->blinder();
- phi_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
- }
- }
+ if ( cloneOption == All || cloneOption == TieMagnitude ) {
+ a_ = rhs.a_->createClone( constFactor );
+ } else {
+ a_ = new LauParameter( "A", rhs.a_->value(), minMagnitude_, maxMagnitude_, rhs.a_->fixed() );
+ if ( rhs.a_->blind() ) {
+ const LauBlind* blinder = rhs.a_->blinder();
+ a_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
+ }
+ }
+
+ if ( cloneOption == All || cloneOption == TieCPPars ) {
+ b_ = rhs.b_->createClone( constFactor );
+ } else {
+ b_ = new LauParameter( "B", rhs.b_->value(), minMagnitude_, maxMagnitude_, rhs.b_->fixed() );
+ if ( rhs.b_->blind() ) {
+ const LauBlind* blinder = rhs.b_->blinder();
+ b_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
+ }
+ }
+
+ if ( cloneOption == All || cloneOption == TiePhase ) {
+ delta_ = rhs.delta_->createClone( constFactor );
+ } else {
+ delta_ =
+ new LauParameter( "Delta", rhs.delta_->value(), minPhase_, maxPhase_, rhs.delta_->fixed() );
+ if ( rhs.delta_->blind() ) {
+ const LauBlind* blinder = rhs.delta_->blinder();
+ delta_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
+ }
+ }
+
+ if ( cloneOption == All || cloneOption == TieCPPars ) {
+ phi_ = rhs.phi_->createClone( constFactor );
+ } else {
+ phi_ = new LauParameter( "Phi", rhs.phi_->value(), minPhase_, maxPhase_, rhs.phi_->fixed() );
+ if ( rhs.phi_->blind() ) {
+ const LauBlind* blinder = rhs.phi_->blinder();
+ phi_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
+ }
+ }
}
std::vector<LauParameter*> LauBelleCPCoeffSet::getParameters()
{
- std::vector<LauParameter*> pars;
- pars.push_back(a_);
- pars.push_back(b_);
- pars.push_back(delta_);
- pars.push_back(phi_);
- return pars;
+ std::vector<LauParameter*> pars;
+ pars.push_back( a_ );
+ pars.push_back( b_ );
+ pars.push_back( delta_ );
+ pars.push_back( phi_ );
+ return pars;
}
void LauBelleCPCoeffSet::printParValues() const
{
- std::cout<<"INFO in LauBelleCPCoeffSet::printParValues : Component \""<<this->name()<<"\" has ";
- std::cout<<"a-magnitude = "<<a_->value()<<",\t";
- std::cout<<"delta = "<<delta_->value()<<",\t";
- std::cout<<"b-magnitude = "<<b_->value()<<",\t";
- std::cout<<"phi = "<<phi_->value()<<"."<<std::endl;
+ std::cout << "INFO in LauBelleCPCoeffSet::printParValues : Component \"" << this->name()
+ << "\" has ";
+ std::cout << "a-magnitude = " << a_->value() << ",\t";
+ std::cout << "delta = " << delta_->value() << ",\t";
+ std::cout << "b-magnitude = " << b_->value() << ",\t";
+ std::cout << "phi = " << phi_->value() << "." << std::endl;
}
-void LauBelleCPCoeffSet::printTableHeading(std::ostream& stream) const
+void LauBelleCPCoeffSet::printTableHeading( std::ostream& stream ) const
{
- stream<<"\\begin{tabular}{|l|c|c|c|c|}"<<std::endl;
- stream<<"\\hline"<<std::endl;
- stream<<"Component & a-Magnitude & delta & b-Magnitude & phi \\\\"<<std::endl;
- stream<<"\\hline"<<std::endl;
+ stream << "\\begin{tabular}{|l|c|c|c|c|}" << std::endl;
+ stream << "\\hline" << std::endl;
+ stream << "Component & a-Magnitude & delta & b-Magnitude & phi \\\\" << std::endl;
+ stream << "\\hline" << std::endl;
}
-void LauBelleCPCoeffSet::printTableRow(std::ostream& stream) const
+void LauBelleCPCoeffSet::printTableRow( std::ostream& stream ) const
{
- LauPrint print;
- TString resName = this->name();
- resName = resName.ReplaceAll("_", "\\_");
- stream<<resName<<" & $";
- print.printFormat(stream, a_->value());
- stream<<" \\pm ";
- print.printFormat(stream, a_->error());
- stream<<"$ & $";
- print.printFormat(stream, delta_->value());
- stream<<" \\pm ";
- print.printFormat(stream, delta_->error());
- stream<<"$ & $";
- print.printFormat(stream, b_->value());
- stream<<" \\pm ";
- print.printFormat(stream, b_->error());
- stream<<"$ & $";
- print.printFormat(stream, phi_->value());
- stream<<" \\pm ";
- print.printFormat(stream, phi_->error());
- stream<<"$ \\\\"<<std::endl;
+ LauPrint print;
+ TString resName = this->name();
+ resName = resName.ReplaceAll( "_", "\\_" );
+ stream << resName << " & $";
+ print.printFormat( stream, a_->value() );
+ stream << " \\pm ";
+ print.printFormat( stream, a_->error() );
+ stream << "$ & $";
+ print.printFormat( stream, delta_->value() );
+ stream << " \\pm ";
+ print.printFormat( stream, delta_->error() );
+ stream << "$ & $";
+ print.printFormat( stream, b_->value() );
+ stream << " \\pm ";
+ print.printFormat( stream, b_->error() );
+ stream << "$ & $";
+ print.printFormat( stream, phi_->value() );
+ stream << " \\pm ";
+ print.printFormat( stream, phi_->error() );
+ stream << "$ \\\\" << std::endl;
}
void LauBelleCPCoeffSet::randomiseInitValues()
{
- if (a_->fixed() == kFALSE) {
- // Choose an a-magnitude between 0.0 and 2.0
- Double_t mag = LauAbsCoeffSet::getRandomiser()->Rndm()*2.0;
- a_->initValue(mag); a_->value(mag);
- }
- if (b_->fixed() == kFALSE && b_->secondStage() == kFALSE) {
- // Choose a b-magnitude between 0.0 and 0.1
- Double_t mag = LauAbsCoeffSet::getRandomiser()->Rndm()*0.1;
- b_->initValue(mag); b_->value(mag);
- }
- if (delta_->fixed() == kFALSE) {
- // Choose a phase between +- pi
- Double_t phase = LauAbsCoeffSet::getRandomiser()->Rndm()*LauConstants::twoPi - LauConstants::pi;
- delta_->initValue(phase); delta_->value(phase);
- }
- if (phi_->fixed() == kFALSE && phi_->secondStage() == kFALSE) {
- // Choose a phase between +- pi
- Double_t phase = LauAbsCoeffSet::getRandomiser()->Rndm()*LauConstants::twoPi - LauConstants::pi;
- phi_->initValue(phase); phi_->value(phase);
- }
+ if ( a_->fixed() == kFALSE ) {
+ // Choose an a-magnitude between 0.0 and 2.0
+ Double_t mag = LauAbsCoeffSet::getRandomiser()->Rndm() * 2.0;
+ a_->initValue( mag );
+ a_->value( mag );
+ }
+ if ( b_->fixed() == kFALSE && b_->secondStage() == kFALSE ) {
+ // Choose a b-magnitude between 0.0 and 0.1
+ Double_t mag = LauAbsCoeffSet::getRandomiser()->Rndm() * 0.1;
+ b_->initValue( mag );
+ b_->value( mag );
+ }
+ if ( delta_->fixed() == kFALSE ) {
+ // Choose a phase between +- pi
+ Double_t phase = LauAbsCoeffSet::getRandomiser()->Rndm() * LauConstants::twoPi -
+ LauConstants::pi;
+ delta_->initValue( phase );
+ delta_->value( phase );
+ }
+ if ( phi_->fixed() == kFALSE && phi_->secondStage() == kFALSE ) {
+ // Choose a phase between +- pi
+ Double_t phase = LauAbsCoeffSet::getRandomiser()->Rndm() * LauConstants::twoPi -
+ LauConstants::pi;
+ phi_->initValue( phase );
+ phi_->value( phase );
+ }
}
void LauBelleCPCoeffSet::finaliseValues()
{
- // retrieve the current values from the parameters
- Double_t aVal = a_->value();
- Double_t bVal = b_->value();
- Double_t deltaVal = delta_->value();
- Double_t phiVal = phi_->value();
- Double_t genDelta = delta_->genValue();
- Double_t genPhi = phi_->genValue();
-
- // Check whether we have a negative "a" magnitude.
- // If so make it positive and add pi to the "delta" phase.
- if (aVal < 0.0) {
- aVal *= -1.0;
- deltaVal += LauConstants::pi;
- }
-
- // Check whether we have a negative "b" magnitude.
- // If so make it positive and add pi to the "phi" phase.
- if (bVal < 0.0) {
- bVal *= -1.0;
- phiVal += LauConstants::pi;
- }
-
- // Check now whether the phases lies in the right range (-pi to pi).
- Bool_t deltaWithinRange(kFALSE);
- Bool_t phiWithinRange(kFALSE);
- while (deltaWithinRange == kFALSE && phiWithinRange == kFALSE) {
- if (deltaVal > -LauConstants::pi && deltaVal < LauConstants::pi) {
- deltaWithinRange = kTRUE;
- } else {
- // Not within the specified range
- if (deltaVal > LauConstants::pi) {
- deltaVal -= LauConstants::twoPi;
- } else if (deltaVal < -LauConstants::pi) {
- deltaVal += LauConstants::twoPi;
- }
- }
-
- if (phiVal > -LauConstants::pi && phiVal < LauConstants::pi) {
- phiWithinRange = kTRUE;
- } else {
- // Not within the specified range
- if (phiVal > LauConstants::pi) {
- phiVal -= LauConstants::twoPi;
- } else if (phiVal < -LauConstants::pi) {
- phiVal += LauConstants::twoPi;
- }
- }
- }
-
- // A further problem can occur when the generated phase is close to -pi or pi.
- // The phase can wrap over to the other end of the scale -
- // this leads to artificially large pulls so we wrap it back.
- Double_t diff = deltaVal - genDelta;
- if (diff > LauConstants::pi) {
- deltaVal -= LauConstants::twoPi;
- } else if (diff < -LauConstants::pi) {
- deltaVal += LauConstants::twoPi;
- }
-
- diff = phiVal - genPhi;
- if (diff > LauConstants::pi) {
- phiVal -= LauConstants::twoPi;
- } else if (diff < -LauConstants::pi) {
- phiVal += LauConstants::twoPi;
- }
-
- // finally store the new values in the parameters
- // and update the pulls
- a_->value(aVal); a_->updatePull();
- b_->value(bVal); b_->updatePull();
- delta_->value(deltaVal); delta_->updatePull();
- phi_->value(phiVal); phi_->updatePull();
+ // retrieve the current values from the parameters
+ Double_t aVal = a_->value();
+ Double_t bVal = b_->value();
+ Double_t deltaVal = delta_->value();
+ Double_t phiVal = phi_->value();
+ Double_t genDelta = delta_->genValue();
+ Double_t genPhi = phi_->genValue();
+
+ // Check whether we have a negative "a" magnitude.
+ // If so make it positive and add pi to the "delta" phase.
+ if ( aVal < 0.0 ) {
+ aVal *= -1.0;
+ deltaVal += LauConstants::pi;
+ }
+
+ // Check whether we have a negative "b" magnitude.
+ // If so make it positive and add pi to the "phi" phase.
+ if ( bVal < 0.0 ) {
+ bVal *= -1.0;
+ phiVal += LauConstants::pi;
+ }
+
+ // Check now whether the phases lies in the right range (-pi to pi).
+ Bool_t deltaWithinRange( kFALSE );
+ Bool_t phiWithinRange( kFALSE );
+ while ( deltaWithinRange == kFALSE && phiWithinRange == kFALSE ) {
+ if ( deltaVal > -LauConstants::pi && deltaVal < LauConstants::pi ) {
+ deltaWithinRange = kTRUE;
+ } else {
+ // Not within the specified range
+ if ( deltaVal > LauConstants::pi ) {
+ deltaVal -= LauConstants::twoPi;
+ } else if ( deltaVal < -LauConstants::pi ) {
+ deltaVal += LauConstants::twoPi;
+ }
+ }
+
+ if ( phiVal > -LauConstants::pi && phiVal < LauConstants::pi ) {
+ phiWithinRange = kTRUE;
+ } else {
+ // Not within the specified range
+ if ( phiVal > LauConstants::pi ) {
+ phiVal -= LauConstants::twoPi;
+ } else if ( phiVal < -LauConstants::pi ) {
+ phiVal += LauConstants::twoPi;
+ }
+ }
+ }
+
+ // A further problem can occur when the generated phase is close to -pi or pi.
+ // The phase can wrap over to the other end of the scale -
+ // this leads to artificially large pulls so we wrap it back.
+ Double_t diff = deltaVal - genDelta;
+ if ( diff > LauConstants::pi ) {
+ deltaVal -= LauConstants::twoPi;
+ } else if ( diff < -LauConstants::pi ) {
+ deltaVal += LauConstants::twoPi;
+ }
+
+ diff = phiVal - genPhi;
+ if ( diff > LauConstants::pi ) {
+ phiVal -= LauConstants::twoPi;
+ } else if ( diff < -LauConstants::pi ) {
+ phiVal += LauConstants::twoPi;
+ }
+
+ // finally store the new values in the parameters
+ // and update the pulls
+ a_->value( aVal );
+ a_->updatePull();
+ b_->value( bVal );
+ b_->updatePull();
+ delta_->value( deltaVal );
+ delta_->updatePull();
+ phi_->value( phiVal );
+ phi_->updatePull();
}
const LauComplex& LauBelleCPCoeffSet::particleCoeff()
{
- LauComplex aTerm(a_->unblindValue()*TMath::Cos(delta_->unblindValue()), a_->unblindValue()*TMath::Sin(delta_->unblindValue()));
- LauComplex bTerm(b_->unblindValue()*TMath::Cos(phi_->unblindValue()), b_->unblindValue()*TMath::Sin(phi_->unblindValue()));
- particleCoeff_.setRealImagPart(1.0,0.0);
- particleCoeff_ += bTerm;
- particleCoeff_ *= aTerm;
- return particleCoeff_;
+ LauComplex aTerm( a_->unblindValue() * TMath::Cos( delta_->unblindValue() ),
+ a_->unblindValue() * TMath::Sin( delta_->unblindValue() ) );
+ LauComplex bTerm( b_->unblindValue() * TMath::Cos( phi_->unblindValue() ),
+ b_->unblindValue() * TMath::Sin( phi_->unblindValue() ) );
+ particleCoeff_.setRealImagPart( 1.0, 0.0 );
+ particleCoeff_ += bTerm;
+ particleCoeff_ *= aTerm;
+ return particleCoeff_;
}
const LauComplex& LauBelleCPCoeffSet::antiparticleCoeff()
{
- LauComplex aTerm(a_->unblindValue()*TMath::Cos(delta_->unblindValue()), a_->unblindValue()*TMath::Sin(delta_->unblindValue()));
- LauComplex bTerm(b_->unblindValue()*TMath::Cos(phi_->unblindValue()), b_->unblindValue()*TMath::Sin(phi_->unblindValue()));
- antiparticleCoeff_.setRealImagPart(1.0,0.0);
- antiparticleCoeff_ -= bTerm;
- antiparticleCoeff_ *= aTerm;
- return antiparticleCoeff_;
+ LauComplex aTerm( a_->unblindValue() * TMath::Cos( delta_->unblindValue() ),
+ a_->unblindValue() * TMath::Sin( delta_->unblindValue() ) );
+ LauComplex bTerm( b_->unblindValue() * TMath::Cos( phi_->unblindValue() ),
+ b_->unblindValue() * TMath::Sin( phi_->unblindValue() ) );
+ antiparticleCoeff_.setRealImagPart( 1.0, 0.0 );
+ antiparticleCoeff_ -= bTerm;
+ antiparticleCoeff_ *= aTerm;
+ return antiparticleCoeff_;
}
-void LauBelleCPCoeffSet::setCoeffValues( const LauComplex& coeff, const LauComplex& coeffBar, Bool_t init )
+void LauBelleCPCoeffSet::setCoeffValues( const LauComplex& coeff,
+ const LauComplex& coeffBar,
+ Bool_t init )
{
- LauComplex sum = coeff + coeffBar;
- LauComplex diff = coeff - coeffBar;
- LauComplex ratio = diff / sum;
-
- Double_t aVal( 0.5 * sum.abs() );
- Double_t deltaVal( sum.arg() );
- Double_t bVal( ratio.abs() );
- Double_t phiVal( ratio.arg() );
-
- a_->value( aVal );
- delta_->value( deltaVal );
- b_->value( bVal );
- phi_->value( phiVal );
-
- if ( init ) {
- a_->genValue( aVal );
- delta_->genValue( deltaVal );
- b_->genValue( bVal );
- phi_->genValue( phiVal );
-
- a_->initValue( aVal );
- delta_->initValue( deltaVal );
- b_->initValue( bVal );
- phi_->initValue( phiVal );
- }
+ LauComplex sum = coeff + coeffBar;
+ LauComplex diff = coeff - coeffBar;
+ LauComplex ratio = diff / sum;
+
+ Double_t aVal( 0.5 * sum.abs() );
+ Double_t deltaVal( sum.arg() );
+ Double_t bVal( ratio.abs() );
+ Double_t phiVal( ratio.arg() );
+
+ a_->value( aVal );
+ delta_->value( deltaVal );
+ b_->value( bVal );
+ phi_->value( phiVal );
+
+ if ( init ) {
+ a_->genValue( aVal );
+ delta_->genValue( deltaVal );
+ b_->genValue( bVal );
+ phi_->genValue( phiVal );
+
+ a_->initValue( aVal );
+ delta_->initValue( deltaVal );
+ b_->initValue( bVal );
+ phi_->initValue( phiVal );
+ }
}
LauParameter LauBelleCPCoeffSet::acp()
{
- // set the name
- TString parName(this->baseName()); parName += "_ACP";
- acp_.name(parName);
+ // set the name
+ TString parName( this->baseName() );
+ parName += "_ACP";
+ acp_.name( parName );
- // work out the ACP value
- Double_t value = (-2.0*b_->value()*TMath::Cos(phi_->value()))/(1.0+b_->value()*b_->value());
+ // work out the ACP value
+ Double_t value = ( -2.0 * b_->value() * TMath::Cos( phi_->value() ) ) /
+ ( 1.0 + b_->value() * b_->value() );
- // is it fixed?
- Bool_t fixed = b_->fixed() && phi_->fixed();
- acp_.fixed(fixed);
+ // is it fixed?
+ Bool_t fixed = b_->fixed() && phi_->fixed();
+ acp_.fixed( fixed );
- // we can't work out the error without the covariance matrix
- Double_t error(0.0);
+ // we can't work out the error without the covariance matrix
+ Double_t error( 0.0 );
- // set the value and error
- acp_.valueAndErrors(value,error);
+ // set the value and error
+ acp_.valueAndErrors( value, error );
- return acp_;
+ return acp_;
}
-LauAbsCoeffSet* LauBelleCPCoeffSet::createClone(const TString& newName, CloneOption cloneOption, Double_t constFactor)
+LauAbsCoeffSet* LauBelleCPCoeffSet::createClone( const TString& newName,
+ CloneOption cloneOption,
+ Double_t constFactor )
{
- LauAbsCoeffSet* clone(0);
- if ( cloneOption == All || cloneOption == TiePhase || cloneOption == TieMagnitude || cloneOption == TieCPPars ) {
- clone = new LauBelleCPCoeffSet( *this, cloneOption, constFactor );
- clone->name( newName );
- } else {
- std::cerr << "ERROR in LauBelleCPCoeffSet::createClone : Invalid clone option" << std::endl;
- }
- return clone;
+ LauAbsCoeffSet* clone( 0 );
+ if ( cloneOption == All || cloneOption == TiePhase || cloneOption == TieMagnitude ||
+ cloneOption == TieCPPars ) {
+ clone = new LauBelleCPCoeffSet( *this, cloneOption, constFactor );
+ clone->name( newName );
+ } else {
+ std::cerr << "ERROR in LauBelleCPCoeffSet::createClone : Invalid clone option" << std::endl;
+ }
+ return clone;
}
-
diff --git a/src/LauBelleNR.cc b/src/LauBelleNR.cc
index 940228c..a570219 100644
--- a/src/LauBelleNR.cc
+++ b/src/LauBelleNR.cc
@@ -1,149 +1,156 @@
/*
Copyright 2004 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauBelleNR.cc
\brief File containing implementation of LauBelleNR class.
*/
-#include <iostream>
-
-#include "TMath.h"
-
#include "LauBelleNR.hh"
+
#include "LauDaughters.hh"
#include "LauParameter.hh"
#include "LauResonanceInfo.hh"
+#include "TMath.h"
+#include <iostream>
-LauBelleNR::LauBelleNR(LauResonanceInfo* resInfo, const LauAbsResonance::LauResonanceModel resType,
- const Int_t resPairAmpInt, const LauDaughters* daughters) :
- LauAbsResonance(resInfo, resPairAmpInt, daughters),
- alpha_(0),
- model_(resType),
- forceLegendre_(kTRUE)
+LauBelleNR::LauBelleNR( LauResonanceInfo* resInfo,
+ const LauAbsResonance::LauResonanceModel resType,
+ const Int_t resPairAmpInt,
+ const LauDaughters* daughters ) :
+ LauAbsResonance( resInfo, resPairAmpInt, daughters ),
+ alpha_( 0 ),
+ model_( resType ),
+ forceLegendre_( kTRUE )
{
- TString parName = this->getSanitisedName();
- parName += "_alpha";
- alpha_ = resInfo->getExtraParameter( parName );
- if ( alpha_ == 0 ) {
- alpha_ = new LauParameter( parName, 0.0, -2.0, 10.0, kTRUE );
- alpha_->secondStage(kTRUE);
- resInfo->addExtraParameter( alpha_ );
- }
+ TString parName = this->getSanitisedName();
+ parName += "_alpha";
+ alpha_ = resInfo->getExtraParameter( parName );
+ if ( alpha_ == 0 ) {
+ alpha_ = new LauParameter( parName, 0.0, -2.0, 10.0, kTRUE );
+ alpha_->secondStage( kTRUE );
+ resInfo->addExtraParameter( alpha_ );
+ }
}
LauBelleNR::~LauBelleNR()
{
}
void LauBelleNR::initialise()
{
- const LauDaughters* daughters = this->getDaughters();
- Int_t resPairAmpInt = this->getPairInt();
- if ( daughters->gotSymmetricalDP() && resPairAmpInt != 3 ) {
- std::cerr << "WARNING in LauBelleNR::initialise : Dalitz plot is symmetric - this lineshape is not appropriate." << std::endl;
- }
-
- if ( model_ != LauAbsResonance::BelleNR && model_ != LauAbsResonance::PowerLawNR ) {
- std::cerr << "WARNING in LauBelleNR::initialise : Unknown model requested, defaulting to exponential." << std::endl;
- model_ = LauAbsResonance::BelleNR;
- }
-
- // Make the spin term purely the Legendre polynomial of the cos(helicity angle)
- if ( forceLegendre_ ) {
- this->setSpinType( LauAbsResonance::Legendre );
- }
+ const LauDaughters* daughters = this->getDaughters();
+ Int_t resPairAmpInt = this->getPairInt();
+ if ( daughters->gotSymmetricalDP() && resPairAmpInt != 3 ) {
+ std::cerr << "WARNING in LauBelleNR::initialise : Dalitz plot is symmetric - this lineshape is not appropriate."
+ << std::endl;
+ }
+
+ if ( model_ != LauAbsResonance::BelleNR && model_ != LauAbsResonance::PowerLawNR ) {
+ std::cerr << "WARNING in LauBelleNR::initialise : Unknown model requested, defaulting to exponential."
+ << std::endl;
+ model_ = LauAbsResonance::BelleNR;
+ }
+
+ // Make the spin term purely the Legendre polynomial of the cos(helicity angle)
+ if ( forceLegendre_ ) {
+ this->setSpinType( LauAbsResonance::Legendre );
+ }
}
-LauComplex LauBelleNR::resAmp(Double_t mass, Double_t spinTerm)
+LauComplex LauBelleNR::resAmp( Double_t mass, Double_t spinTerm )
{
- Double_t magnitude(1.0);
+ Double_t magnitude( 1.0 );
- Double_t alpha = this->getAlpha();
+ Double_t alpha = this->getAlpha();
- if ( model_ == LauAbsResonance::BelleNR ) {
- magnitude = spinTerm * TMath::Exp(-alpha*mass*mass);
- } else if ( model_ == LauAbsResonance::PowerLawNR ) {
- magnitude = spinTerm * TMath::Power(mass*mass, -alpha);
- }
+ if ( model_ == LauAbsResonance::BelleNR ) {
+ magnitude = spinTerm * TMath::Exp( -alpha * mass * mass );
+ } else if ( model_ == LauAbsResonance::PowerLawNR ) {
+ magnitude = spinTerm * TMath::Power( mass * mass, -alpha );
+ }
- LauComplex resAmplitude(magnitude, 0.0);
+ LauComplex resAmplitude( magnitude, 0.0 );
- return resAmplitude;
+ return resAmplitude;
}
const std::vector<LauParameter*>& LauBelleNR::getFloatingParameters()
{
- this->clearFloatingParameters();
+ this->clearFloatingParameters();
- if ( ! this->fixAlpha() ) {
- this->addFloatingParameter( alpha_ );
- }
+ if ( ! this->fixAlpha() ) {
+ this->addFloatingParameter( alpha_ );
+ }
- return this->getParameters();
+ return this->getParameters();
}
-void LauBelleNR::setResonanceParameter(const TString& name, const Double_t value)
+void LauBelleNR::setResonanceParameter( const TString& name, const Double_t value )
{
- // Set various parameters for the lineshape
- if (name == "alpha") {
- this->setAlpha(value);
- std::cout << "INFO in LauBelleNR::setResonanceParameter : Setting parameter alpha = " << this->getAlpha() << std::endl;
- } else {
- std::cerr << "WARNING in LauBelleNR::setResonanceParameter: Parameter name not reconised. No parameter changes made." << std::endl;
- }
+ // Set various parameters for the lineshape
+ if ( name == "alpha" ) {
+ this->setAlpha( value );
+ std::cout << "INFO in LauBelleNR::setResonanceParameter : Setting parameter alpha = "
+ << this->getAlpha() << std::endl;
+ } else {
+ std::cerr << "WARNING in LauBelleNR::setResonanceParameter: Parameter name not reconised. No parameter changes made."
+ << std::endl;
+ }
}
-void LauBelleNR::floatResonanceParameter(const TString& name)
+void LauBelleNR::floatResonanceParameter( const TString& name )
{
- if (name == "alpha") {
- if ( alpha_->fixed() ) {
- alpha_->fixed( kFALSE );
- this->addFloatingParameter( alpha_ );
- } else {
- std::cerr << "WARNING in LauBelleNR::floatResonanceParameter: Parameter already floating. No parameter changes made." << std::endl;
- }
- } else {
- std::cerr << "WARNING in LauBelleNR::fixResonanceParameter: Parameter name not reconised. No parameter changes made." << std::endl;
- }
+ if ( name == "alpha" ) {
+ if ( alpha_->fixed() ) {
+ alpha_->fixed( kFALSE );
+ this->addFloatingParameter( alpha_ );
+ } else {
+ std::cerr << "WARNING in LauBelleNR::floatResonanceParameter: Parameter already floating. No parameter changes made."
+ << std::endl;
+ }
+ } else {
+ std::cerr << "WARNING in LauBelleNR::fixResonanceParameter: Parameter name not reconised. No parameter changes made."
+ << std::endl;
+ }
}
-LauParameter* LauBelleNR::getResonanceParameter(const TString& name)
+LauParameter* LauBelleNR::getResonanceParameter( const TString& name )
{
- if (name == "alpha") {
- return alpha_;
- } else {
- std::cerr << "WARNING in LauBelleNR::getResonanceParameter: Parameter name not reconised." << std::endl;
- return 0;
- }
+ if ( name == "alpha" ) {
+ return alpha_;
+ } else {
+ std::cerr << "WARNING in LauBelleNR::getResonanceParameter: Parameter name not reconised."
+ << std::endl;
+ return 0;
+ }
}
-void LauBelleNR::setAlpha(const Double_t alpha)
+void LauBelleNR::setAlpha( const Double_t alpha )
{
- alpha_->value( alpha );
- alpha_->genValue( alpha );
- alpha_->initValue( alpha );
+ alpha_->value( alpha );
+ alpha_->genValue( alpha );
+ alpha_->initValue( alpha );
}
-
diff --git a/src/LauBelleSymNR.cc b/src/LauBelleSymNR.cc
index 6f26bf9..99f32ed 100644
--- a/src/LauBelleSymNR.cc
+++ b/src/LauBelleSymNR.cc
@@ -1,186 +1,197 @@
/*
Copyright 2013 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauBelleSymNR.cc
\brief File containing implementation of LauBelleSymNR class.
*/
-#include <iostream>
-
-#include "TMath.h"
-
#include "LauBelleSymNR.hh"
+
#include "LauDaughters.hh"
#include "LauKinematics.hh"
#include "LauResonanceInfo.hh"
+#include "TMath.h"
+#include <iostream>
-LauBelleSymNR::LauBelleSymNR(LauResonanceInfo* resInfo, const LauAbsResonance::LauResonanceModel resType,
- const Int_t resPairAmpInt, const LauDaughters* daughters) :
- LauAbsResonance(resInfo, resPairAmpInt, daughters),
- alpha_(0),
- model_(resType)
+LauBelleSymNR::LauBelleSymNR( LauResonanceInfo* resInfo,
+ const LauAbsResonance::LauResonanceModel resType,
+ const Int_t resPairAmpInt,
+ const LauDaughters* daughters ) :
+ LauAbsResonance( resInfo, resPairAmpInt, daughters ),
+ alpha_( 0 ),
+ model_( resType )
{
- TString parName = this->getSanitisedName();
- parName += "_alpha";
- alpha_ = resInfo->getExtraParameter( parName );
- if ( alpha_ == 0 ) {
- alpha_ = new LauParameter( parName, 0.0, 0.0, 10.0, kTRUE );
- alpha_->secondStage(kTRUE);
- resInfo->addExtraParameter( alpha_ );
- }
+ TString parName = this->getSanitisedName();
+ parName += "_alpha";
+ alpha_ = resInfo->getExtraParameter( parName );
+ if ( alpha_ == 0 ) {
+ alpha_ = new LauParameter( parName, 0.0, 0.0, 10.0, kTRUE );
+ alpha_->secondStage( kTRUE );
+ resInfo->addExtraParameter( alpha_ );
+ }
}
LauBelleSymNR::~LauBelleSymNR()
{
}
void LauBelleSymNR::initialise()
{
- const LauDaughters* daughters = this->getDaughters();
- if ( ! daughters->gotSymmetricalDP() ) {
- std::cerr << "WARNING in LauBelleSymNR::initialise : Dalitz plot is symmetric - this lineshape is not appropriate." << std::endl;
- }
-
- Int_t resPairAmpInt = this->getPairInt();
- if ( resPairAmpInt == 3 ) {
- std::cerr << "WARNING in LauBelleSymNR::initialise : This lineshape is intended to be on the symmetrised axes of the DP." << std::endl;
- }
-
- if ( (model_ != LauAbsResonance::BelleSymNR) && (model_ != LauAbsResonance::BelleSymNRNoInter) && (model_ != LauAbsResonance::TaylorNR) ) {
- std::cerr << "WARNING in LauBelleSymNR::initialise : Unknown model requested, defaulting to exponential." << std::endl;
- model_ = LauAbsResonance::BelleSymNR;
- }
-
- if ( (model_ != LauAbsResonance::BelleSymNRNoInter) && (this->getSpin() != 0) ) {
- std::cerr << "WARNING in LauBelleSymNR::initialise : Non-zero spin will be ignored for this model - perhaps you should use LauAbsResonance::BelleSymNRNoInter instead" << std::endl;
- }
-
- // NB we do not need to call setSpinType(LauAbsResonance::Legendre) here (as is done in LauBelleNR) since override the amplitude method and explicitly use calcLegendrePoly
+ const LauDaughters* daughters = this->getDaughters();
+ if ( ! daughters->gotSymmetricalDP() ) {
+ std::cerr << "WARNING in LauBelleSymNR::initialise : Dalitz plot is symmetric - this lineshape is not appropriate."
+ << std::endl;
+ }
+
+ Int_t resPairAmpInt = this->getPairInt();
+ if ( resPairAmpInt == 3 ) {
+ std::cerr << "WARNING in LauBelleSymNR::initialise : This lineshape is intended to be on the symmetrised axes of the DP."
+ << std::endl;
+ }
+
+ if ( ( model_ != LauAbsResonance::BelleSymNR ) &&
+ ( model_ != LauAbsResonance::BelleSymNRNoInter ) &&
+ ( model_ != LauAbsResonance::TaylorNR ) ) {
+ std::cerr << "WARNING in LauBelleSymNR::initialise : Unknown model requested, defaulting to exponential."
+ << std::endl;
+ model_ = LauAbsResonance::BelleSymNR;
+ }
+
+ if ( ( model_ != LauAbsResonance::BelleSymNRNoInter ) && ( this->getSpin() != 0 ) ) {
+ std::cerr << "WARNING in LauBelleSymNR::initialise : Non-zero spin will be ignored for this model - perhaps you should use LauAbsResonance::BelleSymNRNoInter instead"
+ << std::endl;
+ }
+
+ // NB we do not need to call setSpinType(LauAbsResonance::Legendre) here (as is done in LauBelleNR) since override the amplitude method and explicitly use calcLegendrePoly
}
-LauComplex LauBelleSymNR::amplitude(const LauKinematics* kinematics)
+LauComplex LauBelleSymNR::amplitude( const LauKinematics* kinematics )
{
- // This function returns the complex dynamical amplitude for a Belle Non-Resonant distribution
+ // This function returns the complex dynamical amplitude for a Belle Non-Resonant distribution
- // Calculate for symmetric DPs, e.g. 3pi or 3K, by using shapeNo = 1 or 2
- // Have s<->t symmetry already done in Dynamics flip function.
- // For Kpipi or similar plots, one can use the separate exponentials
- // and consider them as two separate components with their own mag and phase.
- // For this shapeNo = 3 and shapeNo = 4 need to be used to create the two
- // individual amplitudes (with the same value of alpha).
+ // Calculate for symmetric DPs, e.g. 3pi or 3K, by using shapeNo = 1 or 2
+ // Have s<->t symmetry already done in Dynamics flip function.
+ // For Kpipi or similar plots, one can use the separate exponentials
+ // and consider them as two separate components with their own mag and phase.
+ // For this shapeNo = 3 and shapeNo = 4 need to be used to create the two
+ // individual amplitudes (with the same value of alpha).
- // Calculate Mandelstam variables.
- // s = m_13^2, t = m_23^2
- const Double_t s = kinematics->getm13Sq();
- const Double_t t = kinematics->getm23Sq();
+ // Calculate Mandelstam variables.
+ // s = m_13^2, t = m_23^2
+ const Double_t s = kinematics->getm13Sq();
+ const Double_t t = kinematics->getm23Sq();
- Double_t magnitude(1.0);
+ Double_t magnitude( 1.0 );
- const Double_t alpha = this->getAlpha();
+ const Double_t alpha = this->getAlpha();
- if ( model_ == LauAbsResonance::BelleSymNR ) {
+ if ( model_ == LauAbsResonance::BelleSymNR ) {
- magnitude = TMath::Exp(-alpha*s) + TMath::Exp(-alpha*t);
+ magnitude = TMath::Exp( -alpha * s ) + TMath::Exp( -alpha * t );
- } else if ( model_ == LauAbsResonance::BelleSymNRNoInter ) {
+ } else if ( model_ == LauAbsResonance::BelleSymNRNoInter ) {
- magnitude = (s <= t) ? TMath::Exp(-alpha*s) : TMath::Exp(-alpha*t);
+ magnitude = ( s <= t ) ? TMath::Exp( -alpha * s ) : TMath::Exp( -alpha * t );
- const Double_t cosHel = (s <= t) ? kinematics->getc13() : kinematics->getc23();
- magnitude *= this->calcLegendrePoly( cosHel );
+ const Double_t cosHel = ( s <= t ) ? kinematics->getc13() : kinematics->getc23();
+ magnitude *= this->calcLegendrePoly( cosHel );
- } else if ( model_ == LauAbsResonance::TaylorNR ) {
+ } else if ( model_ == LauAbsResonance::TaylorNR ) {
- const Double_t mParentSq = kinematics->getmParentSq();
- magnitude = alpha*(s + t)/mParentSq + 1.0;
+ const Double_t mParentSq = kinematics->getmParentSq();
+ magnitude = alpha * ( s + t ) / mParentSq + 1.0;
+ }
- }
+ LauComplex resAmplitude( magnitude, 0.0 );
- LauComplex resAmplitude(magnitude, 0.0);
-
- return resAmplitude;
+ return resAmplitude;
}
-LauComplex LauBelleSymNR::resAmp(Double_t mass, Double_t spinTerm)
+LauComplex LauBelleSymNR::resAmp( Double_t mass, Double_t spinTerm )
{
- std::cerr << "ERROR in LauBelleSymNR : This method should never be called." << std::endl;
- std::cerr << " : Returning zero amplitude for mass = " << mass << " and spinTerm = " << spinTerm << "." << std::endl;
- return LauComplex(0.0, 0.0);
+ std::cerr << "ERROR in LauBelleSymNR : This method should never be called." << std::endl;
+ std::cerr << " : Returning zero amplitude for mass = " << mass
+ << " and spinTerm = " << spinTerm << "." << std::endl;
+ return LauComplex( 0.0, 0.0 );
}
const std::vector<LauParameter*>& LauBelleSymNR::getFloatingParameters()
{
- this->clearFloatingParameters();
+ this->clearFloatingParameters();
- if ( ! this->fixAlpha() ) {
- this->addFloatingParameter( alpha_ );
- }
+ if ( ! this->fixAlpha() ) {
+ this->addFloatingParameter( alpha_ );
+ }
- return this->getParameters();
+ return this->getParameters();
}
-void LauBelleSymNR::setResonanceParameter(const TString& name, const Double_t value)
+void LauBelleSymNR::setResonanceParameter( const TString& name, const Double_t value )
{
- // Set various parameters for the lineshape
- if (name == "alpha") {
- this->setAlpha(value);
- std::cout << "INFO in LauBelleSymNR::setResonanceParameter : Setting parameter alpha = " << this->getAlpha() << std::endl;
- } else {
- std::cerr << "WARNING in LauBelleSymNR::setResonanceParameter : Parameter name not reconised. No parameter changes made." << std::endl;
- }
+ // Set various parameters for the lineshape
+ if ( name == "alpha" ) {
+ this->setAlpha( value );
+ std::cout << "INFO in LauBelleSymNR::setResonanceParameter : Setting parameter alpha = "
+ << this->getAlpha() << std::endl;
+ } else {
+ std::cerr << "WARNING in LauBelleSymNR::setResonanceParameter : Parameter name not reconised. No parameter changes made."
+ << std::endl;
+ }
}
-void LauBelleSymNR::floatResonanceParameter(const TString& name)
+void LauBelleSymNR::floatResonanceParameter( const TString& name )
{
- if (name == "alpha") {
- if ( alpha_->fixed() ) {
- alpha_->fixed( kFALSE );
- this->addFloatingParameter( alpha_ );
- } else {
- std::cerr << "WARNING in LauBelleSymNR::floatResonanceParameter: Parameter already floating. No parameter changes made." << std::endl;
- }
- } else {
- std::cerr << "WARNING in LauBelleSymNR::fixResonanceParameter: Parameter name not reconised. No parameter changes made." << std::endl;
- }
+ if ( name == "alpha" ) {
+ if ( alpha_->fixed() ) {
+ alpha_->fixed( kFALSE );
+ this->addFloatingParameter( alpha_ );
+ } else {
+ std::cerr << "WARNING in LauBelleSymNR::floatResonanceParameter: Parameter already floating. No parameter changes made."
+ << std::endl;
+ }
+ } else {
+ std::cerr << "WARNING in LauBelleSymNR::fixResonanceParameter: Parameter name not reconised. No parameter changes made."
+ << std::endl;
+ }
}
-LauParameter* LauBelleSymNR::getResonanceParameter(const TString& name)
+LauParameter* LauBelleSymNR::getResonanceParameter( const TString& name )
{
- if (name == "alpha") {
- return alpha_;
- } else {
- std::cerr << "WARNING in LauBelleSymNR::getResonanceParameter: Parameter name not reconised." << std::endl;
- return 0;
- }
+ if ( name == "alpha" ) {
+ return alpha_;
+ } else {
+ std::cerr << "WARNING in LauBelleSymNR::getResonanceParameter: Parameter name not reconised."
+ << std::endl;
+ return 0;
+ }
}
-void LauBelleSymNR::setAlpha(const Double_t alpha)
+void LauBelleSymNR::setAlpha( const Double_t alpha )
{
- alpha_->value( alpha );
- alpha_->genValue( alpha );
- alpha_->initValue( alpha );
+ alpha_->value( alpha );
+ alpha_->genValue( alpha );
+ alpha_->initValue( alpha );
}
-
diff --git a/src/LauBifurcatedGaussPdf.cc b/src/LauBifurcatedGaussPdf.cc
index 340e492..576400d 100644
--- a/src/LauBifurcatedGaussPdf.cc
+++ b/src/LauBifurcatedGaussPdf.cc
@@ -1,164 +1,163 @@
/*
Copyright 2006 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauBifurcatedGaussPdf.cc
\brief File containing implementation of LauBifurcatedGaussPdf class.
*/
-#include <iostream>
-#include <vector>
-
-#include "TMath.h"
-#include "TSystem.h"
-
#include "LauBifurcatedGaussPdf.hh"
+
#include "LauConstants.hh"
+#include "TMath.h"
+#include "TSystem.h"
+#include <iostream>
+#include <vector>
-LauBifurcatedGaussPdf::LauBifurcatedGaussPdf(const TString& theVarName, const std::vector<LauAbsRValue*>& params, Double_t minAbscissa, Double_t maxAbscissa) :
- LauAbsPdf(theVarName, params, minAbscissa, maxAbscissa),
- mean_(0),
- sigmaL_(0),
- sigmaR_(0)
+LauBifurcatedGaussPdf::LauBifurcatedGaussPdf( const TString& theVarName,
+ const std::vector<LauAbsRValue*>& params,
+ Double_t minAbscissa,
+ Double_t maxAbscissa ) :
+ LauAbsPdf( theVarName, params, minAbscissa, maxAbscissa ),
+ mean_( 0 ),
+ sigmaL_( 0 ),
+ sigmaR_( 0 )
{
- // Constructor for the bifurcated Gaussian PDF.
- // The bifurcated Gaussian combines the left half of a
- // Gaussian with resolution sigmaL with the right half
- // of a Gaussian with resolution sigmaR, both having
- // a common mean (or more correctly, peak position).
-
- // NB the parameters in params are the mean, sigmaL and sigmaR
- // The last two arguments specify the range in which the PDF is defined, and the PDF
- // will be normalised w.r.t. these limits.
-
- mean_ = this->findParameter("mean");
- sigmaL_ = this->findParameter("sigmaL");
- sigmaR_ = this->findParameter("sigmaR");
-
- if ((this->nParameters() != 3) || (mean_ == 0) || (sigmaL_ == 0) || (sigmaR_ == 0) ) {
- std::cerr << "ERROR in LauBifurcatedGaussPdf constructor: LauBifurcatedGaussPdf requires 3 parameters: \"mean\", \"sigmaL\" and \"sigmaR\"." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // Cache the normalisation factor
- this->calcNorm();
+ // Constructor for the bifurcated Gaussian PDF.
+ // The bifurcated Gaussian combines the left half of a
+ // Gaussian with resolution sigmaL with the right half
+ // of a Gaussian with resolution sigmaR, both having
+ // a common mean (or more correctly, peak position).
+
+ // NB the parameters in params are the mean, sigmaL and sigmaR
+ // The last two arguments specify the range in which the PDF is defined, and the PDF
+ // will be normalised w.r.t. these limits.
+
+ mean_ = this->findParameter( "mean" );
+ sigmaL_ = this->findParameter( "sigmaL" );
+ sigmaR_ = this->findParameter( "sigmaR" );
+
+ if ( ( this->nParameters() != 3 ) || ( mean_ == 0 ) || ( sigmaL_ == 0 ) || ( sigmaR_ == 0 ) ) {
+ std::cerr << "ERROR in LauBifurcatedGaussPdf constructor: LauBifurcatedGaussPdf requires 3 parameters: \"mean\", \"sigmaL\" and \"sigmaR\"."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // Cache the normalisation factor
+ this->calcNorm();
}
-LauBifurcatedGaussPdf::~LauBifurcatedGaussPdf()
+LauBifurcatedGaussPdf::~LauBifurcatedGaussPdf()
{
- // Destructor
+ // Destructor
}
-void LauBifurcatedGaussPdf::calcLikelihoodInfo(const LauAbscissas& abscissas)
+void LauBifurcatedGaussPdf::calcLikelihoodInfo( const LauAbscissas& abscissas )
{
- // Check that the given abscissa is within the allowed range
- if (!this->checkRange(abscissas)) {
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // Get our abscissa
- Double_t abscissa = abscissas[0];
-
- // Get the up to date parameter values
- Double_t mean = mean_->unblindValue();
- Double_t sigmaL = sigmaL_->unblindValue();
- Double_t sigmaR = sigmaR_->unblindValue();
-
- // Evaluate the Birfucated Gaussian PDF value
- Double_t arg = abscissa - mean;
- Double_t coef(0.0);
- Double_t value(0.0);
-
- if (arg < 0.0){
- if (TMath::Abs(sigmaL) > 1e-30) {
- coef = -0.5/(sigmaL*sigmaL);
- }
- } else {
- if (TMath::Abs(sigmaR) > 1e-30) {
- coef = -0.5/(sigmaR*sigmaR);
- }
- }
- value = TMath::Exp(coef*arg*arg);
-
- // Calculate the norm
- Double_t xscaleL = LauConstants::root2*sigmaL;
- Double_t xscaleR = LauConstants::root2*sigmaR;
-
- Double_t integral(0.0);
- Double_t norm(0.0);
- Double_t result(0.0);
-
-
- if(this->getMaxAbscissa() < mean){
- integral = sigmaL * ( TMath::Erf((this->getMaxAbscissa() - mean)/xscaleL) - TMath::Erf((this->getMinAbscissa() - mean)/xscaleL));
- }else if (this->getMinAbscissa() > mean){
- integral = sigmaR * (TMath::Erf((this->getMaxAbscissa() - mean)/xscaleR) - TMath::Erf((this->getMinAbscissa() - mean)/xscaleR));
- }else{
- integral = sigmaR*TMath::Erf((this->getMaxAbscissa() -mean)/xscaleR) - sigmaL*TMath::Erf((this->getMinAbscissa() - mean)/xscaleL);
- }
-
- norm = LauConstants::rootPiBy2*integral;
-
- // the result
- result = value/norm;
- this->setUnNormPDFVal(result);
-
+ // Check that the given abscissa is within the allowed range
+ if ( ! this->checkRange( abscissas ) ) {
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // Get our abscissa
+ Double_t abscissa = abscissas[0];
+
+ // Get the up to date parameter values
+ Double_t mean = mean_->unblindValue();
+ Double_t sigmaL = sigmaL_->unblindValue();
+ Double_t sigmaR = sigmaR_->unblindValue();
+
+ // Evaluate the Birfucated Gaussian PDF value
+ Double_t arg = abscissa - mean;
+ Double_t coef( 0.0 );
+ Double_t value( 0.0 );
+
+ if ( arg < 0.0 ) {
+ if ( TMath::Abs( sigmaL ) > 1e-30 ) {
+ coef = -0.5 / ( sigmaL * sigmaL );
+ }
+ } else {
+ if ( TMath::Abs( sigmaR ) > 1e-30 ) {
+ coef = -0.5 / ( sigmaR * sigmaR );
+ }
+ }
+ value = TMath::Exp( coef * arg * arg );
+
+ // Calculate the norm
+ Double_t xscaleL = LauConstants::root2 * sigmaL;
+ Double_t xscaleR = LauConstants::root2 * sigmaR;
+
+ Double_t integral( 0.0 );
+ Double_t norm( 0.0 );
+ Double_t result( 0.0 );
+
+ if ( this->getMaxAbscissa() < mean ) {
+ integral = sigmaL * ( TMath::Erf( ( this->getMaxAbscissa() - mean ) / xscaleL ) -
+ TMath::Erf( ( this->getMinAbscissa() - mean ) / xscaleL ) );
+ } else if ( this->getMinAbscissa() > mean ) {
+ integral = sigmaR * ( TMath::Erf( ( this->getMaxAbscissa() - mean ) / xscaleR ) -
+ TMath::Erf( ( this->getMinAbscissa() - mean ) / xscaleR ) );
+ } else {
+ integral = sigmaR * TMath::Erf( ( this->getMaxAbscissa() - mean ) / xscaleR ) -
+ sigmaL * TMath::Erf( ( this->getMinAbscissa() - mean ) / xscaleL );
+ }
+
+ norm = LauConstants::rootPiBy2 * integral;
+
+ // the result
+ result = value / norm;
+ this->setUnNormPDFVal( result );
}
-void LauBifurcatedGaussPdf::calcNorm()
+void LauBifurcatedGaussPdf::calcNorm()
{
- // Nothing to do here, since it already normalized
- this->setNorm(1.0);
+ // Nothing to do here, since it already normalized
+ this->setNorm( 1.0 );
}
-
void LauBifurcatedGaussPdf::calcPDFHeight( const LauKinematics* /*kinematics*/ )
{
- if (this->heightUpToDate()) {
- return;
- }
-
- // Get the up to date parameter values
- Double_t mean = mean_->unblindValue();
-
- LauAbscissas maxPoint(1);
- maxPoint[0] = mean;
-
- // Calculate the PDF height for the Bifurcated Gaussian function.
- if (mean>this->getMaxAbscissa()) {
- maxPoint[0] = this->getMaxAbscissa();
- } else if (mean<this->getMinAbscissa()) {
- maxPoint[0] = this->getMinAbscissa();
- }
- this->calcLikelihoodInfo(maxPoint);
-
- Double_t height = this->getUnNormLikelihood();
- this->setMaxHeight(height);
+ if ( this->heightUpToDate() ) {
+ return;
+ }
+
+ // Get the up to date parameter values
+ Double_t mean = mean_->unblindValue();
+
+ LauAbscissas maxPoint( 1 );
+ maxPoint[0] = mean;
+
+ // Calculate the PDF height for the Bifurcated Gaussian function.
+ if ( mean > this->getMaxAbscissa() ) {
+ maxPoint[0] = this->getMaxAbscissa();
+ } else if ( mean < this->getMinAbscissa() ) {
+ maxPoint[0] = this->getMinAbscissa();
+ }
+ this->calcLikelihoodInfo( maxPoint );
+
+ Double_t height = this->getUnNormLikelihood();
+ this->setMaxHeight( height );
}
-
-
-
-
diff --git a/src/LauBkgndDPModel.cc b/src/LauBkgndDPModel.cc
index f7a4f48..9054799 100644
--- a/src/LauBkgndDPModel.cc
+++ b/src/LauBkgndDPModel.cc
@@ -1,314 +1,345 @@
/*
Copyright 2004 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauBkgndDPModel.cc
\brief File containing implementation of LauBkgndDPModel class.
*/
-#include <cstdlib>
-#include <iostream>
-
-#include "TRandom.h"
-#include "TSystem.h"
+#include "LauBkgndDPModel.hh"
#include "Lau2DHistDPPdf.hh"
#include "Lau2DSplineDPPdf.hh"
-#include "LauBkgndDPModel.hh"
#include "LauDaughters.hh"
#include "LauFitDataTree.hh"
#include "LauKinematics.hh"
#include "LauRandom.hh"
#include "LauVetoes.hh"
+#include "TRandom.h"
+#include "TSystem.h"
+#include <cstdlib>
+#include <iostream>
-LauBkgndDPModel::LauBkgndDPModel(LauDaughters* daughters, LauVetoes* vetoes) :
- LauAbsBkgndDPModel(daughters, vetoes),
- symmetricalDP_(kFALSE),
- squareDP_(kFALSE),
- bgHistDPPdf_(0),
- curEvtHistVal_(0.0),
- maxPdfHeight_(1.0),
- pdfNorm_(1.0),
- doneGenWarning_(kFALSE),
- lowBinWarningIssued_(kFALSE)
+LauBkgndDPModel::LauBkgndDPModel( LauDaughters* daughters, LauVetoes* vetoes ) :
+ LauAbsBkgndDPModel( daughters, vetoes ),
+ symmetricalDP_( kFALSE ),
+ squareDP_( kFALSE ),
+ bgHistDPPdf_( 0 ),
+ curEvtHistVal_( 0.0 ),
+ maxPdfHeight_( 1.0 ),
+ pdfNorm_( 1.0 ),
+ doneGenWarning_( kFALSE ),
+ lowBinWarningIssued_( kFALSE )
{
- if (daughters != 0) {
- symmetricalDP_ = daughters->gotSymmetricalDP();
- }
+ if ( daughters != 0 ) {
+ symmetricalDP_ = daughters->gotSymmetricalDP();
+ }
}
LauBkgndDPModel::~LauBkgndDPModel()
{
- if (bgHistDPPdf_ != 0) {
- delete bgHistDPPdf_; bgHistDPPdf_ = 0;
- }
+ if ( bgHistDPPdf_ != 0 ) {
+ delete bgHistDPPdf_;
+ bgHistDPPdf_ = 0;
+ }
}
-void LauBkgndDPModel::setBkgndHisto(const TH2* histo, Bool_t useInterpolation, Bool_t fluctuateBins, Bool_t useUpperHalfOnly, Bool_t squareDP)
+void LauBkgndDPModel::setBkgndHisto( const TH2* histo,
+ Bool_t useInterpolation,
+ Bool_t fluctuateBins,
+ Bool_t useUpperHalfOnly,
+ Bool_t squareDP )
{
- if ( ! histo ) {
- std::cerr << "WARNING in LauBkgndDPModel::setBkgndHisto : Supplied background histogram pointer is null, likelihood for this component will be flat in the Dalitz plot" << std::endl;
- }
-
- Bool_t upperHalf = kFALSE;
- if (symmetricalDP_ == kTRUE && useUpperHalfOnly == kTRUE) {upperHalf = kTRUE;}
- std::cout<<"INFO in LauBkgndDPModel::setBkgndHisto : Background histogram has upperHalf = "<<static_cast<Int_t>(upperHalf)<<std::endl;
-
- squareDP_ = squareDP;
-
- LauKinematics* kinematics = this->getKinematics();
- const LauVetoes* vetoes = this->getVetoes();
- bgHistDPPdf_ = new Lau2DHistDPPdf(histo, kinematics, vetoes, useInterpolation, fluctuateBins, upperHalf, squareDP);
-
- maxPdfHeight_ = bgHistDPPdf_->getMaxHeight();
- pdfNorm_ = bgHistDPPdf_->getHistNorm();
+ if ( ! histo ) {
+ std::cerr << "WARNING in LauBkgndDPModel::setBkgndHisto : Supplied background histogram pointer is null, likelihood for this component will be flat in the Dalitz plot"
+ << std::endl;
+ }
+
+ Bool_t upperHalf = kFALSE;
+ if ( symmetricalDP_ == kTRUE && useUpperHalfOnly == kTRUE ) {
+ upperHalf = kTRUE;
+ }
+ std::cout << "INFO in LauBkgndDPModel::setBkgndHisto : Background histogram has upperHalf = "
+ << static_cast<Int_t>( upperHalf ) << std::endl;
+
+ squareDP_ = squareDP;
+
+ LauKinematics* kinematics = this->getKinematics();
+ const LauVetoes* vetoes = this->getVetoes();
+ bgHistDPPdf_ = new Lau2DHistDPPdf( histo,
+ kinematics,
+ vetoes,
+ useInterpolation,
+ fluctuateBins,
+ upperHalf,
+ squareDP );
+
+ maxPdfHeight_ = bgHistDPPdf_->getMaxHeight();
+ pdfNorm_ = bgHistDPPdf_->getHistNorm();
}
-void LauBkgndDPModel::setBkgndSpline(const TH2* histo, Bool_t fluctuateBins, Bool_t useUpperHalfOnly, Bool_t squareDP)
+void LauBkgndDPModel::setBkgndSpline( const TH2* histo,
+ Bool_t fluctuateBins,
+ Bool_t useUpperHalfOnly,
+ Bool_t squareDP )
{
- if ( ! histo ) {
- std::cerr << "WARNING in LauBkgndDPModel::setBkgndSpline : Supplied background histogram pointer is null, construction of spline will fail" << std::endl;
- }
-
- Bool_t upperHalf = kFALSE;
- if (symmetricalDP_ == kTRUE && useUpperHalfOnly == kTRUE) {upperHalf = kTRUE;}
- std::cout<<"INFO in LauBkgndDPModel::setBkgndSpline : Background histogram has upperHalf = "<<static_cast<Int_t>(upperHalf)<<std::endl;
+ if ( ! histo ) {
+ std::cerr << "WARNING in LauBkgndDPModel::setBkgndSpline : Supplied background histogram pointer is null, construction of spline will fail"
+ << std::endl;
+ }
+
+ Bool_t upperHalf = kFALSE;
+ if ( symmetricalDP_ == kTRUE && useUpperHalfOnly == kTRUE ) {
+ upperHalf = kTRUE;
+ }
+ std::cout << "INFO in LauBkgndDPModel::setBkgndSpline : Background histogram has upperHalf = "
+ << static_cast<Int_t>( upperHalf ) << std::endl;
+
+ squareDP_ = squareDP;
+
+ LauKinematics* kinematics = this->getKinematics();
+ const LauVetoes* vetoes = this->getVetoes();
+ bgHistDPPdf_ =
+ new Lau2DSplineDPPdf( histo, kinematics, vetoes, fluctuateBins, upperHalf, squareDP );
+
+ maxPdfHeight_ = bgHistDPPdf_->getMaxHeight();
+ pdfNorm_ = bgHistDPPdf_->getHistNorm();
+}
- squareDP_ = squareDP;
+Double_t LauBkgndDPModel::calcHistValue( Double_t xVal, Double_t yVal )
+{
+ // Get the likelihood value of the background in the Dalitz plot.
+
+ // Check that we have a valid histogram PDF
+ if ( bgHistDPPdf_ == 0 ) {
+ std::cerr << "WARNING in LauBkgndDPModel::calcHistValue : We don't have a histogram so assuming the likelihood is flat in the Dalitz plot."
+ << std::endl;
+ this->setBkgndHisto( 0, kFALSE, kFALSE, kFALSE, kFALSE );
+ }
+
+ // Find out the un-normalised PDF value
+ Double_t value = bgHistDPPdf_->interpolateXY( xVal, yVal );
+
+ // Check that the value is greater than zero
+ // If we're using a spline then negative values can be caused by adjacent bins that all contain a value of zero.
+ // The spline requires the value, its first derivatives and the mixed second derivative to be continuous and to match the input histogram
+ // at the bin centres. Derivatives are calculated using a finite difference approximation taking the difference between the neighbouring bins.
+ // If two bins are zero but the third is not then the second bin will have a positive first derivative causing the spline to dip below zero
+ // between the two zero bins to remain smooth. Such dips are unavoidable but are correctly removed here.
+ if ( value < 0.0 ) {
+ if ( ! lowBinWarningIssued_ ) {
+ std::cerr << "WARNING in LauBkgndDPModel::calcHistValue : Value " << value
+ << " is less than 0 - setting to 0. You may want to check your histogram!"
+ << std::endl
+ << " : If you are using a spline then this could be caused by adjacent empty bins. Further warnings will be suppressed."
+ << std::endl;
+ lowBinWarningIssued_ = kTRUE;
+ }
+ return 0.0;
+ }
- LauKinematics* kinematics = this->getKinematics();
- const LauVetoes* vetoes = this->getVetoes();
- bgHistDPPdf_ = new Lau2DSplineDPPdf(histo, kinematics, vetoes, fluctuateBins, upperHalf, squareDP);
+ LauKinematics* kinematics = this->getKinematics();
- maxPdfHeight_ = bgHistDPPdf_->getMaxHeight();
- pdfNorm_ = bgHistDPPdf_->getHistNorm();
-}
+ // For square DP co-ordinates, need to divide by Jacobian
+ if ( squareDP_ == kTRUE ) {
+ // Make sure that square DP kinematics are correct, then get Jacobian
+ kinematics->updateSqDPKinematics( xVal, yVal );
+ Double_t jacobian = kinematics->calcSqDPJacobian();
+ value /= jacobian;
+ }
-Double_t LauBkgndDPModel::calcHistValue(Double_t xVal, Double_t yVal)
-{
- // Get the likelihood value of the background in the Dalitz plot.
-
- // Check that we have a valid histogram PDF
- if (bgHistDPPdf_ == 0) {
- std::cerr << "WARNING in LauBkgndDPModel::calcHistValue : We don't have a histogram so assuming the likelihood is flat in the Dalitz plot." << std::endl;
- this->setBkgndHisto( 0, kFALSE, kFALSE, kFALSE, kFALSE );
- }
-
- // Find out the un-normalised PDF value
- Double_t value = bgHistDPPdf_->interpolateXY(xVal, yVal);
-
- // Check that the value is greater than zero
- // If we're using a spline then negative values can be caused by adjacent bins that all contain a value of zero.
- // The spline requires the value, its first derivatives and the mixed second derivative to be continuous and to match the input histogram
- // at the bin centres. Derivatives are calculated using a finite difference approximation taking the difference between the neighbouring bins.
- // If two bins are zero but the third is not then the second bin will have a positive first derivative causing the spline to dip below zero
- // between the two zero bins to remain smooth. Such dips are unavoidable but are correctly removed here.
- if ( value < 0.0 ) {
- if(!lowBinWarningIssued_) {
- std::cerr << "WARNING in LauBkgndDPModel::calcHistValue : Value " << value << " is less than 0 - setting to 0. You may want to check your histogram!" << std::endl
- << " : If you are using a spline then this could be caused by adjacent empty bins. Further warnings will be suppressed." << std::endl;
- lowBinWarningIssued_=kTRUE;
- }
- return 0.0;
- }
-
- LauKinematics* kinematics = this->getKinematics();
-
- // For square DP co-ordinates, need to divide by Jacobian
- if (squareDP_ == kTRUE) {
- // Make sure that square DP kinematics are correct, then get Jacobian
- kinematics->updateSqDPKinematics(xVal, yVal);
- Double_t jacobian = kinematics->calcSqDPJacobian();
- value /= jacobian;
- }
-
- return value;
+ return value;
}
-void LauBkgndDPModel::initialise()
+void LauBkgndDPModel::initialise()
{
}
Bool_t LauBkgndDPModel::generate()
{
- // Routine to generate the background, using data provided by an
- // already defined histogram.
-
- LauKinematics* kinematics = this->getKinematics();
-
- Bool_t gotBG(kFALSE);
-
- while (gotBG == kFALSE) {
-
- if (squareDP_ == kTRUE) {
- // Generate a point in m', theta' space. By construction, this point
- // is already within the DP region.
- Double_t mPrime(0.0), thetaPrime(0.0);
- kinematics->genFlatSqDP(mPrime, thetaPrime);
-
- // If we're in a symmetrical DP then we should only generate events in one half
- if ( symmetricalDP_ && thetaPrime > 0.5 ) {
- thetaPrime = 1.0 - thetaPrime;
- }
-
- // Calculate histogram height for DP point and
- // compare with the maximum height
- if ( bgHistDPPdf_ != 0 ) {
- Double_t bgContDP = bgHistDPPdf_->interpolateXY(mPrime, thetaPrime)/maxPdfHeight_;
- if (LauRandom::randomFun()->Rndm() < bgContDP) {
- kinematics->updateSqDPKinematics(mPrime, thetaPrime);
- gotBG = kTRUE;
- }
- } else {
- if ( !doneGenWarning_ ) {
- std::cerr << "WARNING in LauBkgndDPModel::generate : We don't have a histogram so generating flat in the square DP, which won't be flat in the conventional DP!" << std::endl;
- std::cerr << "WARNING in LauBkgndDPModel::generate : This should never happen!! What have you done?!" << std::endl;
- doneGenWarning_ = kTRUE;
- }
- kinematics->updateSqDPKinematics(mPrime, thetaPrime);
- gotBG = kTRUE;
- }
- } else {
- // Generate a point in the Dalitz plot (phase-space).
- Double_t m13Sq(0.0), m23Sq(0.0);
- kinematics->genFlatPhaseSpace(m13Sq, m23Sq);
-
- // If we're in a symmetrical DP then we should only generate events in one half
- if ( symmetricalDP_ && m13Sq > m23Sq ) {
- Double_t tmpSq = m13Sq;
- m13Sq = m23Sq;
- m23Sq = tmpSq;
- }
-
- // Calculate histogram height for DP point and
- // compare with the maximum height
- if ( bgHistDPPdf_ != 0 ) {
- Double_t bgContDP = bgHistDPPdf_->interpolateXY(m13Sq, m23Sq)/maxPdfHeight_;
- if (LauRandom::randomFun()->Rndm() < bgContDP) {
- kinematics->updateKinematics(m13Sq, m23Sq);
- gotBG = kTRUE;
- }
- } else {
- if ( !doneGenWarning_ ) {
- std::cerr << "WARNING in LauBkgndDPModel::generate : We don't have a histogram so generating flat in the DP." << std::endl;
- doneGenWarning_ = kTRUE;
- }
- kinematics->updateKinematics(m13Sq, m23Sq);
- gotBG = kTRUE;
- }
- }
- }
-
- // Implement veto
- Bool_t vetoOK(kTRUE);
- const LauVetoes* vetoes = this->getVetoes();
- if (vetoes) {
- vetoOK = vetoes->passVeto(kinematics);
- }
- // Call this function recusively until we pass the veto.
- if (vetoOK == kFALSE) {
- this->generate();
- }
- return kTRUE;
+ // Routine to generate the background, using data provided by an
+ // already defined histogram.
+
+ LauKinematics* kinematics = this->getKinematics();
+
+ Bool_t gotBG( kFALSE );
+
+ while ( gotBG == kFALSE ) {
+
+ if ( squareDP_ == kTRUE ) {
+ // Generate a point in m', theta' space. By construction, this point
+ // is already within the DP region.
+ Double_t mPrime( 0.0 ), thetaPrime( 0.0 );
+ kinematics->genFlatSqDP( mPrime, thetaPrime );
+
+ // If we're in a symmetrical DP then we should only generate events in one half
+ if ( symmetricalDP_ && thetaPrime > 0.5 ) {
+ thetaPrime = 1.0 - thetaPrime;
+ }
+
+ // Calculate histogram height for DP point and
+ // compare with the maximum height
+ if ( bgHistDPPdf_ != 0 ) {
+ Double_t bgContDP = bgHistDPPdf_->interpolateXY( mPrime, thetaPrime ) / maxPdfHeight_;
+ if ( LauRandom::randomFun()->Rndm() < bgContDP ) {
+ kinematics->updateSqDPKinematics( mPrime, thetaPrime );
+ gotBG = kTRUE;
+ }
+ } else {
+ if ( ! doneGenWarning_ ) {
+ std::cerr << "WARNING in LauBkgndDPModel::generate : We don't have a histogram so generating flat in the square DP, which won't be flat in the conventional DP!"
+ << std::endl;
+ std::cerr << "WARNING in LauBkgndDPModel::generate : This should never happen!! What have you done?!"
+ << std::endl;
+ doneGenWarning_ = kTRUE;
+ }
+ kinematics->updateSqDPKinematics( mPrime, thetaPrime );
+ gotBG = kTRUE;
+ }
+ } else {
+ // Generate a point in the Dalitz plot (phase-space).
+ Double_t m13Sq( 0.0 ), m23Sq( 0.0 );
+ kinematics->genFlatPhaseSpace( m13Sq, m23Sq );
+
+ // If we're in a symmetrical DP then we should only generate events in one half
+ if ( symmetricalDP_ && m13Sq > m23Sq ) {
+ Double_t tmpSq = m13Sq;
+ m13Sq = m23Sq;
+ m23Sq = tmpSq;
+ }
+
+ // Calculate histogram height for DP point and
+ // compare with the maximum height
+ if ( bgHistDPPdf_ != 0 ) {
+ Double_t bgContDP = bgHistDPPdf_->interpolateXY( m13Sq, m23Sq ) / maxPdfHeight_;
+ if ( LauRandom::randomFun()->Rndm() < bgContDP ) {
+ kinematics->updateKinematics( m13Sq, m23Sq );
+ gotBG = kTRUE;
+ }
+ } else {
+ if ( ! doneGenWarning_ ) {
+ std::cerr << "WARNING in LauBkgndDPModel::generate : We don't have a histogram so generating flat in the DP."
+ << std::endl;
+ doneGenWarning_ = kTRUE;
+ }
+ kinematics->updateKinematics( m13Sq, m23Sq );
+ gotBG = kTRUE;
+ }
+ }
+ }
+
+ // Implement veto
+ Bool_t vetoOK( kTRUE );
+ const LauVetoes* vetoes = this->getVetoes();
+ if ( vetoes ) {
+ vetoOK = vetoes->passVeto( kinematics );
+ }
+ // Call this function recusively until we pass the veto.
+ if ( vetoOK == kFALSE ) {
+ this->generate();
+ }
+ return kTRUE;
}
-void LauBkgndDPModel::fillDataTree(const LauFitDataTree& inputFitTree)
+void LauBkgndDPModel::fillDataTree( const LauFitDataTree& inputFitTree )
{
- // In LauFitDataTree, the first two variables should always be
- // m13^2 and m23^2. Other variables follow thus: charge.
+ // In LauFitDataTree, the first two variables should always be
+ // m13^2 and m23^2. Other variables follow thus: charge.
- Int_t nBranches = inputFitTree.nBranches();
- if (nBranches < 2) {
- std::cerr<<"ERROR in LauBkgndDPModel::fillDataTree : Expecting at least 2 variables "<<"in input data tree, but there are "<<nBranches<<"!\n";
- std::cerr<<" : Make sure you have the right number of variables in your input data file!"<<std::endl;
- return;
- }
+ Int_t nBranches = inputFitTree.nBranches();
+ if ( nBranches < 2 ) {
+ std::cerr << "ERROR in LauBkgndDPModel::fillDataTree : Expecting at least 2 variables "
+ << "in input data tree, but there are " << nBranches << "!\n";
+ std::cerr << " : Make sure you have the right number of variables in your input data file!"
+ << std::endl;
+ return;
+ }
- const UInt_t nEvents { inputFitTree.nEvents() };
+ const UInt_t nEvents { inputFitTree.nEvents() };
- // clear and resize the data vector
- bgData_.clear();
- bgData_.resize(nEvents);
+ // clear and resize the data vector
+ bgData_.clear();
+ bgData_.resize( nEvents );
- Double_t m13Sq { 0.0 }, m23Sq { 0.0 };
+ Double_t m13Sq { 0.0 }, m23Sq { 0.0 };
- for (UInt_t iEvt = 0; iEvt < nEvents; iEvt++) {
+ for ( UInt_t iEvt = 0; iEvt < nEvents; iEvt++ ) {
- const LauFitData& dataValues = inputFitTree.getData(iEvt);
- m13Sq = dataValues.at("m13Sq");
- m23Sq = dataValues.at("m23Sq");
+ const LauFitData& dataValues = inputFitTree.getData( iEvt );
+ m13Sq = dataValues.at( "m13Sq" );
+ m23Sq = dataValues.at( "m23Sq" );
- bgData_[iEvt] = this->getUnNormValue( m13Sq, m23Sq );
- }
+ bgData_[iEvt] = this->getUnNormValue( m13Sq, m23Sq );
+ }
}
-Double_t LauBkgndDPModel::getUnNormValue(const Double_t m13Sq, const Double_t m23Sq)
+Double_t LauBkgndDPModel::getUnNormValue( const Double_t m13Sq, const Double_t m23Sq )
{
- // Update the kinematics. This will also update m' and theta' if squareDP = true
- LauKinematics* kinematics = this->getKinematics();
- kinematics->updateKinematics(m13Sq, m23Sq);
-
- if (squareDP_) {
- const Double_t mPrime { kinematics->getmPrime() };
- const Double_t thetaPrime { kinematics->getThetaPrime() };
- curEvtHistVal_ = this->calcHistValue(mPrime, thetaPrime);
- } else {
- curEvtHistVal_ = this->calcHistValue(m13Sq, m23Sq);
- }
-
- return curEvtHistVal_;
+ // Update the kinematics. This will also update m' and theta' if squareDP = true
+ LauKinematics* kinematics = this->getKinematics();
+ kinematics->updateKinematics( m13Sq, m23Sq );
+
+ if ( squareDP_ ) {
+ const Double_t mPrime { kinematics->getmPrime() };
+ const Double_t thetaPrime { kinematics->getThetaPrime() };
+ curEvtHistVal_ = this->calcHistValue( mPrime, thetaPrime );
+ } else {
+ curEvtHistVal_ = this->calcHistValue( m13Sq, m23Sq );
+ }
+
+ return curEvtHistVal_;
}
-Double_t LauBkgndDPModel::getLikelihood(const Double_t m13Sq, const Double_t m23Sq)
+Double_t LauBkgndDPModel::getLikelihood( const Double_t m13Sq, const Double_t m23Sq )
{
- this->getUnNormValue( m13Sq, m23Sq );
- return curEvtHistVal_ / this->getPdfNorm();
+ this->getUnNormValue( m13Sq, m23Sq );
+ return curEvtHistVal_ / this->getPdfNorm();
}
-Double_t LauBkgndDPModel::getUnNormValue(UInt_t iEvt)
+Double_t LauBkgndDPModel::getUnNormValue( UInt_t iEvt )
{
- // Retrieve the likelihood for the given event
- this->setDataEventNo(iEvt);
- return curEvtHistVal_;
+ // Retrieve the likelihood for the given event
+ this->setDataEventNo( iEvt );
+ return curEvtHistVal_;
}
-Double_t LauBkgndDPModel::getLikelihood(UInt_t iEvt)
+Double_t LauBkgndDPModel::getLikelihood( UInt_t iEvt )
{
- // Retrieve the likelihood for the given event
- this->setDataEventNo(iEvt);
- Double_t llhd = curEvtHistVal_ / this->getPdfNorm();
- return llhd;
+ // Retrieve the likelihood for the given event
+ this->setDataEventNo( iEvt );
+ Double_t llhd = curEvtHistVal_ / this->getPdfNorm();
+ return llhd;
}
-void LauBkgndDPModel::setDataEventNo(UInt_t iEvt)
+void LauBkgndDPModel::setDataEventNo( UInt_t iEvt )
{
- // Retrieve the data for event iEvt
- if (bgData_.size() > iEvt) {
- curEvtHistVal_ = bgData_[iEvt];
- } else {
- std::cerr<<"ERROR in LauBkgndDPModel::setDataEventNo : Event index too large: "<<iEvt<<" >= "<<bgData_.size()<<"."<<std::endl;
- }
+ // Retrieve the data for event iEvt
+ if ( bgData_.size() > iEvt ) {
+ curEvtHistVal_ = bgData_[iEvt];
+ } else {
+ std::cerr << "ERROR in LauBkgndDPModel::setDataEventNo : Event index too large: " << iEvt
+ << " >= " << bgData_.size() << "." << std::endl;
+ }
}
-
diff --git a/src/LauBlattWeisskopfFactor.cc b/src/LauBlattWeisskopfFactor.cc
index aff03e4..1d416ac 100644
--- a/src/LauBlattWeisskopfFactor.cc
+++ b/src/LauBlattWeisskopfFactor.cc
@@ -1,197 +1,221 @@
/*
Copyright 2014 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauBlattWeisskopfFactor.cc
- \brief File containing implementation of LauBlattWeisskopfFactor class.
- */
-
-#include <iostream>
-
-#include "TMath.h"
+ \brief File containing implementation of LauBlattWeisskopfFactor class.
+*/
#include "LauBlattWeisskopfFactor.hh"
+
#include "LauParameter.hh"
#include "LauResonanceInfo.hh"
+#include "TMath.h"
+#include <iostream>
// Constructor
-LauBlattWeisskopfFactor::LauBlattWeisskopfFactor( const LauResonanceInfo& resInfo, const BarrierType barrierType, const RestFrame restFrame, const BlattWeisskopfCategory category ) :
- spin_(resInfo.getSpin()),
- radius_(new LauParameter("NEED_A_GOOD_NAME",resInfo.getBWRadius(),0.0,10.0,kTRUE)),
- barrierType_(barrierType),
- restFrame_(restFrame)
+LauBlattWeisskopfFactor::LauBlattWeisskopfFactor( const LauResonanceInfo& resInfo,
+ const BarrierType barrierType,
+ const RestFrame restFrame,
+ const BlattWeisskopfCategory category ) :
+ spin_( resInfo.getSpin() ),
+ radius_( new LauParameter( "NEED_A_GOOD_NAME", resInfo.getBWRadius(), 0.0, 10.0, kTRUE ) ),
+ barrierType_( barrierType ),
+ restFrame_( restFrame )
{
- TString categoryName = this->setRadiusName( resInfo, category );
- std::cout << "INFO in LauBlattWeisskopfFactor constructor : creating radius parameter for category \"" << categoryName << "\", with initial value " << resInfo.getBWRadius() << std::endl;
+ TString categoryName = this->setRadiusName( resInfo, category );
+ std::cout << "INFO in LauBlattWeisskopfFactor constructor : creating radius parameter for category \""
+ << categoryName << "\", with initial value " << resInfo.getBWRadius() << std::endl;
}
-LauBlattWeisskopfFactor::LauBlattWeisskopfFactor( const LauResonanceInfo& resInfo, const Double_t resRadius, const BarrierType barrierType, const RestFrame restFrame, const BlattWeisskopfCategory category ) :
- spin_(resInfo.getSpin()),
- radius_(new LauParameter("NEED_A_GOOD_NAME",resRadius,0.0,10.0,kTRUE)),
- barrierType_(barrierType),
- restFrame_(restFrame)
+LauBlattWeisskopfFactor::LauBlattWeisskopfFactor( const LauResonanceInfo& resInfo,
+ const Double_t resRadius,
+ const BarrierType barrierType,
+ const RestFrame restFrame,
+ const BlattWeisskopfCategory category ) :
+ spin_( resInfo.getSpin() ),
+ radius_( new LauParameter( "NEED_A_GOOD_NAME", resRadius, 0.0, 10.0, kTRUE ) ),
+ barrierType_( barrierType ),
+ restFrame_( restFrame )
{
- TString categoryName = this->setRadiusName( resInfo, category );
- std::cout << "INFO in LauBlattWeisskopfFactor constructor : creating radius parameter for category \"" << categoryName << "\", with initial value " << resRadius << std::endl;
+ TString categoryName = this->setRadiusName( resInfo, category );
+ std::cout << "INFO in LauBlattWeisskopfFactor constructor : creating radius parameter for category \""
+ << categoryName << "\", with initial value " << resRadius << std::endl;
}
-LauBlattWeisskopfFactor::LauBlattWeisskopfFactor( const Int_t spin, const Double_t resRadius, const BarrierType barrierType, const RestFrame restFrame, const BlattWeisskopfCategory category ) :
- spin_(spin),
- radius_(new LauParameter("NEED_A_GOOD_NAME",resRadius,0.0,10.0,kTRUE)),
- barrierType_(barrierType),
- restFrame_(restFrame)
+LauBlattWeisskopfFactor::LauBlattWeisskopfFactor( const Int_t spin,
+ const Double_t resRadius,
+ const BarrierType barrierType,
+ const RestFrame restFrame,
+ const BlattWeisskopfCategory category ) :
+ spin_( spin ),
+ radius_( new LauParameter( "NEED_A_GOOD_NAME", resRadius, 0.0, 10.0, kTRUE ) ),
+ barrierType_( barrierType ),
+ restFrame_( restFrame )
{
- TString categoryName = this->setRadiusName( category );
- std::cout << "INFO in LauBlattWeisskopfFactor constructor : creating radius parameter for category \"" << categoryName << "\", with initial value " << resRadius << std::endl;
+ TString categoryName = this->setRadiusName( category );
+ std::cout << "INFO in LauBlattWeisskopfFactor constructor : creating radius parameter for category \""
+ << categoryName << "\", with initial value " << resRadius << std::endl;
}
-LauBlattWeisskopfFactor::LauBlattWeisskopfFactor( const LauBlattWeisskopfFactor& other, const UInt_t newSpin, const BarrierType newBarrierType ) :
- spin_(newSpin),
- radius_(other.radius_->createClone()),
- barrierType_(newBarrierType),
- restFrame_(other.restFrame_)
+LauBlattWeisskopfFactor::LauBlattWeisskopfFactor( const LauBlattWeisskopfFactor& other,
+ const UInt_t newSpin,
+ const BarrierType newBarrierType ) :
+ spin_( newSpin ),
+ radius_( other.radius_->createClone() ),
+ barrierType_( newBarrierType ),
+ restFrame_( other.restFrame_ )
{
}
-TString LauBlattWeisskopfFactor::setRadiusName( const LauResonanceInfo& resInfo, const BlattWeisskopfCategory category )
+TString LauBlattWeisskopfFactor::setRadiusName( const LauResonanceInfo& resInfo,
+ const BlattWeisskopfCategory category )
{
- switch (category) {
- case Indep :
- return this->setRadiusName( resInfo.getSanitisedName() );
- default :
- return this->setRadiusName( category );
- }
+ switch ( category ) {
+ case Indep :
+ return this->setRadiusName( resInfo.getSanitisedName() );
+ default :
+ return this->setRadiusName( category );
+ }
}
TString LauBlattWeisskopfFactor::setRadiusName( const BlattWeisskopfCategory category )
{
- switch (category) {
- case Default :
- return this->setRadiusName("Unknown");
- case Indep :
- // We shouldn't ever end up here
- return this->setRadiusName("Unknown");
- case Parent :
- return this->setRadiusName("Parent");
- case Light :
- return this->setRadiusName("Light");
- case Kstar :
- return this->setRadiusName("Kstar");
- case Charm :
- return this->setRadiusName("Charm");
- case StrangeCharm :
- return this->setRadiusName("StrangeCharm");
- case Charmonium :
- return this->setRadiusName("Charmonium");
- case Beauty :
- return this->setRadiusName("Beauty");
- case StrangeBeauty :
- return this->setRadiusName("StrangeBeauty");
- case CharmBeauty :
- return this->setRadiusName("CharmBeauty");
- case Custom1 :
- return this->setRadiusName("Custom1");
- case Custom2 :
- return this->setRadiusName("Custom2");
- case Custom3 :
- return this->setRadiusName("Custom3");
- case Custom4 :
- return this->setRadiusName("Custom4");
- }
- // We should never get here but gcc seems to think we can
- return this->setRadiusName("Unknown");
+ switch ( category ) {
+ case Default :
+ return this->setRadiusName( "Unknown" );
+ case Indep :
+ // We shouldn't ever end up here
+ return this->setRadiusName( "Unknown" );
+ case Parent :
+ return this->setRadiusName( "Parent" );
+ case Light :
+ return this->setRadiusName( "Light" );
+ case Kstar :
+ return this->setRadiusName( "Kstar" );
+ case Charm :
+ return this->setRadiusName( "Charm" );
+ case StrangeCharm :
+ return this->setRadiusName( "StrangeCharm" );
+ case Charmonium :
+ return this->setRadiusName( "Charmonium" );
+ case Beauty :
+ return this->setRadiusName( "Beauty" );
+ case StrangeBeauty :
+ return this->setRadiusName( "StrangeBeauty" );
+ case CharmBeauty :
+ return this->setRadiusName( "CharmBeauty" );
+ case Custom1 :
+ return this->setRadiusName( "Custom1" );
+ case Custom2 :
+ return this->setRadiusName( "Custom2" );
+ case Custom3 :
+ return this->setRadiusName( "Custom3" );
+ case Custom4 :
+ return this->setRadiusName( "Custom4" );
+ }
+ // We should never get here but gcc seems to think we can
+ return this->setRadiusName( "Unknown" );
}
TString LauBlattWeisskopfFactor::setRadiusName( const TString& categoryName )
{
TString name = "BarrierRadius_";
- name.Append(categoryName);
+ name.Append( categoryName );
- radius_->name(name);
+ radius_->name( name );
return categoryName;
}
-LauBlattWeisskopfFactor* LauBlattWeisskopfFactor::createClone( const UInt_t newSpin, const BarrierType newBarrierType )
+LauBlattWeisskopfFactor* LauBlattWeisskopfFactor::createClone( const UInt_t newSpin,
+ const BarrierType newBarrierType )
{
- LauBlattWeisskopfFactor* clone = new LauBlattWeisskopfFactor( *this, newSpin, newBarrierType );
- return clone;
+ LauBlattWeisskopfFactor* clone = new LauBlattWeisskopfFactor( *this, newSpin, newBarrierType );
+ return clone;
}
Double_t LauBlattWeisskopfFactor::calcFormFactor( const Double_t p ) const
{
- // Calculate the requested form factor for the resonance, given the momentum value
- Double_t fFactor(1.0);
-
- // For scalars the form factor is always unity
- // TODO: and we currently don't have formulae for spin > 5
- if ( (spin_ == 0) || (spin_ > 5) ) {
- return fFactor;
- }
-
- const Double_t radius = radius_->unblindValue();
- const Double_t z = radius*radius*p*p;
-
- if ( barrierType_ == BWBarrier ) {
- if (spin_ == 1) {
- fFactor = TMath::Sqrt(2.0*z/(z + 1.0));
- } else if (spin_ == 2) {
- fFactor = TMath::Sqrt(13.0*z*z/(z*z + 3.0*z + 9.0));
- } else if (spin_ == 3) {
- fFactor = TMath::Sqrt(277.0*z*z*z/(z*z*z + 6.0*z*z + 45.0*z + 225.0));
- } else if (spin_ == 4) {
- fFactor = TMath::Sqrt(12746.0*z*z*z*z/(z*z*z*z + 10.0*z*z*z + 135.0*z*z + 1575.0*z + 11025.0));
- } else if (spin_ == 5) {
- fFactor = TMath::Sqrt(998881.0*z*z*z*z*z/(z*z*z*z*z + 15.0*z*z*z*z + 315.0*z*z*z + 6300.0*z*z + 99225.0*z + 893025.0));
- }
- } else if ( barrierType_ == BWPrimeBarrier ) {
- if (spin_ == 1) {
- fFactor = TMath::Sqrt(1.0/(z + 1.0));
- } else if (spin_ == 2) {
- fFactor = TMath::Sqrt(1.0/(z*z + 3.0*z + 9.0));
- } else if (spin_ == 3) {
- fFactor = TMath::Sqrt(1.0/(z*z*z + 6.0*z*z + 45.0*z + 225.0));
- } else if (spin_ == 4) {
- fFactor = TMath::Sqrt(1.0/(z*z*z*z + 10.0*z*z*z + 135.0*z*z + 1575.0*z + 11025.0));
- } else if (spin_ == 5) {
- fFactor = TMath::Sqrt(1.0/(z*z*z*z*z + 15.0*z*z*z*z + 315.0*z*z*z + 6300.0*z*z + 99225.0*z + 893025.0));
- }
- } else if ( barrierType_ == ExpBarrier ) {
- if (spin_ == 1) {
- fFactor = TMath::Exp( -TMath::Sqrt(z) );
- } else if (spin_ == 2) {
- fFactor = TMath::Exp( -z );
- } else if (spin_ == 3) {
- fFactor = TMath::Exp( -TMath::Sqrt(z*z*z) );
- } else if (spin_ == 4) {
- fFactor = TMath::Exp( -z*z );
- } else if (spin_ == 5) {
- fFactor = TMath::Exp( -TMath::Sqrt(z*z*z*z*z) );
- }
- }
-
- return fFactor;
+ // Calculate the requested form factor for the resonance, given the momentum value
+ Double_t fFactor( 1.0 );
+
+ // For scalars the form factor is always unity
+ // TODO: and we currently don't have formulae for spin > 5
+ if ( ( spin_ == 0 ) || ( spin_ > 5 ) ) {
+ return fFactor;
+ }
+
+ const Double_t radius = radius_->unblindValue();
+ const Double_t z = radius * radius * p * p;
+
+ if ( barrierType_ == BWBarrier ) {
+ if ( spin_ == 1 ) {
+ fFactor = TMath::Sqrt( 2.0 * z / ( z + 1.0 ) );
+ } else if ( spin_ == 2 ) {
+ fFactor = TMath::Sqrt( 13.0 * z * z / ( z * z + 3.0 * z + 9.0 ) );
+ } else if ( spin_ == 3 ) {
+ fFactor = TMath::Sqrt( 277.0 * z * z * z /
+ ( z * z * z + 6.0 * z * z + 45.0 * z + 225.0 ) );
+ } else if ( spin_ == 4 ) {
+ fFactor = TMath::Sqrt(
+ 12746.0 * z * z * z * z /
+ ( z * z * z * z + 10.0 * z * z * z + 135.0 * z * z + 1575.0 * z + 11025.0 ) );
+ } else if ( spin_ == 5 ) {
+ fFactor = TMath::Sqrt( 998881.0 * z * z * z * z * z /
+ ( z * z * z * z * z + 15.0 * z * z * z * z + 315.0 * z * z * z +
+ 6300.0 * z * z + 99225.0 * z + 893025.0 ) );
+ }
+ } else if ( barrierType_ == BWPrimeBarrier ) {
+ if ( spin_ == 1 ) {
+ fFactor = TMath::Sqrt( 1.0 / ( z + 1.0 ) );
+ } else if ( spin_ == 2 ) {
+ fFactor = TMath::Sqrt( 1.0 / ( z * z + 3.0 * z + 9.0 ) );
+ } else if ( spin_ == 3 ) {
+ fFactor = TMath::Sqrt( 1.0 / ( z * z * z + 6.0 * z * z + 45.0 * z + 225.0 ) );
+ } else if ( spin_ == 4 ) {
+ fFactor = TMath::Sqrt(
+ 1.0 / ( z * z * z * z + 10.0 * z * z * z + 135.0 * z * z + 1575.0 * z + 11025.0 ) );
+ } else if ( spin_ == 5 ) {
+ fFactor = TMath::Sqrt( 1.0 /
+ ( z * z * z * z * z + 15.0 * z * z * z * z + 315.0 * z * z * z +
+ 6300.0 * z * z + 99225.0 * z + 893025.0 ) );
+ }
+ } else if ( barrierType_ == ExpBarrier ) {
+ if ( spin_ == 1 ) {
+ fFactor = TMath::Exp( -TMath::Sqrt( z ) );
+ } else if ( spin_ == 2 ) {
+ fFactor = TMath::Exp( -z );
+ } else if ( spin_ == 3 ) {
+ fFactor = TMath::Exp( -TMath::Sqrt( z * z * z ) );
+ } else if ( spin_ == 4 ) {
+ fFactor = TMath::Exp( -z * z );
+ } else if ( spin_ == 5 ) {
+ fFactor = TMath::Exp( -TMath::Sqrt( z * z * z * z * z ) );
+ }
+ }
+
+ return fFactor;
}
-
diff --git a/src/LauBlind.cc b/src/LauBlind.cc
index ecaa34e..fa562b9 100644
--- a/src/LauBlind.cc
+++ b/src/LauBlind.cc
@@ -1,70 +1,67 @@
/*
Copyright 2015 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauBlind.cc
\brief File containing implementation of LauBlind class.
*/
#include "LauBlind.hh"
#include "TMath.h"
#include "TRandom3.h"
-
-
LauBlind::LauBlind() :
- blindingString_(""),
- blindingWidth_(0.0),
- offset_(0.0)
+ blindingString_( "" ),
+ blindingWidth_( 0.0 ),
+ offset_( 0.0 )
{
}
-LauBlind::LauBlind(const TString& blindingStr, const Double_t width) :
- blindingString_(blindingStr),
- blindingWidth_(width),
- offset_(0.0)
+LauBlind::LauBlind( const TString& blindingStr, const Double_t width ) :
+ blindingString_( blindingStr ),
+ blindingWidth_( width ),
+ offset_( 0.0 )
{
- this->calcOffset();
+ this->calcOffset();
}
-LauBlind::LauBlind(const LauBlind& rhs) :
- blindingString_(rhs.blindingString_),
- blindingWidth_(rhs.blindingWidth_),
- offset_(rhs.offset_)
+LauBlind::LauBlind( const LauBlind& rhs ) :
+ blindingString_( rhs.blindingString_ ),
+ blindingWidth_( rhs.blindingWidth_ ),
+ offset_( rhs.offset_ )
{
}
LauBlind::~LauBlind()
{
}
void LauBlind::calcOffset()
{
- //hash the blinding string to obtain a seed
- TRandom3 r(TMath::Hash(blindingString_));
+ //hash the blinding string to obtain a seed
+ TRandom3 r( TMath::Hash( blindingString_ ) );
- //offsets are Gaussian distributed with defined width
- offset_ = blindingWidth_ * r.Gaus();
+ //offsets are Gaussian distributed with defined width
+ offset_ = blindingWidth_ * r.Gaus();
}
-
diff --git a/src/LauBreitWignerRes.cc b/src/LauBreitWignerRes.cc
index 892bccc..6fe64e8 100644
--- a/src/LauBreitWignerRes.cc
+++ b/src/LauBreitWignerRes.cc
@@ -1,77 +1,76 @@
/*
Copyright 2004 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauBreitWignerRes.cc
\brief File containing implementation of LauBreitWignerRes class.
*/
#include "LauBreitWignerRes.hh"
-
-
-LauBreitWignerRes::LauBreitWignerRes(LauResonanceInfo* resInfo, const Int_t resPairAmpInt, const LauDaughters* daughters) :
- LauAbsResonance(resInfo, resPairAmpInt, daughters)
+LauBreitWignerRes::LauBreitWignerRes( LauResonanceInfo* resInfo,
+ const Int_t resPairAmpInt,
+ const LauDaughters* daughters ) :
+ LauAbsResonance( resInfo, resPairAmpInt, daughters )
{
}
LauBreitWignerRes::~LauBreitWignerRes()
{
}
void LauBreitWignerRes::initialise()
{
}
-LauComplex LauBreitWignerRes::resAmp(Double_t mass, Double_t spinTerm)
+LauComplex LauBreitWignerRes::resAmp( Double_t mass, Double_t spinTerm )
{
- // This function returns the complex dynamical amplitude for a Breit-Wigner resonance,
- // given the invariant mass and cos(helicity) values.
+ // This function returns the complex dynamical amplitude for a Breit-Wigner resonance,
+ // given the invariant mass and cos(helicity) values.
- Double_t resMass = this->getMass();
- Double_t deltaM = mass - resMass;
+ Double_t resMass = this->getMass();
+ Double_t deltaM = mass - resMass;
- Double_t resWidthO2 = 0.5 * this->getWidth();
- Double_t resWidthO2Sq = resWidthO2*resWidthO2;
+ Double_t resWidthO2 = 0.5 * this->getWidth();
+ Double_t resWidthO2Sq = resWidthO2 * resWidthO2;
- LauComplex resAmplitude(deltaM, resWidthO2);
+ LauComplex resAmplitude( deltaM, resWidthO2 );
- resAmplitude.rescale(spinTerm/(deltaM*deltaM + resWidthO2Sq));
+ resAmplitude.rescale( spinTerm / ( deltaM * deltaM + resWidthO2Sq ) );
- return resAmplitude;
+ return resAmplitude;
}
const std::vector<LauParameter*>& LauBreitWignerRes::getFloatingParameters()
{
- this->clearFloatingParameters();
+ this->clearFloatingParameters();
- if ( ! this->fixMass() ) {
- this->addFloatingParameter( this->getMassPar() );
- }
- if ( ! this->fixWidth() ) {
- this->addFloatingParameter( this->getWidthPar() );
- }
+ if ( ! this->fixMass() ) {
+ this->addFloatingParameter( this->getMassPar() );
+ }
+ if ( ! this->fixWidth() ) {
+ this->addFloatingParameter( this->getWidthPar() );
+ }
- return this->getParameters();
+ return this->getParameters();
}
-
diff --git a/src/LauCPFitModel.cc b/src/LauCPFitModel.cc
index 5d929f3..46af5e0 100644
--- a/src/LauCPFitModel.cc
+++ b/src/LauCPFitModel.cc
@@ -1,3483 +1,3799 @@
/*
Copyright 2004 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauCPFitModel.cc
- \brief File containing implementation of LauCPFitModel class.
- */
-
-#include <iostream>
-#include <iomanip>
-#include <fstream>
-#include <vector>
+ \brief File containing implementation of LauCPFitModel class.
+*/
-#include "TVirtualFitter.h"
-#include "TSystem.h"
-#include "TMinuit.h"
-#include "TRandom.h"
-#include "TFile.h"
-#include "TTree.h"
-#include "TBranch.h"
-#include "TLeaf.h"
-#include "TMath.h"
-#include "TH2.h"
-#include "TGraph2D.h"
-#include "TGraph.h"
-#include "TStyle.h"
-#include "TCanvas.h"
+#include "LauCPFitModel.hh"
#include "LauAbsBkgndDPModel.hh"
#include "LauAbsCoeffSet.hh"
-#include "LauIsobarDynamics.hh"
#include "LauAbsPdf.hh"
#include "LauAsymmCalc.hh"
#include "LauComplex.hh"
#include "LauConstants.hh"
-#include "LauCPFitModel.hh"
#include "LauDaughters.hh"
#include "LauEffModel.hh"
#include "LauEmbeddedData.hh"
#include "LauFitNtuple.hh"
#include "LauGenNtuple.hh"
+#include "LauIsobarDynamics.hh"
#include "LauKinematics.hh"
#include "LauPrint.hh"
#include "LauRandom.hh"
#include "LauScfMap.hh"
+#include "TBranch.h"
+#include "TCanvas.h"
+#include "TFile.h"
+#include "TGraph.h"
+#include "TGraph2D.h"
+#include "TH2.h"
+#include "TLeaf.h"
+#include "TMath.h"
+#include "TMinuit.h"
+#include "TRandom.h"
+#include "TStyle.h"
+#include "TSystem.h"
+#include "TTree.h"
+#include "TVirtualFitter.h"
+#include <fstream>
+#include <iomanip>
+#include <iostream>
+#include <vector>
-LauCPFitModel::LauCPFitModel(LauIsobarDynamics* negModel, LauIsobarDynamics* posModel, Bool_t tagged, const TString& tagVarName) : LauAbsFitModel(),
- negSigModel_(negModel), posSigModel_(posModel),
- negKinematics_(negModel ? negModel->getKinematics() : 0),
- posKinematics_(posModel ? posModel->getKinematics() : 0),
- usingBkgnd_(kFALSE),
- nSigComp_(0),
- nSigDPPar_(0),
- nExtraPdfPar_(0),
- nNormPar_(0),
- negMeanEff_("negMeanEff",0.0,0.0,1.0), posMeanEff_("posMeanEff",0.0,0.0,1.0),
- negDPRate_("negDPRate",0.0,0.0,100.0), posDPRate_("posDPRate",0.0,0.0,100.0),
- signalEvents_(0),
- signalAsym_(0),
- forceAsym_(kFALSE),
- tagged_(tagged),
- tagVarName_(tagVarName),
- curEvtCharge_(0),
- useSCF_(kFALSE),
- useSCFHist_(kFALSE),
- scfFrac_("scfFrac",0.0,0.0,1.0),
- scfFracHist_(0),
- scfMap_(0),
- compareFitData_(kFALSE),
- negParent_("B-"), posParent_("B+"),
- negSignalTree_(0), posSignalTree_(0),
- reuseSignal_(kFALSE),
- useNegReweighting_(kFALSE), usePosReweighting_(kFALSE),
- sigDPLike_(0.0),
- scfDPLike_(0.0),
- sigExtraLike_(0.0),
- scfExtraLike_(0.0),
- sigTotalLike_(0.0),
- scfTotalLike_(0.0)
-{
- const LauDaughters* negDaug = negSigModel_->getDaughters();
- if (negDaug != 0) {negParent_ = negDaug->getNameParent();}
- const LauDaughters* posDaug = posSigModel_->getDaughters();
- if (posDaug != 0) {posParent_ = posDaug->getNameParent();}
+LauCPFitModel::LauCPFitModel( LauIsobarDynamics* negModel,
+ LauIsobarDynamics* posModel,
+ Bool_t tagged,
+ const TString& tagVarName ) :
+ LauAbsFitModel(),
+ negSigModel_( negModel ),
+ posSigModel_( posModel ),
+ negKinematics_( negModel ? negModel->getKinematics() : 0 ),
+ posKinematics_( posModel ? posModel->getKinematics() : 0 ),
+ usingBkgnd_( kFALSE ),
+ nSigComp_( 0 ),
+ nSigDPPar_( 0 ),
+ nExtraPdfPar_( 0 ),
+ nNormPar_( 0 ),
+ negMeanEff_( "negMeanEff", 0.0, 0.0, 1.0 ),
+ posMeanEff_( "posMeanEff", 0.0, 0.0, 1.0 ),
+ negDPRate_( "negDPRate", 0.0, 0.0, 100.0 ),
+ posDPRate_( "posDPRate", 0.0, 0.0, 100.0 ),
+ signalEvents_( 0 ),
+ signalAsym_( 0 ),
+ forceAsym_( kFALSE ),
+ tagged_( tagged ),
+ tagVarName_( tagVarName ),
+ curEvtCharge_( 0 ),
+ useSCF_( kFALSE ),
+ useSCFHist_( kFALSE ),
+ scfFrac_( "scfFrac", 0.0, 0.0, 1.0 ),
+ scfFracHist_( 0 ),
+ scfMap_( 0 ),
+ compareFitData_( kFALSE ),
+ negParent_( "B-" ),
+ posParent_( "B+" ),
+ negSignalTree_( 0 ),
+ posSignalTree_( 0 ),
+ reuseSignal_( kFALSE ),
+ useNegReweighting_( kFALSE ),
+ usePosReweighting_( kFALSE ),
+ sigDPLike_( 0.0 ),
+ scfDPLike_( 0.0 ),
+ sigExtraLike_( 0.0 ),
+ scfExtraLike_( 0.0 ),
+ sigTotalLike_( 0.0 ),
+ scfTotalLike_( 0.0 )
+{
+ const LauDaughters* negDaug = negSigModel_->getDaughters();
+ if ( negDaug != 0 ) {
+ negParent_ = negDaug->getNameParent();
+ }
+ const LauDaughters* posDaug = posSigModel_->getDaughters();
+ if ( posDaug != 0 ) {
+ posParent_ = posDaug->getNameParent();
+ }
}
LauCPFitModel::~LauCPFitModel()
{
- delete negSignalTree_;
- delete posSignalTree_;
- for (LauBkgndEmbDataList::iterator iter = negBkgndTree_.begin(); iter != negBkgndTree_.end(); ++iter) {
- delete (*iter);
- }
- for (LauBkgndEmbDataList::iterator iter = posBkgndTree_.begin(); iter != posBkgndTree_.end(); ++iter) {
- delete (*iter);
- }
- delete scfFracHist_;
+ delete negSignalTree_;
+ delete posSignalTree_;
+ for ( LauBkgndEmbDataList::iterator iter = negBkgndTree_.begin(); iter != negBkgndTree_.end();
+ ++iter ) {
+ delete ( *iter );
+ }
+ for ( LauBkgndEmbDataList::iterator iter = posBkgndTree_.begin(); iter != posBkgndTree_.end();
+ ++iter ) {
+ delete ( *iter );
+ }
+ delete scfFracHist_;
}
void LauCPFitModel::setupBkgndVectors()
{
- UInt_t nBkgnds = this->nBkgndClasses();
- negBkgndDPModels_.resize( nBkgnds );
- posBkgndDPModels_.resize( nBkgnds );
- negBkgndPdfs_.resize( nBkgnds );
- posBkgndPdfs_.resize( nBkgnds );
- bkgndEvents_.resize( nBkgnds );
- bkgndAsym_.resize( nBkgnds );
- negBkgndTree_.resize( nBkgnds );
- posBkgndTree_.resize( nBkgnds );
- reuseBkgnd_.resize( nBkgnds );
- bkgndDPLike_.resize( nBkgnds );
- bkgndExtraLike_.resize( nBkgnds );
- bkgndTotalLike_.resize( nBkgnds );
-}
-
-void LauCPFitModel::setNSigEvents(LauParameter* nSigEvents)
-{
- if ( nSigEvents == 0 ) {
- std::cerr << "ERROR in LauCPFitModel::setNSigEvents : The LauParameter pointer is null." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- if ( signalEvents_ != 0 ) {
- std::cerr << "ERROR in LauCPFitModel::setNSigEvents : You are trying to overwrite the signal yield." << std::endl;
- return;
- }
- if ( signalAsym_ != 0 ) {
- std::cerr << "ERROR in LauCPFitModel::setNSigEvents : You are trying to overwrite the signal asymmetry." << std::endl;
- return;
- }
-
- signalEvents_ = nSigEvents;
- TString name = signalEvents_->name();
- if ( ! name.Contains("signalEvents") && !( name.BeginsWith("signal") && name.EndsWith("Events") ) ) {
- signalEvents_->name("signalEvents");
- }
- Double_t value = nSigEvents->value();
- signalEvents_->range(-2.0*(TMath::Abs(value)+1.0), 2.0*(TMath::Abs(value)+1.0));
-
- signalAsym_ = new LauParameter("signalAsym",0.0,-1.0,1.0,kTRUE);
+ UInt_t nBkgnds = this->nBkgndClasses();
+ negBkgndDPModels_.resize( nBkgnds );
+ posBkgndDPModels_.resize( nBkgnds );
+ negBkgndPdfs_.resize( nBkgnds );
+ posBkgndPdfs_.resize( nBkgnds );
+ bkgndEvents_.resize( nBkgnds );
+ bkgndAsym_.resize( nBkgnds );
+ negBkgndTree_.resize( nBkgnds );
+ posBkgndTree_.resize( nBkgnds );
+ reuseBkgnd_.resize( nBkgnds );
+ bkgndDPLike_.resize( nBkgnds );
+ bkgndExtraLike_.resize( nBkgnds );
+ bkgndTotalLike_.resize( nBkgnds );
+}
+
+void LauCPFitModel::setNSigEvents( LauParameter* nSigEvents )
+{
+ if ( nSigEvents == 0 ) {
+ std::cerr << "ERROR in LauCPFitModel::setNSigEvents : The LauParameter pointer is null."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ if ( signalEvents_ != 0 ) {
+ std::cerr << "ERROR in LauCPFitModel::setNSigEvents : You are trying to overwrite the signal yield."
+ << std::endl;
+ return;
+ }
+ if ( signalAsym_ != 0 ) {
+ std::cerr << "ERROR in LauCPFitModel::setNSigEvents : You are trying to overwrite the signal asymmetry."
+ << std::endl;
+ return;
+ }
+
+ signalEvents_ = nSigEvents;
+ TString name = signalEvents_->name();
+ if ( ! name.Contains( "signalEvents" ) &&
+ ! ( name.BeginsWith( "signal" ) && name.EndsWith( "Events" ) ) ) {
+ signalEvents_->name( "signalEvents" );
+ }
+ Double_t value = nSigEvents->value();
+ signalEvents_->range( -2.0 * ( TMath::Abs( value ) + 1.0 ), 2.0 * ( TMath::Abs( value ) + 1.0 ) );
+
+ signalAsym_ = new LauParameter( "signalAsym", 0.0, -1.0, 1.0, kTRUE );
}
void LauCPFitModel::setNSigEvents( LauParameter* nSigEvents, LauParameter* sigAsym, Bool_t forceAsym )
{
- if ( nSigEvents == 0 ) {
- std::cerr << "ERROR in LauCPFitModel::setNSigEvents : The event LauParameter pointer is null." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- if ( sigAsym == 0 ) {
- std::cerr << "ERROR in LauCPFitModel::setNSigEvents : The asym LauParameter pointer is null." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
+ if ( nSigEvents == 0 ) {
+ std::cerr << "ERROR in LauCPFitModel::setNSigEvents : The event LauParameter pointer is null."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ if ( sigAsym == 0 ) {
+ std::cerr << "ERROR in LauCPFitModel::setNSigEvents : The asym LauParameter pointer is null."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
- if ( signalEvents_ != 0 ) {
- std::cerr << "ERROR in LauCPFitModel::setNSigEvents : You are trying to overwrite the signal yield." << std::endl;
- return;
- }
- if ( signalAsym_ != 0 ) {
- std::cerr << "ERROR in LauCPFitModel::setNSigEvents : You are trying to overwrite the signal asymmetry." << std::endl;
- return;
- }
+ if ( signalEvents_ != 0 ) {
+ std::cerr << "ERROR in LauCPFitModel::setNSigEvents : You are trying to overwrite the signal yield."
+ << std::endl;
+ return;
+ }
+ if ( signalAsym_ != 0 ) {
+ std::cerr << "ERROR in LauCPFitModel::setNSigEvents : You are trying to overwrite the signal asymmetry."
+ << std::endl;
+ return;
+ }
- signalEvents_ = nSigEvents;
- signalEvents_->name("signalEvents");
- Double_t value = nSigEvents->value();
- signalEvents_->range(-2.0*(TMath::Abs(value)+1.0), 2.0*(TMath::Abs(value)+1.0));
+ signalEvents_ = nSigEvents;
+ signalEvents_->name( "signalEvents" );
+ Double_t value = nSigEvents->value();
+ signalEvents_->range( -2.0 * ( TMath::Abs( value ) + 1.0 ), 2.0 * ( TMath::Abs( value ) + 1.0 ) );
- signalAsym_ = sigAsym;
- signalAsym_->name("signalAsym");
- signalAsym_->range(-1.0,1.0);
+ signalAsym_ = sigAsym;
+ signalAsym_->name( "signalAsym" );
+ signalAsym_->range( -1.0, 1.0 );
- forceAsym_ = forceAsym;
+ forceAsym_ = forceAsym;
}
void LauCPFitModel::setNBkgndEvents( LauAbsRValue* nBkgndEvents )
{
- if ( nBkgndEvents == 0 ) {
- std::cerr << "ERROR in LauCPFitModel::setNBgkndEvents : The background yield LauParameter pointer is null." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
+ if ( nBkgndEvents == 0 ) {
+ std::cerr << "ERROR in LauCPFitModel::setNBgkndEvents : The background yield LauParameter pointer is null."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
- if ( ! this->validBkgndClass( nBkgndEvents->name() ) ) {
- std::cerr << "ERROR in LauCPFitModel::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;
- gSystem->Exit(EXIT_FAILURE);
- }
+ if ( ! this->validBkgndClass( nBkgndEvents->name() ) ) {
+ std::cerr << "ERROR in LauCPFitModel::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;
+ gSystem->Exit( EXIT_FAILURE );
+ }
- UInt_t bkgndID = this->bkgndClassID( nBkgndEvents->name() );
+ UInt_t bkgndID = this->bkgndClassID( nBkgndEvents->name() );
- if ( bkgndEvents_[bkgndID] != 0 ) {
- std::cerr << "ERROR in LauCPFitModel::setNBkgndEvents : You are trying to overwrite the background yield." << std::endl;
- return;
- }
+ if ( bkgndEvents_[bkgndID] != 0 ) {
+ std::cerr << "ERROR in LauCPFitModel::setNBkgndEvents : You are trying to overwrite the background yield."
+ << std::endl;
+ return;
+ }
- if ( bkgndAsym_[bkgndID] != 0 ) {
- std::cerr << "ERROR in LauCPFitModel::setNBkgndEvents : You are trying to overwrite the background asymmetry." << std::endl;
- return;
- }
+ if ( bkgndAsym_[bkgndID] != 0 ) {
+ std::cerr << "ERROR in LauCPFitModel::setNBkgndEvents : You are trying to overwrite the background asymmetry."
+ << std::endl;
+ return;
+ }
- nBkgndEvents->name( nBkgndEvents->name()+"Events" );
- if ( nBkgndEvents->isLValue() ) {
- Double_t value = nBkgndEvents->value();
- LauParameter* yield = dynamic_cast<LauParameter*>( nBkgndEvents );
- yield->range(-2.0*(TMath::Abs(value)+1.0), 2.0*(TMath::Abs(value)+1.0));
- }
- bkgndEvents_[bkgndID] = nBkgndEvents;
+ nBkgndEvents->name( nBkgndEvents->name() + "Events" );
+ if ( nBkgndEvents->isLValue() ) {
+ Double_t value = nBkgndEvents->value();
+ LauParameter* yield = dynamic_cast<LauParameter*>( nBkgndEvents );
+ yield->range( -2.0 * ( TMath::Abs( value ) + 1.0 ), 2.0 * ( TMath::Abs( value ) + 1.0 ) );
+ }
+ bkgndEvents_[bkgndID] = nBkgndEvents;
- bkgndAsym_[bkgndID] = new LauParameter(nBkgndEvents->name()+"Asym",0.0,-1.0,1.0,kTRUE);
+ bkgndAsym_[bkgndID] = new LauParameter( nBkgndEvents->name() + "Asym", 0.0, -1.0, 1.0, kTRUE );
}
-void LauCPFitModel::setNBkgndEvents(LauAbsRValue* nBkgndEvents, LauAbsRValue* bkgndAsym)
+void LauCPFitModel::setNBkgndEvents( LauAbsRValue* nBkgndEvents, LauAbsRValue* bkgndAsym )
{
- if ( nBkgndEvents == 0 ) {
- std::cerr << "ERROR in LauCPFitModel::setNBkgndEvents : The background yield LauParameter pointer is null." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
+ if ( nBkgndEvents == 0 ) {
+ std::cerr << "ERROR in LauCPFitModel::setNBkgndEvents : The background yield LauParameter pointer is null."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
- if ( bkgndAsym == 0 ) {
- std::cerr << "ERROR in LauCPFitModel::setNBkgndEvents : The background asym LauParameter pointer is null." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
+ if ( bkgndAsym == 0 ) {
+ std::cerr << "ERROR in LauCPFitModel::setNBkgndEvents : The background asym LauParameter pointer is null."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
- if ( ! this->validBkgndClass( nBkgndEvents->name() ) ) {
- std::cerr << "ERROR in LauCPFitModel::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;
- gSystem->Exit(EXIT_FAILURE);
- }
+ if ( ! this->validBkgndClass( nBkgndEvents->name() ) ) {
+ std::cerr << "ERROR in LauCPFitModel::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;
+ gSystem->Exit( EXIT_FAILURE );
+ }
- UInt_t bkgndID = this->bkgndClassID( nBkgndEvents->name() );
+ UInt_t bkgndID = this->bkgndClassID( nBkgndEvents->name() );
- if ( bkgndEvents_[bkgndID] != 0 ) {
- std::cerr << "ERROR in LauCPFitModel::setNBkgndEvents : You are trying to overwrite the background yield." << std::endl;
- return;
- }
+ if ( bkgndEvents_[bkgndID] != 0 ) {
+ std::cerr << "ERROR in LauCPFitModel::setNBkgndEvents : You are trying to overwrite the background yield."
+ << std::endl;
+ return;
+ }
- if ( bkgndAsym_[bkgndID] != 0 ) {
- std::cerr << "ERROR in LauCPFitModel::setNBkgndEvents : You are trying to overwrite the background asymmetry." << std::endl;
- return;
- }
+ if ( bkgndAsym_[bkgndID] != 0 ) {
+ std::cerr << "ERROR in LauCPFitModel::setNBkgndEvents : You are trying to overwrite the background asymmetry."
+ << std::endl;
+ return;
+ }
- nBkgndEvents->name( nBkgndEvents->name()+"Events" );
- if ( nBkgndEvents->isLValue() ) {
- Double_t value = nBkgndEvents->value();
- LauParameter* yield = dynamic_cast<LauParameter*>( nBkgndEvents );
- yield->range(-2.0*(TMath::Abs(value)+1.0), 2.0*(TMath::Abs(value)+1.0));
- }
- bkgndEvents_[bkgndID] = nBkgndEvents;
+ nBkgndEvents->name( nBkgndEvents->name() + "Events" );
+ if ( nBkgndEvents->isLValue() ) {
+ Double_t value = nBkgndEvents->value();
+ LauParameter* yield = dynamic_cast<LauParameter*>( nBkgndEvents );
+ yield->range( -2.0 * ( TMath::Abs( value ) + 1.0 ), 2.0 * ( TMath::Abs( value ) + 1.0 ) );
+ }
+ bkgndEvents_[bkgndID] = nBkgndEvents;
- bkgndAsym->name( nBkgndEvents->name()+"Asym" );
- if ( bkgndAsym->isLValue() ) {
- LauParameter* asym = dynamic_cast<LauParameter*>( bkgndAsym );
- asym->range(-1.0, 1.0);
- }
- bkgndAsym_[bkgndID] = bkgndAsym;
+ bkgndAsym->name( nBkgndEvents->name() + "Asym" );
+ if ( bkgndAsym->isLValue() ) {
+ LauParameter* asym = dynamic_cast<LauParameter*>( bkgndAsym );
+ asym->range( -1.0, 1.0 );
+ }
+ bkgndAsym_[bkgndID] = bkgndAsym;
}
-void LauCPFitModel::splitSignalComponent( const TH2* dpHisto, const Bool_t upperHalf, const Bool_t fluctuateBins, LauScfMap* scfMap )
+void LauCPFitModel::splitSignalComponent( const TH2* dpHisto,
+ const Bool_t upperHalf,
+ const Bool_t fluctuateBins,
+ LauScfMap* scfMap )
{
- if ( useSCF_ == kTRUE ) {
- std::cerr << "ERROR in LauCPFitModel::splitSignalComponent : Have already setup SCF." << std::endl;
- return;
- }
+ if ( useSCF_ == kTRUE ) {
+ std::cerr << "ERROR in LauCPFitModel::splitSignalComponent : Have already setup SCF."
+ << std::endl;
+ return;
+ }
- if ( dpHisto == 0 ) {
- std::cerr << "ERROR in LauCPFitModel::splitSignalComponent : The histogram pointer is null." << std::endl;
- return;
- }
+ if ( dpHisto == 0 ) {
+ std::cerr << "ERROR in LauCPFitModel::splitSignalComponent : The histogram pointer is null."
+ << std::endl;
+ return;
+ }
- const LauDaughters* daughters = negSigModel_->getDaughters();
- scfFracHist_ = new LauEffModel( daughters, 0 );
- scfFracHist_->setEffHisto( dpHisto, kTRUE, fluctuateBins, 0.0, 0.0, upperHalf, daughters->squareDP() );
+ const LauDaughters* daughters = negSigModel_->getDaughters();
+ scfFracHist_ = new LauEffModel( daughters, 0 );
+ scfFracHist_
+ ->setEffHisto( dpHisto, kTRUE, fluctuateBins, 0.0, 0.0, upperHalf, daughters->squareDP() );
- scfMap_ = scfMap;
+ scfMap_ = scfMap;
- useSCF_ = kTRUE;
- useSCFHist_ = kTRUE;
+ useSCF_ = kTRUE;
+ useSCFHist_ = kTRUE;
}
void LauCPFitModel::splitSignalComponent( const Double_t scfFrac, const Bool_t fixed )
{
- if ( useSCF_ == kTRUE ) {
- std::cerr << "ERROR in LauCPFitModel::splitSignalComponent : Have already setup SCF." << std::endl;
- return;
- }
-
- scfFrac_.range( 0.0, 1.0 );
- scfFrac_.value( scfFrac ); scfFrac_.initValue( scfFrac ); scfFrac_.genValue( scfFrac );
- scfFrac_.fixed( fixed );
-
- useSCF_ = kTRUE;
- useSCFHist_ = kFALSE;
-}
-
-void LauCPFitModel::setBkgndDPModels(const TString& bkgndClass, LauAbsBkgndDPModel* negModel, LauAbsBkgndDPModel* posModel)
-{
- if ((negModel==0) || (posModel==0)) {
- std::cerr << "ERROR in LauCPFitModel::setBkgndDPModels : One or both of the model pointers is null." << std::endl;
- return;
- }
-
- // check that this background name is valid
- if ( ! this->validBkgndClass( bkgndClass) ) {
- std::cerr << "ERROR in LauCPFitModel::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;
- return;
- }
-
- UInt_t bkgndID = this->bkgndClassID( bkgndClass );
- negBkgndDPModels_[bkgndID] = negModel;
- posBkgndDPModels_[bkgndID] = posModel;
-
- usingBkgnd_ = kTRUE;
-}
-
-void LauCPFitModel::setSignalPdfs(LauAbsPdf* negPdf, LauAbsPdf* posPdf)
-{
- if ( tagged_ ) {
- if (negPdf==0 || posPdf==0) {
- std::cerr << "ERROR in LauCPFitModel::setSignalPdfs : One or both of the PDF pointers is null." << std::endl;
- return;
- }
- } else {
- // if we're doing an untagged analysis we will only use the negative PDFs
- if ( negPdf==0 ) {
- std::cerr << "ERROR in LauCPFitModel::setSignalPdfs : The negative PDF pointer is null." << std::endl;
- return;
- }
- if ( posPdf!=0 ) {
- std::cerr << "WARNING in LauCPFitModel::setSignalPdfs : Doing an untagged fit so will not use the positive PDF." << std::endl;
- }
- }
- negSignalPdfs_.push_back(negPdf);
- posSignalPdfs_.push_back(posPdf);
-}
-
-void LauCPFitModel::setSCFPdfs(LauAbsPdf* negPdf, LauAbsPdf* posPdf)
-{
- if ( tagged_ ) {
- if (negPdf==0 || posPdf==0) {
- std::cerr << "ERROR in LauCPFitModel::setSCFPdfs : One or both of the PDF pointers is null." << std::endl;
- return;
- }
- } else {
- // if we're doing an untagged analysis we will only use the negative PDFs
- if ( negPdf==0 ) {
- std::cerr << "ERROR in LauCPFitModel::setSCFPdfs : The negative PDF pointer is null." << std::endl;
- return;
- }
- if ( posPdf!=0 ) {
- std::cerr << "WARNING in LauCPFitModel::setSCFPdfs : Doing an untagged fit so will not use the positive PDF." << std::endl;
- }
- }
- negScfPdfs_.push_back(negPdf);
- posScfPdfs_.push_back(posPdf);
-}
-
-void LauCPFitModel::setBkgndPdfs(const TString& bkgndClass, LauAbsPdf* negPdf, LauAbsPdf* posPdf)
-{
- if ( tagged_ ) {
- if (negPdf==0 || posPdf==0) {
- std::cerr << "ERROR in LauCPFitModel::setBkgndPdfs : One or both of the PDF pointers is null." << std::endl;
- return;
- }
- } else {
- // if we're doing an untagged analysis we will only use the negative PDFs
- if ( negPdf==0 ) {
- std::cerr << "ERROR in LauCPFitModel::setBkgndPdfs : The negative PDF pointer is null." << std::endl;
- return;
- }
- if ( posPdf!=0 ) {
- std::cerr << "WARNING in LauCPFitModel::setBkgndPdfs : Doing an untagged fit so will not use the positive PDF." << std::endl;
- }
- }
-
- // check that this background name is valid
- if ( ! this->validBkgndClass( bkgndClass ) ) {
- std::cerr << "ERROR in LauCPFitModel::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;
- return;
- }
-
- UInt_t bkgndID = this->bkgndClassID( bkgndClass );
- negBkgndPdfs_[bkgndID].push_back(negPdf);
- posBkgndPdfs_[bkgndID].push_back(posPdf);
-
- usingBkgnd_ = kTRUE;
-}
-
-void LauCPFitModel::setAmpCoeffSet(LauAbsCoeffSet* coeffSet)
-{
- // Resize the coeffPars vector if not already done
- if ( coeffPars_.empty() ) {
- const UInt_t nNegAmp = negSigModel_->getnTotAmp();
- const UInt_t nPosAmp = posSigModel_->getnTotAmp();
- if ( nNegAmp != nPosAmp ) {
- std::cerr << "ERROR in LauCPFitModel::setAmpCoeffSet : Unequal number of signal DP components in the negative and positive models: " << nNegAmp << " != " << nPosAmp << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- coeffPars_.resize( nNegAmp );
- for (std::vector<LauAbsCoeffSet*>::iterator iter = coeffPars_.begin(); iter != coeffPars_.end(); ++iter) {
- (*iter) = 0;
- }
- fitFracAsymm_.resize( nNegAmp );
- acp_.resize( nNegAmp );
- }
-
- // Is there a component called compName in the signal model?
- TString compName(coeffSet->name());
- TString conjName = negSigModel_->getConjResName(compName);
- const Int_t negIndex = negSigModel_->resonanceIndex(compName);
- const Int_t posIndex = posSigModel_->resonanceIndex(conjName);
- if ( negIndex < 0 ) {
- std::cerr << "ERROR in LauCPFitModel::setAmpCoeffSet : " << negParent_ << " signal DP model doesn't contain component \"" << compName << "\"." << std::endl;
- return;
- }
- if ( posIndex < 0 ) {
- std::cerr << "ERROR in LauCPFitModel::setAmpCoeffSet : " << posParent_ << " signal DP model doesn't contain component \"" << conjName << "\"." << std::endl;
- return;
- }
- if ( posIndex != negIndex ) {
- std::cerr << "ERROR in LauCPFitModel::setAmpCoeffSet : " << negParent_ << " signal DP model and " << posParent_ << " signal DP model have different indices for components \"" << compName << "\" and \"" << conjName << "\"." << std::endl;
- return;
- }
-
- // Do we already have it in our list of names?
- if ( coeffPars_[negIndex] != 0 && coeffPars_[negIndex]->name() == compName) {
- std::cerr << "ERROR in LauCPFitModel::setAmpCoeffSet : Have already set coefficients for \"" << compName << "\"." << std::endl;
- return;
- }
-
- coeffSet->index(negIndex);
- coeffPars_[negIndex] = coeffSet;
-
- TString parName = coeffSet->baseName(); parName += "FitFracAsym";
- fitFracAsymm_[negIndex] = LauParameter(parName, 0.0, -1.0, 1.0);
-
- acp_[negIndex] = coeffSet->acp();
-
- ++nSigComp_;
-
- std::cout << "INFO in LauCPFitModel::setAmpCoeffSet : Added coefficients for component \"" << compName << "\" to the fit model." << std::endl;
- coeffSet->printParValues();
+ if ( useSCF_ == kTRUE ) {
+ std::cerr << "ERROR in LauCPFitModel::splitSignalComponent : Have already setup SCF."
+ << std::endl;
+ return;
+ }
+
+ scfFrac_.range( 0.0, 1.0 );
+ scfFrac_.value( scfFrac );
+ scfFrac_.initValue( scfFrac );
+ scfFrac_.genValue( scfFrac );
+ scfFrac_.fixed( fixed );
+
+ useSCF_ = kTRUE;
+ useSCFHist_ = kFALSE;
}
-void LauCPFitModel::initialise()
+void LauCPFitModel::setBkgndDPModels( const TString& bkgndClass,
+ LauAbsBkgndDPModel* negModel,
+ LauAbsBkgndDPModel* posModel )
{
- // Initialisation
- if (!this->useDP() && negSignalPdfs_.empty()) {
- std::cerr << "ERROR in LauCPFitModel::initialise : Signal model doesn't exist for any variable." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- if ( this->useDP() ) {
- // Check that we have all the Dalitz-plot models
- if ((negSigModel_ == 0) || (posSigModel_ == 0)) {
- std::cerr << "ERROR in LauCPFitModel::initialise : the pointer to one (neg or pos) of the signal DP models is null.\n";
- std::cerr << " : Removing the Dalitz Plot from the model." << std::endl;
- this->useDP(kFALSE);
- }
- if ( usingBkgnd_ ) {
- if ( negBkgndDPModels_.empty() || posBkgndDPModels_.empty() ) {
- std::cerr << "ERROR in LauCPFitModel::initialise : No background DP models found.\n";
- std::cerr << " : Removing the Dalitz plot from the model." << std::endl;
- this->useDP(kFALSE);
- }
- for (LauBkgndDPModelList::const_iterator dpmodel_iter = negBkgndDPModels_.begin(); dpmodel_iter != negBkgndDPModels_.end(); ++dpmodel_iter ) {
- if ( (*dpmodel_iter) == 0 ) {
- std::cerr << "ERROR in LauCPFitModel::initialise : The pointer to one of the background DP models is null.\n";
- std::cerr << " : Removing the Dalitz Plot from the model." << std::endl;
- this->useDP(kFALSE);
- break;
- }
- }
- for (LauBkgndDPModelList::const_iterator dpmodel_iter = posBkgndDPModels_.begin(); dpmodel_iter != posBkgndDPModels_.end(); ++dpmodel_iter ) {
- if ( (*dpmodel_iter) == 0 ) {
- std::cerr << "ERROR in LauCPFitModel::initialise : The pointer to one of the background DP models is null.\n";
- std::cerr << " : Removing the Dalitz Plot from the model." << std::endl;
- this->useDP(kFALSE);
- break;
- }
- }
- }
-
- // Need to check that the number of components we have and that the dynamics has matches up
- const UInt_t nNegAmp = negSigModel_->getnTotAmp();
- const UInt_t nPosAmp = posSigModel_->getnTotAmp();
- if ( nNegAmp != nPosAmp ) {
- std::cerr << "ERROR in LauCPFitModel::initialise : 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 LauCPFitModel::initialise : Number of signal DP components in the model (" << nNegAmp << ") not equal to number of coefficients supplied (" << nSigComp_ << ")." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- if ( !fixParamFileName_.IsNull() || !fixParamMap_.empty() ) {
-
- // Set coefficients
-
- std::vector<LauParameter*> params;
- for ( auto itr = coeffPars_.begin(); itr != coeffPars_.end(); ++itr ) {
- std::vector<LauParameter*> p = (*itr)->getParameters();
- params.insert(params.end(), p.begin(), p.end());
- }
-
- this->fixParams(params);
-
- // Set resonance parameters (if they exist)
-
- negSigModel_->collateResonanceParameters();
- posSigModel_->collateResonanceParameters();
-
- this->fixParams(negSigModel_->getFloatingParameters());
- this->fixParams(posSigModel_->getFloatingParameters());
- }
-
- // From the initial parameter values calculate the coefficients
- // so they can be passed to the signal model
- this->updateCoeffs();
-
- // If all is well, go ahead and initialise them
- this->initialiseDPModels();
- }
-
- // Next check that, if a given component is being used we've got the
- // right number of PDFs for all the variables involved
- // TODO - should probably check variable names and so on as well
-
- UInt_t nsigpdfvars(0);
- for ( LauPdfPList::const_iterator pdf_iter = negSignalPdfs_.begin(); pdf_iter != negSignalPdfs_.end(); ++pdf_iter ) {
- std::vector<TString> varNames = (*pdf_iter)->varNames();
- for ( std::vector<TString>::const_iterator var_iter = varNames.begin(); var_iter != varNames.end(); ++var_iter ) {
- if ( (*var_iter) != "m13Sq" && (*var_iter) != "m23Sq" ) {
- ++nsigpdfvars;
- }
- }
- }
- if (useSCF_) {
- UInt_t nscfpdfvars(0);
- for ( LauPdfPList::const_iterator pdf_iter = negScfPdfs_.begin(); pdf_iter != negScfPdfs_.end(); ++pdf_iter ) {
- std::vector<TString> varNames = (*pdf_iter)->varNames();
- for ( std::vector<TString>::const_iterator var_iter = varNames.begin(); var_iter != varNames.end(); ++var_iter ) {
- if ( (*var_iter) != "m13Sq" && (*var_iter) != "m23Sq" ) {
- ++nscfpdfvars;
- }
- }
- }
- if (nscfpdfvars != nsigpdfvars) {
- std::cerr << "ERROR in LauCPFitModel::initialise : There are " << nsigpdfvars << " TM signal PDF variables but " << nscfpdfvars << " SCF signal PDF variables." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- }
- if (usingBkgnd_) {
- for (LauBkgndPdfsList::const_iterator bgclass_iter = negBkgndPdfs_.begin(); bgclass_iter != negBkgndPdfs_.end(); ++bgclass_iter) {
- UInt_t nbkgndpdfvars(0);
- const LauPdfPList& pdfList = (*bgclass_iter);
- for ( LauPdfPList::const_iterator pdf_iter = pdfList.begin(); pdf_iter != pdfList.end(); ++pdf_iter ) {
- std::vector<TString> varNames = (*pdf_iter)->varNames();
- for ( std::vector<TString>::const_iterator var_iter = varNames.begin(); var_iter != varNames.end(); ++var_iter ) {
- if ( (*var_iter) != "m13Sq" && (*var_iter) != "m23Sq" ) {
- ++nbkgndpdfvars;
- }
- }
- }
- if (nbkgndpdfvars != nsigpdfvars) {
- std::cerr << "ERROR in LauCPFitModel::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
- const LauParameterPList& fitVars = this->fitPars();
- if (fitVars.size() != (nSigDPPar_ + nExtraPdfPar_ + nNormPar_)) {
- std::cerr << "ERROR in LauCPFitModel::initialise : Number of fit parameters not of expected size. Exiting" << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- this->setExtraNtupleVars();
+ if ( ( negModel == 0 ) || ( posModel == 0 ) ) {
+ std::cerr << "ERROR in LauCPFitModel::setBkgndDPModels : One or both of the model pointers is null."
+ << std::endl;
+ return;
+ }
+
+ // check that this background name is valid
+ if ( ! this->validBkgndClass( bkgndClass ) ) {
+ std::cerr << "ERROR in LauCPFitModel::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;
+ return;
+ }
+
+ UInt_t bkgndID = this->bkgndClassID( bkgndClass );
+ negBkgndDPModels_[bkgndID] = negModel;
+ posBkgndDPModels_[bkgndID] = posModel;
+
+ usingBkgnd_ = kTRUE;
}
-void LauCPFitModel::recalculateNormalisation()
+void LauCPFitModel::setSignalPdfs( LauAbsPdf* negPdf, LauAbsPdf* posPdf )
{
- //std::cout << "INFO in LauCPFitModel::recalculateNormalizationInDPModels : Recalc Norm in DP model" << std::endl;
- negSigModel_->recalculateNormalisation();
- posSigModel_->recalculateNormalisation();
- negSigModel_->modifyDataTree();
- posSigModel_->modifyDataTree();
+ if ( tagged_ ) {
+ if ( negPdf == 0 || posPdf == 0 ) {
+ std::cerr << "ERROR in LauCPFitModel::setSignalPdfs : One or both of the PDF pointers is null."
+ << std::endl;
+ return;
+ }
+ } else {
+ // if we're doing an untagged analysis we will only use the negative PDFs
+ if ( negPdf == 0 ) {
+ std::cerr << "ERROR in LauCPFitModel::setSignalPdfs : The negative PDF pointer is null."
+ << std::endl;
+ return;
+ }
+ if ( posPdf != 0 ) {
+ std::cerr << "WARNING in LauCPFitModel::setSignalPdfs : Doing an untagged fit so will not use the positive PDF."
+ << std::endl;
+ }
+ }
+ negSignalPdfs_.push_back( negPdf );
+ posSignalPdfs_.push_back( posPdf );
}
-void LauCPFitModel::initialiseDPModels()
+void LauCPFitModel::setSCFPdfs( LauAbsPdf* negPdf, LauAbsPdf* posPdf )
{
- std::cout << "INFO in LauCPFitModel::initialiseDPModels : Initialising signal DP model" << std::endl;
- negSigModel_->initialise(negCoeffs_);
- posSigModel_->initialise(posCoeffs_);
-
- if (usingBkgnd_ == kTRUE) {
- for (LauBkgndDPModelList::iterator iter = negBkgndDPModels_.begin(); iter != negBkgndDPModels_.end(); ++iter) {
- (*iter)->initialise();
- }
- for (LauBkgndDPModelList::iterator iter = posBkgndDPModels_.begin(); iter != posBkgndDPModels_.end(); ++iter) {
- (*iter)->initialise();
- }
- }
+ if ( tagged_ ) {
+ if ( negPdf == 0 || posPdf == 0 ) {
+ std::cerr << "ERROR in LauCPFitModel::setSCFPdfs : One or both of the PDF pointers is null."
+ << std::endl;
+ return;
+ }
+ } else {
+ // if we're doing an untagged analysis we will only use the negative PDFs
+ if ( negPdf == 0 ) {
+ std::cerr << "ERROR in LauCPFitModel::setSCFPdfs : The negative PDF pointer is null."
+ << std::endl;
+ return;
+ }
+ if ( posPdf != 0 ) {
+ std::cerr << "WARNING in LauCPFitModel::setSCFPdfs : Doing an untagged fit so will not use the positive PDF."
+ << std::endl;
+ }
+ }
+ negScfPdfs_.push_back( negPdf );
+ posScfPdfs_.push_back( posPdf );
}
-void LauCPFitModel::setSignalDPParameters()
+void LauCPFitModel::setBkgndPdfs( const TString& bkgndClass, LauAbsPdf* negPdf, LauAbsPdf* posPdf )
{
- // Set the fit parameters for the signal model.
-
- nSigDPPar_ = 0;
- if ( ! this->useDP() ) {
- return;
- }
+ if ( tagged_ ) {
+ if ( negPdf == 0 || posPdf == 0 ) {
+ std::cerr << "ERROR in LauCPFitModel::setBkgndPdfs : One or both of the PDF pointers is null."
+ << std::endl;
+ return;
+ }
+ } else {
+ // if we're doing an untagged analysis we will only use the negative PDFs
+ if ( negPdf == 0 ) {
+ std::cerr << "ERROR in LauCPFitModel::setBkgndPdfs : The negative PDF pointer is null."
+ << std::endl;
+ return;
+ }
+ if ( posPdf != 0 ) {
+ std::cerr << "WARNING in LauCPFitModel::setBkgndPdfs : Doing an untagged fit so will not use the positive PDF."
+ << std::endl;
+ }
+ }
- std::cout << "INFO in LauCPFitModel::setSignalDPParameters : Setting the initial fit parameters for the signal DP model." << std::endl;
+ // check that this background name is valid
+ if ( ! this->validBkgndClass( bkgndClass ) ) {
+ std::cerr << "ERROR in LauCPFitModel::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;
+ return;
+ }
- // Place isobar coefficient parameters in vector of fit variables
- for (UInt_t i = 0; i < nSigComp_; i++) {
- LauParameterPList pars = coeffPars_[i]->getParameters();
- nSigDPPar_ += this->addFitParameters( pars, kTRUE );
- }
+ UInt_t bkgndID = this->bkgndClassID( bkgndClass );
+ negBkgndPdfs_[bkgndID].push_back( negPdf );
+ posBkgndPdfs_[bkgndID].push_back( posPdf );
- // Obtain the resonance parameters and place them in the vector of fit variables and in a separate vector
- // Need to make sure that they are unique because some might appear in both DP models
- LauParameterPList& negSigDPPars = negSigModel_->getFloatingParameters();
- LauParameterPList& posSigDPPars = posSigModel_->getFloatingParameters();
- nSigDPPar_ += this->addResonanceParameters( negSigDPPars );
- nSigDPPar_ += this->addResonanceParameters( posSigDPPars );
+ usingBkgnd_ = kTRUE;
}
-void LauCPFitModel::setExtraPdfParameters()
+void LauCPFitModel::setAmpCoeffSet( LauAbsCoeffSet* coeffSet )
{
- // Include all the parameters of the PDF in the fit
- // NB all of them are passed to the fit, even though some have been fixed through parameter.fixed(kTRUE)
- // With the new "cloned parameter" scheme only "original" parameters are passed to the fit.
- // Their clones are updated automatically when the originals are updated.
-
- nExtraPdfPar_ = 0;
-
- nExtraPdfPar_ += this->addFitParameters(negSignalPdfs_);
- if ( tagged_ ) {
- nExtraPdfPar_ += this->addFitParameters(posSignalPdfs_);
- }
-
- if (useSCF_ == kTRUE) {
- nExtraPdfPar_ += this->addFitParameters(negScfPdfs_);
- if ( tagged_ ) {
- nExtraPdfPar_ += this->addFitParameters(posScfPdfs_);
- }
- }
-
- if (usingBkgnd_ == kTRUE) {
- for (LauBkgndPdfsList::iterator iter = negBkgndPdfs_.begin(); iter != negBkgndPdfs_.end(); ++iter) {
- nExtraPdfPar_ += this->addFitParameters(*iter);
- }
- if ( tagged_ ) {
- for (LauBkgndPdfsList::iterator iter = posBkgndPdfs_.begin(); iter != posBkgndPdfs_.end(); ++iter) {
- nExtraPdfPar_ += this->addFitParameters(*iter);
- }
- }
- }
-}
+ // Resize the coeffPars vector if not already done
+ if ( coeffPars_.empty() ) {
+ const UInt_t nNegAmp = negSigModel_->getnTotAmp();
+ const UInt_t nPosAmp = posSigModel_->getnTotAmp();
+ if ( nNegAmp != nPosAmp ) {
+ std::cerr << "ERROR in LauCPFitModel::setAmpCoeffSet : Unequal number of signal DP components in the negative and positive models: "
+ << nNegAmp << " != " << nPosAmp << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ coeffPars_.resize( nNegAmp );
+ for ( std::vector<LauAbsCoeffSet*>::iterator iter = coeffPars_.begin();
+ iter != coeffPars_.end();
+ ++iter ) {
+ ( *iter ) = 0;
+ }
+ fitFracAsymm_.resize( nNegAmp );
+ acp_.resize( nNegAmp );
+ }
-void LauCPFitModel::setFitNEvents()
-{
- if ( signalEvents_ == 0 ) {
- std::cerr << "ERROR in LauCPFitModel::setFitNEvents : Signal yield not defined." << std::endl;
- return;
- }
- nNormPar_ = 0;
-
- // initialise the total number of events to be the sum of all the hypotheses
- Double_t nTotEvts = signalEvents_->value();
- for (LauBkgndYieldList::const_iterator iter = bkgndEvents_.begin(); iter != bkgndEvents_.end(); ++iter) {
- nTotEvts += (*iter)->value();
- if ( (*iter) == 0 ) {
- std::cerr << "ERROR in LauCPFitModel::setFitNEvents : Background yield not defined." << std::endl;
- return;
- }
- }
- this->eventsPerExpt(TMath::FloorNint(nTotEvts));
-
- // if doing an extended ML fit add the number of signal events into the fit parameters
- if (this->doEMLFit()) {
- std::cout << "INFO in LauCPFitModel::setFitNEvents : Initialising number of events for signal and background components..." << std::endl;
- // add the signal fraction to the list of fit parameters
- nNormPar_ += this->addFitParameters( signalEvents_ );
- } else {
- std::cout << "INFO in LauCPFitModel::setFitNEvents : Initialising number of events for background components (and hence signal)..." << std::endl;
- }
-
- // if not using the DP in the model we need an explicit signal asymmetry parameter
- if (this->useDP() == kFALSE) {
- nNormPar_ += this->addFitParameters( signalAsym_ );
- }
-
- if (useSCF_ && !useSCFHist_) {
- nNormPar_ += this->addFitParameters( &scfFrac_ );
- }
-
- if (usingBkgnd_ == kTRUE) {
- nNormPar_ += this->addFitParameters( bkgndEvents_ );
- nNormPar_ += this->addFitParameters( bkgndAsym_ );
- }
-}
+ // Is there a component called compName in the signal model?
+ TString compName( coeffSet->name() );
+ TString conjName = negSigModel_->getConjResName( compName );
+ const Int_t negIndex = negSigModel_->resonanceIndex( compName );
+ const Int_t posIndex = posSigModel_->resonanceIndex( conjName );
+ if ( negIndex < 0 ) {
+ std::cerr << "ERROR in LauCPFitModel::setAmpCoeffSet : " << negParent_
+ << " signal DP model doesn't contain component \"" << compName << "\"."
+ << std::endl;
+ return;
+ }
+ if ( posIndex < 0 ) {
+ std::cerr << "ERROR in LauCPFitModel::setAmpCoeffSet : " << posParent_
+ << " signal DP model doesn't contain component \"" << conjName << "\"."
+ << std::endl;
+ return;
+ }
+ if ( posIndex != negIndex ) {
+ std::cerr << "ERROR in LauCPFitModel::setAmpCoeffSet : " << negParent_
+ << " signal DP model and " << posParent_
+ << " signal DP model have different indices for components \"" << compName
+ << "\" and \"" << conjName << "\"." << std::endl;
+ return;
+ }
-void LauCPFitModel::setExtraNtupleVars()
-{
- // Set-up other parameters derived from the fit results, e.g. fit fractions.
-
- if (this->useDP() != kTRUE) {
- return;
- }
-
- // First clear the vectors so we start from scratch
- this->clearExtraVarVectors();
-
- LauParameterList& extraVars = this->extraPars();
-
- // Add the positive and negative fit fractions for each signal component
- negFitFrac_ = negSigModel_->getFitFractions();
- if (negFitFrac_.size() != nSigComp_) {
- std::cerr << "ERROR in LauCPFitModel::setExtraNtupleVars : Initial Fit Fraction array of unexpected dimension: " << negFitFrac_.size() << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- for (UInt_t i(0); i<nSigComp_; ++i) {
- if (negFitFrac_[i].size() != nSigComp_) {
- std::cerr << "ERROR in LauCPFitModel::setExtraNtupleVars : Initial Fit Fraction array of unexpected dimension: " << negFitFrac_[i].size() << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- }
-
- posFitFrac_ = posSigModel_->getFitFractions();
- if (posFitFrac_.size() != nSigComp_) {
- std::cerr << "ERROR in LauCPFitModel::setExtraNtupleVars : Initial Fit Fraction array of unexpected dimension: " << posFitFrac_.size() << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- for (UInt_t i(0); i<nSigComp_; ++i) {
- if (posFitFrac_[i].size() != nSigComp_) {
- std::cerr << "ERROR in LauCPFitModel::setExtraNtupleVars : Initial Fit Fraction array of unexpected dimension: " << posFitFrac_[i].size() << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- }
-
- // Add the positive and negative fit fractions that have not been corrected for the efficiency for each signal component
- negFitFracEffUnCorr_ = negSigModel_->getFitFractionsEfficiencyUncorrected();
- if (negFitFracEffUnCorr_.size() != nSigComp_) {
- std::cerr << "ERROR in LauCPFitModel::setExtraNtupleVars : Initial Fit Fraction array of unexpected dimension: " << negFitFracEffUnCorr_.size() << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- for (UInt_t i(0); i<nSigComp_; ++i) {
- if (negFitFracEffUnCorr_[i].size() != nSigComp_) {
- std::cerr << "ERROR in LauCPFitModel::setExtraNtupleVars : Initial Fit Fraction array of unexpected dimension: " << negFitFracEffUnCorr_[i].size() << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- }
-
- posFitFracEffUnCorr_ = posSigModel_->getFitFractionsEfficiencyUncorrected();
- if (posFitFracEffUnCorr_.size() != nSigComp_) {
- std::cerr << "ERROR in LauCPFitModel::setExtraNtupleVars : Initial Fit Fraction array of unexpected dimension: " << posFitFracEffUnCorr_.size() << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- for (UInt_t i(0); i<nSigComp_; ++i) {
- if (posFitFracEffUnCorr_[i].size() != nSigComp_) {
- std::cerr << "ERROR in LauCPFitModel::setExtraNtupleVars : Initial Fit Fraction array of unexpected dimension: " << posFitFracEffUnCorr_[i].size() << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- }
-
- for (UInt_t i(0); i<nSigComp_; ++i) {
- for (UInt_t j(i); j<nSigComp_; ++j) {
- TString name = negFitFrac_[i][j].name();
- name.Insert( name.Index("FitFrac"), "Neg" );
- negFitFrac_[i][j].name(name);
- extraVars.push_back(negFitFrac_[i][j]);
-
- name = posFitFrac_[i][j].name();
- name.Insert( name.Index("FitFrac"), "Pos" );
- posFitFrac_[i][j].name(name);
- extraVars.push_back(posFitFrac_[i][j]);
-
- name = negFitFracEffUnCorr_[i][j].name();
- name.Insert( name.Index("FitFrac"), "Neg" );
- negFitFracEffUnCorr_[i][j].name(name);
- extraVars.push_back(negFitFracEffUnCorr_[i][j]);
-
- name = posFitFracEffUnCorr_[i][j].name();
- name.Insert( name.Index("FitFrac"), "Pos" );
- posFitFracEffUnCorr_[i][j].name(name);
- extraVars.push_back(posFitFracEffUnCorr_[i][j]);
- }
- }
-
- // Store any extra parameters/quantities from the DP model (e.g. K-matrix total fit fractions)
- std::vector<LauParameter> negExtraPars = negSigModel_->getExtraParameters();
- std::vector<LauParameter>::iterator negExtraIter;
- for (negExtraIter = negExtraPars.begin(); negExtraIter != negExtraPars.end(); ++negExtraIter) {
- LauParameter negExtraParameter = (*negExtraIter);
- extraVars.push_back(negExtraParameter);
- }
-
- std::vector<LauParameter> posExtraPars = posSigModel_->getExtraParameters();
- std::vector<LauParameter>::iterator posExtraIter;
- for (posExtraIter = posExtraPars.begin(); posExtraIter != posExtraPars.end(); ++posExtraIter) {
- LauParameter posExtraParameter = (*posExtraIter);
- extraVars.push_back(posExtraParameter);
- }
-
- // Now add in the DP efficiency value
- Double_t initMeanEff = negSigModel_->getMeanEff().initValue();
- negMeanEff_.value(initMeanEff);
- negMeanEff_.genValue(initMeanEff);
- negMeanEff_.initValue(initMeanEff);
- extraVars.push_back(negMeanEff_);
-
- initMeanEff = posSigModel_->getMeanEff().initValue();
- posMeanEff_.value(initMeanEff);
- posMeanEff_.genValue(initMeanEff);
- posMeanEff_.initValue(initMeanEff);
- extraVars.push_back(posMeanEff_);
-
- // Also add in the DP rates
- Double_t initDPRate = negSigModel_->getDPRate().initValue();
- negDPRate_.value(initDPRate);
- negDPRate_.genValue(initDPRate);
- negDPRate_.initValue(initDPRate);
- extraVars.push_back(negDPRate_);
-
- initDPRate = posSigModel_->getDPRate().initValue();
- posDPRate_.value(initDPRate);
- posDPRate_.genValue(initDPRate);
- posDPRate_.initValue(initDPRate);
- extraVars.push_back(posDPRate_);
-
- // Calculate the CPC and CPV Fit Fractions, ACPs and FitFrac asymmetries
- this->calcExtraFractions(kTRUE);
- this->calcAsymmetries(kTRUE);
-
- // Add the CP violating and CP conserving fit fractions for each signal component
- for (UInt_t i = 0; i < nSigComp_; i++) {
- for (UInt_t j = i; j < nSigComp_; j++) {
- extraVars.push_back(CPVFitFrac_[i][j]);
- }
- }
- for (UInt_t i = 0; i < nSigComp_; i++) {
- for (UInt_t j = i; j < nSigComp_; j++) {
- extraVars.push_back(CPCFitFrac_[i][j]);
- }
- }
-
- // Add the Fit Fraction asymmetry for each signal component
- for (UInt_t i = 0; i < nSigComp_; i++) {
- extraVars.push_back(fitFracAsymm_[i]);
- }
-
- // Add the calculated CP asymmetry for each signal component
- for (UInt_t i = 0; i < nSigComp_; i++) {
- extraVars.push_back(acp_[i]);
- }
-}
-
-void LauCPFitModel::calcExtraFractions(Bool_t initValues)
-{
- // Calculate the CP-conserving and CP-violating fit fractions
-
- if (initValues) {
- // create the structure
- CPCFitFrac_.clear();
- CPVFitFrac_.clear();
- CPCFitFrac_.resize(nSigComp_);
- CPVFitFrac_.resize(nSigComp_);
- for (UInt_t i(0); i<nSigComp_; ++i) {
- CPCFitFrac_[i].resize(nSigComp_);
- CPVFitFrac_[i].resize(nSigComp_);
-
- for (UInt_t j(i); j<nSigComp_; ++j) {
- TString name = negFitFrac_[i][j].name();
- name.Replace( name.Index("Neg"), 3, "CPC" );
- CPCFitFrac_[i][j].name( name );
- CPCFitFrac_[i][j].valueAndRange( 0.0, -100.0, 100.0 );
-
- name = negFitFrac_[i][j].name();
- name.Replace( name.Index("Neg"), 3, "CPV" );
- CPVFitFrac_[i][j].name( name );
- CPVFitFrac_[i][j].valueAndRange( 0.0, -100.0, 100.0 );
- }
- }
- }
-
- Double_t denom = negDPRate_.value() + posDPRate_.value();
-
- for (UInt_t i(0); i<nSigComp_; ++i) {
- for (UInt_t j(i); j<nSigComp_; ++j) {
-
- Double_t negTerm = negFitFrac_[i][j].value()*negDPRate_.value();
- Double_t posTerm = posFitFrac_[i][j].value()*posDPRate_.value();
-
- Double_t cpcFitFrac = (negTerm + posTerm)/denom;
- Double_t cpvFitFrac = (negTerm - posTerm)/denom;
-
- CPCFitFrac_[i][j].value(cpcFitFrac);
- CPVFitFrac_[i][j].value(cpvFitFrac);
-
- if (initValues) {
- CPCFitFrac_[i][j].genValue(cpcFitFrac);
- CPCFitFrac_[i][j].initValue(cpcFitFrac);
-
- CPVFitFrac_[i][j].genValue(cpvFitFrac);
- CPVFitFrac_[i][j].initValue(cpvFitFrac);
- }
- }
- }
-}
-
-void LauCPFitModel::calcAsymmetries(Bool_t initValues)
-{
- // Calculate the CP asymmetries
- // Also calculate the fit fraction asymmetries
-
- for (UInt_t i = 0; i < nSigComp_; i++) {
-
- acp_[i] = coeffPars_[i]->acp();
-
- LauAsymmCalc asymmCalc(negFitFrac_[i][i].value(), posFitFrac_[i][i].value());
- Double_t asym = asymmCalc.getAsymmetry();
- fitFracAsymm_[i].value(asym);
- if (initValues) {
- fitFracAsymm_[i].genValue(asym);
- fitFracAsymm_[i].initValue(asym);
- }
- }
-}
-
-void LauCPFitModel::finaliseFitResults(const TString& tablePrefixName)
-{
- // Retrieve parameters from the fit results for calculations and toy generation
- // and eventually store these in output root ntuples/text files
-
- // Now take the fit parameters and update them as necessary
- // i.e. to make mag > 0.0, phase in the right range.
- // This function will also calculate any other values, such as the
- // fit fractions, using any errors provided by fitParErrors as appropriate.
- // Also obtain the pull values: (measured - generated)/(average error)
-
- if (this->useDP() == kTRUE) {
- for (UInt_t i = 0; i < nSigComp_; ++i) {
- // Check whether we have "a/b > 0.0", and phases in the right range
- coeffPars_[i]->finaliseValues();
- }
- }
-
- // update the pulls on the event fractions and asymmetries
- if (this->doEMLFit()) {
- signalEvents_->updatePull();
- }
- if (this->useDP() == kFALSE) {
- signalAsym_->updatePull();
- }
- if (useSCF_ && !useSCFHist_) {
- scfFrac_.updatePull();
- }
- if (usingBkgnd_ == kTRUE) {
- for (LauBkgndYieldList::iterator iter = bkgndEvents_.begin(); iter != bkgndEvents_.end(); ++iter) {
- std::vector<LauParameter*> parameters = (*iter)->getPars();
- for ( LauParameter* parameter : parameters ) {
- parameter->updatePull();
- }
- }
- for (LauBkgndYieldList::iterator iter = bkgndAsym_.begin(); iter != bkgndAsym_.end(); ++iter) {
- std::vector<LauParameter*> parameters = (*iter)->getPars();
- for ( LauParameter* parameter : parameters ) {
- parameter->updatePull();
- }
- }
- }
-
- // Update the pulls on all the extra PDFs' parameters
- this->updateFitParameters(negSignalPdfs_);
- this->updateFitParameters(posSignalPdfs_);
- if (useSCF_ == kTRUE) {
- this->updateFitParameters(negScfPdfs_);
- this->updateFitParameters(posScfPdfs_);
- }
- if (usingBkgnd_ == kTRUE) {
- for (LauBkgndPdfsList::iterator iter = negBkgndPdfs_.begin(); iter != negBkgndPdfs_.end(); ++iter) {
- this->updateFitParameters(*iter);
- }
- for (LauBkgndPdfsList::iterator iter = posBkgndPdfs_.begin(); iter != posBkgndPdfs_.end(); ++iter) {
- this->updateFitParameters(*iter);
- }
- }
-
- // Fill the fit results to the ntuple
-
- // update the coefficients and then calculate the fit fractions and ACP's
- if (this->useDP() == kTRUE) {
- this->updateCoeffs();
- negSigModel_->updateCoeffs(negCoeffs_); negSigModel_->calcExtraInfo();
- posSigModel_->updateCoeffs(posCoeffs_); posSigModel_->calcExtraInfo();
-
- LauParArray negFitFrac = negSigModel_->getFitFractions();
- if (negFitFrac.size() != nSigComp_) {
- std::cerr << "ERROR in LauCPFitModel::finaliseFitResults : Fit Fraction array of unexpected dimension: " << negFitFrac.size() << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- for (UInt_t i(0); i<nSigComp_; ++i) {
- if (negFitFrac[i].size() != nSigComp_) {
- std::cerr << "ERROR in LauCPFitModel::finaliseFitResults : Fit Fraction array of unexpected dimension: " << negFitFrac[i].size() << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- }
-
- LauParArray posFitFrac = posSigModel_->getFitFractions();
- if (posFitFrac.size() != nSigComp_) {
- std::cerr << "ERROR in LauCPFitModel::finaliseFitResults : Fit Fraction array of unexpected dimension: " << posFitFrac.size() << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- for (UInt_t i(0); i<nSigComp_; ++i) {
- if (posFitFrac[i].size() != nSigComp_) {
- std::cerr << "ERROR in LauCPFitModel::finaliseFitResults : Fit Fraction array of unexpected dimension: " << posFitFrac[i].size() << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- }
-
- LauParArray negFitFracEffUnCorr = negSigModel_->getFitFractionsEfficiencyUncorrected();
- if (negFitFracEffUnCorr.size() != nSigComp_) {
- std::cerr << "ERROR in LauCPFitModel::finaliseFitResults : Fit Fraction array of unexpected dimension: " << negFitFracEffUnCorr.size() << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- for (UInt_t i(0); i<nSigComp_; ++i) {
- if (negFitFracEffUnCorr[i].size() != nSigComp_) {
- std::cerr << "ERROR in LauCPFitModel::finaliseFitResults : Fit Fraction array of unexpected dimension: " << negFitFracEffUnCorr[i].size() << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- }
-
- LauParArray posFitFracEffUnCorr = posSigModel_->getFitFractionsEfficiencyUncorrected();
- if (posFitFracEffUnCorr.size() != nSigComp_) {
- std::cerr << "ERROR in LauCPFitModel::finaliseFitResults : Fit Fraction array of unexpected dimension: " << posFitFracEffUnCorr.size() << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- for (UInt_t i(0); i<nSigComp_; ++i) {
- if (posFitFracEffUnCorr[i].size() != nSigComp_) {
- std::cerr << "ERROR in LauCPFitModel::finaliseFitResults : Fit Fraction array of unexpected dimension: " << posFitFracEffUnCorr[i].size() << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- }
-
- for (UInt_t i(0); i<nSigComp_; ++i) {
- for (UInt_t j(i); j<nSigComp_; ++j) {
- negFitFrac_[i][j].value(negFitFrac[i][j].value());
- posFitFrac_[i][j].value(posFitFrac[i][j].value());
- negFitFracEffUnCorr_[i][j].value(negFitFracEffUnCorr[i][j].value());
- posFitFracEffUnCorr_[i][j].value(posFitFracEffUnCorr[i][j].value());
- }
- }
-
- negMeanEff_.value(negSigModel_->getMeanEff().value());
- posMeanEff_.value(posSigModel_->getMeanEff().value());
- negDPRate_.value(negSigModel_->getDPRate().value());
- posDPRate_.value(posSigModel_->getDPRate().value());
-
- this->calcExtraFractions();
- this->calcAsymmetries();
-
- // Then store the final fit parameters, and any extra parameters for
- // the signal model (e.g. fit fractions, FF asymmetries, ACPs, mean efficiency and DP rate)
-
- this->clearExtraVarVectors();
- LauParameterList& extraVars = this->extraPars();
-
- // Add the positive and negative fit fractions for each signal component
- for (UInt_t i(0); i<nSigComp_; ++i) {
- for (UInt_t j(i); j<nSigComp_; ++j) {
- extraVars.push_back(negFitFrac_[i][j]);
- extraVars.push_back(posFitFrac_[i][j]);
- extraVars.push_back(negFitFracEffUnCorr_[i][j]);
- extraVars.push_back(posFitFracEffUnCorr_[i][j]);
- }
- }
-
- // Store any extra parameters/quantities from the DP model (e.g. K-matrix total fit fractions)
- std::vector<LauParameter> negExtraPars = negSigModel_->getExtraParameters();
- std::vector<LauParameter>::iterator negExtraIter;
- for (negExtraIter = negExtraPars.begin(); negExtraIter != negExtraPars.end(); ++negExtraIter) {
- LauParameter negExtraParameter = (*negExtraIter);
- extraVars.push_back(negExtraParameter);
- }
-
- std::vector<LauParameter> posExtraPars = posSigModel_->getExtraParameters();
- std::vector<LauParameter>::iterator posExtraIter;
- for (posExtraIter = posExtraPars.begin(); posExtraIter != posExtraPars.end(); ++posExtraIter) {
- LauParameter posExtraParameter = (*posExtraIter);
- extraVars.push_back(posExtraParameter);
- }
-
- extraVars.push_back(negMeanEff_);
- extraVars.push_back(posMeanEff_);
- extraVars.push_back(negDPRate_);
- extraVars.push_back(posDPRate_);
-
- for (UInt_t i = 0; i < nSigComp_; i++) {
- for (UInt_t j(i); j<nSigComp_; ++j) {
- extraVars.push_back(CPVFitFrac_[i][j]);
- }
- }
- for (UInt_t i = 0; i < nSigComp_; i++) {
- for (UInt_t j(i); j<nSigComp_; ++j) {
- extraVars.push_back(CPCFitFrac_[i][j]);
- }
- }
- for (UInt_t i(0); i<nSigComp_; ++i) {
- extraVars.push_back(fitFracAsymm_[i]);
- }
- for (UInt_t i(0); i<nSigComp_; ++i) {
- extraVars.push_back(acp_[i]);
- }
-
- this->printFitFractions(std::cout);
- this->printAsymmetries(std::cout);
- }
-
- LauFitNtuple* ntuple = this->fitNtuple();
- ntuple->storeParsAndErrors(this->fitPars(), this->multiDimConstrainedPars(), this->extraPars());
-
- // find out the correlation matrix for the parameters
- ntuple->storeCorrMatrix(this->iExpt(), this->fitStatus(), this->covarianceMatrix());
-
- // Fill the data into ntuple
- ntuple->updateFitNtuple();
-
- // Print out the partial fit fractions, phases and the
- // averaged efficiency, reweighted by the dynamics (and anything else)
- if (this->writeLatexTable()) {
- TString sigOutFileName(tablePrefixName);
- sigOutFileName += "_"; sigOutFileName += this->iExpt(); sigOutFileName += "Expt.tex";
- this->writeOutTable(sigOutFileName);
- }
-}
-
-void LauCPFitModel::printFitFractions(std::ostream& output)
-{
- // Print out Fit Fractions, total DP rate and mean efficiency
- // First for the B- events
- for (UInt_t i = 0; i < nSigComp_; i++) {
- const TString compName(coeffPars_[i]->name());
- output << negParent_ << " FitFraction for component " << i << " (" << compName << ") = " << negFitFrac_[i][i] << std::endl;
- }
- output << negParent_ << " overall DP rate (integral of matrix element squared) = " << negDPRate_ << std::endl;
- output << negParent_ << " average efficiency weighted by whole DP dynamics = " << negMeanEff_ << std::endl;
-
- // Then for the positive sample
- for (UInt_t i = 0; i < nSigComp_; i++) {
- const TString compName(coeffPars_[i]->name());
- const TString conjName(negSigModel_->getConjResName(compName));
- output << posParent_ << " FitFraction for component " << i << " (" << conjName << ") = " << posFitFrac_[i][i] << std::endl;
- }
- output << posParent_ << " overall DP rate (integral of matrix element squared) = " << posDPRate_ << std::endl;
- output << posParent_ << " average efficiency weighted by whole DP dynamics = " << posMeanEff_ << std::endl;
-}
-
-void LauCPFitModel::printAsymmetries(std::ostream& output)
-{
- for (UInt_t i = 0; i < nSigComp_; i++) {
- const TString compName(coeffPars_[i]->name());
- output << "Fit Fraction asymmetry for component " << i << " (" << compName << ") = " << fitFracAsymm_[i] << std::endl;
- }
- for (UInt_t i = 0; i < nSigComp_; i++) {
- const TString compName(coeffPars_[i]->name());
- output << "ACP for component " << i << " (" << compName << ") = " << acp_[i] << std::endl;
- }
-}
-
-void LauCPFitModel::writeOutTable(const TString& outputFile)
-{
- // Write out the results of the fit to a tex-readable table
- // TODO - need to include the yields in this table
- std::ofstream fout(outputFile);
- LauPrint print;
-
- std::cout << "INFO in LauCPFitModel::writeOutTable : Writing out results of the fit to the tex file " << outputFile << std::endl;
-
- if (this->useDP() == kTRUE) {
- // print the fit coefficients in one table
- coeffPars_.front()->printTableHeading(fout);
- for (UInt_t i = 0; i < nSigComp_; i++) {
- coeffPars_[i]->printTableRow(fout);
- }
- fout << "\\hline" << std::endl;
- fout << "\\end{tabular}" << std::endl << std::endl;
-
- // print the fit fractions and asymmetries in another
- fout << "\\begin{tabular}{|l|c|c|c|c|}" << std::endl;
- fout << "\\hline" << std::endl;
- fout << "Component & " << negParent_ << " Fit Fraction & " << posParent_ << " Fit Fraction & Fit Fraction Asymmetry & ACP \\\\" << std::endl;
- fout << "\\hline" << std::endl;
-
- Double_t negFitFracSum(0.0);
- Double_t posFitFracSum(0.0);
-
- for (UInt_t i = 0; i < nSigComp_; i++) {
- TString resName = coeffPars_[i]->name();
- resName = resName.ReplaceAll("_", "\\_");
-
- Double_t negFitFrac = negFitFrac_[i][i].value();
- Double_t posFitFrac = posFitFrac_[i][i].value();
- negFitFracSum += negFitFrac;
- posFitFracSum += posFitFrac;
-
- Double_t fitFracAsymm = fitFracAsymm_[i].value();
-
- Double_t acp = acp_[i].value();
- Double_t acpErr = acp_[i].error();
-
- fout << resName << " & $";
-
- print.printFormat(fout, negFitFrac);
- fout << "$ & $";
- print.printFormat(fout, posFitFrac);
- fout << "$ & $";
-
- print.printFormat(fout, fitFracAsymm);
- fout << "$ & $";
-
- print.printFormat(fout, acp);
- fout << " \\pm ";
- print.printFormat(fout, acpErr);
- fout << "$ \\\\" << std::endl;
- }
- fout << "\\hline" << std::endl;
-
- // Also print out sum of fit fractions
- fout << "Fit Fraction Sum & $";
- print.printFormat(fout, negFitFracSum);
- fout << "$ & $";
- print.printFormat(fout, posFitFracSum);
- fout << "$ & & \\\\" << std::endl;
- fout << "\\hline" << std::endl;
-
- fout << "DP rate & $";
- print.printFormat(fout, negDPRate_.value());
- fout << "$ & $";
- print.printFormat(fout, posDPRate_.value());
- fout << "$ & & \\\\" << std::endl;
-
- fout << "$< \\varepsilon > $ & $";
- print.printFormat(fout, negMeanEff_.value());
- fout << "$ & $";
- print.printFormat(fout, posMeanEff_.value());
- fout << "$ & & \\\\" << std::endl;
- fout << "\\hline" << std::endl;
- fout << "\\end{tabular}" << std::endl << std::endl;
- }
-
- if (!negSignalPdfs_.empty()) {
- fout << "\\begin{tabular}{|l|c|}" << std::endl;
- fout << "\\hline" << std::endl;
- if (useSCF_ == kTRUE) {
- fout << "\\Extra TM Signal PDFs' Parameters: & \\\\" << std::endl;
- } else {
- fout << "\\Extra Signal PDFs' Parameters: & \\\\" << std::endl;
- }
- this->printFitParameters(negSignalPdfs_, fout);
- if ( tagged_ ) {
- this->printFitParameters(posSignalPdfs_, fout);
- }
- if (useSCF_ == kTRUE && !negScfPdfs_.empty()) {
- fout << "\\hline" << std::endl;
- fout << "\\Extra SCF Signal PDFs' Parameters: & \\\\" << std::endl;
- this->printFitParameters(negScfPdfs_, fout);
- if ( tagged_ ) {
- this->printFitParameters(posScfPdfs_, fout);
- }
- }
- if (usingBkgnd_ == kTRUE && !negBkgndPdfs_.empty()) {
- fout << "\\hline" << std::endl;
- fout << "\\Extra Background PDFs' Parameters: & \\\\" << std::endl;
- for (LauBkgndPdfsList::const_iterator iter = negBkgndPdfs_.begin(); iter != negBkgndPdfs_.end(); ++iter) {
- this->printFitParameters(*iter, fout);
- }
- if ( tagged_ ) {
- for (LauBkgndPdfsList::const_iterator iter = posBkgndPdfs_.begin(); iter != posBkgndPdfs_.end(); ++iter) {
- this->printFitParameters(*iter, fout);
- }
- }
- }
- fout << "\\hline \n\\end{tabular}" << std::endl << std::endl;
- }
-}
+ // Do we already have it in our list of names?
+ if ( coeffPars_[negIndex] != 0 && coeffPars_[negIndex]->name() == compName ) {
+ std::cerr << "ERROR in LauCPFitModel::setAmpCoeffSet : Have already set coefficients for \""
+ << compName << "\"." << std::endl;
+ return;
+ }
-void LauCPFitModel::checkInitFitParams()
-{
- // Update the number of signal events to be total-sum(background events)
- this->updateSigEvents();
+ coeffSet->index( negIndex );
+ coeffPars_[negIndex] = coeffSet;
- // Check whether we want to have randomised initial fit parameters for the signal model
- if (this->useRandomInitFitPars() == kTRUE) {
- std::cout << "INFO in LauCPFitModel::checkInitFitParams : Setting random parameters for the signal model" << std::endl;
- this->randomiseInitFitPars();
- }
-}
+ TString parName = coeffSet->baseName();
+ parName += "FitFracAsym";
+ fitFracAsymm_[negIndex] = LauParameter( parName, 0.0, -1.0, 1.0 );
-void LauCPFitModel::randomiseInitFitPars()
-{
- // Only randomise those parameters that are not fixed!
- std::cout << "INFO in LauCPFitModel::randomiseInitFitPars : Randomising the initial fit magnitudes and phases of the components..." << std::endl;
-
- if ( fixParamFileName_.IsNull() && fixParamMap_.empty() ) {
- // No params are imported - randomise as normal
- for (UInt_t i = 0; i < nSigComp_; i++) {
- coeffPars_[i]->randomiseInitValues();
- }
- } else {
- // Only randomise those that are not imported (i.e., not found in allImportedFreeParams_)
- // by temporarily fixing all imported parameters, and then freeing those not set to be fixed when imported,
- // except those that are previously set to be fixed anyhow.
- // Convoluted, but beats changing the behaviour of functions that call checkInitFitParams or the coeffSet
- // itself.
-
- for (auto p : allImportedFreeParams_) { p->fixed(kTRUE); }
-
- for (UInt_t i = 0; i < nSigComp_; i++) {
- coeffPars_[i]->randomiseInitValues();
- }
-
- for (auto p : allImportedFreeParams_) { p->fixed(kFALSE); }
- }
-}
-
-std::pair<LauCPFitModel::LauGenInfo,Bool_t> LauCPFitModel::eventsToGenerate()
-{
- // Determine the number of events to generate for each hypothesis
- // If we're smearing then smear each one individually
-
- LauGenInfo nEvtsGen;
-
- // Keep track of whether any yield or asymmetry parameters are blinded
- Bool_t blind = kFALSE;
-
- // Signal
- if ( signalEvents_->blind() ) {
- blind = kTRUE;
- }
-
- Double_t evtWeight(1.0);
- Double_t nEvts = signalEvents_->genValue();
- if ( nEvts < 0.0 ) {
- evtWeight = -1.0;
- nEvts = TMath::Abs( nEvts );
- }
-
- Double_t sigAsym(0.0);
- // need to include this as an alternative in case the DP isn't in the model
- if ( !this->useDP() || forceAsym_ ) {
- sigAsym = signalAsym_->genValue();
- if ( signalAsym_->blind() ) {
- blind = kTRUE;
- }
- } else {
- Double_t negRate = negSigModel_->getDPNorm();
- Double_t posRate = posSigModel_->getDPNorm();
- if (negRate+posRate>1e-30) {
- sigAsym = (negRate-posRate)/(negRate+posRate);
- }
- }
- Double_t nPosEvts = (nEvts/2.0 * (1.0 - sigAsym));
- Double_t nNegEvts = (nEvts/2.0 * (1.0 + sigAsym));
-
- Int_t nPosEvtsToGen { static_cast<Int_t>(nPosEvts) };
- Int_t nNegEvtsToGen { static_cast<Int_t>(nNegEvts) };
- if (this->doPoissonSmearing()) {
- nPosEvtsToGen = LauRandom::randomFun()->Poisson(nPosEvts);
- nNegEvtsToGen = LauRandom::randomFun()->Poisson(nNegEvts);
- }
-
- nEvtsGen[std::make_pair("signal",+1)] = std::make_pair(nPosEvtsToGen,evtWeight);
- nEvtsGen[std::make_pair("signal",-1)] = std::make_pair(nNegEvtsToGen,evtWeight);
-
- // backgrounds
- const UInt_t nBkgnds = this->nBkgndClasses();
- for ( UInt_t bkgndID(0); bkgndID < nBkgnds; ++bkgndID ) {
- const LauAbsRValue* evtsPar = bkgndEvents_[bkgndID];
- const LauAbsRValue* asymPar = bkgndAsym_[bkgndID];
- if ( evtsPar->blind() || asymPar->blind() ) {
- blind = kTRUE;
- }
-
- evtWeight = 1.0;
- nEvts = evtsPar->genValue();
- if ( nEvts < 0 ) {
- evtWeight = -1.0;
- nEvts = TMath::Abs( nEvts );
- }
-
- const Double_t asym = asymPar->genValue();
- nPosEvts = (nEvts/2.0 * (1.0 - asym));
- nNegEvts = (nEvts/2.0 * (1.0 + asym));
-
- nPosEvtsToGen = static_cast<Int_t>(nPosEvts);
- nNegEvtsToGen = static_cast<Int_t>(nNegEvts);
- if (this->doPoissonSmearing()) {
- nPosEvtsToGen = LauRandom::randomFun()->Poisson(nPosEvts);
- nNegEvtsToGen = LauRandom::randomFun()->Poisson(nNegEvts);
- }
-
- const TString& bkgndClass = this->bkgndClassName(bkgndID);
- nEvtsGen[std::make_pair(bkgndClass,+1)] = std::make_pair(nPosEvtsToGen,evtWeight);
- nEvtsGen[std::make_pair(bkgndClass,-1)] = std::make_pair(nNegEvtsToGen,evtWeight);
- }
-
- // Print out the information on what we're generating, but only if none of the parameters are blind (otherwise we risk unblinding them!)
- if ( !blind ) {
- std::cout << "INFO in LauCPFitModel::eventsToGenerate : Generating toy MC with:" << std::endl;
- std::cout << " : Signal asymmetry = " << sigAsym << " and number of signal events = " << signalEvents_->genValue() << std::endl;
- for ( UInt_t bkgndID(0); bkgndID < nBkgnds; ++bkgndID ) {
- const TString& bkgndClass = this->bkgndClassName(bkgndID);
- const LauAbsRValue* evtsPar = bkgndEvents_[bkgndID];
- const LauAbsRValue* asymPar = bkgndAsym_[bkgndID];
- std::cout << " : " << bkgndClass << " asymmetry = " << asymPar->genValue() << " and number of " << bkgndClass << " events = " << evtsPar->genValue() << std::endl;
- }
- }
-
- return std::make_pair( nEvtsGen, blind );
-}
+ acp_[negIndex] = coeffSet->acp();
-Bool_t LauCPFitModel::genExpt()
-{
- // Routine to generate toy Monte Carlo events according to the various models we have defined.
-
- // Determine the number of events to generate for each hypothesis
- std::pair<LauGenInfo,Bool_t> info = this->eventsToGenerate();
- LauGenInfo nEvts = info.first;
- const Bool_t blind = info.second;
-
- Bool_t genOK(kTRUE);
- Int_t evtNum(0);
-
- const UInt_t nBkgnds = this->nBkgndClasses();
- std::vector<TString> bkgndClassNames(nBkgnds);
- std::vector<TString> bkgndClassNamesGen(nBkgnds);
- for ( UInt_t iBkgnd(0); iBkgnd < nBkgnds; ++iBkgnd ) {
- TString name( this->bkgndClassName(iBkgnd) );
- bkgndClassNames[iBkgnd] = name;
- bkgndClassNamesGen[iBkgnd] = "gen"+name;
- }
-
- const Bool_t storeSCFTruthInfo = ( useSCF_ || ( this->enableEmbedding() &&
- negSignalTree_ != 0 && negSignalTree_->haveBranch("mcMatch") &&
- posSignalTree_ != 0 && posSignalTree_->haveBranch("mcMatch") ) );
-
- // Loop over the hypotheses and generate the requested number of events for each one
- for (LauGenInfo::const_iterator iter = nEvts.begin(); iter != nEvts.end(); ++iter) {
-
- const TString& type(iter->first.first);
- curEvtCharge_ = iter->first.second;
- Double_t evtWeight( iter->second.second );
- Int_t nEvtsGen( iter->second.first );
-
- for (Int_t iEvt(0); iEvt<nEvtsGen; ++iEvt) {
-
- this->setGenNtupleDoubleBranchValue( "evtWeight", evtWeight );
- this->setGenNtupleDoubleBranchValue( "efficiency", 1.0 );
-
- if (type == "signal") {
- this->setGenNtupleIntegerBranchValue("genSig",1);
- for ( UInt_t iBkgnd(0); iBkgnd < nBkgnds; ++iBkgnd ) {
- this->setGenNtupleIntegerBranchValue( bkgndClassNamesGen[iBkgnd], 0 );
- }
- genOK = this->generateSignalEvent();
- if ( curEvtCharge_ > 0 ){
- this->setGenNtupleDoubleBranchValue( "efficiency", posSigModel_->getEvtEff() );
- } else {
- this->setGenNtupleDoubleBranchValue( "efficiency", negSigModel_->getEvtEff() );
- }
-
- } else {
- this->setGenNtupleIntegerBranchValue("genSig",0);
- if ( storeSCFTruthInfo ) {
- this->setGenNtupleIntegerBranchValue("genTMSig",0);
- this->setGenNtupleIntegerBranchValue("genSCFSig",0);
- }
- UInt_t bkgndID(0);
- for ( UInt_t iBkgnd(0); iBkgnd < nBkgnds; ++iBkgnd ) {
- Int_t gen(0);
- if ( bkgndClassNames[iBkgnd] == type ) {
- gen = 1;
- bkgndID = iBkgnd;
- }
- this->setGenNtupleIntegerBranchValue( bkgndClassNamesGen[iBkgnd], gen );
- }
- genOK = this->generateBkgndEvent(bkgndID);
- }
- if (!genOK) {
- // If there was a problem with the generation then break out and return.
- // The problem model will have adjusted itself so that all should be OK next time.
- break;
- }
- if (this->useDP() == kTRUE) {
- this->setDPBranchValues();
- }
-
- // Store the event charge
- this->setGenNtupleIntegerBranchValue(tagVarName_,curEvtCharge_);
-
- // Store the event number (within this experiment)
- // and then increment it
- this->setGenNtupleIntegerBranchValue("iEvtWithinExpt",evtNum);
- ++evtNum;
-
- this->fillGenNtupleBranches();
- if ( !blind && (iEvt%500 == 0) ) {
- std::cout << "INFO in LauCPFitModel::genExpt : Generated event number " << iEvt << " out of " << nEvtsGen << " " << type << " events." << std::endl;
- }
- }
-
- if (!genOK) {
- break;
- }
- }
-
- if (this->useDP() && genOK) {
-
- negSigModel_->checkToyMC(kTRUE,kTRUE);
- posSigModel_->checkToyMC(kTRUE,kTRUE);
-
- // Get the fit fractions if they're to be written into the latex table
- if (this->writeLatexTable()) {
- LauParArray negFitFrac = negSigModel_->getFitFractions();
- if (negFitFrac.size() != nSigComp_) {
- std::cerr << "ERROR in LauCPFitModel::genExpt : Fit Fraction array of unexpected dimension: " << negFitFrac.size() << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- for (UInt_t i(0); i<nSigComp_; ++i) {
- if (negFitFrac[i].size() != nSigComp_) {
- std::cerr << "ERROR in LauCPFitModel::genExpt : Fit Fraction array of unexpected dimension: " << negFitFrac[i].size() << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- }
- LauParArray posFitFrac = posSigModel_->getFitFractions();
- if (posFitFrac.size() != nSigComp_) {
- std::cerr << "ERROR in LauCPFitModel::genExpt : Fit Fraction array of unexpected dimension: " << posFitFrac.size() << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- for (UInt_t i(0); i<nSigComp_; ++i) {
- if (posFitFrac[i].size() != nSigComp_) {
- std::cerr << "ERROR in LauCPFitModel::genExpt : Fit Fraction array of unexpected dimension: " << posFitFrac[i].size() << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- }
-
- for (UInt_t i(0); i<nSigComp_; ++i) {
- for (UInt_t j(i); j<nSigComp_; ++j) {
- negFitFrac_[i][j].value(negFitFrac[i][j].value());
- posFitFrac_[i][j].value(posFitFrac[i][j].value());
- }
- }
- negMeanEff_.value(negSigModel_->getMeanEff().value());
- posMeanEff_.value(posSigModel_->getMeanEff().value());
- negDPRate_.value(negSigModel_->getDPRate().value());
- posDPRate_.value(posSigModel_->getDPRate().value());
- }
- }
-
- // If we're reusing embedded events or if the generation is being
- // reset then clear the lists of used events
- if (reuseSignal_ || !genOK) {
- if (negSignalTree_) {
- negSignalTree_->clearUsedList();
- }
- if (posSignalTree_) {
- posSignalTree_->clearUsedList();
- }
- }
- for ( UInt_t bkgndID(0); bkgndID < nBkgnds; ++bkgndID ) {
- LauEmbeddedData* data = negBkgndTree_[bkgndID];
- if (reuseBkgnd_[bkgndID] || !genOK) {
- if (data) {
- data->clearUsedList();
- }
- }
- }
- for ( UInt_t bkgndID(0); bkgndID < nBkgnds; ++bkgndID ) {
- LauEmbeddedData* data = posBkgndTree_[bkgndID];
- if (reuseBkgnd_[bkgndID] || !genOK) {
- if (data) {
- data->clearUsedList();
- }
- }
- }
-
- return genOK;
-}
+ ++nSigComp_;
-Bool_t LauCPFitModel::generateSignalEvent()
-{
- // Generate signal event
- Bool_t genOK(kTRUE);
- Bool_t genSCF(kFALSE);
-
- LauIsobarDynamics* model(0);
- LauKinematics* kinematics(0);
- LauEmbeddedData* embeddedData(0);
- LauPdfPList* sigPdfs(0);
- LauPdfPList* scfPdfs(0);
-
- Bool_t doReweighting(kFALSE);
-
- if (curEvtCharge_<0) {
- model = negSigModel_;
- kinematics = negKinematics_;
- sigPdfs = &negSignalPdfs_;
- scfPdfs = &negScfPdfs_;
- if (this->enableEmbedding()) {
- embeddedData = negSignalTree_;
- doReweighting = useNegReweighting_;
- }
- } else {
- model = posSigModel_;
- kinematics = posKinematics_;
- if ( tagged_ ) {
- sigPdfs = &posSignalPdfs_;
- scfPdfs = &posScfPdfs_;
- } else {
- sigPdfs = &negSignalPdfs_;
- scfPdfs = &negScfPdfs_;
- }
- if (this->enableEmbedding()) {
- embeddedData = posSignalTree_;
- doReweighting = usePosReweighting_;
- }
- }
-
- if (this->useDP()) {
- if (embeddedData) {
- if (doReweighting) {
- // Select a (random) event from the generated data. Then store the
- // reconstructed DP co-ords, together with other pdf information,
- // as the embedded data.
- genOK = embeddedData->getReweightedEvent(model);
- } else {
- // Just get the information of a (randomly) selected event in the
- // embedded data
- embeddedData->getEmbeddedEvent(kinematics);
- }
- genSCF = this->storeSignalMCMatch( embeddedData );
- } else {
- genOK = model->generate();
- if ( genOK && useSCF_ ) {
- Double_t frac(0.0);
- if ( useSCFHist_ ) {
- frac = scfFracHist_->calcEfficiency( kinematics );
- } else {
- frac = scfFrac_.genValue();
- }
- if ( frac < LauRandom::randomFun()->Rndm() ) {
- this->setGenNtupleIntegerBranchValue("genTMSig",1);
- this->setGenNtupleIntegerBranchValue("genSCFSig",0);
- genSCF = kFALSE;
- } else {
- this->setGenNtupleIntegerBranchValue("genTMSig",0);
- this->setGenNtupleIntegerBranchValue("genSCFSig",1);
- genSCF = kTRUE;
-
- // Optionally smear the DP position
- // of the SCF event
- if ( scfMap_ != 0 ) {
- Double_t xCoord(0.0), yCoord(0.0);
- if ( kinematics->squareDP() ) {
- xCoord = kinematics->getmPrime();
- yCoord = kinematics->getThetaPrime();
- } else {
- xCoord = kinematics->getm13Sq();
- yCoord = kinematics->getm23Sq();
- }
-
- // Find the bin number where this event is generated
- Int_t binNo = scfMap_->binNumber( xCoord, yCoord );
-
- // Retrieve the migration histogram
- TH2* histo = scfMap_->trueHist( binNo );
-
- const LauAbsEffModel * effModel = model->getEffModel();
- do {
- // Get a random point from the histogram
- histo->GetRandom2( xCoord, yCoord );
-
- // Update the kinematics
- if ( kinematics->squareDP() ) {
- kinematics->updateSqDPKinematics( xCoord, yCoord );
- } else {
- kinematics->updateKinematics( xCoord, yCoord );
- }
- } while ( ! effModel->passVeto( kinematics ) );
- }
- }
- }
- }
- } else {
- if (embeddedData) {
- embeddedData->getEmbeddedEvent(0);
- genSCF = this->storeSignalMCMatch( embeddedData );
- } else if ( useSCF_ ) {
- Double_t frac = scfFrac_.genValue();
- if ( frac < LauRandom::randomFun()->Rndm() ) {
- this->setGenNtupleIntegerBranchValue("genTMSig",1);
- this->setGenNtupleIntegerBranchValue("genSCFSig",0);
- genSCF = kFALSE;
- } else {
- this->setGenNtupleIntegerBranchValue("genTMSig",0);
- this->setGenNtupleIntegerBranchValue("genSCFSig",1);
- genSCF = kTRUE;
- }
- }
- }
- if (genOK) {
- if ( useSCF_ ) {
- if ( genSCF ) {
- this->generateExtraPdfValues(scfPdfs, embeddedData);
- } else {
- this->generateExtraPdfValues(sigPdfs, embeddedData);
- }
- } else {
- this->generateExtraPdfValues(sigPdfs, embeddedData);
- }
- }
- // Check for problems with the embedding
- if (embeddedData && (embeddedData->nEvents() == embeddedData->nUsedEvents())) {
- std::cerr << "WARNING in LauCPFitModel::generateSignalEvent : Source of embedded signal events used up, clearing the list of used events." << std::endl;
- embeddedData->clearUsedList();
- }
-
- return genOK;
-}
-
-Bool_t LauCPFitModel::generateBkgndEvent(UInt_t bkgndID)
-{
- // Generate Bkgnd event
- Bool_t genOK(kTRUE);
-
- LauAbsBkgndDPModel* model(0);
- LauEmbeddedData* embeddedData(0);
- LauPdfPList* extraPdfs(0);
- LauKinematics* kinematics(0);
-
- if (curEvtCharge_<0) {
- model = negBkgndDPModels_[bkgndID];
- if (this->enableEmbedding()) {
- embeddedData = negBkgndTree_[bkgndID];
- }
- extraPdfs = &negBkgndPdfs_[bkgndID];
- kinematics = negKinematics_;
- } else {
- model = posBkgndDPModels_[bkgndID];
- if (this->enableEmbedding()) {
- embeddedData = posBkgndTree_[bkgndID];
- }
- if ( tagged_ ) {
- extraPdfs = &posBkgndPdfs_[bkgndID];
- } else {
- extraPdfs = &negBkgndPdfs_[bkgndID];
- }
- kinematics = posKinematics_;
- }
-
- if (this->useDP()) {
- if (embeddedData) {
- embeddedData->getEmbeddedEvent(kinematics);
- } else {
- if (model == 0) {
- const TString& bkgndClass = this->bkgndClassName(bkgndID);
- std::cerr << "ERROR in LauCPFitModel::generateBkgndEvent : Can't find the DP model for background class \"" << bkgndClass << "\"." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- genOK = model->generate();
- }
- } else {
- if (embeddedData) {
- embeddedData->getEmbeddedEvent(0);
- }
- }
- if (genOK) {
- this->generateExtraPdfValues(extraPdfs, embeddedData);
- }
-
- // Check for problems with the embedding
- if (embeddedData && (embeddedData->nEvents() == embeddedData->nUsedEvents())) {
- const TString& bkgndClass = this->bkgndClassName(bkgndID);
- std::cerr << "WARNING in LauCPFitModel::generateBkgndEvent : Source of embedded " << bkgndClass << " events used up, clearing the list of used events." << std::endl;
- embeddedData->clearUsedList();
- }
-
- return genOK;
+ std::cout << "INFO in LauCPFitModel::setAmpCoeffSet : Added coefficients for component \""
+ << compName << "\" to the fit model." << std::endl;
+ coeffSet->printParValues();
}
-void LauCPFitModel::setupGenNtupleBranches()
+void LauCPFitModel::initialise()
{
- // Setup the required ntuple branches
- this->addGenNtupleDoubleBranch("evtWeight");
- this->addGenNtupleIntegerBranch("genSig");
- this->addGenNtupleDoubleBranch("efficiency");
- if ( useSCF_ || ( this->enableEmbedding() &&
- negSignalTree_ != 0 && negSignalTree_->haveBranch("mcMatch") &&
- posSignalTree_ != 0 && posSignalTree_->haveBranch("mcMatch") ) ) {
- this->addGenNtupleIntegerBranch("genTMSig");
- this->addGenNtupleIntegerBranch("genSCFSig");
- }
- const UInt_t nBkgnds = this->nBkgndClasses();
- for ( UInt_t iBkgnd(0); iBkgnd < nBkgnds; ++iBkgnd ) {
- TString name( this->bkgndClassName(iBkgnd) );
- name.Prepend("gen");
- this->addGenNtupleIntegerBranch(name);
- }
- this->addGenNtupleIntegerBranch("charge");
- if (this->useDP() == kTRUE) {
- this->addGenNtupleDoubleBranch("m12");
- this->addGenNtupleDoubleBranch("m23");
- this->addGenNtupleDoubleBranch("m13");
- this->addGenNtupleDoubleBranch("m12Sq");
- this->addGenNtupleDoubleBranch("m23Sq");
- this->addGenNtupleDoubleBranch("m13Sq");
- this->addGenNtupleDoubleBranch("cosHel12");
- this->addGenNtupleDoubleBranch("cosHel23");
- this->addGenNtupleDoubleBranch("cosHel13");
- if (negKinematics_->squareDP() && posKinematics_->squareDP()) {
- this->addGenNtupleDoubleBranch("mPrime");
- this->addGenNtupleDoubleBranch("thPrime");
- }
- }
- for (LauPdfPList::const_iterator pdf_iter = negSignalPdfs_.begin(); pdf_iter != negSignalPdfs_.end(); ++pdf_iter) {
- std::vector<TString> varNames = (*pdf_iter)->varNames();
- for ( std::vector<TString>::const_iterator var_iter = varNames.begin(); var_iter != varNames.end(); ++var_iter ) {
- if ( (*var_iter) != "m13Sq" && (*var_iter) != "m23Sq" ) {
- this->addGenNtupleDoubleBranch( (*var_iter) );
- }
- }
- }
-}
+ // Initialisation
+ if ( ! this->useDP() && negSignalPdfs_.empty() ) {
+ std::cerr << "ERROR in LauCPFitModel::initialise : Signal model doesn't exist for any variable."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
-void LauCPFitModel::setDPBranchValues()
-{
- LauKinematics* kinematics(0);
- if (curEvtCharge_<0) {
- kinematics = negKinematics_;
- } else {
- kinematics = posKinematics_;
- }
-
- // Store all the DP information
- this->setGenNtupleDoubleBranchValue("m12", kinematics->getm12());
- this->setGenNtupleDoubleBranchValue("m23", kinematics->getm23());
- this->setGenNtupleDoubleBranchValue("m13", kinematics->getm13());
- this->setGenNtupleDoubleBranchValue("m12Sq", kinematics->getm12Sq());
- this->setGenNtupleDoubleBranchValue("m23Sq", kinematics->getm23Sq());
- this->setGenNtupleDoubleBranchValue("m13Sq", kinematics->getm13Sq());
- this->setGenNtupleDoubleBranchValue("cosHel12", kinematics->getc12());
- this->setGenNtupleDoubleBranchValue("cosHel23", kinematics->getc23());
- this->setGenNtupleDoubleBranchValue("cosHel13", kinematics->getc13());
- if (kinematics->squareDP()) {
- this->setGenNtupleDoubleBranchValue("mPrime", kinematics->getmPrime());
- this->setGenNtupleDoubleBranchValue("thPrime", kinematics->getThetaPrime());
- }
-}
-
-void LauCPFitModel::generateExtraPdfValues(LauPdfPList* extraPdfs, LauEmbeddedData* embeddedData)
-{
- LauKinematics* kinematics(0);
- if (curEvtCharge_<0) {
- kinematics = negKinematics_;
- } else {
- kinematics = posKinematics_;
- }
-
- if (!extraPdfs) {
- std::cerr << "ERROR in LauCPFitModel::generateExtraPdfValues : Null pointer to PDF list." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- if (extraPdfs->empty()) {
- //std::cerr << "WARNING in LauCPFitModel::generateExtraPdfValues : PDF list is empty." << std::endl;
- return;
- }
-
- // Generate from the extra PDFs
- for (LauPdfPList::iterator pdf_iter = extraPdfs->begin(); pdf_iter != extraPdfs->end(); ++pdf_iter) {
- LauFitData genValues;
- if (embeddedData) {
- genValues = embeddedData->getValues( (*pdf_iter)->varNames() );
- } else {
- genValues = (*pdf_iter)->generate(kinematics);
- }
- for ( LauFitData::const_iterator var_iter = genValues.begin(); var_iter != genValues.end(); ++var_iter ) {
- TString varName = var_iter->first;
- if ( varName != "m13Sq" && varName != "m23Sq" ) {
- Double_t value = var_iter->second;
- this->setGenNtupleDoubleBranchValue(varName,value);
- }
- }
- }
-}
-
-Bool_t LauCPFitModel::storeSignalMCMatch(LauEmbeddedData* embeddedData)
-{
- // Default to TM
- Bool_t genSCF(kFALSE);
- Int_t match(1);
-
- // Check that we have a valid pointer and that embedded data has
- // the mcMatch branch. If so then get the match value.
- if ( embeddedData && embeddedData->haveBranch("mcMatch") ) {
- match = TMath::Nint( embeddedData->getValue("mcMatch") );
- }
-
- // Set the variables accordingly.
- if (match) {
- this->setGenNtupleIntegerBranchValue("genTMSig",1);
- this->setGenNtupleIntegerBranchValue("genSCFSig",0);
- genSCF = kFALSE;
- } else {
- this->setGenNtupleIntegerBranchValue("genTMSig",0);
- this->setGenNtupleIntegerBranchValue("genSCFSig",1);
- genSCF = kTRUE;
- }
-
- return genSCF;
-}
+ if ( this->useDP() ) {
+ // Check that we have all the Dalitz-plot models
+ if ( ( negSigModel_ == 0 ) || ( posSigModel_ == 0 ) ) {
+ std::cerr << "ERROR in LauCPFitModel::initialise : the pointer to one (neg or pos) of the signal DP models is null.\n";
+ std::cerr << " : Removing the Dalitz Plot from the model."
+ << std::endl;
+ this->useDP( kFALSE );
+ }
+ if ( usingBkgnd_ ) {
+ if ( negBkgndDPModels_.empty() || posBkgndDPModels_.empty() ) {
+ std::cerr << "ERROR in LauCPFitModel::initialise : No background DP models found.\n";
+ std::cerr << " : Removing the Dalitz plot from the model."
+ << std::endl;
+ this->useDP( kFALSE );
+ }
+ for ( LauBkgndDPModelList::const_iterator dpmodel_iter = negBkgndDPModels_.begin();
+ dpmodel_iter != negBkgndDPModels_.end();
+ ++dpmodel_iter ) {
+ if ( ( *dpmodel_iter ) == 0 ) {
+ std::cerr << "ERROR in LauCPFitModel::initialise : The pointer to one of the background DP models is null.\n";
+ std::cerr << " : Removing the Dalitz Plot from the model."
+ << std::endl;
+ this->useDP( kFALSE );
+ break;
+ }
+ }
+ for ( LauBkgndDPModelList::const_iterator dpmodel_iter = posBkgndDPModels_.begin();
+ dpmodel_iter != posBkgndDPModels_.end();
+ ++dpmodel_iter ) {
+ if ( ( *dpmodel_iter ) == 0 ) {
+ std::cerr << "ERROR in LauCPFitModel::initialise : The pointer to one of the background DP models is null.\n";
+ std::cerr << " : Removing the Dalitz Plot from the model."
+ << std::endl;
+ this->useDP( kFALSE );
+ break;
+ }
+ }
+ }
-void LauCPFitModel::propagateParUpdates()
-{
- // Update the signal parameters and then the total normalisation for the signal likelihood
- if (this->useDP() == kTRUE) {
- this->updateCoeffs();
- negSigModel_->updateCoeffs(negCoeffs_);
- posSigModel_->updateCoeffs(posCoeffs_);
- }
+ // Need to check that the number of components we have and that the dynamics has matches up
+ const UInt_t nNegAmp = negSigModel_->getnTotAmp();
+ const UInt_t nPosAmp = posSigModel_->getnTotAmp();
+ if ( nNegAmp != nPosAmp ) {
+ std::cerr << "ERROR in LauCPFitModel::initialise : 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 LauCPFitModel::initialise : Number of signal DP components in the model ("
+ << nNegAmp << ") not equal to number of coefficients supplied (" << nSigComp_
+ << ")." << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
- // Update the signal fraction from the background fractions if not doing an extended fit
- if ( !this->doEMLFit() && !signalEvents_->fixed() ) {
- this->updateSigEvents();
- }
-}
+ if ( ! fixParamFileName_.IsNull() || ! fixParamMap_.empty() ) {
-void LauCPFitModel::updateSigEvents()
-{
- // The background parameters will have been set from Minuit.
- // We need to update the signal events using these.
- Double_t nTotEvts = this->eventsPerExpt();
-
- signalEvents_->range(-2.0*nTotEvts,2.0*nTotEvts);
- for (LauBkgndYieldList::iterator iter = bkgndEvents_.begin(); iter != bkgndEvents_.end(); ++iter) {
- LauAbsRValue* nBkgndEvents = (*iter);
- if ( nBkgndEvents->isLValue() ) {
- LauParameter* yield = dynamic_cast<LauParameter*>( nBkgndEvents );
- yield->range(-2.0*nTotEvts,2.0*nTotEvts);
- }
- }
-
- if (signalEvents_->fixed()) {
- return;
- }
-
- // Subtract background events (if any) from signal.
- Double_t signalEvents = nTotEvts;
- if (usingBkgnd_ == kTRUE) {
- for (LauBkgndYieldList::const_iterator iter = bkgndEvents_.begin(); iter != bkgndEvents_.end(); ++iter) {
- signalEvents -= (*iter)->value();
- }
- }
- signalEvents_->value(signalEvents);
-}
+ // Set coefficients
-void LauCPFitModel::cacheInputFitVars()
-{
- // Fill the internal data trees of the signal and background models.
- // Note that we store the events of both charges in both the
- // negative and the positive models. It's only later, at the stage
- // when the likelihood is being calculated, that we separate them.
-
- LauFitDataTree* inputFitData = this->fitData();
-
- // First the Dalitz plot variables (m_ij^2)
- if (this->useDP() == kTRUE) {
-
- // need to append SCF smearing bins before caching DP amplitudes
- if ( scfMap_ != 0 ) {
- this->appendBinCentres( inputFitData );
- }
-
- negSigModel_->fillDataTree(*inputFitData);
- posSigModel_->fillDataTree(*inputFitData);
-
- if (usingBkgnd_ == kTRUE) {
- for (LauBkgndDPModelList::iterator iter = negBkgndDPModels_.begin(); iter != negBkgndDPModels_.end(); ++iter) {
- (*iter)->fillDataTree(*inputFitData);
- }
- for (LauBkgndDPModelList::iterator iter = posBkgndDPModels_.begin(); iter != posBkgndDPModels_.end(); ++iter) {
- (*iter)->fillDataTree(*inputFitData);
- }
- }
- }
-
- // ...and then the extra PDFs
- this->cacheInfo(negSignalPdfs_, *inputFitData);
- this->cacheInfo(negScfPdfs_, *inputFitData);
- for (LauBkgndPdfsList::iterator iter = negBkgndPdfs_.begin(); iter != negBkgndPdfs_.end(); ++iter) {
- this->cacheInfo((*iter), *inputFitData);
- }
- if ( tagged_ ) {
- this->cacheInfo(posSignalPdfs_, *inputFitData);
- this->cacheInfo(posScfPdfs_, *inputFitData);
- for (LauBkgndPdfsList::iterator iter = posBkgndPdfs_.begin(); iter != posBkgndPdfs_.end(); ++iter) {
- this->cacheInfo((*iter), *inputFitData);
- }
- }
-
- // the SCF fractions and jacobians
- if ( useSCF_ && useSCFHist_ ) {
- if ( !inputFitData->haveBranch( "m13Sq" ) || !inputFitData->haveBranch( "m23Sq" ) ) {
- std::cerr << "ERROR in LauCPFitModel::cacheInputFitVars : Input data does not contain DP branches and so can't cache the SCF fraction." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- UInt_t nEvents = inputFitData->nEvents();
- recoSCFFracs_.clear();
- recoSCFFracs_.reserve( nEvents );
- if ( negKinematics_->squareDP() ) {
- recoJacobians_.clear();
- recoJacobians_.reserve( nEvents );
- }
- for (UInt_t iEvt = 0; iEvt < nEvents; iEvt++) {
- const LauFitData& dataValues = inputFitData->getData(iEvt);
- LauFitData::const_iterator m13_iter = dataValues.find("m13Sq");
- LauFitData::const_iterator m23_iter = dataValues.find("m23Sq");
- negKinematics_->updateKinematics( m13_iter->second, m23_iter->second );
- Double_t scfFrac = scfFracHist_->calcEfficiency( negKinematics_ );
- recoSCFFracs_.push_back( scfFrac );
- if ( negKinematics_->squareDP() ) {
- recoJacobians_.push_back( negKinematics_->calcSqDPJacobian() );
- }
- }
- }
-
- // finally cache the event charge
- evtCharges_.clear();
- if ( tagged_ ) {
- if ( !inputFitData->haveBranch( tagVarName_ ) ) {
- std::cerr << "ERROR in LauCPFitModel::cacheInputFitVars : Input data does not contain branch \"" << tagVarName_ << "\"." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- UInt_t nEvents = inputFitData->nEvents();
- evtCharges_.reserve( nEvents );
- for (UInt_t iEvt = 0; iEvt < nEvents; iEvt++) {
- const LauFitData& dataValues = inputFitData->getData(iEvt);
- LauFitData::const_iterator iter = dataValues.find( tagVarName_ );
- curEvtCharge_ = static_cast<Int_t>( iter->second );
- evtCharges_.push_back( curEvtCharge_ );
- }
- }
-}
+ std::vector<LauParameter*> params;
+ for ( auto itr = coeffPars_.begin(); itr != coeffPars_.end(); ++itr ) {
+ std::vector<LauParameter*> p = ( *itr )->getParameters();
+ params.insert( params.end(), p.begin(), p.end() );
+ }
-void LauCPFitModel::appendBinCentres( LauFitDataTree* inputData )
-{
- // We'll be caching the DP amplitudes and efficiencies of the centres of the true bins.
- // To do so, we attach some fake points at the end of inputData, the number of the entry
- // minus the total number of events corresponding to the number of the histogram for that
- // given true bin in the LauScfMap object. (What this means is that when Laura is provided with
- // the LauScfMap object by the user, it's the latter who has to make sure that it contains the
- // right number of histograms and in exactly the right order!)
-
- // Get the x and y co-ordinates of the bin centres
- std::vector<Double_t> binCentresXCoords;
- std::vector<Double_t> binCentresYCoords;
- scfMap_->listBinCentres(binCentresXCoords, binCentresYCoords);
-
- // The SCF histograms could be in square Dalitz plot histograms.
- // The dynamics takes normal Dalitz plot coords, so we might have to convert them back.
- Bool_t sqDP = negKinematics_->squareDP();
- UInt_t nBins = binCentresXCoords.size();
- fakeSCFFracs_.clear();
- fakeSCFFracs_.reserve( nBins );
- if ( sqDP ) {
- fakeJacobians_.clear();
- fakeJacobians_.reserve( nBins );
- }
-
- for (UInt_t iBin = 0; iBin < nBins; ++iBin) {
-
- if ( sqDP ) {
- negKinematics_->updateSqDPKinematics(binCentresXCoords[iBin],binCentresYCoords[iBin]);
- binCentresXCoords[iBin] = negKinematics_->getm13Sq();
- binCentresYCoords[iBin] = negKinematics_->getm23Sq();
- fakeJacobians_.push_back( negKinematics_->calcSqDPJacobian() );
- } else {
- negKinematics_->updateKinematics(binCentresXCoords[iBin],binCentresYCoords[iBin]);
- }
-
- fakeSCFFracs_.push_back( scfFracHist_->calcEfficiency( negKinematics_ ) );
- }
-
- // Set up inputFitVars_ object to hold the fake events
- inputData->appendFakePoints(binCentresXCoords,binCentresYCoords);
-}
-
-Double_t LauCPFitModel::getTotEvtLikelihood(UInt_t iEvt)
-{
- // Find out whether we have B- or B+
- if ( tagged_ ) {
- curEvtCharge_ = evtCharges_[iEvt];
-
- // check that the charge is either +1 or -1
- if (TMath::Abs(curEvtCharge_)!=1) {
- std::cerr << "ERROR in LauCPFitModel::getTotEvtLikelihood : Charge/tag not accepted value: " << curEvtCharge_ << std::endl;
- if (curEvtCharge_>0) {
- curEvtCharge_ = +1;
- } else {
- curEvtCharge_ = -1;
- }
- std::cerr << " : Making it: " << curEvtCharge_ << "." << std::endl;
- }
- }
-
- // Get the DP likelihood for signal and backgrounds
- this->getEvtDPLikelihood(iEvt);
-
- // Get the combined extra PDFs likelihood for signal and backgrounds
- this->getEvtExtraLikelihoods(iEvt);
-
- // If appropriate, combine the TM and SCF likelihoods
- Double_t sigLike = sigDPLike_ * sigExtraLike_;
- if ( useSCF_ ) {
- Double_t scfFrac(0.0);
- if (useSCFHist_) {
- scfFrac = recoSCFFracs_[iEvt];
- } else {
- scfFrac = scfFrac_.unblindValue();
- }
- sigLike *= (1.0 - scfFrac);
- if ( (scfMap_ != 0) && (this->useDP() == kTRUE) ) {
- // if we're smearing the SCF DP PDF then the SCF frac
- // is already included in the SCF DP likelihood
- sigLike += (scfDPLike_ * scfExtraLike_);
- } else {
- sigLike += (scfFrac * scfDPLike_ * scfExtraLike_);
- }
- }
-
- // Get the correct event fractions depending on the charge
- // Signal asymmetry is built into the DP model... but when the DP
- // isn't in the fit we need an explicit parameter
- Double_t signalEvents = signalEvents_->unblindValue() * 0.5;
- if (this->useDP() == kFALSE) {
- signalEvents *= (1.0 - curEvtCharge_ * signalAsym_->unblindValue());
- }
-
- // Construct the total event likelihood
- Double_t likelihood(0.0);
- if (usingBkgnd_) {
- likelihood = sigLike*signalEvents;
- const UInt_t nBkgnds = this->nBkgndClasses();
- for ( UInt_t bkgndID(0); bkgndID < nBkgnds; ++bkgndID ) {
- Double_t bkgndEvents = bkgndEvents_[bkgndID]->unblindValue() * 0.5 * (1.0 - curEvtCharge_ * bkgndAsym_[bkgndID]->unblindValue());
- likelihood += bkgndEvents*bkgndDPLike_[bkgndID]*bkgndExtraLike_[bkgndID];
- }
- } else {
- likelihood = sigLike*0.5;
- }
- return likelihood;
-}
+ this->fixParams( params );
-Double_t LauCPFitModel::getEventSum() const
-{
- Double_t eventSum(0.0);
- eventSum += signalEvents_->unblindValue();
- if (usingBkgnd_) {
- for (LauBkgndYieldList::const_iterator iter = bkgndEvents_.begin(); iter != bkgndEvents_.end(); ++iter) {
- eventSum += (*iter)->unblindValue();
- }
- }
- return eventSum;
-}
-
-void LauCPFitModel::getEvtDPLikelihood(UInt_t iEvt)
-{
- // Function to return the signal and background likelihoods for the
- // Dalitz plot for the given event evtNo.
-
- if ( ! this->useDP() ) {
- // There's always going to be a term in the likelihood for the
- // signal, so we'd better not zero it.
- sigDPLike_ = 1.0;
- scfDPLike_ = 1.0;
-
- const UInt_t nBkgnds = this->nBkgndClasses();
- for ( UInt_t bkgndID(0); bkgndID < nBkgnds; ++bkgndID ) {
- if (usingBkgnd_ == kTRUE) {
- bkgndDPLike_[bkgndID] = 1.0;
- } else {
- bkgndDPLike_[bkgndID] = 0.0;
- }
- }
-
- return;
- }
-
- const UInt_t nBkgnds = this->nBkgndClasses();
- if ( tagged_ ) {
- if (curEvtCharge_==+1) {
- posSigModel_->calcLikelihoodInfo(iEvt);
- sigDPLike_ = posSigModel_->getEvtIntensity();
-
- for ( UInt_t bkgndID(0); bkgndID < nBkgnds; ++bkgndID ) {
- if (usingBkgnd_ == kTRUE) {
- bkgndDPLike_[bkgndID] = posBkgndDPModels_[bkgndID]->getLikelihood(iEvt);
- } else {
- bkgndDPLike_[bkgndID] = 0.0;
- }
- }
- } else {
- negSigModel_->calcLikelihoodInfo(iEvt);
- sigDPLike_ = negSigModel_->getEvtIntensity();
-
- for ( UInt_t bkgndID(0); bkgndID < nBkgnds; ++bkgndID ) {
- if (usingBkgnd_ == kTRUE) {
- bkgndDPLike_[bkgndID] = negBkgndDPModels_[bkgndID]->getLikelihood(iEvt);
- } else {
- bkgndDPLike_[bkgndID] = 0.0;
- }
- }
- }
- } else {
- posSigModel_->calcLikelihoodInfo(iEvt);
- negSigModel_->calcLikelihoodInfo(iEvt);
-
- sigDPLike_ = 0.5 * ( posSigModel_->getEvtIntensity() + negSigModel_->getEvtIntensity() );
-
- for ( UInt_t bkgndID(0); bkgndID < nBkgnds; ++bkgndID ) {
- if (usingBkgnd_ == kTRUE) {
- bkgndDPLike_[bkgndID] = 0.5 * ( posBkgndDPModels_[bkgndID]->getLikelihood(iEvt) +
- negBkgndDPModels_[bkgndID]->getLikelihood(iEvt) );
- } else {
- bkgndDPLike_[bkgndID] = 0.0;
- }
- }
- }
-
- if ( useSCF_ == kTRUE ) {
- if ( scfMap_ == 0 ) {
- // we're not smearing the SCF DP position
- // so the likelihood is the same as the TM
- scfDPLike_ = sigDPLike_;
- } else {
- // calculate the smeared SCF DP likelihood
- scfDPLike_ = this->getEvtSCFDPLikelihood(iEvt);
- }
- }
-
- // Calculate the signal normalisation
- // NB the 2.0 is there so that the 0.5 factor is applied to
- // signal and background in the same place otherwise you get
- // normalisation problems when you switch off the DP in the fit
- Double_t norm = negSigModel_->getDPNorm() + posSigModel_->getDPNorm();
- sigDPLike_ *= 2.0/norm;
- scfDPLike_ *= 2.0/norm;
-}
-
-Double_t LauCPFitModel::getEvtSCFDPLikelihood(UInt_t iEvt)
-{
- Double_t scfDPLike(0.0);
-
- Double_t recoJacobian(1.0);
- Double_t xCoord(0.0);
- Double_t yCoord(0.0);
-
- Bool_t squareDP = negKinematics_->squareDP();
- if ( squareDP ) {
- xCoord = negSigModel_->getEvtmPrime();
- yCoord = negSigModel_->getEvtthPrime();
- recoJacobian = recoJacobians_[iEvt];
- } else {
- xCoord = negSigModel_->getEvtm13Sq();
- yCoord = negSigModel_->getEvtm23Sq();
- }
-
- // Find the bin that our reco event falls in
- Int_t recoBin = scfMap_->binNumber( xCoord, yCoord );
-
- // Find out which true Bins contribute to the given reco bin
- const std::vector<Int_t>* trueBins = scfMap_->trueBins(recoBin);
-
- const Int_t nDataEvents = this->eventsPerExpt();
-
- // Loop over the true bins
- for (std::vector<Int_t>::const_iterator iter = trueBins->begin(); iter != trueBins->end(); ++iter)
- {
- Int_t trueBin = (*iter);
-
- // prob of a true event in the given true bin migrating to the reco bin
- Double_t pRecoGivenTrue = scfMap_->prob( recoBin, trueBin );
- Double_t pTrue(0.0);
-
- // We've cached the DP amplitudes and the efficiency for the
- // true bin centres, just after the data points
- if ( tagged_ ) {
- LauIsobarDynamics* sigModel(0);
- if (curEvtCharge_<0) {
- sigModel = negSigModel_;
- } else {
- sigModel = posSigModel_;
- }
-
- sigModel->calcLikelihoodInfo( nDataEvents + trueBin );
-
- pTrue = sigModel->getEvtIntensity();
- } else {
- posSigModel_->calcLikelihoodInfo( nDataEvents + trueBin );
- negSigModel_->calcLikelihoodInfo( nDataEvents + trueBin );
-
- pTrue = 0.5 * ( posSigModel_->getEvtIntensity() + negSigModel_->getEvtIntensity() );
- }
-
- // Get the cached SCF fraction (and jacobian if we're using the square DP)
- Double_t scfFraction = fakeSCFFracs_[ trueBin ];
- Double_t jacobian(1.0);
- if ( squareDP ) {
- jacobian = fakeJacobians_[ trueBin ];
- }
-
- scfDPLike += pTrue * jacobian * scfFraction * pRecoGivenTrue;
- }
-
- // Divide by the reco jacobian
- scfDPLike /= recoJacobian;
-
- return scfDPLike;
-}
-
-void LauCPFitModel::getEvtExtraLikelihoods(UInt_t iEvt)
-{
- // Function to return the signal and background likelihoods for the
- // extra variables for the given event evtNo.
-
- sigExtraLike_ = 1.0;
-
- const UInt_t nBkgnds = this->nBkgndClasses();
-
- if ( ! tagged_ || curEvtCharge_ < 0 ) {
- sigExtraLike_ = this->prodPdfValue( negSignalPdfs_, iEvt );
-
- if (useSCF_) {
- scfExtraLike_ = this->prodPdfValue( negScfPdfs_, iEvt );
- }
+ // Set resonance parameters (if they exist)
- for ( UInt_t bkgndID(0); bkgndID < nBkgnds; ++bkgndID ) {
- if (usingBkgnd_) {
- bkgndExtraLike_[bkgndID] = this->prodPdfValue( negBkgndPdfs_[bkgndID], iEvt );
- } else {
- bkgndExtraLike_[bkgndID] = 0.0;
- }
- }
- } else {
- sigExtraLike_ = this->prodPdfValue( posSignalPdfs_, iEvt );
+ negSigModel_->collateResonanceParameters();
+ posSigModel_->collateResonanceParameters();
- if (useSCF_) {
- scfExtraLike_ = this->prodPdfValue( posScfPdfs_, iEvt );
- }
+ this->fixParams( negSigModel_->getFloatingParameters() );
+ this->fixParams( posSigModel_->getFloatingParameters() );
+ }
- for ( UInt_t bkgndID(0); bkgndID < nBkgnds; ++bkgndID ) {
- if (usingBkgnd_) {
- bkgndExtraLike_[bkgndID] = this->prodPdfValue( posBkgndPdfs_[bkgndID], iEvt );
- } else {
- bkgndExtraLike_[bkgndID] = 0.0;
- }
- }
- }
-}
+ // From the initial parameter values calculate the coefficients
+ // so they can be passed to the signal model
+ this->updateCoeffs();
-void LauCPFitModel::updateCoeffs()
-{
- negCoeffs_.clear(); posCoeffs_.clear();
- negCoeffs_.reserve(nSigComp_); posCoeffs_.reserve(nSigComp_);
- for (UInt_t i = 0; i < nSigComp_; i++) {
- negCoeffs_.push_back(coeffPars_[i]->antiparticleCoeff());
- posCoeffs_.push_back(coeffPars_[i]->particleCoeff());
- }
-}
+ // If all is well, go ahead and initialise them
+ this->initialiseDPModels();
+ }
-void LauCPFitModel::setupSPlotNtupleBranches()
-{
- // add branches for storing the experiment number and the number of
- // the event within the current experiment
- this->addSPlotNtupleIntegerBranch("iExpt");
- this->addSPlotNtupleIntegerBranch("iEvtWithinExpt");
-
- // Store the efficiency of the event (for inclusive BF calculations).
- if (this->storeDPEff()) {
- this->addSPlotNtupleDoubleBranch("efficiency");
- if ( negSigModel_->usingScfModel() && posSigModel_->usingScfModel() ) {
- this->addSPlotNtupleDoubleBranch("scffraction");
- }
- }
-
- // Store the total event likelihood for each species.
- if (useSCF_) {
- this->addSPlotNtupleDoubleBranch("sigTMTotalLike");
- this->addSPlotNtupleDoubleBranch("sigSCFTotalLike");
- this->addSPlotNtupleDoubleBranch("sigSCFFrac");
- } else {
- this->addSPlotNtupleDoubleBranch("sigTotalLike");
- }
- if (usingBkgnd_) {
- const UInt_t nBkgnds = this->nBkgndClasses();
- for ( UInt_t iBkgnd(0); iBkgnd < nBkgnds; ++iBkgnd ) {
- TString name( this->bkgndClassName(iBkgnd) );
- name += "TotalLike";
- this->addSPlotNtupleDoubleBranch(name);
- }
- }
-
- // Store the DP likelihoods
- if (this->useDP()) {
- if (useSCF_) {
- this->addSPlotNtupleDoubleBranch("sigTMDPLike");
- this->addSPlotNtupleDoubleBranch("sigSCFDPLike");
- } else {
- this->addSPlotNtupleDoubleBranch("sigDPLike");
- }
- if (usingBkgnd_) {
- const UInt_t nBkgnds = this->nBkgndClasses();
- for ( UInt_t iBkgnd(0); iBkgnd < nBkgnds; ++iBkgnd ) {
- TString name( this->bkgndClassName(iBkgnd) );
- name += "DPLike";
- this->addSPlotNtupleDoubleBranch(name);
- }
- }
- }
-
- // Store the likelihoods for each extra PDF
- if (useSCF_) {
- this->addSPlotNtupleBranches(&negSignalPdfs_, "sigTM");
- this->addSPlotNtupleBranches(&negScfPdfs_, "sigSCF");
- } else {
- this->addSPlotNtupleBranches(&negSignalPdfs_, "sig");
- }
- if (usingBkgnd_) {
- const UInt_t nBkgnds = this->nBkgndClasses();
- for ( UInt_t iBkgnd(0); iBkgnd < nBkgnds; ++iBkgnd ) {
- const TString& bkgndClass = this->bkgndClassName(iBkgnd);
- const LauPdfPList* pdfList = &(negBkgndPdfs_[iBkgnd]);
- this->addSPlotNtupleBranches(pdfList, bkgndClass);
- }
- }
-}
-
-void LauCPFitModel::addSPlotNtupleBranches(const LauPdfPList* extraPdfs, const TString& prefix)
-{
- if (extraPdfs) {
- // Loop through each of the PDFs
- for (LauPdfPList::const_iterator pdf_iter = extraPdfs->begin(); pdf_iter != extraPdfs->end(); ++pdf_iter) {
-
- // Count the number of input variables that are not
- // DP variables (used in the case where there is DP
- // dependence for e.g. MVA)
- UInt_t nVars(0);
- std::vector<TString> varNames = (*pdf_iter)->varNames();
- for ( std::vector<TString>::const_iterator var_iter = varNames.begin(); var_iter != varNames.end(); ++var_iter ) {
- if ( (*var_iter) != "m13Sq" && (*var_iter) != "m23Sq" ) {
- ++nVars;
- }
- }
-
- if ( nVars == 1 ) {
- // If the PDF only has one variable then
- // simply add one branch for that variable
- TString varName = (*pdf_iter)->varName();
- TString name(prefix);
- name += varName;
- name += "Like";
- this->addSPlotNtupleDoubleBranch(name);
- } else if ( nVars == 2 ) {
- // If the PDF has two variables then we
- // need a branch for them both together and
- // branches for each
- TString allVars("");
- for ( std::vector<TString>::const_iterator var_iter = varNames.begin(); var_iter != varNames.end(); ++var_iter ) {
- allVars += (*var_iter);
- TString name(prefix);
- name += (*var_iter);
- name += "Like";
- this->addSPlotNtupleDoubleBranch(name);
- }
- TString name(prefix);
- name += allVars;
- name += "Like";
- this->addSPlotNtupleDoubleBranch(name);
- } else {
- std::cerr << "WARNING in LauCPFitModel::addSPlotNtupleBranches : Can't yet deal with 3D PDFs." << std::endl;
- }
- }
- }
-}
-
-Double_t LauCPFitModel::setSPlotNtupleBranchValues(LauPdfPList* extraPdfs, const TString& prefix, UInt_t iEvt)
-{
- // Store the PDF value for each variable in the list
- Double_t totalLike(1.0);
- Double_t extraLike(0.0);
- if (extraPdfs) {
- for (LauPdfPList::iterator pdf_iter = extraPdfs->begin(); pdf_iter != extraPdfs->end(); ++pdf_iter) {
-
- // calculate the likelihood for this event
- (*pdf_iter)->calcLikelihoodInfo(iEvt);
- extraLike = (*pdf_iter)->getLikelihood();
- totalLike *= extraLike;
-
- // Count the number of input variables that are not
- // DP variables (used in the case where there is DP
- // dependence for e.g. MVA)
- UInt_t nVars(0);
- std::vector<TString> varNames = (*pdf_iter)->varNames();
- for ( std::vector<TString>::const_iterator var_iter = varNames.begin(); var_iter != varNames.end(); ++var_iter ) {
- if ( (*var_iter) != "m13Sq" && (*var_iter) != "m23Sq" ) {
- ++nVars;
- }
- }
-
- if ( nVars == 1 ) {
- // If the PDF only has one variable then
- // simply store the value for that variable
- TString varName = (*pdf_iter)->varName();
- TString name(prefix);
- name += varName;
- name += "Like";
- this->setSPlotNtupleDoubleBranchValue(name, extraLike);
- } else if ( nVars == 2 ) {
- // If the PDF has two variables then we
- // store the value for them both together
- // and for each on their own
- TString allVars("");
- for ( std::vector<TString>::const_iterator var_iter = varNames.begin(); var_iter != varNames.end(); ++var_iter ) {
- allVars += (*var_iter);
- TString name(prefix);
- name += (*var_iter);
- name += "Like";
- Double_t indivLike = (*pdf_iter)->getLikelihood( (*var_iter) );
- this->setSPlotNtupleDoubleBranchValue(name, indivLike);
- }
- TString name(prefix);
- name += allVars;
- name += "Like";
- this->setSPlotNtupleDoubleBranchValue(name, extraLike);
- } else {
- std::cerr << "WARNING in LauCPFitModel::setSPlotNtupleBranchValues : Can't yet deal with 3D PDFs." << std::endl;
- }
- }
- }
- return totalLike;
-}
+ // Next check that, if a given component is being used we've got the
+ // right number of PDFs for all the variables involved
+ // TODO - should probably check variable names and so on as well
+
+ UInt_t nsigpdfvars( 0 );
+ for ( LauPdfPList::const_iterator pdf_iter = negSignalPdfs_.begin();
+ pdf_iter != negSignalPdfs_.end();
+ ++pdf_iter ) {
+ std::vector<TString> varNames = ( *pdf_iter )->varNames();
+ for ( std::vector<TString>::const_iterator var_iter = varNames.begin();
+ var_iter != varNames.end();
+ ++var_iter ) {
+ if ( ( *var_iter ) != "m13Sq" && ( *var_iter ) != "m23Sq" ) {
+ ++nsigpdfvars;
+ }
+ }
+ }
+ if ( useSCF_ ) {
+ UInt_t nscfpdfvars( 0 );
+ for ( LauPdfPList::const_iterator pdf_iter = negScfPdfs_.begin();
+ pdf_iter != negScfPdfs_.end();
+ ++pdf_iter ) {
+ std::vector<TString> varNames = ( *pdf_iter )->varNames();
+ for ( std::vector<TString>::const_iterator var_iter = varNames.begin();
+ var_iter != varNames.end();
+ ++var_iter ) {
+ if ( ( *var_iter ) != "m13Sq" && ( *var_iter ) != "m23Sq" ) {
+ ++nscfpdfvars;
+ }
+ }
+ }
+ if ( nscfpdfvars != nsigpdfvars ) {
+ std::cerr << "ERROR in LauCPFitModel::initialise : There are " << nsigpdfvars
+ << " TM signal PDF variables but " << nscfpdfvars
+ << " SCF signal PDF variables." << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ }
+ if ( usingBkgnd_ ) {
+ for ( LauBkgndPdfsList::const_iterator bgclass_iter = negBkgndPdfs_.begin();
+ bgclass_iter != negBkgndPdfs_.end();
+ ++bgclass_iter ) {
+ UInt_t nbkgndpdfvars( 0 );
+ const LauPdfPList& pdfList = ( *bgclass_iter );
+ for ( LauPdfPList::const_iterator pdf_iter = pdfList.begin(); pdf_iter != pdfList.end();
+ ++pdf_iter ) {
+ std::vector<TString> varNames = ( *pdf_iter )->varNames();
+ for ( std::vector<TString>::const_iterator var_iter = varNames.begin();
+ var_iter != varNames.end();
+ ++var_iter ) {
+ if ( ( *var_iter ) != "m13Sq" && ( *var_iter ) != "m23Sq" ) {
+ ++nbkgndpdfvars;
+ }
+ }
+ }
+ if ( nbkgndpdfvars != nsigpdfvars ) {
+ std::cerr << "ERROR in LauCPFitModel::initialise : There are " << nsigpdfvars
+ << " signal PDF variables but " << nbkgndpdfvars
+ << " bkgnd PDF variables." << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ }
+ }
-LauSPlot::NameSet LauCPFitModel::variableNames() const
-{
- LauSPlot::NameSet nameSet;
- if (this->useDP()) {
- nameSet.insert("DP");
- }
- // Loop through all the signal PDFs
- for (LauPdfPList::const_iterator pdf_iter = negSignalPdfs_.begin(); pdf_iter != negSignalPdfs_.end(); ++pdf_iter) {
- // Loop over the variables involved in each PDF
- std::vector<TString> varNames = (*pdf_iter)->varNames();
- for ( std::vector<TString>::const_iterator var_iter = varNames.begin(); var_iter != varNames.end(); ++var_iter ) {
- // If they are not DP coordinates then add them
- if ( (*var_iter) != "m13Sq" && (*var_iter) != "m23Sq" ) {
- nameSet.insert( (*var_iter) );
- }
- }
- }
- return nameSet;
-}
+ // Clear the vectors of parameter information so we can start from scratch
+ this->clearFitParVectors();
-LauSPlot::NumbMap LauCPFitModel::freeSpeciesNames() const
-{
- LauSPlot::NumbMap numbMap;
- if (!signalEvents_->fixed() && this->doEMLFit()) {
- numbMap["sig"] = signalEvents_->genValue();
- }
- if ( usingBkgnd_ ) {
- const UInt_t nBkgnds = this->nBkgndClasses();
- for ( UInt_t iBkgnd(0); iBkgnd < nBkgnds; ++iBkgnd ) {
- const TString& bkgndClass = this->bkgndClassName(iBkgnd);
- const LauAbsRValue* par = bkgndEvents_[iBkgnd];
- if (!par->fixed()) {
- numbMap[bkgndClass] = par->genValue();
- if ( ! par->isLValue() ) {
- std::cerr << "WARNING in LauCPFitModel::freeSpeciesNames : \"" << par->name() << "\" is a LauFormulaPar, which implies it is perhaps not entirely free to float in the fit, so the sWeight calculation may not be reliable" << std::endl;
- }
- }
- }
- }
- return numbMap;
-}
+ // Set the fit parameters for signal and background models
+ this->setSignalDPParameters();
-LauSPlot::NumbMap LauCPFitModel::fixdSpeciesNames() const
-{
- LauSPlot::NumbMap numbMap;
- if (signalEvents_->fixed() && this->doEMLFit()) {
- numbMap["sig"] = signalEvents_->genValue();
- }
- if ( usingBkgnd_ ) {
- const UInt_t nBkgnds = this->nBkgndClasses();
- for ( UInt_t iBkgnd(0); iBkgnd < nBkgnds; ++iBkgnd ) {
- const TString& bkgndClass = this->bkgndClassName(iBkgnd);
- const LauAbsRValue* par = bkgndEvents_[iBkgnd];
- if (par->fixed()) {
- numbMap[bkgndClass] = par->genValue();
- }
- }
- }
- return numbMap;
-}
+ // Set the fit parameters for the various extra PDFs
+ this->setExtraPdfParameters();
-LauSPlot::TwoDMap LauCPFitModel::twodimPDFs() const
-{
- // This makes the assumption that the form of the positive and
- // negative PDFs are the same, which seems reasonable to me
-
- LauSPlot::TwoDMap twodimMap;
-
- for (LauPdfPList::const_iterator pdf_iter = negSignalPdfs_.begin(); pdf_iter != negSignalPdfs_.end(); ++pdf_iter) {
- // Count the number of input variables that are not DP variables
- UInt_t nVars(0);
- std::vector<TString> varNames = (*pdf_iter)->varNames();
- for ( std::vector<TString>::const_iterator var_iter = varNames.begin(); var_iter != varNames.end(); ++var_iter ) {
- if ( (*var_iter) != "m13Sq" && (*var_iter) != "m23Sq" ) {
- ++nVars;
- }
- }
- if ( nVars == 2 ) {
- if (useSCF_) {
- twodimMap.insert( std::make_pair( "sigTM", std::make_pair( varNames[0], varNames[1] ) ) );
- } else {
- twodimMap.insert( std::make_pair( "sig", std::make_pair( varNames[0], varNames[1] ) ) );
- }
- }
- }
-
- if ( useSCF_ ) {
- for (LauPdfPList::const_iterator pdf_iter = negScfPdfs_.begin(); pdf_iter != negScfPdfs_.end(); ++pdf_iter) {
- // Count the number of input variables that are not DP variables
- UInt_t nVars(0);
- std::vector<TString> varNames = (*pdf_iter)->varNames();
- for ( std::vector<TString>::const_iterator var_iter = varNames.begin(); var_iter != varNames.end(); ++var_iter ) {
- if ( (*var_iter) != "m13Sq" && (*var_iter) != "m23Sq" ) {
- ++nVars;
- }
- }
- if ( nVars == 2 ) {
- twodimMap.insert( std::make_pair( "sigSCF", std::make_pair( varNames[0], varNames[1] ) ) );
- }
- }
- }
-
- if (usingBkgnd_) {
- const UInt_t nBkgnds = this->nBkgndClasses();
- for ( UInt_t iBkgnd(0); iBkgnd < nBkgnds; ++iBkgnd ) {
- const TString& bkgndClass = this->bkgndClassName(iBkgnd);
- const LauPdfPList& pdfList = negBkgndPdfs_[iBkgnd];
- for (LauPdfPList::const_iterator pdf_iter = pdfList.begin(); pdf_iter != pdfList.end(); ++pdf_iter) {
- // Count the number of input variables that are not DP variables
- UInt_t nVars(0);
- std::vector<TString> varNames = (*pdf_iter)->varNames();
- for ( std::vector<TString>::const_iterator var_iter = varNames.begin(); var_iter != varNames.end(); ++var_iter ) {
- if ( (*var_iter) != "m13Sq" && (*var_iter) != "m23Sq" ) {
- ++nVars;
- }
- }
- if ( nVars == 2 ) {
- twodimMap.insert( std::make_pair( bkgndClass, std::make_pair( varNames[0], varNames[1] ) ) );
- }
- }
- }
- }
-
- return twodimMap;
+ // Set the initial bg and signal events
+ this->setFitNEvents();
+
+ // Check that we have the expected number of fit variables
+ const LauParameterPList& fitVars = this->fitPars();
+ if ( fitVars.size() != ( nSigDPPar_ + nExtraPdfPar_ + nNormPar_ ) ) {
+ std::cerr << "ERROR in LauCPFitModel::initialise : Number of fit parameters not of expected size. Exiting"
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ this->setExtraNtupleVars();
}
-void LauCPFitModel::storePerEvtLlhds()
+void LauCPFitModel::recalculateNormalisation()
{
- std::cout << "INFO in LauCPFitModel::storePerEvtLlhds : Storing per-event likelihood values..." << std::endl;
-
- // if we've not been using the DP model then we need to cache all
- // the info here so that we can get the efficiency from it
-
- LauFitDataTree* inputFitData = this->fitData();
-
- if (!this->useDP() && this->storeDPEff()) {
- negSigModel_->initialise(negCoeffs_);
- posSigModel_->initialise(posCoeffs_);
- negSigModel_->fillDataTree(*inputFitData);
- posSigModel_->fillDataTree(*inputFitData);
- }
-
- UInt_t evtsPerExpt(this->eventsPerExpt());
-
- LauIsobarDynamics* sigModel(0);
- LauPdfPList* sigPdfs(0);
- LauPdfPList* scfPdfs(0);
- LauBkgndPdfsList* bkgndPdfs(0);
-
- for (UInt_t iEvt = 0; iEvt < evtsPerExpt; ++iEvt) {
-
- this->setSPlotNtupleIntegerBranchValue("iExpt",this->iExpt());
- this->setSPlotNtupleIntegerBranchValue("iEvtWithinExpt",iEvt);
-
- // Find out whether we have B- or B+
- if ( tagged_ ) {
- const LauFitData& dataValues = inputFitData->getData(iEvt);
- LauFitData::const_iterator iter = dataValues.find("charge");
- curEvtCharge_ = static_cast<Int_t>(iter->second);
-
- if (curEvtCharge_==+1) {
- sigModel = posSigModel_;
- sigPdfs = &posSignalPdfs_;
- scfPdfs = &posScfPdfs_;
- bkgndPdfs = &posBkgndPdfs_;
- } else {
- sigModel = negSigModel_;
- sigPdfs = &negSignalPdfs_;
- scfPdfs = &negScfPdfs_;
- bkgndPdfs = &negBkgndPdfs_;
- }
- } else {
- sigPdfs = &negSignalPdfs_;
- scfPdfs = &negScfPdfs_;
- bkgndPdfs = &negBkgndPdfs_;
- }
-
- // the DP information
- this->getEvtDPLikelihood(iEvt);
- if (this->storeDPEff()) {
- if (!this->useDP()) {
- posSigModel_->calcLikelihoodInfo(iEvt);
- negSigModel_->calcLikelihoodInfo(iEvt);
- }
- if ( tagged_ ) {
- this->setSPlotNtupleDoubleBranchValue("efficiency",sigModel->getEvtEff());
- if ( negSigModel_->usingScfModel() && posSigModel_->usingScfModel() ) {
- this->setSPlotNtupleDoubleBranchValue("scffraction",sigModel->getEvtScfFraction());
- }
- } else {
- this->setSPlotNtupleDoubleBranchValue("efficiency",0.5*(posSigModel_->getEvtEff() + negSigModel_->getEvtEff()) );
- if ( negSigModel_->usingScfModel() && posSigModel_->usingScfModel() ) {
- this->setSPlotNtupleDoubleBranchValue("scffraction",0.5*(posSigModel_->getEvtScfFraction() + negSigModel_->getEvtScfFraction()));
- }
- }
- }
- if (this->useDP()) {
- sigTotalLike_ = sigDPLike_;
- if (useSCF_) {
- scfTotalLike_ = scfDPLike_;
- this->setSPlotNtupleDoubleBranchValue("sigTMDPLike",sigDPLike_);
- this->setSPlotNtupleDoubleBranchValue("sigSCFDPLike",scfDPLike_);
- } else {
- this->setSPlotNtupleDoubleBranchValue("sigDPLike",sigDPLike_);
- }
- if (usingBkgnd_) {
- const UInt_t nBkgnds = this->nBkgndClasses();
- for ( UInt_t iBkgnd(0); iBkgnd < nBkgnds; ++iBkgnd ) {
- TString name = this->bkgndClassName(iBkgnd);
- name += "DPLike";
- this->setSPlotNtupleDoubleBranchValue(name,bkgndDPLike_[iBkgnd]);
- }
- }
- } else {
- sigTotalLike_ = 1.0;
- if (useSCF_) {
- scfTotalLike_ = 1.0;
- }
- if (usingBkgnd_) {
- const UInt_t nBkgnds = this->nBkgndClasses();
- for ( UInt_t iBkgnd(0); iBkgnd < nBkgnds; ++iBkgnd ) {
- bkgndTotalLike_[iBkgnd] = 1.0;
- }
- }
- }
-
- // the signal PDF values
- if ( useSCF_ ) {
- sigTotalLike_ *= this->setSPlotNtupleBranchValues(sigPdfs, "sigTM", iEvt);
- scfTotalLike_ *= this->setSPlotNtupleBranchValues(scfPdfs, "sigSCF", iEvt);
- } else {
- sigTotalLike_ *= this->setSPlotNtupleBranchValues(sigPdfs, "sig", iEvt);
- }
-
- // the background PDF values
- if (usingBkgnd_) {
- const UInt_t nBkgnds = this->nBkgndClasses();
- for ( UInt_t iBkgnd(0); iBkgnd < nBkgnds; ++iBkgnd ) {
- const TString& bkgndClass = this->bkgndClassName(iBkgnd);
- LauPdfPList& pdfs = (*bkgndPdfs)[iBkgnd];
- bkgndTotalLike_[iBkgnd] *= this->setSPlotNtupleBranchValues(&(pdfs), bkgndClass, iEvt);
- }
- }
-
- // the total likelihoods
- if (useSCF_) {
- Double_t scfFrac(0.0);
- if ( useSCFHist_ ) {
- scfFrac = recoSCFFracs_[iEvt];
- } else {
- scfFrac = scfFrac_.unblindValue();
- }
- this->setSPlotNtupleDoubleBranchValue("sigSCFFrac",scfFrac);
- sigTotalLike_ *= ( 1.0 - scfFrac );
- if ( scfMap_ == 0 ) {
- scfTotalLike_ *= scfFrac;
- }
- this->setSPlotNtupleDoubleBranchValue("sigTMTotalLike",sigTotalLike_);
- this->setSPlotNtupleDoubleBranchValue("sigSCFTotalLike",scfTotalLike_);
- } else {
- this->setSPlotNtupleDoubleBranchValue("sigTotalLike",sigTotalLike_);
- }
- if (usingBkgnd_) {
- const UInt_t nBkgnds = this->nBkgndClasses();
- for ( UInt_t iBkgnd(0); iBkgnd < nBkgnds; ++iBkgnd ) {
- TString name = this->bkgndClassName(iBkgnd);
- name += "TotalLike";
- this->setSPlotNtupleDoubleBranchValue(name,bkgndTotalLike_[iBkgnd]);
- }
- }
- // fill the tree
- this->fillSPlotNtupleBranches();
- }
- std::cout << "INFO in LauCPFitModel::storePerEvtLlhds : Finished storing per-event likelihood values." << std::endl;
-}
-
-std::map<TString, LauComplex> LauCPFitModel::getDPAmps(const Double_t m13Sq, const Double_t m23Sq)
-{
- // Initialise the DP model, if not already done
- if ( negCoeffs_.empty() || posCoeffs_.empty() ) {
- this->updateCoeffs();
- this->initialiseDPModels();
- }
-
- if ( ! posKinematics_->withinDPLimits( m13Sq, m23Sq ) ) {
- return { { "signal_" + negParent_, {} },
- { "signal_" + posParent_, {} } };
- }
-
- negSigModel_->calcLikelihoodInfo( m13Sq, m23Sq );
- posSigModel_->calcLikelihoodInfo( m13Sq, m23Sq );
-
- return { { "signal_" + negParent_, negSigModel_->getEvtDPAmp() },
- { "signal_" + posParent_, posSigModel_->getEvtDPAmp() } };
-}
-
-std::map<TString, Double_t> LauCPFitModel::getDPLikelihoods(const Double_t m13Sq, const Double_t m23Sq)
-{
- // Initialise the DP model, if not already done
- if ( negCoeffs_.empty() || posCoeffs_.empty() ) {
- this->updateCoeffs();
- this->initialiseDPModels();
- }
-
- std::map<TString, Double_t> likelihoods;
-
- if ( ! posKinematics_->withinDPLimits( m13Sq, m23Sq ) ) {
- likelihoods.emplace( "signal_" + negParent_, 0.0 );
- likelihoods.emplace( "signal_" + posParent_, 0.0 );
- if ( usingBkgnd_ ) {
- const UInt_t nBkgnds { this->nBkgndClasses() };
- for ( UInt_t bkgndID( 0 ); bkgndID < nBkgnds; ++bkgndID ) {
- likelihoods.emplace( this->bkgndClassName( bkgndID ) + "_" + negParent_, 0.0 );
- likelihoods.emplace( this->bkgndClassName( bkgndID ) + "_" + posParent_, 0.0 );
- }
- }
- return likelihoods;
- }
-
- negSigModel_->calcLikelihoodInfo( m13Sq, m23Sq );
- posSigModel_->calcLikelihoodInfo( m13Sq, m23Sq );
-
- // See comment in getEvtDPLikelihood for explanation of the 2.0 factor
- const Double_t norm { 2.0 / ( negSigModel_->getDPNorm() + posSigModel_->getDPNorm() ) };
-
- likelihoods.emplace( "signal_" + negParent_, negSigModel_->getEvtIntensity() * norm );
- likelihoods.emplace( "signal_" + posParent_, posSigModel_->getEvtIntensity() * norm );
-
- // TODO - SCF signal
- static bool warningIssued { false };
- if ( useSCF_ && ! warningIssued ) {
- warningIssued = true;
- std::cerr << "WARNING in LauCPFitModel::getDPLikelihoods : calculation of SCF likelihoods not currently implemented in this function\n";
- std::cerr << " : signal likelihood will just be the truth-matched value";
- std::cerr << std::endl;
- }
-
- if ( usingBkgnd_ ) {
- const UInt_t nBkgnds { this->nBkgndClasses() };
- for ( UInt_t bkgndID( 0 ); bkgndID < nBkgnds; ++bkgndID ) {
- likelihoods.emplace( this->bkgndClassName( bkgndID ) + "_" + negParent_,
- negBkgndDPModels_[bkgndID]->getLikelihood( m13Sq, m23Sq ) );
- likelihoods.emplace( this->bkgndClassName( bkgndID ) + "_" + posParent_,
- posBkgndDPModels_[bkgndID]->getLikelihood( m13Sq, m23Sq ) );
- }
- }
-
- return likelihoods;
-}
-
-void LauCPFitModel::embedNegSignal(const TString& fileName, const TString& treeName,
- Bool_t reuseEventsWithinEnsemble, Bool_t reuseEventsWithinExperiment,
- Bool_t useReweighting)
-{
- if (negSignalTree_) {
- std::cerr << "ERROR in LauCPFitModel::embedNegSignal : Already embedding signal from a file." << std::endl;
- return;
- }
-
- negSignalTree_ = new LauEmbeddedData(fileName,treeName,reuseEventsWithinExperiment);
- Bool_t dataOK = negSignalTree_->findBranches();
- if (!dataOK) {
- delete negSignalTree_; negSignalTree_ = 0;
- std::cerr << "ERROR in LauCPFitModel::embedNegSignal : Problem creating data tree for embedding." << std::endl;
- return;
- }
- reuseSignal_ = reuseEventsWithinEnsemble;
- useNegReweighting_ = useReweighting;
- if (this->enableEmbedding() == kFALSE) {this->enableEmbedding(kTRUE);}
-}
-
-void LauCPFitModel::embedNegBkgnd(const TString& bkgndClass, const TString& fileName, const TString& treeName,
- Bool_t reuseEventsWithinEnsemble, Bool_t reuseEventsWithinExperiment)
-{
- if ( ! this->validBkgndClass( bkgndClass ) ) {
- std::cerr << "ERROR in LauCPFitModel::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;
- return;
- }
-
- UInt_t bkgndID = this->bkgndClassID( bkgndClass );
-
- if (negBkgndTree_[bkgndID]) {
- std::cerr << "ERROR in LauCPFitModel::embedNegBkgnd : Already embedding background from a file." << std::endl;
- return;
- }
-
- negBkgndTree_[bkgndID] = new LauEmbeddedData(fileName,treeName,reuseEventsWithinExperiment);
- Bool_t dataOK = negBkgndTree_[bkgndID]->findBranches();
- if (!dataOK) {
- delete negBkgndTree_[bkgndID]; negBkgndTree_[bkgndID] = 0;
- std::cerr << "ERROR in LauCPFitModel::embedNegBkgnd : Problem creating data tree for embedding." << std::endl;
- return;
- }
- reuseBkgnd_[bkgndID] = reuseEventsWithinEnsemble;
- if (this->enableEmbedding() == kFALSE) {this->enableEmbedding(kTRUE);}
-}
-
-void LauCPFitModel::embedPosSignal(const TString& fileName, const TString& treeName,
- Bool_t reuseEventsWithinEnsemble, Bool_t reuseEventsWithinExperiment,
- Bool_t useReweighting)
-{
- if (posSignalTree_) {
- std::cerr << "ERROR in LauCPFitModel::embedPosSignal : Already embedding signal from a file." << std::endl;
- return;
- }
-
- posSignalTree_ = new LauEmbeddedData(fileName,treeName,reuseEventsWithinExperiment);
- Bool_t dataOK = posSignalTree_->findBranches();
- if (!dataOK) {
- delete posSignalTree_; posSignalTree_ = 0;
- std::cerr << "ERROR in LauCPFitModel::embedPosSignal : Problem creating data tree for embedding." << std::endl;
- return;
- }
- reuseSignal_ = reuseEventsWithinEnsemble;
- usePosReweighting_ = useReweighting;
- if (this->enableEmbedding() == kFALSE) {this->enableEmbedding(kTRUE);}
-}
-
-void LauCPFitModel::embedPosBkgnd(const TString& bkgndClass, const TString& fileName, const TString& treeName,
- Bool_t reuseEventsWithinEnsemble, Bool_t reuseEventsWithinExperiment)
-{
- if ( ! this->validBkgndClass( bkgndClass ) ) {
- std::cerr << "ERROR in LauCPFitModel::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;
- return;
- }
-
- UInt_t bkgndID = this->bkgndClassID( bkgndClass );
-
- if (posBkgndTree_[bkgndID]) {
- std::cerr << "ERROR in LauCPFitModel::embedPosBkgnd : Already embedding background from a file." << std::endl;
- return;
- }
-
- posBkgndTree_[bkgndID] = new LauEmbeddedData(fileName,treeName,reuseEventsWithinExperiment);
- Bool_t dataOK = posBkgndTree_[bkgndID]->findBranches();
- if (!dataOK) {
- delete posBkgndTree_[bkgndID]; posBkgndTree_[bkgndID] = 0;
- std::cerr << "ERROR in LauCPFitModel::embedPosBkgnd : Problem creating data tree for embedding." << std::endl;
- return;
- }
- reuseBkgnd_[bkgndID] = reuseEventsWithinEnsemble;
- if (this->enableEmbedding() == kFALSE) {this->enableEmbedding(kTRUE);}
+ //std::cout << "INFO in LauCPFitModel::recalculateNormalizationInDPModels : Recalc Norm in DP model" << std::endl;
+ negSigModel_->recalculateNormalisation();
+ posSigModel_->recalculateNormalisation();
+ negSigModel_->modifyDataTree();
+ posSigModel_->modifyDataTree();
}
-void LauCPFitModel::weightEvents( const TString& dataFileName, const TString& dataTreeName )
+void LauCPFitModel::initialiseDPModels()
{
- // Routine to provide weights for events that are uniformly distributed
- // in the DP (or square DP) so as to reproduce the given DP model
+ std::cout << "INFO in LauCPFitModel::initialiseDPModels : Initialising signal DP model"
+ << std::endl;
+ negSigModel_->initialise( negCoeffs_ );
+ posSigModel_->initialise( posCoeffs_ );
- const Bool_t squareDP { posKinematics_->squareDP() || negKinematics_->squareDP() };
- if ( squareDP ) {
- std::cout << "INFO in LauCPFitModel::weightEvents : will store DP model weights and the square DP jacobian\n";
- std::cout << " : the DP model weights can be used on their own to weight events that were generated flat in phase space\n";
- std::cout << " : or they can be multiplied by the jacobian to weight events that were generated flat in the square DP\n";
- std::cout << " : or they can be multiplied by max(1.0, jacobian) to weight events that were generated quasi-flat in the square DP" << std::endl;
- } else {
- std::cout << "INFO in LauCPFitModel::weightEvents : will store DP model weights suitable for weighting events that were generated flat in phase space" << std::endl;
- }
+ if ( usingBkgnd_ == kTRUE ) {
+ for ( LauBkgndDPModelList::iterator iter = negBkgndDPModels_.begin();
+ iter != negBkgndDPModels_.end();
+ ++iter ) {
+ ( *iter )->initialise();
+ }
+ for ( LauBkgndDPModelList::iterator iter = posBkgndDPModels_.begin();
+ iter != posBkgndDPModels_.end();
+ ++iter ) {
+ ( *iter )->initialise();
+ }
+ }
+}
- // This reads in the given dataFile and creates an input
- // fit data tree that stores them for all events and experiments.
- const Bool_t dataOK { this->verifyFitData( dataFileName, dataTreeName ) };
- if ( ! dataOK ) {
- std::cerr << "ERROR in LauCPFitModel::weightEvents : Problem caching the data." << std::endl;
- return;
- }
+void LauCPFitModel::setSignalDPParameters()
+{
+ // Set the fit parameters for the signal model.
- LauFitDataTree* inputFitData { this->fitData() };
+ nSigDPPar_ = 0;
+ if ( ! this->useDP() ) {
+ return;
+ }
- if ( ! inputFitData->haveBranch( "m13Sq_MC" ) || ! inputFitData->haveBranch( "m23Sq_MC" ) ) {
- std::cerr << "WARNING in LauCPFitModel::weightEvents : Cannot find MC truth DP coordinate branches in supplied data, aborting." << std::endl;
- return;
- }
- if ( ! inputFitData->haveBranch( "charge" ) ) {
- std::cerr << "WARNING in LauCPFitModel::weightEvents : Cannot find branch specifying event charge in supplied data, aborting." << std::endl;
- return;
- }
+ std::cout << "INFO in LauCPFitModel::setSignalDPParameters : Setting the initial fit parameters for the signal DP model."
+ << std::endl;
- // Create the ntuple to hold the DP weights
- TString weightsFileName{ dataFileName };
- const Ssiz_t index { weightsFileName.Last('.') };
- weightsFileName.Insert( index, "_DPweights" );
+ // Place isobar coefficient parameters in vector of fit variables
+ for ( UInt_t i = 0; i < nSigComp_; i++ ) {
+ LauParameterPList pars = coeffPars_[i]->getParameters();
+ nSigDPPar_ += this->addFitParameters( pars, kTRUE );
+ }
- LauGenNtuple weightsTuple { weightsFileName, dataTreeName };
- weightsTuple.addIntegerBranch( "iExpt" );
- weightsTuple.addIntegerBranch( "iEvtWithinExpt" );
- weightsTuple.addDoubleBranch( "dpModelWeight" );
- if ( squareDP ) {
- weightsTuple.addDoubleBranch( "sqDPJacobian" );
- }
+ // Obtain the resonance parameters and place them in the vector of fit variables and in a separate vector
+ // Need to make sure that they are unique because some might appear in both DP models
+ LauParameterPList& negSigDPPars = negSigModel_->getFloatingParameters();
+ LauParameterPList& posSigDPPars = posSigModel_->getFloatingParameters();
+ nSigDPPar_ += this->addResonanceParameters( negSigDPPars );
+ nSigDPPar_ += this->addResonanceParameters( posSigDPPars );
+}
- const UInt_t nExpmt { this->nExpt() };
- const UInt_t firstExpmt { this->firstExpt() };
- for (UInt_t iExpmt {firstExpmt}; iExpmt < (firstExpmt+nExpmt); ++iExpmt) {
+void LauCPFitModel::setExtraPdfParameters()
+{
+ // Include all the parameters of the PDF in the fit
+ // NB all of them are passed to the fit, even though some have been fixed through parameter.fixed(kTRUE)
+ // With the new "cloned parameter" scheme only "original" parameters are passed to the fit.
+ // Their clones are updated automatically when the originals are updated.
- inputFitData->readExperimentData(iExpmt);
+ nExtraPdfPar_ = 0;
- const UInt_t nEvents { inputFitData->nEvents() };
- if ( nEvents < 1 ) {
- std::cerr << "WARNING in LauCPFitModel::weightEvents : Zero events in experiment " << iExpmt << ", skipping..." << std::endl;
- continue;
+ nExtraPdfPar_ += this->addFitParameters( negSignalPdfs_ );
+ if ( tagged_ ) {
+ nExtraPdfPar_ += this->addFitParameters( posSignalPdfs_ );
}
- weightsTuple.setIntegerBranchValue( "iExpt", iExpmt );
+ if ( useSCF_ == kTRUE ) {
+ nExtraPdfPar_ += this->addFitParameters( negScfPdfs_ );
+ if ( tagged_ ) {
+ nExtraPdfPar_ += this->addFitParameters( posScfPdfs_ );
+ }
+ }
- // Calculate and store the weights for the events in this experiment
- for ( UInt_t iEvent{0}; iEvent < nEvents; ++iEvent ) {
+ if ( usingBkgnd_ == kTRUE ) {
+ for ( LauBkgndPdfsList::iterator iter = negBkgndPdfs_.begin(); iter != negBkgndPdfs_.end();
+ ++iter ) {
+ nExtraPdfPar_ += this->addFitParameters( *iter );
+ }
+ if ( tagged_ ) {
+ for ( LauBkgndPdfsList::iterator iter = posBkgndPdfs_.begin();
+ iter != posBkgndPdfs_.end();
+ ++iter ) {
+ nExtraPdfPar_ += this->addFitParameters( *iter );
+ }
+ }
+ }
+}
- weightsTuple.setIntegerBranchValue( "iEvtWithinExpt", iEvent );
+void LauCPFitModel::setFitNEvents()
+{
+ if ( signalEvents_ == 0 ) {
+ std::cerr << "ERROR in LauCPFitModel::setFitNEvents : Signal yield not defined." << std::endl;
+ return;
+ }
+ nNormPar_ = 0;
+
+ // initialise the total number of events to be the sum of all the hypotheses
+ Double_t nTotEvts = signalEvents_->value();
+ for ( LauBkgndYieldList::const_iterator iter = bkgndEvents_.begin(); iter != bkgndEvents_.end();
+ ++iter ) {
+ nTotEvts += ( *iter )->value();
+ if ( ( *iter ) == 0 ) {
+ std::cerr << "ERROR in LauCPFitModel::setFitNEvents : Background yield not defined."
+ << std::endl;
+ return;
+ }
+ }
+ this->eventsPerExpt( TMath::FloorNint( nTotEvts ) );
+
+ // if doing an extended ML fit add the number of signal events into the fit parameters
+ if ( this->doEMLFit() ) {
+ std::cout << "INFO in LauCPFitModel::setFitNEvents : Initialising number of events for signal and background components..."
+ << std::endl;
+ // add the signal fraction to the list of fit parameters
+ nNormPar_ += this->addFitParameters( signalEvents_ );
+ } else {
+ std::cout << "INFO in LauCPFitModel::setFitNEvents : Initialising number of events for background components (and hence signal)..."
+ << std::endl;
+ }
- const LauFitData& evtData = inputFitData->getData( iEvent );
+ // if not using the DP in the model we need an explicit signal asymmetry parameter
+ if ( this->useDP() == kFALSE ) {
+ nNormPar_ += this->addFitParameters( signalAsym_ );
+ }
- const auto m13Sq_MC { evtData.at( "m13Sq_MC" ) };
- const auto m23Sq_MC { evtData.at( "m23Sq_MC" ) };
- const auto charge { static_cast<Int_t>( evtData.at( "charge" ) ) };
+ if ( useSCF_ && ! useSCFHist_ ) {
+ nNormPar_ += this->addFitParameters( &scfFrac_ );
+ }
- Double_t dpModelWeight{0.0};
- Double_t jacobian{1.0};
+ if ( usingBkgnd_ == kTRUE ) {
+ nNormPar_ += this->addFitParameters( bkgndEvents_ );
+ nNormPar_ += this->addFitParameters( bkgndAsym_ );
+ }
+}
- LauKinematics * kinematics{nullptr};
- LauIsobarDynamics * dpModel{nullptr};
+void LauCPFitModel::setExtraNtupleVars()
+{
+ // Set-up other parameters derived from the fit results, e.g. fit fractions.
- if (charge > 0) {
- kinematics = posKinematics_;
- dpModel = posSigModel_;
- } else {
- kinematics = negKinematics_;
- dpModel = negSigModel_;
- }
+ if ( this->useDP() != kTRUE ) {
+ return;
+ }
- if ( kinematics->withinDPLimits( m13Sq_MC, m23Sq_MC ) ) {
+ // First clear the vectors so we start from scratch
+ this->clearExtraVarVectors();
- kinematics->updateKinematics( m13Sq_MC, m23Sq_MC );
- dpModelWeight = dpModel->getEventWeight();
+ LauParameterList& extraVars = this->extraPars();
- if ( squareDP ) {
- jacobian = kinematics->calcSqDPJacobian();
+ // Add the positive and negative fit fractions for each signal component
+ negFitFrac_ = negSigModel_->getFitFractions();
+ if ( negFitFrac_.size() != nSigComp_ ) {
+ std::cerr << "ERROR in LauCPFitModel::setExtraNtupleVars : Initial Fit Fraction array of unexpected dimension: "
+ << negFitFrac_.size() << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ for ( UInt_t i( 0 ); i < nSigComp_; ++i ) {
+ if ( negFitFrac_[i].size() != nSigComp_ ) {
+ std::cerr << "ERROR in LauCPFitModel::setExtraNtupleVars : Initial Fit Fraction array of unexpected dimension: "
+ << negFitFrac_[i].size() << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
}
+ }
- const Double_t norm { 0.5 * ( negSigModel_->getDPNorm() + posSigModel_->getDPNorm() ) };
- dpModelWeight /= norm;
- }
+ posFitFrac_ = posSigModel_->getFitFractions();
+ if ( posFitFrac_.size() != nSigComp_ ) {
+ std::cerr << "ERROR in LauCPFitModel::setExtraNtupleVars : Initial Fit Fraction array of unexpected dimension: "
+ << posFitFrac_.size() << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ for ( UInt_t i( 0 ); i < nSigComp_; ++i ) {
+ if ( posFitFrac_[i].size() != nSigComp_ ) {
+ std::cerr << "ERROR in LauCPFitModel::setExtraNtupleVars : Initial Fit Fraction array of unexpected dimension: "
+ << posFitFrac_[i].size() << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ }
- weightsTuple.setDoubleBranchValue( "dpModelWeight", dpModelWeight );
- if ( squareDP ) {
- weightsTuple.setDoubleBranchValue( "sqDPJacobian", jacobian );
- }
- weightsTuple.fillBranches();
- }
-
- }
-
- weightsTuple.buildIndex( "iExpt", "iEvtWithinExpt" );
- weightsTuple.addFriendTree( dataFileName, dataTreeName );
- weightsTuple.writeOutGenResults();
-}
-
-
-void LauCPFitModel::savePDFPlots(const TString& label)
-{
- savePDFPlotsWave(label, 0);
- savePDFPlotsWave(label, 1);
- savePDFPlotsWave(label, 2);
-
- std::cout << "LauCPFitModel::plot" << std::endl;
-// ((LauIsobarDynamics*)negSigModel_)->plot();
-
-
-
- //Double_t minm13 = negSigModel_->getKinematics()->getm13Min();
- Double_t minm13 = 0.0;
- Double_t maxm13 = negSigModel_->getKinematics()->getm13Max();
- //Double_t minm23 = negSigModel_->getKinematics()->getm23Min();
- Double_t minm23 = 0.0;
- Double_t maxm23 = negSigModel_->getKinematics()->getm23Max();
-
- Double_t mins13 = minm13*minm13;
- Double_t maxs13 = maxm13*maxm13;
- Double_t mins23 = minm23*minm23;
- Double_t maxs23 = maxm23*maxm23;
-
- Double_t s13, s23, posChPdf, negChPdf;
-
- TString xLabel = "s13";
- TString yLabel = "s23";
-
- if (negSigModel_->getDaughters()->gotSymmetricalDP()) { xLabel = "sHigh"; yLabel = "sLow";}
-
- Int_t n13=200.00, n23=200.00;
- Double_t delta13, delta23;
- delta13 = (maxs13 - mins13)/n13;
- delta23 = (maxs23 - mins23)/n23;
- UInt_t nAmp = negSigModel_->getnCohAmp();
- for (UInt_t resID = 0; resID <= nAmp; ++resID)
- {
- TGraph2D *posDt = new TGraph2D();
- TGraph2D *negDt = new TGraph2D();
- TGraph2D *acpDt = new TGraph2D();
-
- TString resName = "TotalAmp";
- if (resID != nAmp){
- TString tStrResID = Form("%d", resID);
- const LauIsobarDynamics* model = negSigModel_;
- const LauAbsResonance* resonance = model->getResonance(resID);
- resName = resonance->getResonanceName();
- std::cout << "resName = " << resName << std::endl;
- }
-
-
- resName.ReplaceAll("(", "");
- resName.ReplaceAll(")", "");
- resName.ReplaceAll("*", "Star");
-
- posDt->SetName(resName+label);
- posDt->SetTitle(resName+" ("+label+") Positive");
- negDt->SetName(resName+label);
- negDt->SetTitle(resName+" ("+label+") Negative");
- acpDt->SetName(resName+label);
- acpDt->SetTitle(resName+" ("+label+") Asymmetry");
-
- Int_t count=0;
- for (Int_t i=0; i<n13; i++) {
- s13 = mins13 + i*delta13;
- for (Int_t j=0; j<n23; j++) {
- s23 = mins23 + j*delta23;
- if (negSigModel_->getKinematics()->withinDPLimits2(s23, s13))
- {
- if (negSigModel_->getDaughters()->gotSymmetricalDP() && (s13>s23) ) continue;
-
- negSigModel_->calcLikelihoodInfo(s13, s23);
- posSigModel_->calcLikelihoodInfo(s13, s23);
-
- LauComplex negChAmp = negSigModel_->getEvtDPAmp();
- LauComplex posChAmp = posSigModel_->getEvtDPAmp();
-
- if (resID != nAmp){
- negChAmp = negSigModel_->getFullAmplitude(resID);
- posChAmp = posSigModel_->getFullAmplitude(resID);
- }
- negChPdf = negChAmp.abs2();
- posChPdf = posChAmp.abs2();
- negDt->SetPoint(count,s23,s13,negChPdf); // s23=sHigh, s13 = sLow
- posDt->SetPoint(count,s23,s13,posChPdf); // s23=sHigh, s13 = sLow
- acpDt->SetPoint(count,s23,s13, negChPdf - posChPdf); // s23=sHigh, s13 = sLow
- count++;
- }
- }
- }
- gStyle->SetPalette(1);
- TCanvas *posC = new TCanvas("c"+resName+label + "Positive",resName+" ("+label+") Positive",0,0,600,400);
- posDt->GetXaxis()->SetTitle(xLabel);
- posDt->GetYaxis()->SetTitle(yLabel);
- posDt->Draw("SURF1");
- posDt->GetXaxis()->SetTitle(xLabel);
- posDt->GetYaxis()->SetTitle(yLabel);
- posC->SaveAs("plot_2D_"+resName + "_"+label+"Positive.C");
-
- TCanvas *negC = new TCanvas("c"+resName+label + "Negative",resName+" ("+label+") Negative",0,0,600,400);
- negDt->GetXaxis()->SetTitle(xLabel);
- negDt->GetYaxis()->SetTitle(yLabel);
- negDt->Draw("SURF1");
- negDt->GetXaxis()->SetTitle(xLabel);
- negDt->GetYaxis()->SetTitle(yLabel);
- negC->SaveAs("plot_2D_"+resName + "_"+label+"Negative.C");
-
- TCanvas *acpC = new TCanvas("c"+resName+label + "Asymmetry",resName+" ("+label+") Asymmetry",0,0,600,400);
- acpDt->GetXaxis()->SetTitle(xLabel);
- acpDt->GetYaxis()->SetTitle(yLabel);
- acpDt->Draw("SURF1");
- acpDt->GetXaxis()->SetTitle(xLabel);
- acpDt->GetYaxis()->SetTitle(yLabel);
- acpC->SaveAs("plot_2D_"+resName + "_"+label+"Asymmetry.C");
- }
-}
-
-void LauCPFitModel::savePDFPlotsWave(const TString& label, const Int_t& spin)
-{
-
- std::cout << "label = "<< label << ", spin = "<< spin << std::endl;
-
- TString tStrResID = "S_Wave";
- if (spin == 1) tStrResID = "P_Wave";
- if (spin == 2) tStrResID = "D_Wave";
-
- TString xLabel = "s13";
- TString yLabel = "s23";
-
- std::cout << "LauCPFitModel::savePDFPlotsWave: "<< tStrResID << std::endl;
-
- Double_t minm13 = 0.0;
- Double_t maxm13 = negSigModel_->getKinematics()->getm13Max();
- Double_t minm23 = 0.0;
- Double_t maxm23 = negSigModel_->getKinematics()->getm23Max();
-
- Double_t mins13 = minm13*minm13;
- Double_t maxs13 = maxm13*maxm13;
- Double_t mins23 = minm23*minm23;
- Double_t maxs23 = maxm23*maxm23;
-
- Double_t s13, s23, posChPdf, negChPdf;
- TGraph2D *posDt = new TGraph2D();
- TGraph2D *negDt = new TGraph2D();
- TGraph2D *acpDt = new TGraph2D();
-
-
- posDt->SetName(tStrResID+label);
- posDt->SetTitle(tStrResID+" ("+label+") Positive");
- negDt->SetName(tStrResID+label);
- negDt->SetTitle(tStrResID+" ("+label+") Negative");
- acpDt->SetName(tStrResID+label);
- acpDt->SetTitle(tStrResID+" ("+label+") Asymmetry");
-
- Int_t n13=200.00, n23=200.00;
- Double_t delta13, delta23;
- delta13 = (maxs13 - mins13)/n13;
- delta23 = (maxs23 - mins23)/n23;
- UInt_t nAmp = negSigModel_->getnCohAmp();
-
- Int_t count=0;
- for (Int_t i=0; i<n13; i++)
- {
- s13 = mins13 + i*delta13;
- for (Int_t j=0; j<n23; j++)
- {
- s23 = mins23 + j*delta23;
- if (negSigModel_->getKinematics()->withinDPLimits2(s23, s13))
- {
- if (negSigModel_->getDaughters()->gotSymmetricalDP() && (s13>s23) ) continue;
-
- LauComplex negChAmp(0,0);
- LauComplex posChAmp(0,0);
- Bool_t noWaveRes = kTRUE;
- negSigModel_->calcLikelihoodInfo(s13, s23);
- for (UInt_t resID = 0; resID < nAmp; ++resID)
- {
- const LauIsobarDynamics* model = negSigModel_;
- const LauAbsResonance* resonance = model->getResonance(resID);
- Int_t spin_res = resonance->getSpin();
- if (spin != spin_res) continue;
- noWaveRes = kFALSE;
- negChAmp += negSigModel_->getFullAmplitude(resID);
- posChAmp += posSigModel_->getFullAmplitude(resID);
- }
-
- if (noWaveRes) return;
-
- negChPdf = negChAmp.abs2();
- posChPdf = posChAmp.abs2();
-
- negDt->SetPoint(count,s23,s13,negChPdf); // s23=sHigh, s13 = sLow
- posDt->SetPoint(count,s23,s13,posChPdf); // s23=sHigh, s13 = sLow
- acpDt->SetPoint(count,s23,s13, negChPdf - posChPdf); // s23=sHigh, s13 = sLow
- count++;
-
- }
- }
- }
- gStyle->SetPalette(1);
- TCanvas *posC = new TCanvas("c"+tStrResID+label + "Positive",tStrResID+" ("+label+") Positive",0,0,600,400);
- posDt->GetXaxis()->SetTitle(xLabel);
- posDt->GetYaxis()->SetTitle(yLabel);
- posDt->Draw("SURF1");
- posDt->GetXaxis()->SetTitle(xLabel);
- posDt->GetYaxis()->SetTitle(yLabel);
- posC->SaveAs("plot_2D_"+tStrResID + "_"+label+"Positive.C");
-
- TCanvas *negC = new TCanvas("c"+tStrResID+label + "Negative",tStrResID+" ("+label+") Negative",0,0,600,400);
- negDt->GetXaxis()->SetTitle(xLabel);
- negDt->GetYaxis()->SetTitle(yLabel);
- negDt->Draw("SURF1");
- negDt->GetXaxis()->SetTitle(xLabel);
- negDt->GetYaxis()->SetTitle(yLabel);
- negC->SaveAs("plot_2D_"+tStrResID + "_"+label+"Negative.C");
-
- TCanvas *acpC = new TCanvas("c"+tStrResID+label + "Asymmetry",tStrResID+" ("+label+") Asymmetry",0,0,600,400);
- acpDt->GetXaxis()->SetTitle(xLabel);
- acpDt->GetYaxis()->SetTitle(yLabel);
- acpDt->Draw("SURF1");
- acpDt->GetXaxis()->SetTitle(xLabel);
- acpDt->GetYaxis()->SetTitle(yLabel);
- acpC->SaveAs("plot_2D_"+tStrResID + "_"+label+"Asymmetry.C");
+ // Add the positive and negative fit fractions that have not been corrected for the efficiency for each signal component
+ negFitFracEffUnCorr_ = negSigModel_->getFitFractionsEfficiencyUncorrected();
+ if ( negFitFracEffUnCorr_.size() != nSigComp_ ) {
+ std::cerr << "ERROR in LauCPFitModel::setExtraNtupleVars : Initial Fit Fraction array of unexpected dimension: "
+ << negFitFracEffUnCorr_.size() << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ for ( UInt_t i( 0 ); i < nSigComp_; ++i ) {
+ if ( negFitFracEffUnCorr_[i].size() != nSigComp_ ) {
+ std::cerr << "ERROR in LauCPFitModel::setExtraNtupleVars : Initial Fit Fraction array of unexpected dimension: "
+ << negFitFracEffUnCorr_[i].size() << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ }
+ posFitFracEffUnCorr_ = posSigModel_->getFitFractionsEfficiencyUncorrected();
+ if ( posFitFracEffUnCorr_.size() != nSigComp_ ) {
+ std::cerr << "ERROR in LauCPFitModel::setExtraNtupleVars : Initial Fit Fraction array of unexpected dimension: "
+ << posFitFracEffUnCorr_.size() << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ for ( UInt_t i( 0 ); i < nSigComp_; ++i ) {
+ if ( posFitFracEffUnCorr_[i].size() != nSigComp_ ) {
+ std::cerr << "ERROR in LauCPFitModel::setExtraNtupleVars : Initial Fit Fraction array of unexpected dimension: "
+ << posFitFracEffUnCorr_[i].size() << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ }
-}
+ for ( UInt_t i( 0 ); i < nSigComp_; ++i ) {
+ for ( UInt_t j( i ); j < nSigComp_; ++j ) {
+ TString name = negFitFrac_[i][j].name();
+ name.Insert( name.Index( "FitFrac" ), "Neg" );
+ negFitFrac_[i][j].name( name );
+ extraVars.push_back( negFitFrac_[i][j] );
+
+ name = posFitFrac_[i][j].name();
+ name.Insert( name.Index( "FitFrac" ), "Pos" );
+ posFitFrac_[i][j].name( name );
+ extraVars.push_back( posFitFrac_[i][j] );
+
+ name = negFitFracEffUnCorr_[i][j].name();
+ name.Insert( name.Index( "FitFrac" ), "Neg" );
+ negFitFracEffUnCorr_[i][j].name( name );
+ extraVars.push_back( negFitFracEffUnCorr_[i][j] );
+
+ name = posFitFracEffUnCorr_[i][j].name();
+ name.Insert( name.Index( "FitFrac" ), "Pos" );
+ posFitFracEffUnCorr_[i][j].name( name );
+ extraVars.push_back( posFitFracEffUnCorr_[i][j] );
+ }
+ }
-Double_t LauCPFitModel::getParamFromTree( TTree& tree, const TString& name )
-{
- TBranch* branch{tree.FindBranch( name )};
- if ( branch ) {
- TLeaf* leaf{branch->GetLeaf( name )};
- if ( leaf ) {
- tree.GetEntry(0);
- return leaf->GetValue();
- } else {
- std::cout << "ERROR in LauCPFitModel::getParamFromTree : Leaf name " + name + " not found in parameter file!" << std::endl;
- }
- } else {
- std::cout << "ERROR in LauCPFitModel::getParamFromTree : Branch name " + name + " not found in parameter file!" << std::endl;
- }
+ // Store any extra parameters/quantities from the DP model (e.g. K-matrix total fit fractions)
+ std::vector<LauParameter> negExtraPars = negSigModel_->getExtraParameters();
+ std::vector<LauParameter>::iterator negExtraIter;
+ for ( negExtraIter = negExtraPars.begin(); negExtraIter != negExtraPars.end(); ++negExtraIter ) {
+ LauParameter negExtraParameter = ( *negExtraIter );
+ extraVars.push_back( negExtraParameter );
+ }
- return -1.1;
-}
+ std::vector<LauParameter> posExtraPars = posSigModel_->getExtraParameters();
+ std::vector<LauParameter>::iterator posExtraIter;
+ for ( posExtraIter = posExtraPars.begin(); posExtraIter != posExtraPars.end(); ++posExtraIter ) {
+ LauParameter posExtraParameter = ( *posExtraIter );
+ extraVars.push_back( posExtraParameter );
+ }
-void LauCPFitModel::fixParam( LauParameter* param, const Double_t val, const Bool_t fix)
-{
- std::cout << "INFO in LauCPFitModel::fixParam : Setting " << param->name() << " to " << val << std::endl;
+ // Now add in the DP efficiency value
+ Double_t initMeanEff = negSigModel_->getMeanEff().initValue();
+ negMeanEff_.value( initMeanEff );
+ negMeanEff_.genValue( initMeanEff );
+ negMeanEff_.initValue( initMeanEff );
+ extraVars.push_back( negMeanEff_ );
+
+ initMeanEff = posSigModel_->getMeanEff().initValue();
+ posMeanEff_.value( initMeanEff );
+ posMeanEff_.genValue( initMeanEff );
+ posMeanEff_.initValue( initMeanEff );
+ extraVars.push_back( posMeanEff_ );
+
+ // Also add in the DP rates
+ Double_t initDPRate = negSigModel_->getDPRate().initValue();
+ negDPRate_.value( initDPRate );
+ negDPRate_.genValue( initDPRate );
+ negDPRate_.initValue( initDPRate );
+ extraVars.push_back( negDPRate_ );
+
+ initDPRate = posSigModel_->getDPRate().initValue();
+ posDPRate_.value( initDPRate );
+ posDPRate_.genValue( initDPRate );
+ posDPRate_.initValue( initDPRate );
+ extraVars.push_back( posDPRate_ );
+
+ // Calculate the CPC and CPV Fit Fractions, ACPs and FitFrac asymmetries
+ this->calcExtraFractions( kTRUE );
+ this->calcAsymmetries( kTRUE );
+
+ // Add the CP violating and CP conserving fit fractions for each signal component
+ for ( UInt_t i = 0; i < nSigComp_; i++ ) {
+ for ( UInt_t j = i; j < nSigComp_; j++ ) {
+ extraVars.push_back( CPVFitFrac_[i][j] );
+ }
+ }
+ for ( UInt_t i = 0; i < nSigComp_; i++ ) {
+ for ( UInt_t j = i; j < nSigComp_; j++ ) {
+ extraVars.push_back( CPCFitFrac_[i][j] );
+ }
+ }
- param->value(val);
- param->genValue(val);
- param->initValue(val);
+ // Add the Fit Fraction asymmetry for each signal component
+ for ( UInt_t i = 0; i < nSigComp_; i++ ) {
+ extraVars.push_back( fitFracAsymm_[i] );
+ }
- if (fix) {
- param->fixed(kTRUE);
- } else if (!param->fixed()){
- // Add parameter name to list to indicate that this should not be randomised by randomiseInitFitPars
- // (otherwise only those that are fixed are not randomised).
- // This is only done to those that are not already fixed (see randomiseInitFitPars).
- allImportedFreeParams_.insert(param);
- }
+ // Add the calculated CP asymmetry for each signal component
+ for ( UInt_t i = 0; i < nSigComp_; i++ ) {
+ extraVars.push_back( acp_[i] );
+ }
}
-void LauCPFitModel::fixParams( std::vector<LauParameter*>& params )
+void LauCPFitModel::calcExtraFractions( Bool_t initValues )
{
- const Bool_t fix{fixParams_};
-
- // TODO: Allow some parameters to be fixed and some to remain floating (but initialised)
-
- if ( !fixParamFileName_.IsNull() ) {
+ // Calculate the CP-conserving and CP-violating fit fractions
- // Take param values from a file
+ if ( initValues ) {
+ // create the structure
+ CPCFitFrac_.clear();
+ CPVFitFrac_.clear();
+ CPCFitFrac_.resize( nSigComp_ );
+ CPVFitFrac_.resize( nSigComp_ );
+ for ( UInt_t i( 0 ); i < nSigComp_; ++i ) {
+ CPCFitFrac_[i].resize( nSigComp_ );
+ CPVFitFrac_[i].resize( nSigComp_ );
- TFile * paramFile = TFile::Open(fixParamFileName_, "READ");
- if (!paramFile) {
- std::cerr << "ERROR in LauCPFitModel::fixParams : File '" + fixParamFileName_ + "' could not be opened for reading!" << std::endl;
- return;
- }
+ for ( UInt_t j( i ); j < nSigComp_; ++j ) {
+ TString name = negFitFrac_[i][j].name();
+ name.Replace( name.Index( "Neg" ), 3, "CPC" );
+ CPCFitFrac_[i][j].name( name );
+ CPCFitFrac_[i][j].valueAndRange( 0.0, -100.0, 100.0 );
- TTree * paramTree = dynamic_cast<TTree*>(paramFile->Get(fixParamTreeName_));
- if (!paramTree) {
- std::cerr << "ERROR in LauCPFitModel::fixParams : Tree '" + fixParamTreeName_ + "' not found in parameter file!" << std::endl;
- return;
- }
+ name = negFitFrac_[i][j].name();
+ name.Replace( name.Index( "Neg" ), 3, "CPV" );
+ CPVFitFrac_[i][j].name( name );
+ CPVFitFrac_[i][j].valueAndRange( 0.0, -100.0, 100.0 );
+ }
+ }
+ }
- if ( !fixParamNames_.empty() ) {
+ Double_t denom = negDPRate_.value() + posDPRate_.value();
- // Fix params from file, according to vector of names
+ for ( UInt_t i( 0 ); i < nSigComp_; ++i ) {
+ for ( UInt_t j( i ); j < nSigComp_; ++j ) {
- for( auto itr = params.begin(); itr != params.end(); ++itr ) {
- auto itrName = fixParamNames_.find( (*itr)->name() );
- if ( itrName != fixParamNames_.end() ) {
- this->fixParam(*itr, this->getParamFromTree(*paramTree, *itrName), fix);
- }
- }
+ Double_t negTerm = negFitFrac_[i][j].value() * negDPRate_.value();
+ Double_t posTerm = posFitFrac_[i][j].value() * posDPRate_.value();
+ Double_t cpcFitFrac = ( negTerm + posTerm ) / denom;
+ Double_t cpvFitFrac = ( negTerm - posTerm ) / denom;
- } else {
+ CPCFitFrac_[i][j].value( cpcFitFrac );
+ CPVFitFrac_[i][j].value( cpvFitFrac );
- // Fix some (unspecified) parameters from file, prioritising the map (if it exists)
+ if ( initValues ) {
+ CPCFitFrac_[i][j].genValue( cpcFitFrac );
+ CPCFitFrac_[i][j].initValue( cpcFitFrac );
- for( auto itr = params.begin(); itr != params.end(); ++itr) {
+ CPVFitFrac_[i][j].genValue( cpvFitFrac );
+ CPVFitFrac_[i][j].initValue( cpvFitFrac );
+ }
+ }
+ }
+}
- const TString& name = (*itr)->name();
+void LauCPFitModel::calcAsymmetries( Bool_t initValues )
+{
+ // Calculate the CP asymmetries
+ // Also calculate the fit fraction asymmetries
- if ( ! fixParamMap_.empty() ) {
- auto nameValItr = fixParamMap_.find(name);
- if ( nameValItr != fixParamMap_.end() ) {
- this->fixParam(*itr, nameValItr->second, fix);
- }
- } else {
- this->fixParam(*itr, this->getParamFromTree(*paramTree, name), fix);
- }
+ for ( UInt_t i = 0; i < nSigComp_; i++ ) {
- }
+ acp_[i] = coeffPars_[i]->acp();
- } // Vector of names?
+ LauAsymmCalc asymmCalc( negFitFrac_[i][i].value(), posFitFrac_[i][i].value() );
+ Double_t asym = asymmCalc.getAsymmetry();
+ fitFracAsymm_[i].value( asym );
+ if ( initValues ) {
+ fitFracAsymm_[i].genValue( asym );
+ fitFracAsymm_[i].initValue( asym );
+ }
+ }
+}
- } else {
+void LauCPFitModel::finaliseFitResults( const TString& tablePrefixName )
+{
+ // Retrieve parameters from the fit results for calculations and toy generation
+ // and eventually store these in output root ntuples/text files
- // Fix param names fom map, leave others floating
+ // Now take the fit parameters and update them as necessary
+ // i.e. to make mag > 0.0, phase in the right range.
+ // This function will also calculate any other values, such as the
+ // fit fractions, using any errors provided by fitParErrors as appropriate.
+ // Also obtain the pull values: (measured - generated)/(average error)
- for( auto itr = params.begin(); itr != params.end(); ++itr ) {
- auto nameValItr = this->fixParamMap_.find( (*itr)->name() );
- if ( nameValItr != this->fixParamMap_.end() ) {
- this->fixParam(*itr, nameValItr->second, fix);
- }
- }
+ if ( this->useDP() == kTRUE ) {
+ for ( UInt_t i = 0; i < nSigComp_; ++i ) {
+ // Check whether we have "a/b > 0.0", and phases in the right range
+ coeffPars_[i]->finaliseValues();
+ }
+ }
- }
+ // update the pulls on the event fractions and asymmetries
+ if ( this->doEMLFit() ) {
+ signalEvents_->updatePull();
+ }
+ if ( this->useDP() == kFALSE ) {
+ signalAsym_->updatePull();
+ }
+ if ( useSCF_ && ! useSCFHist_ ) {
+ scfFrac_.updatePull();
+ }
+ if ( usingBkgnd_ == kTRUE ) {
+ for ( LauBkgndYieldList::iterator iter = bkgndEvents_.begin(); iter != bkgndEvents_.end();
+ ++iter ) {
+ std::vector<LauParameter*> parameters = ( *iter )->getPars();
+ for ( LauParameter* parameter : parameters ) {
+ parameter->updatePull();
+ }
+ }
+ for ( LauBkgndYieldList::iterator iter = bkgndAsym_.begin(); iter != bkgndAsym_.end();
+ ++iter ) {
+ std::vector<LauParameter*> parameters = ( *iter )->getPars();
+ for ( LauParameter* parameter : parameters ) {
+ parameter->updatePull();
+ }
+ }
+ }
+
+ // Update the pulls on all the extra PDFs' parameters
+ this->updateFitParameters( negSignalPdfs_ );
+ this->updateFitParameters( posSignalPdfs_ );
+ if ( useSCF_ == kTRUE ) {
+ this->updateFitParameters( negScfPdfs_ );
+ this->updateFitParameters( posScfPdfs_ );
+ }
+ if ( usingBkgnd_ == kTRUE ) {
+ for ( LauBkgndPdfsList::iterator iter = negBkgndPdfs_.begin(); iter != negBkgndPdfs_.end();
+ ++iter ) {
+ this->updateFitParameters( *iter );
+ }
+ for ( LauBkgndPdfsList::iterator iter = posBkgndPdfs_.begin(); iter != posBkgndPdfs_.end();
+ ++iter ) {
+ this->updateFitParameters( *iter );
+ }
+ }
+
+ // Fill the fit results to the ntuple
+
+ // update the coefficients and then calculate the fit fractions and ACP's
+ if ( this->useDP() == kTRUE ) {
+ this->updateCoeffs();
+ negSigModel_->updateCoeffs( negCoeffs_ );
+ negSigModel_->calcExtraInfo();
+ posSigModel_->updateCoeffs( posCoeffs_ );
+ posSigModel_->calcExtraInfo();
+
+ LauParArray negFitFrac = negSigModel_->getFitFractions();
+ if ( negFitFrac.size() != nSigComp_ ) {
+ std::cerr << "ERROR in LauCPFitModel::finaliseFitResults : Fit Fraction array of unexpected dimension: "
+ << negFitFrac.size() << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ for ( UInt_t i( 0 ); i < nSigComp_; ++i ) {
+ if ( negFitFrac[i].size() != nSigComp_ ) {
+ std::cerr << "ERROR in LauCPFitModel::finaliseFitResults : Fit Fraction array of unexpected dimension: "
+ << negFitFrac[i].size() << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ }
+
+ LauParArray posFitFrac = posSigModel_->getFitFractions();
+ if ( posFitFrac.size() != nSigComp_ ) {
+ std::cerr << "ERROR in LauCPFitModel::finaliseFitResults : Fit Fraction array of unexpected dimension: "
+ << posFitFrac.size() << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ for ( UInt_t i( 0 ); i < nSigComp_; ++i ) {
+ if ( posFitFrac[i].size() != nSigComp_ ) {
+ std::cerr << "ERROR in LauCPFitModel::finaliseFitResults : Fit Fraction array of unexpected dimension: "
+ << posFitFrac[i].size() << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ }
+
+ LauParArray negFitFracEffUnCorr = negSigModel_->getFitFractionsEfficiencyUncorrected();
+ if ( negFitFracEffUnCorr.size() != nSigComp_ ) {
+ std::cerr << "ERROR in LauCPFitModel::finaliseFitResults : Fit Fraction array of unexpected dimension: "
+ << negFitFracEffUnCorr.size() << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ for ( UInt_t i( 0 ); i < nSigComp_; ++i ) {
+ if ( negFitFracEffUnCorr[i].size() != nSigComp_ ) {
+ std::cerr << "ERROR in LauCPFitModel::finaliseFitResults : Fit Fraction array of unexpected dimension: "
+ << negFitFracEffUnCorr[i].size() << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ }
+
+ LauParArray posFitFracEffUnCorr = posSigModel_->getFitFractionsEfficiencyUncorrected();
+ if ( posFitFracEffUnCorr.size() != nSigComp_ ) {
+ std::cerr << "ERROR in LauCPFitModel::finaliseFitResults : Fit Fraction array of unexpected dimension: "
+ << posFitFracEffUnCorr.size() << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ for ( UInt_t i( 0 ); i < nSigComp_; ++i ) {
+ if ( posFitFracEffUnCorr[i].size() != nSigComp_ ) {
+ std::cerr << "ERROR in LauCPFitModel::finaliseFitResults : Fit Fraction array of unexpected dimension: "
+ << posFitFracEffUnCorr[i].size() << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ }
+
+ for ( UInt_t i( 0 ); i < nSigComp_; ++i ) {
+ for ( UInt_t j( i ); j < nSigComp_; ++j ) {
+ negFitFrac_[i][j].value( negFitFrac[i][j].value() );
+ posFitFrac_[i][j].value( posFitFrac[i][j].value() );
+ negFitFracEffUnCorr_[i][j].value( negFitFracEffUnCorr[i][j].value() );
+ posFitFracEffUnCorr_[i][j].value( posFitFracEffUnCorr[i][j].value() );
+ }
+ }
+
+ negMeanEff_.value( negSigModel_->getMeanEff().value() );
+ posMeanEff_.value( posSigModel_->getMeanEff().value() );
+ negDPRate_.value( negSigModel_->getDPRate().value() );
+ posDPRate_.value( posSigModel_->getDPRate().value() );
+
+ this->calcExtraFractions();
+ this->calcAsymmetries();
+
+ // Then store the final fit parameters, and any extra parameters for
+ // the signal model (e.g. fit fractions, FF asymmetries, ACPs, mean efficiency and DP rate)
+
+ this->clearExtraVarVectors();
+ LauParameterList& extraVars = this->extraPars();
+
+ // Add the positive and negative fit fractions for each signal component
+ for ( UInt_t i( 0 ); i < nSigComp_; ++i ) {
+ for ( UInt_t j( i ); j < nSigComp_; ++j ) {
+ extraVars.push_back( negFitFrac_[i][j] );
+ extraVars.push_back( posFitFrac_[i][j] );
+ extraVars.push_back( negFitFracEffUnCorr_[i][j] );
+ extraVars.push_back( posFitFracEffUnCorr_[i][j] );
+ }
+ }
+
+ // Store any extra parameters/quantities from the DP model (e.g. K-matrix total fit fractions)
+ std::vector<LauParameter> negExtraPars = negSigModel_->getExtraParameters();
+ std::vector<LauParameter>::iterator negExtraIter;
+ for ( negExtraIter = negExtraPars.begin(); negExtraIter != negExtraPars.end();
+ ++negExtraIter ) {
+ LauParameter negExtraParameter = ( *negExtraIter );
+ extraVars.push_back( negExtraParameter );
+ }
+
+ std::vector<LauParameter> posExtraPars = posSigModel_->getExtraParameters();
+ std::vector<LauParameter>::iterator posExtraIter;
+ for ( posExtraIter = posExtraPars.begin(); posExtraIter != posExtraPars.end();
+ ++posExtraIter ) {
+ LauParameter posExtraParameter = ( *posExtraIter );
+ extraVars.push_back( posExtraParameter );
+ }
+
+ extraVars.push_back( negMeanEff_ );
+ extraVars.push_back( posMeanEff_ );
+ extraVars.push_back( negDPRate_ );
+ extraVars.push_back( posDPRate_ );
+
+ for ( UInt_t i = 0; i < nSigComp_; i++ ) {
+ for ( UInt_t j( i ); j < nSigComp_; ++j ) {
+ extraVars.push_back( CPVFitFrac_[i][j] );
+ }
+ }
+ for ( UInt_t i = 0; i < nSigComp_; i++ ) {
+ for ( UInt_t j( i ); j < nSigComp_; ++j ) {
+ extraVars.push_back( CPCFitFrac_[i][j] );
+ }
+ }
+ for ( UInt_t i( 0 ); i < nSigComp_; ++i ) {
+ extraVars.push_back( fitFracAsymm_[i] );
+ }
+ for ( UInt_t i( 0 ); i < nSigComp_; ++i ) {
+ extraVars.push_back( acp_[i] );
+ }
+
+ this->printFitFractions( std::cout );
+ this->printAsymmetries( std::cout );
+ }
+
+ LauFitNtuple* ntuple = this->fitNtuple();
+ ntuple->storeParsAndErrors( this->fitPars(), this->multiDimConstrainedPars(), this->extraPars() );
+
+ // find out the correlation matrix for the parameters
+ ntuple->storeCorrMatrix( this->iExpt(), this->fitStatus(), this->covarianceMatrix() );
+
+ // Fill the data into ntuple
+ ntuple->updateFitNtuple();
+
+ // Print out the partial fit fractions, phases and the
+ // averaged efficiency, reweighted by the dynamics (and anything else)
+ if ( this->writeLatexTable() ) {
+ TString sigOutFileName( tablePrefixName );
+ sigOutFileName += "_";
+ sigOutFileName += this->iExpt();
+ sigOutFileName += "Expt.tex";
+ this->writeOutTable( sigOutFileName );
+ }
+}
+
+void LauCPFitModel::printFitFractions( std::ostream& output )
+{
+ // Print out Fit Fractions, total DP rate and mean efficiency
+ // First for the B- events
+ for ( UInt_t i = 0; i < nSigComp_; i++ ) {
+ const TString compName( coeffPars_[i]->name() );
+ output << negParent_ << " FitFraction for component " << i << " (" << compName
+ << ") = " << negFitFrac_[i][i] << std::endl;
+ }
+ output << negParent_ << " overall DP rate (integral of matrix element squared) = " << negDPRate_
+ << std::endl;
+ output << negParent_ << " average efficiency weighted by whole DP dynamics = " << negMeanEff_
+ << std::endl;
+
+ // Then for the positive sample
+ for ( UInt_t i = 0; i < nSigComp_; i++ ) {
+ const TString compName( coeffPars_[i]->name() );
+ const TString conjName( negSigModel_->getConjResName( compName ) );
+ output << posParent_ << " FitFraction for component " << i << " (" << conjName
+ << ") = " << posFitFrac_[i][i] << std::endl;
+ }
+ output << posParent_ << " overall DP rate (integral of matrix element squared) = " << posDPRate_
+ << std::endl;
+ output << posParent_ << " average efficiency weighted by whole DP dynamics = " << posMeanEff_
+ << std::endl;
+}
+
+void LauCPFitModel::printAsymmetries( std::ostream& output )
+{
+ for ( UInt_t i = 0; i < nSigComp_; i++ ) {
+ const TString compName( coeffPars_[i]->name() );
+ output << "Fit Fraction asymmetry for component " << i << " (" << compName
+ << ") = " << fitFracAsymm_[i] << std::endl;
+ }
+ for ( UInt_t i = 0; i < nSigComp_; i++ ) {
+ const TString compName( coeffPars_[i]->name() );
+ output << "ACP for component " << i << " (" << compName << ") = " << acp_[i] << std::endl;
+ }
+}
+
+void LauCPFitModel::writeOutTable( const TString& outputFile )
+{
+ // Write out the results of the fit to a tex-readable table
+ // TODO - need to include the yields in this table
+ std::ofstream fout( outputFile );
+ LauPrint print;
+
+ std::cout << "INFO in LauCPFitModel::writeOutTable : Writing out results of the fit to the tex file "
+ << outputFile << std::endl;
+
+ if ( this->useDP() == kTRUE ) {
+ // print the fit coefficients in one table
+ coeffPars_.front()->printTableHeading( fout );
+ for ( UInt_t i = 0; i < nSigComp_; i++ ) {
+ coeffPars_[i]->printTableRow( fout );
+ }
+ fout << "\\hline" << std::endl;
+ fout << "\\end{tabular}" << std::endl << std::endl;
+
+ // print the fit fractions and asymmetries in another
+ fout << "\\begin{tabular}{|l|c|c|c|c|}" << std::endl;
+ fout << "\\hline" << std::endl;
+ fout << "Component & " << negParent_ << " Fit Fraction & " << posParent_
+ << " Fit Fraction & Fit Fraction Asymmetry & ACP \\\\" << std::endl;
+ fout << "\\hline" << std::endl;
+
+ Double_t negFitFracSum( 0.0 );
+ Double_t posFitFracSum( 0.0 );
+
+ for ( UInt_t i = 0; i < nSigComp_; i++ ) {
+ TString resName = coeffPars_[i]->name();
+ resName = resName.ReplaceAll( "_", "\\_" );
+
+ Double_t negFitFrac = negFitFrac_[i][i].value();
+ Double_t posFitFrac = posFitFrac_[i][i].value();
+ negFitFracSum += negFitFrac;
+ posFitFracSum += posFitFrac;
+
+ Double_t fitFracAsymm = fitFracAsymm_[i].value();
+
+ Double_t acp = acp_[i].value();
+ Double_t acpErr = acp_[i].error();
+
+ fout << resName << " & $";
+
+ print.printFormat( fout, negFitFrac );
+ fout << "$ & $";
+ print.printFormat( fout, posFitFrac );
+ fout << "$ & $";
+
+ print.printFormat( fout, fitFracAsymm );
+ fout << "$ & $";
+
+ print.printFormat( fout, acp );
+ fout << " \\pm ";
+ print.printFormat( fout, acpErr );
+ fout << "$ \\\\" << std::endl;
+ }
+ fout << "\\hline" << std::endl;
+
+ // Also print out sum of fit fractions
+ fout << "Fit Fraction Sum & $";
+ print.printFormat( fout, negFitFracSum );
+ fout << "$ & $";
+ print.printFormat( fout, posFitFracSum );
+ fout << "$ & & \\\\" << std::endl;
+ fout << "\\hline" << std::endl;
+
+ fout << "DP rate & $";
+ print.printFormat( fout, negDPRate_.value() );
+ fout << "$ & $";
+ print.printFormat( fout, posDPRate_.value() );
+ fout << "$ & & \\\\" << std::endl;
+
+ fout << "$< \\varepsilon > $ & $";
+ print.printFormat( fout, negMeanEff_.value() );
+ fout << "$ & $";
+ print.printFormat( fout, posMeanEff_.value() );
+ fout << "$ & & \\\\" << std::endl;
+ fout << "\\hline" << std::endl;
+ fout << "\\end{tabular}" << std::endl << std::endl;
+ }
+
+ if ( ! negSignalPdfs_.empty() ) {
+ fout << "\\begin{tabular}{|l|c|}" << std::endl;
+ fout << "\\hline" << std::endl;
+ if ( useSCF_ == kTRUE ) {
+ fout << "\\Extra TM Signal PDFs' Parameters: & \\\\" << std::endl;
+ } else {
+ fout << "\\Extra Signal PDFs' Parameters: & \\\\" << std::endl;
+ }
+ this->printFitParameters( negSignalPdfs_, fout );
+ if ( tagged_ ) {
+ this->printFitParameters( posSignalPdfs_, fout );
+ }
+ if ( useSCF_ == kTRUE && ! negScfPdfs_.empty() ) {
+ fout << "\\hline" << std::endl;
+ fout << "\\Extra SCF Signal PDFs' Parameters: & \\\\" << std::endl;
+ this->printFitParameters( negScfPdfs_, fout );
+ if ( tagged_ ) {
+ this->printFitParameters( posScfPdfs_, fout );
+ }
+ }
+ if ( usingBkgnd_ == kTRUE && ! negBkgndPdfs_.empty() ) {
+ fout << "\\hline" << std::endl;
+ fout << "\\Extra Background PDFs' Parameters: & \\\\" << std::endl;
+ for ( LauBkgndPdfsList::const_iterator iter = negBkgndPdfs_.begin();
+ iter != negBkgndPdfs_.end();
+ ++iter ) {
+ this->printFitParameters( *iter, fout );
+ }
+ if ( tagged_ ) {
+ for ( LauBkgndPdfsList::const_iterator iter = posBkgndPdfs_.begin();
+ iter != posBkgndPdfs_.end();
+ ++iter ) {
+ this->printFitParameters( *iter, fout );
+ }
+ }
+ }
+ fout << "\\hline \n\\end{tabular}" << std::endl << std::endl;
+ }
+}
+
+void LauCPFitModel::checkInitFitParams()
+{
+ // Update the number of signal events to be total-sum(background events)
+ this->updateSigEvents();
+
+ // Check whether we want to have randomised initial fit parameters for the signal model
+ if ( this->useRandomInitFitPars() == kTRUE ) {
+ std::cout << "INFO in LauCPFitModel::checkInitFitParams : Setting random parameters for the signal model"
+ << std::endl;
+ this->randomiseInitFitPars();
+ }
+}
+
+void LauCPFitModel::randomiseInitFitPars()
+{
+ // Only randomise those parameters that are not fixed!
+ std::cout << "INFO in LauCPFitModel::randomiseInitFitPars : Randomising the initial fit magnitudes and phases of the components..."
+ << std::endl;
+
+ if ( fixParamFileName_.IsNull() && fixParamMap_.empty() ) {
+ // No params are imported - randomise as normal
+ for ( UInt_t i = 0; i < nSigComp_; i++ ) {
+ coeffPars_[i]->randomiseInitValues();
+ }
+ } else {
+ // Only randomise those that are not imported (i.e., not found in allImportedFreeParams_)
+ // by temporarily fixing all imported parameters, and then freeing those not set to be fixed when imported,
+ // except those that are previously set to be fixed anyhow.
+ // Convoluted, but beats changing the behaviour of functions that call checkInitFitParams or the coeffSet
+ // itself.
+
+ for ( auto p : allImportedFreeParams_ ) {
+ p->fixed( kTRUE );
+ }
+
+ for ( UInt_t i = 0; i < nSigComp_; i++ ) {
+ coeffPars_[i]->randomiseInitValues();
+ }
+
+ for ( auto p : allImportedFreeParams_ ) {
+ p->fixed( kFALSE );
+ }
+ }
+}
+
+std::pair<LauCPFitModel::LauGenInfo, Bool_t> LauCPFitModel::eventsToGenerate()
+{
+ // Determine the number of events to generate for each hypothesis
+ // If we're smearing then smear each one individually
+
+ LauGenInfo nEvtsGen;
+
+ // Keep track of whether any yield or asymmetry parameters are blinded
+ Bool_t blind = kFALSE;
+
+ // Signal
+ if ( signalEvents_->blind() ) {
+ blind = kTRUE;
+ }
+
+ Double_t evtWeight( 1.0 );
+ Double_t nEvts = signalEvents_->genValue();
+ if ( nEvts < 0.0 ) {
+ evtWeight = -1.0;
+ nEvts = TMath::Abs( nEvts );
+ }
+
+ Double_t sigAsym( 0.0 );
+ // need to include this as an alternative in case the DP isn't in the model
+ if ( ! this->useDP() || forceAsym_ ) {
+ sigAsym = signalAsym_->genValue();
+ if ( signalAsym_->blind() ) {
+ blind = kTRUE;
+ }
+ } else {
+ Double_t negRate = negSigModel_->getDPNorm();
+ Double_t posRate = posSigModel_->getDPNorm();
+ if ( negRate + posRate > 1e-30 ) {
+ sigAsym = ( negRate - posRate ) / ( negRate + posRate );
+ }
+ }
+ Double_t nPosEvts = ( nEvts / 2.0 * ( 1.0 - sigAsym ) );
+ Double_t nNegEvts = ( nEvts / 2.0 * ( 1.0 + sigAsym ) );
+
+ Int_t nPosEvtsToGen { static_cast<Int_t>( nPosEvts ) };
+ Int_t nNegEvtsToGen { static_cast<Int_t>( nNegEvts ) };
+ if ( this->doPoissonSmearing() ) {
+ nPosEvtsToGen = LauRandom::randomFun()->Poisson( nPosEvts );
+ nNegEvtsToGen = LauRandom::randomFun()->Poisson( nNegEvts );
+ }
+
+ nEvtsGen[std::make_pair( "signal", +1 )] = std::make_pair( nPosEvtsToGen, evtWeight );
+ nEvtsGen[std::make_pair( "signal", -1 )] = std::make_pair( nNegEvtsToGen, evtWeight );
+
+ // backgrounds
+ const UInt_t nBkgnds = this->nBkgndClasses();
+ for ( UInt_t bkgndID( 0 ); bkgndID < nBkgnds; ++bkgndID ) {
+ const LauAbsRValue* evtsPar = bkgndEvents_[bkgndID];
+ const LauAbsRValue* asymPar = bkgndAsym_[bkgndID];
+ if ( evtsPar->blind() || asymPar->blind() ) {
+ blind = kTRUE;
+ }
+
+ evtWeight = 1.0;
+ nEvts = evtsPar->genValue();
+ if ( nEvts < 0 ) {
+ evtWeight = -1.0;
+ nEvts = TMath::Abs( nEvts );
+ }
+
+ const Double_t asym = asymPar->genValue();
+ nPosEvts = ( nEvts / 2.0 * ( 1.0 - asym ) );
+ nNegEvts = ( nEvts / 2.0 * ( 1.0 + asym ) );
+
+ nPosEvtsToGen = static_cast<Int_t>( nPosEvts );
+ nNegEvtsToGen = static_cast<Int_t>( nNegEvts );
+ if ( this->doPoissonSmearing() ) {
+ nPosEvtsToGen = LauRandom::randomFun()->Poisson( nPosEvts );
+ nNegEvtsToGen = LauRandom::randomFun()->Poisson( nNegEvts );
+ }
+
+ const TString& bkgndClass = this->bkgndClassName( bkgndID );
+ nEvtsGen[std::make_pair( bkgndClass, +1 )] = std::make_pair( nPosEvtsToGen, evtWeight );
+ nEvtsGen[std::make_pair( bkgndClass, -1 )] = std::make_pair( nNegEvtsToGen, evtWeight );
+ }
+
+ // Print out the information on what we're generating, but only if none of the parameters are blind (otherwise we risk unblinding them!)
+ if ( ! blind ) {
+ std::cout << "INFO in LauCPFitModel::eventsToGenerate : Generating toy MC with:" << std::endl;
+ std::cout << " : Signal asymmetry = " << sigAsym
+ << " and number of signal events = " << signalEvents_->genValue() << std::endl;
+ for ( UInt_t bkgndID( 0 ); bkgndID < nBkgnds; ++bkgndID ) {
+ const TString& bkgndClass = this->bkgndClassName( bkgndID );
+ const LauAbsRValue* evtsPar = bkgndEvents_[bkgndID];
+ const LauAbsRValue* asymPar = bkgndAsym_[bkgndID];
+ std::cout << " : " << bkgndClass
+ << " asymmetry = " << asymPar->genValue() << " and number of " << bkgndClass
+ << " events = " << evtsPar->genValue() << std::endl;
+ }
+ }
+
+ return std::make_pair( nEvtsGen, blind );
+}
+
+Bool_t LauCPFitModel::genExpt()
+{
+ // Routine to generate toy Monte Carlo events according to the various models we have defined.
+
+ // Determine the number of events to generate for each hypothesis
+ std::pair<LauGenInfo, Bool_t> info = this->eventsToGenerate();
+ LauGenInfo nEvts = info.first;
+ const Bool_t blind = info.second;
+
+ Bool_t genOK( kTRUE );
+ Int_t evtNum( 0 );
+
+ const UInt_t nBkgnds = this->nBkgndClasses();
+ std::vector<TString> bkgndClassNames( nBkgnds );
+ std::vector<TString> bkgndClassNamesGen( nBkgnds );
+ for ( UInt_t iBkgnd( 0 ); iBkgnd < nBkgnds; ++iBkgnd ) {
+ TString name( this->bkgndClassName( iBkgnd ) );
+ bkgndClassNames[iBkgnd] = name;
+ bkgndClassNamesGen[iBkgnd] = "gen" + name;
+ }
+
+ const Bool_t storeSCFTruthInfo = ( useSCF_ || ( this->enableEmbedding() && negSignalTree_ != 0 &&
+ negSignalTree_->haveBranch( "mcMatch" ) &&
+ posSignalTree_ != 0 &&
+ posSignalTree_->haveBranch( "mcMatch" ) ) );
+
+ // Loop over the hypotheses and generate the requested number of events for each one
+ for ( LauGenInfo::const_iterator iter = nEvts.begin(); iter != nEvts.end(); ++iter ) {
+
+ const TString& type( iter->first.first );
+ curEvtCharge_ = iter->first.second;
+ Double_t evtWeight( iter->second.second );
+ Int_t nEvtsGen( iter->second.first );
+
+ for ( Int_t iEvt( 0 ); iEvt < nEvtsGen; ++iEvt ) {
+
+ this->setGenNtupleDoubleBranchValue( "evtWeight", evtWeight );
+ this->setGenNtupleDoubleBranchValue( "efficiency", 1.0 );
+
+ if ( type == "signal" ) {
+ this->setGenNtupleIntegerBranchValue( "genSig", 1 );
+ for ( UInt_t iBkgnd( 0 ); iBkgnd < nBkgnds; ++iBkgnd ) {
+ this->setGenNtupleIntegerBranchValue( bkgndClassNamesGen[iBkgnd], 0 );
+ }
+ genOK = this->generateSignalEvent();
+ if ( curEvtCharge_ > 0 ) {
+ this->setGenNtupleDoubleBranchValue( "efficiency", posSigModel_->getEvtEff() );
+ } else {
+ this->setGenNtupleDoubleBranchValue( "efficiency", negSigModel_->getEvtEff() );
+ }
+
+ } else {
+ this->setGenNtupleIntegerBranchValue( "genSig", 0 );
+ if ( storeSCFTruthInfo ) {
+ this->setGenNtupleIntegerBranchValue( "genTMSig", 0 );
+ this->setGenNtupleIntegerBranchValue( "genSCFSig", 0 );
+ }
+ UInt_t bkgndID( 0 );
+ for ( UInt_t iBkgnd( 0 ); iBkgnd < nBkgnds; ++iBkgnd ) {
+ Int_t gen( 0 );
+ if ( bkgndClassNames[iBkgnd] == type ) {
+ gen = 1;
+ bkgndID = iBkgnd;
+ }
+ this->setGenNtupleIntegerBranchValue( bkgndClassNamesGen[iBkgnd], gen );
+ }
+ genOK = this->generateBkgndEvent( bkgndID );
+ }
+ if ( ! genOK ) {
+ // If there was a problem with the generation then break out and return.
+ // The problem model will have adjusted itself so that all should be OK next time.
+ break;
+ }
+ if ( this->useDP() == kTRUE ) {
+ this->setDPBranchValues();
+ }
+
+ // Store the event charge
+ this->setGenNtupleIntegerBranchValue( tagVarName_, curEvtCharge_ );
+
+ // Store the event number (within this experiment)
+ // and then increment it
+ this->setGenNtupleIntegerBranchValue( "iEvtWithinExpt", evtNum );
+ ++evtNum;
+
+ this->fillGenNtupleBranches();
+ if ( ! blind && ( iEvt % 500 == 0 ) ) {
+ std::cout << "INFO in LauCPFitModel::genExpt : Generated event number " << iEvt
+ << " out of " << nEvtsGen << " " << type << " events." << std::endl;
+ }
+ }
+
+ if ( ! genOK ) {
+ break;
+ }
+ }
+
+ if ( this->useDP() && genOK ) {
+
+ negSigModel_->checkToyMC( kTRUE, kTRUE );
+ posSigModel_->checkToyMC( kTRUE, kTRUE );
+
+ // Get the fit fractions if they're to be written into the latex table
+ if ( this->writeLatexTable() ) {
+ LauParArray negFitFrac = negSigModel_->getFitFractions();
+ if ( negFitFrac.size() != nSigComp_ ) {
+ std::cerr << "ERROR in LauCPFitModel::genExpt : Fit Fraction array of unexpected dimension: "
+ << negFitFrac.size() << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ for ( UInt_t i( 0 ); i < nSigComp_; ++i ) {
+ if ( negFitFrac[i].size() != nSigComp_ ) {
+ std::cerr << "ERROR in LauCPFitModel::genExpt : Fit Fraction array of unexpected dimension: "
+ << negFitFrac[i].size() << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ }
+ LauParArray posFitFrac = posSigModel_->getFitFractions();
+ if ( posFitFrac.size() != nSigComp_ ) {
+ std::cerr << "ERROR in LauCPFitModel::genExpt : Fit Fraction array of unexpected dimension: "
+ << posFitFrac.size() << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ for ( UInt_t i( 0 ); i < nSigComp_; ++i ) {
+ if ( posFitFrac[i].size() != nSigComp_ ) {
+ std::cerr << "ERROR in LauCPFitModel::genExpt : Fit Fraction array of unexpected dimension: "
+ << posFitFrac[i].size() << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ }
+
+ for ( UInt_t i( 0 ); i < nSigComp_; ++i ) {
+ for ( UInt_t j( i ); j < nSigComp_; ++j ) {
+ negFitFrac_[i][j].value( negFitFrac[i][j].value() );
+ posFitFrac_[i][j].value( posFitFrac[i][j].value() );
+ }
+ }
+ negMeanEff_.value( negSigModel_->getMeanEff().value() );
+ posMeanEff_.value( posSigModel_->getMeanEff().value() );
+ negDPRate_.value( negSigModel_->getDPRate().value() );
+ posDPRate_.value( posSigModel_->getDPRate().value() );
+ }
+ }
+
+ // If we're reusing embedded events or if the generation is being
+ // reset then clear the lists of used events
+ if ( reuseSignal_ || ! genOK ) {
+ if ( negSignalTree_ ) {
+ negSignalTree_->clearUsedList();
+ }
+ if ( posSignalTree_ ) {
+ posSignalTree_->clearUsedList();
+ }
+ }
+ for ( UInt_t bkgndID( 0 ); bkgndID < nBkgnds; ++bkgndID ) {
+ LauEmbeddedData* data = negBkgndTree_[bkgndID];
+ if ( reuseBkgnd_[bkgndID] || ! genOK ) {
+ if ( data ) {
+ data->clearUsedList();
+ }
+ }
+ }
+ for ( UInt_t bkgndID( 0 ); bkgndID < nBkgnds; ++bkgndID ) {
+ LauEmbeddedData* data = posBkgndTree_[bkgndID];
+ if ( reuseBkgnd_[bkgndID] || ! genOK ) {
+ if ( data ) {
+ data->clearUsedList();
+ }
+ }
+ }
+
+ return genOK;
+}
+
+Bool_t LauCPFitModel::generateSignalEvent()
+{
+ // Generate signal event
+ Bool_t genOK( kTRUE );
+ Bool_t genSCF( kFALSE );
+
+ LauIsobarDynamics* model( 0 );
+ LauKinematics* kinematics( 0 );
+ LauEmbeddedData* embeddedData( 0 );
+ LauPdfPList* sigPdfs( 0 );
+ LauPdfPList* scfPdfs( 0 );
+
+ Bool_t doReweighting( kFALSE );
+
+ if ( curEvtCharge_ < 0 ) {
+ model = negSigModel_;
+ kinematics = negKinematics_;
+ sigPdfs = &negSignalPdfs_;
+ scfPdfs = &negScfPdfs_;
+ if ( this->enableEmbedding() ) {
+ embeddedData = negSignalTree_;
+ doReweighting = useNegReweighting_;
+ }
+ } else {
+ model = posSigModel_;
+ kinematics = posKinematics_;
+ if ( tagged_ ) {
+ sigPdfs = &posSignalPdfs_;
+ scfPdfs = &posScfPdfs_;
+ } else {
+ sigPdfs = &negSignalPdfs_;
+ scfPdfs = &negScfPdfs_;
+ }
+ if ( this->enableEmbedding() ) {
+ embeddedData = posSignalTree_;
+ doReweighting = usePosReweighting_;
+ }
+ }
+
+ if ( this->useDP() ) {
+ if ( embeddedData ) {
+ if ( doReweighting ) {
+ // Select a (random) event from the generated data. Then store the
+ // reconstructed DP co-ords, together with other pdf information,
+ // as the embedded data.
+ genOK = embeddedData->getReweightedEvent( model );
+ } else {
+ // Just get the information of a (randomly) selected event in the
+ // embedded data
+ embeddedData->getEmbeddedEvent( kinematics );
+ }
+ genSCF = this->storeSignalMCMatch( embeddedData );
+ } else {
+ genOK = model->generate();
+ if ( genOK && useSCF_ ) {
+ Double_t frac( 0.0 );
+ if ( useSCFHist_ ) {
+ frac = scfFracHist_->calcEfficiency( kinematics );
+ } else {
+ frac = scfFrac_.genValue();
+ }
+ if ( frac < LauRandom::randomFun()->Rndm() ) {
+ this->setGenNtupleIntegerBranchValue( "genTMSig", 1 );
+ this->setGenNtupleIntegerBranchValue( "genSCFSig", 0 );
+ genSCF = kFALSE;
+ } else {
+ this->setGenNtupleIntegerBranchValue( "genTMSig", 0 );
+ this->setGenNtupleIntegerBranchValue( "genSCFSig", 1 );
+ genSCF = kTRUE;
+
+ // Optionally smear the DP position
+ // of the SCF event
+ if ( scfMap_ != 0 ) {
+ Double_t xCoord( 0.0 ), yCoord( 0.0 );
+ if ( kinematics->squareDP() ) {
+ xCoord = kinematics->getmPrime();
+ yCoord = kinematics->getThetaPrime();
+ } else {
+ xCoord = kinematics->getm13Sq();
+ yCoord = kinematics->getm23Sq();
+ }
+
+ // Find the bin number where this event is generated
+ Int_t binNo = scfMap_->binNumber( xCoord, yCoord );
+
+ // Retrieve the migration histogram
+ TH2* histo = scfMap_->trueHist( binNo );
+
+ const LauAbsEffModel* effModel = model->getEffModel();
+ do {
+ // Get a random point from the histogram
+ histo->GetRandom2( xCoord, yCoord );
+
+ // Update the kinematics
+ if ( kinematics->squareDP() ) {
+ kinematics->updateSqDPKinematics( xCoord, yCoord );
+ } else {
+ kinematics->updateKinematics( xCoord, yCoord );
+ }
+ } while ( ! effModel->passVeto( kinematics ) );
+ }
+ }
+ }
+ }
+ } else {
+ if ( embeddedData ) {
+ embeddedData->getEmbeddedEvent( 0 );
+ genSCF = this->storeSignalMCMatch( embeddedData );
+ } else if ( useSCF_ ) {
+ Double_t frac = scfFrac_.genValue();
+ if ( frac < LauRandom::randomFun()->Rndm() ) {
+ this->setGenNtupleIntegerBranchValue( "genTMSig", 1 );
+ this->setGenNtupleIntegerBranchValue( "genSCFSig", 0 );
+ genSCF = kFALSE;
+ } else {
+ this->setGenNtupleIntegerBranchValue( "genTMSig", 0 );
+ this->setGenNtupleIntegerBranchValue( "genSCFSig", 1 );
+ genSCF = kTRUE;
+ }
+ }
+ }
+ if ( genOK ) {
+ if ( useSCF_ ) {
+ if ( genSCF ) {
+ this->generateExtraPdfValues( scfPdfs, embeddedData );
+ } else {
+ this->generateExtraPdfValues( sigPdfs, embeddedData );
+ }
+ } else {
+ this->generateExtraPdfValues( sigPdfs, embeddedData );
+ }
+ }
+ // Check for problems with the embedding
+ if ( embeddedData && ( embeddedData->nEvents() == embeddedData->nUsedEvents() ) ) {
+ std::cerr << "WARNING in LauCPFitModel::generateSignalEvent : Source of embedded signal events used up, clearing the list of used events."
+ << std::endl;
+ embeddedData->clearUsedList();
+ }
+
+ return genOK;
+}
+
+Bool_t LauCPFitModel::generateBkgndEvent( UInt_t bkgndID )
+{
+ // Generate Bkgnd event
+ Bool_t genOK( kTRUE );
+
+ LauAbsBkgndDPModel* model( 0 );
+ LauEmbeddedData* embeddedData( 0 );
+ LauPdfPList* extraPdfs( 0 );
+ LauKinematics* kinematics( 0 );
+
+ if ( curEvtCharge_ < 0 ) {
+ model = negBkgndDPModels_[bkgndID];
+ if ( this->enableEmbedding() ) {
+ embeddedData = negBkgndTree_[bkgndID];
+ }
+ extraPdfs = &negBkgndPdfs_[bkgndID];
+ kinematics = negKinematics_;
+ } else {
+ model = posBkgndDPModels_[bkgndID];
+ if ( this->enableEmbedding() ) {
+ embeddedData = posBkgndTree_[bkgndID];
+ }
+ if ( tagged_ ) {
+ extraPdfs = &posBkgndPdfs_[bkgndID];
+ } else {
+ extraPdfs = &negBkgndPdfs_[bkgndID];
+ }
+ kinematics = posKinematics_;
+ }
+
+ if ( this->useDP() ) {
+ if ( embeddedData ) {
+ embeddedData->getEmbeddedEvent( kinematics );
+ } else {
+ if ( model == 0 ) {
+ const TString& bkgndClass = this->bkgndClassName( bkgndID );
+ std::cerr << "ERROR in LauCPFitModel::generateBkgndEvent : Can't find the DP model for background class \""
+ << bkgndClass << "\"." << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ genOK = model->generate();
+ }
+ } else {
+ if ( embeddedData ) {
+ embeddedData->getEmbeddedEvent( 0 );
+ }
+ }
+ if ( genOK ) {
+ this->generateExtraPdfValues( extraPdfs, embeddedData );
+ }
+
+ // Check for problems with the embedding
+ if ( embeddedData && ( embeddedData->nEvents() == embeddedData->nUsedEvents() ) ) {
+ const TString& bkgndClass = this->bkgndClassName( bkgndID );
+ std::cerr << "WARNING in LauCPFitModel::generateBkgndEvent : Source of embedded "
+ << bkgndClass << " events used up, clearing the list of used events." << std::endl;
+ embeddedData->clearUsedList();
+ }
+
+ return genOK;
+}
+
+void LauCPFitModel::setupGenNtupleBranches()
+{
+ // Setup the required ntuple branches
+ this->addGenNtupleDoubleBranch( "evtWeight" );
+ this->addGenNtupleIntegerBranch( "genSig" );
+ this->addGenNtupleDoubleBranch( "efficiency" );
+ if ( useSCF_ || ( this->enableEmbedding() && negSignalTree_ != 0 &&
+ negSignalTree_->haveBranch( "mcMatch" ) && posSignalTree_ != 0 &&
+ posSignalTree_->haveBranch( "mcMatch" ) ) ) {
+ this->addGenNtupleIntegerBranch( "genTMSig" );
+ this->addGenNtupleIntegerBranch( "genSCFSig" );
+ }
+ const UInt_t nBkgnds = this->nBkgndClasses();
+ for ( UInt_t iBkgnd( 0 ); iBkgnd < nBkgnds; ++iBkgnd ) {
+ TString name( this->bkgndClassName( iBkgnd ) );
+ name.Prepend( "gen" );
+ this->addGenNtupleIntegerBranch( name );
+ }
+ this->addGenNtupleIntegerBranch( "charge" );
+ if ( this->useDP() == kTRUE ) {
+ this->addGenNtupleDoubleBranch( "m12" );
+ this->addGenNtupleDoubleBranch( "m23" );
+ this->addGenNtupleDoubleBranch( "m13" );
+ this->addGenNtupleDoubleBranch( "m12Sq" );
+ this->addGenNtupleDoubleBranch( "m23Sq" );
+ this->addGenNtupleDoubleBranch( "m13Sq" );
+ this->addGenNtupleDoubleBranch( "cosHel12" );
+ this->addGenNtupleDoubleBranch( "cosHel23" );
+ this->addGenNtupleDoubleBranch( "cosHel13" );
+ if ( negKinematics_->squareDP() && posKinematics_->squareDP() ) {
+ this->addGenNtupleDoubleBranch( "mPrime" );
+ this->addGenNtupleDoubleBranch( "thPrime" );
+ }
+ }
+ for ( LauPdfPList::const_iterator pdf_iter = negSignalPdfs_.begin();
+ pdf_iter != negSignalPdfs_.end();
+ ++pdf_iter ) {
+ std::vector<TString> varNames = ( *pdf_iter )->varNames();
+ for ( std::vector<TString>::const_iterator var_iter = varNames.begin();
+ var_iter != varNames.end();
+ ++var_iter ) {
+ if ( ( *var_iter ) != "m13Sq" && ( *var_iter ) != "m23Sq" ) {
+ this->addGenNtupleDoubleBranch( ( *var_iter ) );
+ }
+ }
+ }
+}
+
+void LauCPFitModel::setDPBranchValues()
+{
+ LauKinematics* kinematics( 0 );
+ if ( curEvtCharge_ < 0 ) {
+ kinematics = negKinematics_;
+ } else {
+ kinematics = posKinematics_;
+ }
+
+ // Store all the DP information
+ this->setGenNtupleDoubleBranchValue( "m12", kinematics->getm12() );
+ this->setGenNtupleDoubleBranchValue( "m23", kinematics->getm23() );
+ this->setGenNtupleDoubleBranchValue( "m13", kinematics->getm13() );
+ this->setGenNtupleDoubleBranchValue( "m12Sq", kinematics->getm12Sq() );
+ this->setGenNtupleDoubleBranchValue( "m23Sq", kinematics->getm23Sq() );
+ this->setGenNtupleDoubleBranchValue( "m13Sq", kinematics->getm13Sq() );
+ this->setGenNtupleDoubleBranchValue( "cosHel12", kinematics->getc12() );
+ this->setGenNtupleDoubleBranchValue( "cosHel23", kinematics->getc23() );
+ this->setGenNtupleDoubleBranchValue( "cosHel13", kinematics->getc13() );
+ if ( kinematics->squareDP() ) {
+ this->setGenNtupleDoubleBranchValue( "mPrime", kinematics->getmPrime() );
+ this->setGenNtupleDoubleBranchValue( "thPrime", kinematics->getThetaPrime() );
+ }
+}
+
+void LauCPFitModel::generateExtraPdfValues( LauPdfPList* extraPdfs, LauEmbeddedData* embeddedData )
+{
+ LauKinematics* kinematics( 0 );
+ if ( curEvtCharge_ < 0 ) {
+ kinematics = negKinematics_;
+ } else {
+ kinematics = posKinematics_;
+ }
+
+ if ( ! extraPdfs ) {
+ std::cerr << "ERROR in LauCPFitModel::generateExtraPdfValues : Null pointer to PDF list."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ if ( extraPdfs->empty() ) {
+ //std::cerr << "WARNING in LauCPFitModel::generateExtraPdfValues : PDF list is empty." << std::endl;
+ return;
+ }
+
+ // Generate from the extra PDFs
+ for ( LauPdfPList::iterator pdf_iter = extraPdfs->begin(); pdf_iter != extraPdfs->end();
+ ++pdf_iter ) {
+ LauFitData genValues;
+ if ( embeddedData ) {
+ genValues = embeddedData->getValues( ( *pdf_iter )->varNames() );
+ } else {
+ genValues = ( *pdf_iter )->generate( kinematics );
+ }
+ for ( LauFitData::const_iterator var_iter = genValues.begin(); var_iter != genValues.end();
+ ++var_iter ) {
+ TString varName = var_iter->first;
+ if ( varName != "m13Sq" && varName != "m23Sq" ) {
+ Double_t value = var_iter->second;
+ this->setGenNtupleDoubleBranchValue( varName, value );
+ }
+ }
+ }
+}
+
+Bool_t LauCPFitModel::storeSignalMCMatch( LauEmbeddedData* embeddedData )
+{
+ // Default to TM
+ Bool_t genSCF( kFALSE );
+ Int_t match( 1 );
+
+ // Check that we have a valid pointer and that embedded data has
+ // the mcMatch branch. If so then get the match value.
+ if ( embeddedData && embeddedData->haveBranch( "mcMatch" ) ) {
+ match = TMath::Nint( embeddedData->getValue( "mcMatch" ) );
+ }
+
+ // Set the variables accordingly.
+ if ( match ) {
+ this->setGenNtupleIntegerBranchValue( "genTMSig", 1 );
+ this->setGenNtupleIntegerBranchValue( "genSCFSig", 0 );
+ genSCF = kFALSE;
+ } else {
+ this->setGenNtupleIntegerBranchValue( "genTMSig", 0 );
+ this->setGenNtupleIntegerBranchValue( "genSCFSig", 1 );
+ genSCF = kTRUE;
+ }
+
+ return genSCF;
+}
+
+void LauCPFitModel::propagateParUpdates()
+{
+ // Update the signal parameters and then the total normalisation for the signal likelihood
+ if ( this->useDP() == kTRUE ) {
+ this->updateCoeffs();
+ negSigModel_->updateCoeffs( negCoeffs_ );
+ posSigModel_->updateCoeffs( posCoeffs_ );
+ }
+
+ // Update the signal fraction from the background fractions if not doing an extended fit
+ if ( ! this->doEMLFit() && ! signalEvents_->fixed() ) {
+ this->updateSigEvents();
+ }
+}
+
+void LauCPFitModel::updateSigEvents()
+{
+ // The background parameters will have been set from Minuit.
+ // We need to update the signal events using these.
+ Double_t nTotEvts = this->eventsPerExpt();
+
+ signalEvents_->range( -2.0 * nTotEvts, 2.0 * nTotEvts );
+ for ( LauBkgndYieldList::iterator iter = bkgndEvents_.begin(); iter != bkgndEvents_.end();
+ ++iter ) {
+ LauAbsRValue* nBkgndEvents = ( *iter );
+ if ( nBkgndEvents->isLValue() ) {
+ LauParameter* yield = dynamic_cast<LauParameter*>( nBkgndEvents );
+ yield->range( -2.0 * nTotEvts, 2.0 * nTotEvts );
+ }
+ }
+
+ if ( signalEvents_->fixed() ) {
+ return;
+ }
+
+ // Subtract background events (if any) from signal.
+ Double_t signalEvents = nTotEvts;
+ if ( usingBkgnd_ == kTRUE ) {
+ for ( LauBkgndYieldList::const_iterator iter = bkgndEvents_.begin();
+ iter != bkgndEvents_.end();
+ ++iter ) {
+ signalEvents -= ( *iter )->value();
+ }
+ }
+ signalEvents_->value( signalEvents );
+}
+
+void LauCPFitModel::cacheInputFitVars()
+{
+ // Fill the internal data trees of the signal and background models.
+ // Note that we store the events of both charges in both the
+ // negative and the positive models. It's only later, at the stage
+ // when the likelihood is being calculated, that we separate them.
+
+ LauFitDataTree* inputFitData = this->fitData();
+
+ // First the Dalitz plot variables (m_ij^2)
+ if ( this->useDP() == kTRUE ) {
+
+ // need to append SCF smearing bins before caching DP amplitudes
+ if ( scfMap_ != 0 ) {
+ this->appendBinCentres( inputFitData );
+ }
+
+ negSigModel_->fillDataTree( *inputFitData );
+ posSigModel_->fillDataTree( *inputFitData );
+
+ if ( usingBkgnd_ == kTRUE ) {
+ for ( LauBkgndDPModelList::iterator iter = negBkgndDPModels_.begin();
+ iter != negBkgndDPModels_.end();
+ ++iter ) {
+ ( *iter )->fillDataTree( *inputFitData );
+ }
+ for ( LauBkgndDPModelList::iterator iter = posBkgndDPModels_.begin();
+ iter != posBkgndDPModels_.end();
+ ++iter ) {
+ ( *iter )->fillDataTree( *inputFitData );
+ }
+ }
+ }
+
+ // ...and then the extra PDFs
+ this->cacheInfo( negSignalPdfs_, *inputFitData );
+ this->cacheInfo( negScfPdfs_, *inputFitData );
+ for ( LauBkgndPdfsList::iterator iter = negBkgndPdfs_.begin(); iter != negBkgndPdfs_.end();
+ ++iter ) {
+ this->cacheInfo( ( *iter ), *inputFitData );
+ }
+ if ( tagged_ ) {
+ this->cacheInfo( posSignalPdfs_, *inputFitData );
+ this->cacheInfo( posScfPdfs_, *inputFitData );
+ for ( LauBkgndPdfsList::iterator iter = posBkgndPdfs_.begin(); iter != posBkgndPdfs_.end();
+ ++iter ) {
+ this->cacheInfo( ( *iter ), *inputFitData );
+ }
+ }
+
+ // the SCF fractions and jacobians
+ if ( useSCF_ && useSCFHist_ ) {
+ if ( ! inputFitData->haveBranch( "m13Sq" ) || ! inputFitData->haveBranch( "m23Sq" ) ) {
+ std::cerr << "ERROR in LauCPFitModel::cacheInputFitVars : Input data does not contain DP branches and so can't cache the SCF fraction."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ UInt_t nEvents = inputFitData->nEvents();
+ recoSCFFracs_.clear();
+ recoSCFFracs_.reserve( nEvents );
+ if ( negKinematics_->squareDP() ) {
+ recoJacobians_.clear();
+ recoJacobians_.reserve( nEvents );
+ }
+ for ( UInt_t iEvt = 0; iEvt < nEvents; iEvt++ ) {
+ const LauFitData& dataValues = inputFitData->getData( iEvt );
+ LauFitData::const_iterator m13_iter = dataValues.find( "m13Sq" );
+ LauFitData::const_iterator m23_iter = dataValues.find( "m23Sq" );
+ negKinematics_->updateKinematics( m13_iter->second, m23_iter->second );
+ Double_t scfFrac = scfFracHist_->calcEfficiency( negKinematics_ );
+ recoSCFFracs_.push_back( scfFrac );
+ if ( negKinematics_->squareDP() ) {
+ recoJacobians_.push_back( negKinematics_->calcSqDPJacobian() );
+ }
+ }
+ }
+
+ // finally cache the event charge
+ evtCharges_.clear();
+ if ( tagged_ ) {
+ if ( ! inputFitData->haveBranch( tagVarName_ ) ) {
+ std::cerr << "ERROR in LauCPFitModel::cacheInputFitVars : Input data does not contain branch \""
+ << tagVarName_ << "\"." << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ UInt_t nEvents = inputFitData->nEvents();
+ evtCharges_.reserve( nEvents );
+ for ( UInt_t iEvt = 0; iEvt < nEvents; iEvt++ ) {
+ const LauFitData& dataValues = inputFitData->getData( iEvt );
+ LauFitData::const_iterator iter = dataValues.find( tagVarName_ );
+ curEvtCharge_ = static_cast<Int_t>( iter->second );
+ evtCharges_.push_back( curEvtCharge_ );
+ }
+ }
+}
+
+void LauCPFitModel::appendBinCentres( LauFitDataTree* inputData )
+{
+ // We'll be caching the DP amplitudes and efficiencies of the centres of the true bins.
+ // To do so, we attach some fake points at the end of inputData, the number of the entry
+ // minus the total number of events corresponding to the number of the histogram for that
+ // given true bin in the LauScfMap object. (What this means is that when Laura is provided with
+ // the LauScfMap object by the user, it's the latter who has to make sure that it contains the
+ // right number of histograms and in exactly the right order!)
+
+ // Get the x and y co-ordinates of the bin centres
+ std::vector<Double_t> binCentresXCoords;
+ std::vector<Double_t> binCentresYCoords;
+ scfMap_->listBinCentres( binCentresXCoords, binCentresYCoords );
+
+ // The SCF histograms could be in square Dalitz plot histograms.
+ // The dynamics takes normal Dalitz plot coords, so we might have to convert them back.
+ Bool_t sqDP = negKinematics_->squareDP();
+ UInt_t nBins = binCentresXCoords.size();
+ fakeSCFFracs_.clear();
+ fakeSCFFracs_.reserve( nBins );
+ if ( sqDP ) {
+ fakeJacobians_.clear();
+ fakeJacobians_.reserve( nBins );
+ }
+
+ for ( UInt_t iBin = 0; iBin < nBins; ++iBin ) {
+
+ if ( sqDP ) {
+ negKinematics_->updateSqDPKinematics( binCentresXCoords[iBin], binCentresYCoords[iBin] );
+ binCentresXCoords[iBin] = negKinematics_->getm13Sq();
+ binCentresYCoords[iBin] = negKinematics_->getm23Sq();
+ fakeJacobians_.push_back( negKinematics_->calcSqDPJacobian() );
+ } else {
+ negKinematics_->updateKinematics( binCentresXCoords[iBin], binCentresYCoords[iBin] );
+ }
+
+ fakeSCFFracs_.push_back( scfFracHist_->calcEfficiency( negKinematics_ ) );
+ }
+
+ // Set up inputFitVars_ object to hold the fake events
+ inputData->appendFakePoints( binCentresXCoords, binCentresYCoords );
+}
+
+Double_t LauCPFitModel::getTotEvtLikelihood( UInt_t iEvt )
+{
+ // Find out whether we have B- or B+
+ if ( tagged_ ) {
+ curEvtCharge_ = evtCharges_[iEvt];
+
+ // check that the charge is either +1 or -1
+ if ( TMath::Abs( curEvtCharge_ ) != 1 ) {
+ std::cerr << "ERROR in LauCPFitModel::getTotEvtLikelihood : Charge/tag not accepted value: "
+ << curEvtCharge_ << std::endl;
+ if ( curEvtCharge_ > 0 ) {
+ curEvtCharge_ = +1;
+ } else {
+ curEvtCharge_ = -1;
+ }
+ std::cerr << " : Making it: " << curEvtCharge_
+ << "." << std::endl;
+ }
+ }
+
+ // Get the DP likelihood for signal and backgrounds
+ this->getEvtDPLikelihood( iEvt );
+
+ // Get the combined extra PDFs likelihood for signal and backgrounds
+ this->getEvtExtraLikelihoods( iEvt );
+
+ // If appropriate, combine the TM and SCF likelihoods
+ Double_t sigLike = sigDPLike_ * sigExtraLike_;
+ if ( useSCF_ ) {
+ Double_t scfFrac( 0.0 );
+ if ( useSCFHist_ ) {
+ scfFrac = recoSCFFracs_[iEvt];
+ } else {
+ scfFrac = scfFrac_.unblindValue();
+ }
+ sigLike *= ( 1.0 - scfFrac );
+ if ( ( scfMap_ != 0 ) && ( this->useDP() == kTRUE ) ) {
+ // if we're smearing the SCF DP PDF then the SCF frac
+ // is already included in the SCF DP likelihood
+ sigLike += ( scfDPLike_ * scfExtraLike_ );
+ } else {
+ sigLike += ( scfFrac * scfDPLike_ * scfExtraLike_ );
+ }
+ }
+
+ // Get the correct event fractions depending on the charge
+ // Signal asymmetry is built into the DP model... but when the DP
+ // isn't in the fit we need an explicit parameter
+ Double_t signalEvents = signalEvents_->unblindValue() * 0.5;
+ if ( this->useDP() == kFALSE ) {
+ signalEvents *= ( 1.0 - curEvtCharge_ * signalAsym_->unblindValue() );
+ }
+
+ // Construct the total event likelihood
+ Double_t likelihood( 0.0 );
+ if ( usingBkgnd_ ) {
+ likelihood = sigLike * signalEvents;
+ const UInt_t nBkgnds = this->nBkgndClasses();
+ for ( UInt_t bkgndID( 0 ); bkgndID < nBkgnds; ++bkgndID ) {
+ Double_t bkgndEvents = bkgndEvents_[bkgndID]->unblindValue() * 0.5 *
+ ( 1.0 - curEvtCharge_ * bkgndAsym_[bkgndID]->unblindValue() );
+ likelihood += bkgndEvents * bkgndDPLike_[bkgndID] * bkgndExtraLike_[bkgndID];
+ }
+ } else {
+ likelihood = sigLike * 0.5;
+ }
+ return likelihood;
+}
+
+Double_t LauCPFitModel::getEventSum() const
+{
+ Double_t eventSum( 0.0 );
+ eventSum += signalEvents_->unblindValue();
+ if ( usingBkgnd_ ) {
+ for ( LauBkgndYieldList::const_iterator iter = bkgndEvents_.begin();
+ iter != bkgndEvents_.end();
+ ++iter ) {
+ eventSum += ( *iter )->unblindValue();
+ }
+ }
+ return eventSum;
+}
+
+void LauCPFitModel::getEvtDPLikelihood( UInt_t iEvt )
+{
+ // Function to return the signal and background likelihoods for the
+ // Dalitz plot for the given event evtNo.
+
+ if ( ! this->useDP() ) {
+ // There's always going to be a term in the likelihood for the
+ // signal, so we'd better not zero it.
+ sigDPLike_ = 1.0;
+ scfDPLike_ = 1.0;
+
+ const UInt_t nBkgnds = this->nBkgndClasses();
+ for ( UInt_t bkgndID( 0 ); bkgndID < nBkgnds; ++bkgndID ) {
+ if ( usingBkgnd_ == kTRUE ) {
+ bkgndDPLike_[bkgndID] = 1.0;
+ } else {
+ bkgndDPLike_[bkgndID] = 0.0;
+ }
+ }
+
+ return;
+ }
+
+ const UInt_t nBkgnds = this->nBkgndClasses();
+ if ( tagged_ ) {
+ if ( curEvtCharge_ == +1 ) {
+ posSigModel_->calcLikelihoodInfo( iEvt );
+ sigDPLike_ = posSigModel_->getEvtIntensity();
+
+ for ( UInt_t bkgndID( 0 ); bkgndID < nBkgnds; ++bkgndID ) {
+ if ( usingBkgnd_ == kTRUE ) {
+ bkgndDPLike_[bkgndID] = posBkgndDPModels_[bkgndID]->getLikelihood( iEvt );
+ } else {
+ bkgndDPLike_[bkgndID] = 0.0;
+ }
+ }
+ } else {
+ negSigModel_->calcLikelihoodInfo( iEvt );
+ sigDPLike_ = negSigModel_->getEvtIntensity();
+
+ for ( UInt_t bkgndID( 0 ); bkgndID < nBkgnds; ++bkgndID ) {
+ if ( usingBkgnd_ == kTRUE ) {
+ bkgndDPLike_[bkgndID] = negBkgndDPModels_[bkgndID]->getLikelihood( iEvt );
+ } else {
+ bkgndDPLike_[bkgndID] = 0.0;
+ }
+ }
+ }
+ } else {
+ posSigModel_->calcLikelihoodInfo( iEvt );
+ negSigModel_->calcLikelihoodInfo( iEvt );
+
+ sigDPLike_ = 0.5 * ( posSigModel_->getEvtIntensity() + negSigModel_->getEvtIntensity() );
+
+ for ( UInt_t bkgndID( 0 ); bkgndID < nBkgnds; ++bkgndID ) {
+ if ( usingBkgnd_ == kTRUE ) {
+ bkgndDPLike_[bkgndID] = 0.5 * ( posBkgndDPModels_[bkgndID]->getLikelihood( iEvt ) +
+ negBkgndDPModels_[bkgndID]->getLikelihood( iEvt ) );
+ } else {
+ bkgndDPLike_[bkgndID] = 0.0;
+ }
+ }
+ }
+
+ if ( useSCF_ == kTRUE ) {
+ if ( scfMap_ == 0 ) {
+ // we're not smearing the SCF DP position
+ // so the likelihood is the same as the TM
+ scfDPLike_ = sigDPLike_;
+ } else {
+ // calculate the smeared SCF DP likelihood
+ scfDPLike_ = this->getEvtSCFDPLikelihood( iEvt );
+ }
+ }
+
+ // Calculate the signal normalisation
+ // NB the 2.0 is there so that the 0.5 factor is applied to
+ // signal and background in the same place otherwise you get
+ // normalisation problems when you switch off the DP in the fit
+ Double_t norm = negSigModel_->getDPNorm() + posSigModel_->getDPNorm();
+ sigDPLike_ *= 2.0 / norm;
+ scfDPLike_ *= 2.0 / norm;
+}
+
+Double_t LauCPFitModel::getEvtSCFDPLikelihood( UInt_t iEvt )
+{
+ Double_t scfDPLike( 0.0 );
+
+ Double_t recoJacobian( 1.0 );
+ Double_t xCoord( 0.0 );
+ Double_t yCoord( 0.0 );
+
+ Bool_t squareDP = negKinematics_->squareDP();
+ if ( squareDP ) {
+ xCoord = negSigModel_->getEvtmPrime();
+ yCoord = negSigModel_->getEvtthPrime();
+ recoJacobian = recoJacobians_[iEvt];
+ } else {
+ xCoord = negSigModel_->getEvtm13Sq();
+ yCoord = negSigModel_->getEvtm23Sq();
+ }
+
+ // Find the bin that our reco event falls in
+ Int_t recoBin = scfMap_->binNumber( xCoord, yCoord );
+
+ // Find out which true Bins contribute to the given reco bin
+ const std::vector<Int_t>* trueBins = scfMap_->trueBins( recoBin );
+
+ const Int_t nDataEvents = this->eventsPerExpt();
+
+ // Loop over the true bins
+ for ( std::vector<Int_t>::const_iterator iter = trueBins->begin(); iter != trueBins->end();
+ ++iter ) {
+ Int_t trueBin = ( *iter );
+
+ // prob of a true event in the given true bin migrating to the reco bin
+ Double_t pRecoGivenTrue = scfMap_->prob( recoBin, trueBin );
+ Double_t pTrue( 0.0 );
+
+ // We've cached the DP amplitudes and the efficiency for the
+ // true bin centres, just after the data points
+ if ( tagged_ ) {
+ LauIsobarDynamics* sigModel( 0 );
+ if ( curEvtCharge_ < 0 ) {
+ sigModel = negSigModel_;
+ } else {
+ sigModel = posSigModel_;
+ }
+
+ sigModel->calcLikelihoodInfo( nDataEvents + trueBin );
+
+ pTrue = sigModel->getEvtIntensity();
+ } else {
+ posSigModel_->calcLikelihoodInfo( nDataEvents + trueBin );
+ negSigModel_->calcLikelihoodInfo( nDataEvents + trueBin );
+
+ pTrue = 0.5 * ( posSigModel_->getEvtIntensity() + negSigModel_->getEvtIntensity() );
+ }
+
+ // Get the cached SCF fraction (and jacobian if we're using the square DP)
+ Double_t scfFraction = fakeSCFFracs_[trueBin];
+ Double_t jacobian( 1.0 );
+ if ( squareDP ) {
+ jacobian = fakeJacobians_[trueBin];
+ }
+
+ scfDPLike += pTrue * jacobian * scfFraction * pRecoGivenTrue;
+ }
+
+ // Divide by the reco jacobian
+ scfDPLike /= recoJacobian;
+
+ return scfDPLike;
+}
+
+void LauCPFitModel::getEvtExtraLikelihoods( UInt_t iEvt )
+{
+ // Function to return the signal and background likelihoods for the
+ // extra variables for the given event evtNo.
+
+ sigExtraLike_ = 1.0;
+
+ const UInt_t nBkgnds = this->nBkgndClasses();
+
+ if ( ! tagged_ || curEvtCharge_ < 0 ) {
+ sigExtraLike_ = this->prodPdfValue( negSignalPdfs_, iEvt );
+
+ if ( useSCF_ ) {
+ scfExtraLike_ = this->prodPdfValue( negScfPdfs_, iEvt );
+ }
+
+ for ( UInt_t bkgndID( 0 ); bkgndID < nBkgnds; ++bkgndID ) {
+ if ( usingBkgnd_ ) {
+ bkgndExtraLike_[bkgndID] = this->prodPdfValue( negBkgndPdfs_[bkgndID], iEvt );
+ } else {
+ bkgndExtraLike_[bkgndID] = 0.0;
+ }
+ }
+ } else {
+ sigExtraLike_ = this->prodPdfValue( posSignalPdfs_, iEvt );
+
+ if ( useSCF_ ) {
+ scfExtraLike_ = this->prodPdfValue( posScfPdfs_, iEvt );
+ }
+
+ for ( UInt_t bkgndID( 0 ); bkgndID < nBkgnds; ++bkgndID ) {
+ if ( usingBkgnd_ ) {
+ bkgndExtraLike_[bkgndID] = this->prodPdfValue( posBkgndPdfs_[bkgndID], iEvt );
+ } else {
+ bkgndExtraLike_[bkgndID] = 0.0;
+ }
+ }
+ }
+}
+
+void LauCPFitModel::updateCoeffs()
+{
+ negCoeffs_.clear();
+ posCoeffs_.clear();
+ negCoeffs_.reserve( nSigComp_ );
+ posCoeffs_.reserve( nSigComp_ );
+ for ( UInt_t i = 0; i < nSigComp_; i++ ) {
+ negCoeffs_.push_back( coeffPars_[i]->antiparticleCoeff() );
+ posCoeffs_.push_back( coeffPars_[i]->particleCoeff() );
+ }
+}
+
+void LauCPFitModel::setupSPlotNtupleBranches()
+{
+ // add branches for storing the experiment number and the number of
+ // the event within the current experiment
+ this->addSPlotNtupleIntegerBranch( "iExpt" );
+ this->addSPlotNtupleIntegerBranch( "iEvtWithinExpt" );
+
+ // Store the efficiency of the event (for inclusive BF calculations).
+ if ( this->storeDPEff() ) {
+ this->addSPlotNtupleDoubleBranch( "efficiency" );
+ if ( negSigModel_->usingScfModel() && posSigModel_->usingScfModel() ) {
+ this->addSPlotNtupleDoubleBranch( "scffraction" );
+ }
+ }
+
+ // Store the total event likelihood for each species.
+ if ( useSCF_ ) {
+ this->addSPlotNtupleDoubleBranch( "sigTMTotalLike" );
+ this->addSPlotNtupleDoubleBranch( "sigSCFTotalLike" );
+ this->addSPlotNtupleDoubleBranch( "sigSCFFrac" );
+ } else {
+ this->addSPlotNtupleDoubleBranch( "sigTotalLike" );
+ }
+ if ( usingBkgnd_ ) {
+ const UInt_t nBkgnds = this->nBkgndClasses();
+ for ( UInt_t iBkgnd( 0 ); iBkgnd < nBkgnds; ++iBkgnd ) {
+ TString name( this->bkgndClassName( iBkgnd ) );
+ name += "TotalLike";
+ this->addSPlotNtupleDoubleBranch( name );
+ }
+ }
+
+ // Store the DP likelihoods
+ if ( this->useDP() ) {
+ if ( useSCF_ ) {
+ this->addSPlotNtupleDoubleBranch( "sigTMDPLike" );
+ this->addSPlotNtupleDoubleBranch( "sigSCFDPLike" );
+ } else {
+ this->addSPlotNtupleDoubleBranch( "sigDPLike" );
+ }
+ if ( usingBkgnd_ ) {
+ const UInt_t nBkgnds = this->nBkgndClasses();
+ for ( UInt_t iBkgnd( 0 ); iBkgnd < nBkgnds; ++iBkgnd ) {
+ TString name( this->bkgndClassName( iBkgnd ) );
+ name += "DPLike";
+ this->addSPlotNtupleDoubleBranch( name );
+ }
+ }
+ }
+
+ // Store the likelihoods for each extra PDF
+ if ( useSCF_ ) {
+ this->addSPlotNtupleBranches( &negSignalPdfs_, "sigTM" );
+ this->addSPlotNtupleBranches( &negScfPdfs_, "sigSCF" );
+ } else {
+ this->addSPlotNtupleBranches( &negSignalPdfs_, "sig" );
+ }
+ if ( usingBkgnd_ ) {
+ const UInt_t nBkgnds = this->nBkgndClasses();
+ for ( UInt_t iBkgnd( 0 ); iBkgnd < nBkgnds; ++iBkgnd ) {
+ const TString& bkgndClass = this->bkgndClassName( iBkgnd );
+ const LauPdfPList* pdfList = &( negBkgndPdfs_[iBkgnd] );
+ this->addSPlotNtupleBranches( pdfList, bkgndClass );
+ }
+ }
+}
+
+void LauCPFitModel::addSPlotNtupleBranches( const LauPdfPList* extraPdfs, const TString& prefix )
+{
+ if ( extraPdfs ) {
+ // Loop through each of the PDFs
+ for ( LauPdfPList::const_iterator pdf_iter = extraPdfs->begin(); pdf_iter != extraPdfs->end();
+ ++pdf_iter ) {
+
+ // Count the number of input variables that are not
+ // DP variables (used in the case where there is DP
+ // dependence for e.g. MVA)
+ UInt_t nVars( 0 );
+ std::vector<TString> varNames = ( *pdf_iter )->varNames();
+ for ( std::vector<TString>::const_iterator var_iter = varNames.begin();
+ var_iter != varNames.end();
+ ++var_iter ) {
+ if ( ( *var_iter ) != "m13Sq" && ( *var_iter ) != "m23Sq" ) {
+ ++nVars;
+ }
+ }
+
+ if ( nVars == 1 ) {
+ // If the PDF only has one variable then
+ // simply add one branch for that variable
+ TString varName = ( *pdf_iter )->varName();
+ TString name( prefix );
+ name += varName;
+ name += "Like";
+ this->addSPlotNtupleDoubleBranch( name );
+ } else if ( nVars == 2 ) {
+ // If the PDF has two variables then we
+ // need a branch for them both together and
+ // branches for each
+ TString allVars( "" );
+ for ( std::vector<TString>::const_iterator var_iter = varNames.begin();
+ var_iter != varNames.end();
+ ++var_iter ) {
+ allVars += ( *var_iter );
+ TString name( prefix );
+ name += ( *var_iter );
+ name += "Like";
+ this->addSPlotNtupleDoubleBranch( name );
+ }
+ TString name( prefix );
+ name += allVars;
+ name += "Like";
+ this->addSPlotNtupleDoubleBranch( name );
+ } else {
+ std::cerr << "WARNING in LauCPFitModel::addSPlotNtupleBranches : Can't yet deal with 3D PDFs."
+ << std::endl;
+ }
+ }
+ }
+}
+
+Double_t LauCPFitModel::setSPlotNtupleBranchValues( LauPdfPList* extraPdfs,
+ const TString& prefix,
+ UInt_t iEvt )
+{
+ // Store the PDF value for each variable in the list
+ Double_t totalLike( 1.0 );
+ Double_t extraLike( 0.0 );
+ if ( extraPdfs ) {
+ for ( LauPdfPList::iterator pdf_iter = extraPdfs->begin(); pdf_iter != extraPdfs->end();
+ ++pdf_iter ) {
+
+ // calculate the likelihood for this event
+ ( *pdf_iter )->calcLikelihoodInfo( iEvt );
+ extraLike = ( *pdf_iter )->getLikelihood();
+ totalLike *= extraLike;
+
+ // Count the number of input variables that are not
+ // DP variables (used in the case where there is DP
+ // dependence for e.g. MVA)
+ UInt_t nVars( 0 );
+ std::vector<TString> varNames = ( *pdf_iter )->varNames();
+ for ( std::vector<TString>::const_iterator var_iter = varNames.begin();
+ var_iter != varNames.end();
+ ++var_iter ) {
+ if ( ( *var_iter ) != "m13Sq" && ( *var_iter ) != "m23Sq" ) {
+ ++nVars;
+ }
+ }
+
+ if ( nVars == 1 ) {
+ // If the PDF only has one variable then
+ // simply store the value for that variable
+ TString varName = ( *pdf_iter )->varName();
+ TString name( prefix );
+ name += varName;
+ name += "Like";
+ this->setSPlotNtupleDoubleBranchValue( name, extraLike );
+ } else if ( nVars == 2 ) {
+ // If the PDF has two variables then we
+ // store the value for them both together
+ // and for each on their own
+ TString allVars( "" );
+ for ( std::vector<TString>::const_iterator var_iter = varNames.begin();
+ var_iter != varNames.end();
+ ++var_iter ) {
+ allVars += ( *var_iter );
+ TString name( prefix );
+ name += ( *var_iter );
+ name += "Like";
+ Double_t indivLike = ( *pdf_iter )->getLikelihood( ( *var_iter ) );
+ this->setSPlotNtupleDoubleBranchValue( name, indivLike );
+ }
+ TString name( prefix );
+ name += allVars;
+ name += "Like";
+ this->setSPlotNtupleDoubleBranchValue( name, extraLike );
+ } else {
+ std::cerr << "WARNING in LauCPFitModel::setSPlotNtupleBranchValues : Can't yet deal with 3D PDFs."
+ << std::endl;
+ }
+ }
+ }
+ return totalLike;
+}
+
+LauSPlot::NameSet LauCPFitModel::variableNames() const
+{
+ LauSPlot::NameSet nameSet;
+ if ( this->useDP() ) {
+ nameSet.insert( "DP" );
+ }
+ // Loop through all the signal PDFs
+ for ( LauPdfPList::const_iterator pdf_iter = negSignalPdfs_.begin();
+ pdf_iter != negSignalPdfs_.end();
+ ++pdf_iter ) {
+ // Loop over the variables involved in each PDF
+ std::vector<TString> varNames = ( *pdf_iter )->varNames();
+ for ( std::vector<TString>::const_iterator var_iter = varNames.begin();
+ var_iter != varNames.end();
+ ++var_iter ) {
+ // If they are not DP coordinates then add them
+ if ( ( *var_iter ) != "m13Sq" && ( *var_iter ) != "m23Sq" ) {
+ nameSet.insert( ( *var_iter ) );
+ }
+ }
+ }
+ return nameSet;
+}
+
+LauSPlot::NumbMap LauCPFitModel::freeSpeciesNames() const
+{
+ LauSPlot::NumbMap numbMap;
+ if ( ! signalEvents_->fixed() && this->doEMLFit() ) {
+ numbMap["sig"] = signalEvents_->genValue();
+ }
+ if ( usingBkgnd_ ) {
+ const UInt_t nBkgnds = this->nBkgndClasses();
+ for ( UInt_t iBkgnd( 0 ); iBkgnd < nBkgnds; ++iBkgnd ) {
+ const TString& bkgndClass = this->bkgndClassName( iBkgnd );
+ const LauAbsRValue* par = bkgndEvents_[iBkgnd];
+ if ( ! par->fixed() ) {
+ numbMap[bkgndClass] = par->genValue();
+ if ( ! par->isLValue() ) {
+ std::cerr << "WARNING in LauCPFitModel::freeSpeciesNames : \"" << par->name()
+ << "\" is a LauFormulaPar, which implies it is perhaps not entirely free to float in the fit, so the sWeight calculation may not be reliable"
+ << std::endl;
+ }
+ }
+ }
+ }
+ return numbMap;
+}
+
+LauSPlot::NumbMap LauCPFitModel::fixdSpeciesNames() const
+{
+ LauSPlot::NumbMap numbMap;
+ if ( signalEvents_->fixed() && this->doEMLFit() ) {
+ numbMap["sig"] = signalEvents_->genValue();
+ }
+ if ( usingBkgnd_ ) {
+ const UInt_t nBkgnds = this->nBkgndClasses();
+ for ( UInt_t iBkgnd( 0 ); iBkgnd < nBkgnds; ++iBkgnd ) {
+ const TString& bkgndClass = this->bkgndClassName( iBkgnd );
+ const LauAbsRValue* par = bkgndEvents_[iBkgnd];
+ if ( par->fixed() ) {
+ numbMap[bkgndClass] = par->genValue();
+ }
+ }
+ }
+ return numbMap;
+}
+
+LauSPlot::TwoDMap LauCPFitModel::twodimPDFs() const
+{
+ // This makes the assumption that the form of the positive and
+ // negative PDFs are the same, which seems reasonable to me
+
+ LauSPlot::TwoDMap twodimMap;
+
+ for ( LauPdfPList::const_iterator pdf_iter = negSignalPdfs_.begin();
+ pdf_iter != negSignalPdfs_.end();
+ ++pdf_iter ) {
+ // Count the number of input variables that are not DP variables
+ UInt_t nVars( 0 );
+ std::vector<TString> varNames = ( *pdf_iter )->varNames();
+ for ( std::vector<TString>::const_iterator var_iter = varNames.begin();
+ var_iter != varNames.end();
+ ++var_iter ) {
+ if ( ( *var_iter ) != "m13Sq" && ( *var_iter ) != "m23Sq" ) {
+ ++nVars;
+ }
+ }
+ if ( nVars == 2 ) {
+ if ( useSCF_ ) {
+ twodimMap.insert(
+ std::make_pair( "sigTM", std::make_pair( varNames[0], varNames[1] ) ) );
+ } else {
+ twodimMap.insert(
+ std::make_pair( "sig", std::make_pair( varNames[0], varNames[1] ) ) );
+ }
+ }
+ }
+
+ if ( useSCF_ ) {
+ for ( LauPdfPList::const_iterator pdf_iter = negScfPdfs_.begin();
+ pdf_iter != negScfPdfs_.end();
+ ++pdf_iter ) {
+ // Count the number of input variables that are not DP variables
+ UInt_t nVars( 0 );
+ std::vector<TString> varNames = ( *pdf_iter )->varNames();
+ for ( std::vector<TString>::const_iterator var_iter = varNames.begin();
+ var_iter != varNames.end();
+ ++var_iter ) {
+ if ( ( *var_iter ) != "m13Sq" && ( *var_iter ) != "m23Sq" ) {
+ ++nVars;
+ }
+ }
+ if ( nVars == 2 ) {
+ twodimMap.insert(
+ std::make_pair( "sigSCF", std::make_pair( varNames[0], varNames[1] ) ) );
+ }
+ }
+ }
+
+ if ( usingBkgnd_ ) {
+ const UInt_t nBkgnds = this->nBkgndClasses();
+ for ( UInt_t iBkgnd( 0 ); iBkgnd < nBkgnds; ++iBkgnd ) {
+ const TString& bkgndClass = this->bkgndClassName( iBkgnd );
+ const LauPdfPList& pdfList = negBkgndPdfs_[iBkgnd];
+ for ( LauPdfPList::const_iterator pdf_iter = pdfList.begin(); pdf_iter != pdfList.end();
+ ++pdf_iter ) {
+ // Count the number of input variables that are not DP variables
+ UInt_t nVars( 0 );
+ std::vector<TString> varNames = ( *pdf_iter )->varNames();
+ for ( std::vector<TString>::const_iterator var_iter = varNames.begin();
+ var_iter != varNames.end();
+ ++var_iter ) {
+ if ( ( *var_iter ) != "m13Sq" && ( *var_iter ) != "m23Sq" ) {
+ ++nVars;
+ }
+ }
+ if ( nVars == 2 ) {
+ twodimMap.insert(
+ std::make_pair( bkgndClass, std::make_pair( varNames[0], varNames[1] ) ) );
+ }
+ }
+ }
+ }
+
+ return twodimMap;
+}
+
+void LauCPFitModel::storePerEvtLlhds()
+{
+ std::cout << "INFO in LauCPFitModel::storePerEvtLlhds : Storing per-event likelihood values..."
+ << std::endl;
+
+ // if we've not been using the DP model then we need to cache all
+ // the info here so that we can get the efficiency from it
+
+ LauFitDataTree* inputFitData = this->fitData();
+
+ if ( ! this->useDP() && this->storeDPEff() ) {
+ negSigModel_->initialise( negCoeffs_ );
+ posSigModel_->initialise( posCoeffs_ );
+ negSigModel_->fillDataTree( *inputFitData );
+ posSigModel_->fillDataTree( *inputFitData );
+ }
+
+ UInt_t evtsPerExpt( this->eventsPerExpt() );
+
+ LauIsobarDynamics* sigModel( 0 );
+ LauPdfPList* sigPdfs( 0 );
+ LauPdfPList* scfPdfs( 0 );
+ LauBkgndPdfsList* bkgndPdfs( 0 );
+
+ for ( UInt_t iEvt = 0; iEvt < evtsPerExpt; ++iEvt ) {
+
+ this->setSPlotNtupleIntegerBranchValue( "iExpt", this->iExpt() );
+ this->setSPlotNtupleIntegerBranchValue( "iEvtWithinExpt", iEvt );
+
+ // Find out whether we have B- or B+
+ if ( tagged_ ) {
+ const LauFitData& dataValues = inputFitData->getData( iEvt );
+ LauFitData::const_iterator iter = dataValues.find( "charge" );
+ curEvtCharge_ = static_cast<Int_t>( iter->second );
+
+ if ( curEvtCharge_ == +1 ) {
+ sigModel = posSigModel_;
+ sigPdfs = &posSignalPdfs_;
+ scfPdfs = &posScfPdfs_;
+ bkgndPdfs = &posBkgndPdfs_;
+ } else {
+ sigModel = negSigModel_;
+ sigPdfs = &negSignalPdfs_;
+ scfPdfs = &negScfPdfs_;
+ bkgndPdfs = &negBkgndPdfs_;
+ }
+ } else {
+ sigPdfs = &negSignalPdfs_;
+ scfPdfs = &negScfPdfs_;
+ bkgndPdfs = &negBkgndPdfs_;
+ }
+
+ // the DP information
+ this->getEvtDPLikelihood( iEvt );
+ if ( this->storeDPEff() ) {
+ if ( ! this->useDP() ) {
+ posSigModel_->calcLikelihoodInfo( iEvt );
+ negSigModel_->calcLikelihoodInfo( iEvt );
+ }
+ if ( tagged_ ) {
+ this->setSPlotNtupleDoubleBranchValue( "efficiency", sigModel->getEvtEff() );
+ if ( negSigModel_->usingScfModel() && posSigModel_->usingScfModel() ) {
+ this->setSPlotNtupleDoubleBranchValue( "scffraction",
+ sigModel->getEvtScfFraction() );
+ }
+ } else {
+ this->setSPlotNtupleDoubleBranchValue( "efficiency",
+ 0.5 * ( posSigModel_->getEvtEff() +
+ negSigModel_->getEvtEff() ) );
+ if ( negSigModel_->usingScfModel() && posSigModel_->usingScfModel() ) {
+ this->setSPlotNtupleDoubleBranchValue(
+ "scffraction",
+ 0.5 * ( posSigModel_->getEvtScfFraction() +
+ negSigModel_->getEvtScfFraction() ) );
+ }
+ }
+ }
+ if ( this->useDP() ) {
+ sigTotalLike_ = sigDPLike_;
+ if ( useSCF_ ) {
+ scfTotalLike_ = scfDPLike_;
+ this->setSPlotNtupleDoubleBranchValue( "sigTMDPLike", sigDPLike_ );
+ this->setSPlotNtupleDoubleBranchValue( "sigSCFDPLike", scfDPLike_ );
+ } else {
+ this->setSPlotNtupleDoubleBranchValue( "sigDPLike", sigDPLike_ );
+ }
+ if ( usingBkgnd_ ) {
+ const UInt_t nBkgnds = this->nBkgndClasses();
+ for ( UInt_t iBkgnd( 0 ); iBkgnd < nBkgnds; ++iBkgnd ) {
+ TString name = this->bkgndClassName( iBkgnd );
+ name += "DPLike";
+ this->setSPlotNtupleDoubleBranchValue( name, bkgndDPLike_[iBkgnd] );
+ }
+ }
+ } else {
+ sigTotalLike_ = 1.0;
+ if ( useSCF_ ) {
+ scfTotalLike_ = 1.0;
+ }
+ if ( usingBkgnd_ ) {
+ const UInt_t nBkgnds = this->nBkgndClasses();
+ for ( UInt_t iBkgnd( 0 ); iBkgnd < nBkgnds; ++iBkgnd ) {
+ bkgndTotalLike_[iBkgnd] = 1.0;
+ }
+ }
+ }
+
+ // the signal PDF values
+ if ( useSCF_ ) {
+ sigTotalLike_ *= this->setSPlotNtupleBranchValues( sigPdfs, "sigTM", iEvt );
+ scfTotalLike_ *= this->setSPlotNtupleBranchValues( scfPdfs, "sigSCF", iEvt );
+ } else {
+ sigTotalLike_ *= this->setSPlotNtupleBranchValues( sigPdfs, "sig", iEvt );
+ }
+
+ // the background PDF values
+ if ( usingBkgnd_ ) {
+ const UInt_t nBkgnds = this->nBkgndClasses();
+ for ( UInt_t iBkgnd( 0 ); iBkgnd < nBkgnds; ++iBkgnd ) {
+ const TString& bkgndClass = this->bkgndClassName( iBkgnd );
+ LauPdfPList& pdfs = ( *bkgndPdfs )[iBkgnd];
+ bkgndTotalLike_[iBkgnd] *=
+ this->setSPlotNtupleBranchValues( &( pdfs ), bkgndClass, iEvt );
+ }
+ }
+
+ // the total likelihoods
+ if ( useSCF_ ) {
+ Double_t scfFrac( 0.0 );
+ if ( useSCFHist_ ) {
+ scfFrac = recoSCFFracs_[iEvt];
+ } else {
+ scfFrac = scfFrac_.unblindValue();
+ }
+ this->setSPlotNtupleDoubleBranchValue( "sigSCFFrac", scfFrac );
+ sigTotalLike_ *= ( 1.0 - scfFrac );
+ if ( scfMap_ == 0 ) {
+ scfTotalLike_ *= scfFrac;
+ }
+ this->setSPlotNtupleDoubleBranchValue( "sigTMTotalLike", sigTotalLike_ );
+ this->setSPlotNtupleDoubleBranchValue( "sigSCFTotalLike", scfTotalLike_ );
+ } else {
+ this->setSPlotNtupleDoubleBranchValue( "sigTotalLike", sigTotalLike_ );
+ }
+ if ( usingBkgnd_ ) {
+ const UInt_t nBkgnds = this->nBkgndClasses();
+ for ( UInt_t iBkgnd( 0 ); iBkgnd < nBkgnds; ++iBkgnd ) {
+ TString name = this->bkgndClassName( iBkgnd );
+ name += "TotalLike";
+ this->setSPlotNtupleDoubleBranchValue( name, bkgndTotalLike_[iBkgnd] );
+ }
+ }
+ // fill the tree
+ this->fillSPlotNtupleBranches();
+ }
+ std::cout << "INFO in LauCPFitModel::storePerEvtLlhds : Finished storing per-event likelihood values."
+ << std::endl;
+}
+
+std::map<TString, LauComplex> LauCPFitModel::getDPAmps( const Double_t m13Sq, const Double_t m23Sq )
+{
+ // Initialise the DP model, if not already done
+ if ( negCoeffs_.empty() || posCoeffs_.empty() ) {
+ this->updateCoeffs();
+ this->initialiseDPModels();
+ }
+
+ if ( ! posKinematics_->withinDPLimits( m13Sq, m23Sq ) ) {
+ return {
+ {"signal_" + negParent_, {}},
+ {"signal_" + posParent_, {}}
+ };
+ }
+
+ negSigModel_->calcLikelihoodInfo( m13Sq, m23Sq );
+ posSigModel_->calcLikelihoodInfo( m13Sq, m23Sq );
+
+ return {
+ {"signal_" + negParent_, negSigModel_->getEvtDPAmp()},
+ {"signal_" + posParent_, posSigModel_->getEvtDPAmp()}
+ };
+}
+
+std::map<TString, Double_t> LauCPFitModel::getDPLikelihoods( const Double_t m13Sq,
+ const Double_t m23Sq )
+{
+ // Initialise the DP model, if not already done
+ if ( negCoeffs_.empty() || posCoeffs_.empty() ) {
+ this->updateCoeffs();
+ this->initialiseDPModels();
+ }
+
+ std::map<TString, Double_t> likelihoods;
+
+ if ( ! posKinematics_->withinDPLimits( m13Sq, m23Sq ) ) {
+ likelihoods.emplace( "signal_" + negParent_, 0.0 );
+ likelihoods.emplace( "signal_" + posParent_, 0.0 );
+ if ( usingBkgnd_ ) {
+ const UInt_t nBkgnds { this->nBkgndClasses() };
+ for ( UInt_t bkgndID( 0 ); bkgndID < nBkgnds; ++bkgndID ) {
+ likelihoods.emplace( this->bkgndClassName( bkgndID ) + "_" + negParent_, 0.0 );
+ likelihoods.emplace( this->bkgndClassName( bkgndID ) + "_" + posParent_, 0.0 );
+ }
+ }
+ return likelihoods;
+ }
+
+ negSigModel_->calcLikelihoodInfo( m13Sq, m23Sq );
+ posSigModel_->calcLikelihoodInfo( m13Sq, m23Sq );
+
+ // See comment in getEvtDPLikelihood for explanation of the 2.0 factor
+ const Double_t norm { 2.0 / ( negSigModel_->getDPNorm() + posSigModel_->getDPNorm() ) };
+
+ likelihoods.emplace( "signal_" + negParent_, negSigModel_->getEvtIntensity() * norm );
+ likelihoods.emplace( "signal_" + posParent_, posSigModel_->getEvtIntensity() * norm );
+
+ // TODO - SCF signal
+ static bool warningIssued { false };
+ if ( useSCF_ && ! warningIssued ) {
+ warningIssued = true;
+ std::cerr << "WARNING in LauCPFitModel::getDPLikelihoods : calculation of SCF likelihoods not currently implemented in this function\n";
+ std::cerr << " : signal likelihood will just be the truth-matched value";
+ std::cerr << std::endl;
+ }
+
+ if ( usingBkgnd_ ) {
+ const UInt_t nBkgnds { this->nBkgndClasses() };
+ for ( UInt_t bkgndID( 0 ); bkgndID < nBkgnds; ++bkgndID ) {
+ likelihoods.emplace( this->bkgndClassName( bkgndID ) + "_" + negParent_,
+ negBkgndDPModels_[bkgndID]->getLikelihood( m13Sq, m23Sq ) );
+ likelihoods.emplace( this->bkgndClassName( bkgndID ) + "_" + posParent_,
+ posBkgndDPModels_[bkgndID]->getLikelihood( m13Sq, m23Sq ) );
+ }
+ }
+
+ return likelihoods;
+}
+
+void LauCPFitModel::embedNegSignal( const TString& fileName,
+ const TString& treeName,
+ Bool_t reuseEventsWithinEnsemble,
+ Bool_t reuseEventsWithinExperiment,
+ Bool_t useReweighting )
+{
+ if ( negSignalTree_ ) {
+ std::cerr << "ERROR in LauCPFitModel::embedNegSignal : Already embedding signal from a file."
+ << std::endl;
+ return;
+ }
+
+ negSignalTree_ = new LauEmbeddedData( fileName, treeName, reuseEventsWithinExperiment );
+ Bool_t dataOK = negSignalTree_->findBranches();
+ if ( ! dataOK ) {
+ delete negSignalTree_;
+ negSignalTree_ = 0;
+ std::cerr << "ERROR in LauCPFitModel::embedNegSignal : Problem creating data tree for embedding."
+ << std::endl;
+ return;
+ }
+ reuseSignal_ = reuseEventsWithinEnsemble;
+ useNegReweighting_ = useReweighting;
+ if ( this->enableEmbedding() == kFALSE ) {
+ this->enableEmbedding( kTRUE );
+ }
+}
+
+void LauCPFitModel::embedNegBkgnd( const TString& bkgndClass,
+ const TString& fileName,
+ const TString& treeName,
+ Bool_t reuseEventsWithinEnsemble,
+ Bool_t reuseEventsWithinExperiment )
+{
+ if ( ! this->validBkgndClass( bkgndClass ) ) {
+ std::cerr << "ERROR in LauCPFitModel::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;
+ return;
+ }
+
+ UInt_t bkgndID = this->bkgndClassID( bkgndClass );
+
+ if ( negBkgndTree_[bkgndID] ) {
+ std::cerr << "ERROR in LauCPFitModel::embedNegBkgnd : Already embedding background from a file."
+ << std::endl;
+ return;
+ }
+
+ negBkgndTree_[bkgndID] = new LauEmbeddedData( fileName, treeName, reuseEventsWithinExperiment );
+ Bool_t dataOK = negBkgndTree_[bkgndID]->findBranches();
+ if ( ! dataOK ) {
+ delete negBkgndTree_[bkgndID];
+ negBkgndTree_[bkgndID] = 0;
+ std::cerr << "ERROR in LauCPFitModel::embedNegBkgnd : Problem creating data tree for embedding."
+ << std::endl;
+ return;
+ }
+ reuseBkgnd_[bkgndID] = reuseEventsWithinEnsemble;
+ if ( this->enableEmbedding() == kFALSE ) {
+ this->enableEmbedding( kTRUE );
+ }
+}
+
+void LauCPFitModel::embedPosSignal( const TString& fileName,
+ const TString& treeName,
+ Bool_t reuseEventsWithinEnsemble,
+ Bool_t reuseEventsWithinExperiment,
+ Bool_t useReweighting )
+{
+ if ( posSignalTree_ ) {
+ std::cerr << "ERROR in LauCPFitModel::embedPosSignal : Already embedding signal from a file."
+ << std::endl;
+ return;
+ }
+
+ posSignalTree_ = new LauEmbeddedData( fileName, treeName, reuseEventsWithinExperiment );
+ Bool_t dataOK = posSignalTree_->findBranches();
+ if ( ! dataOK ) {
+ delete posSignalTree_;
+ posSignalTree_ = 0;
+ std::cerr << "ERROR in LauCPFitModel::embedPosSignal : Problem creating data tree for embedding."
+ << std::endl;
+ return;
+ }
+ reuseSignal_ = reuseEventsWithinEnsemble;
+ usePosReweighting_ = useReweighting;
+ if ( this->enableEmbedding() == kFALSE ) {
+ this->enableEmbedding( kTRUE );
+ }
+}
+
+void LauCPFitModel::embedPosBkgnd( const TString& bkgndClass,
+ const TString& fileName,
+ const TString& treeName,
+ Bool_t reuseEventsWithinEnsemble,
+ Bool_t reuseEventsWithinExperiment )
+{
+ if ( ! this->validBkgndClass( bkgndClass ) ) {
+ std::cerr << "ERROR in LauCPFitModel::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;
+ return;
+ }
+
+ UInt_t bkgndID = this->bkgndClassID( bkgndClass );
+
+ if ( posBkgndTree_[bkgndID] ) {
+ std::cerr << "ERROR in LauCPFitModel::embedPosBkgnd : Already embedding background from a file."
+ << std::endl;
+ return;
+ }
+
+ posBkgndTree_[bkgndID] = new LauEmbeddedData( fileName, treeName, reuseEventsWithinExperiment );
+ Bool_t dataOK = posBkgndTree_[bkgndID]->findBranches();
+ if ( ! dataOK ) {
+ delete posBkgndTree_[bkgndID];
+ posBkgndTree_[bkgndID] = 0;
+ std::cerr << "ERROR in LauCPFitModel::embedPosBkgnd : Problem creating data tree for embedding."
+ << std::endl;
+ return;
+ }
+ reuseBkgnd_[bkgndID] = reuseEventsWithinEnsemble;
+ if ( this->enableEmbedding() == kFALSE ) {
+ this->enableEmbedding( kTRUE );
+ }
+}
+
+void LauCPFitModel::weightEvents( const TString& dataFileName, const TString& dataTreeName )
+{
+ // Routine to provide weights for events that are uniformly distributed
+ // in the DP (or square DP) so as to reproduce the given DP model
+
+ const Bool_t squareDP { posKinematics_->squareDP() || negKinematics_->squareDP() };
+ if ( squareDP ) {
+ std::cout << "INFO in LauCPFitModel::weightEvents : will store DP model weights and the square DP jacobian\n";
+ std::cout << " : the DP model weights can be used on their own to weight events that were generated flat in phase space\n";
+ std::cout << " : or they can be multiplied by the jacobian to weight events that were generated flat in the square DP\n";
+ std::cout << " : or they can be multiplied by max(1.0, jacobian) to weight events that were generated quasi-flat in the square DP"
+ << std::endl;
+ } else {
+ std::cout << "INFO in LauCPFitModel::weightEvents : will store DP model weights suitable for weighting events that were generated flat in phase space"
+ << std::endl;
+ }
+
+ // This reads in the given dataFile and creates an input
+ // fit data tree that stores them for all events and experiments.
+ const Bool_t dataOK { this->verifyFitData( dataFileName, dataTreeName ) };
+ if ( ! dataOK ) {
+ std::cerr << "ERROR in LauCPFitModel::weightEvents : Problem caching the data." << std::endl;
+ return;
+ }
+
+ LauFitDataTree* inputFitData { this->fitData() };
+
+ if ( ! inputFitData->haveBranch( "m13Sq_MC" ) || ! inputFitData->haveBranch( "m23Sq_MC" ) ) {
+ std::cerr << "WARNING in LauCPFitModel::weightEvents : Cannot find MC truth DP coordinate branches in supplied data, aborting."
+ << std::endl;
+ return;
+ }
+ if ( ! inputFitData->haveBranch( "charge" ) ) {
+ std::cerr << "WARNING in LauCPFitModel::weightEvents : Cannot find branch specifying event charge in supplied data, aborting."
+ << std::endl;
+ return;
+ }
+
+ // Create the ntuple to hold the DP weights
+ TString weightsFileName { dataFileName };
+ const Ssiz_t index { weightsFileName.Last( '.' ) };
+ weightsFileName.Insert( index, "_DPweights" );
+
+ LauGenNtuple weightsTuple { weightsFileName, dataTreeName };
+ weightsTuple.addIntegerBranch( "iExpt" );
+ weightsTuple.addIntegerBranch( "iEvtWithinExpt" );
+ weightsTuple.addDoubleBranch( "dpModelWeight" );
+ if ( squareDP ) {
+ weightsTuple.addDoubleBranch( "sqDPJacobian" );
+ }
+
+ const UInt_t nExpmt { this->nExpt() };
+ const UInt_t firstExpmt { this->firstExpt() };
+ for ( UInt_t iExpmt { firstExpmt }; iExpmt < ( firstExpmt + nExpmt ); ++iExpmt ) {
+
+ inputFitData->readExperimentData( iExpmt );
+
+ const UInt_t nEvents { inputFitData->nEvents() };
+ if ( nEvents < 1 ) {
+ std::cerr << "WARNING in LauCPFitModel::weightEvents : Zero events in experiment "
+ << iExpmt << ", skipping..." << std::endl;
+ continue;
+ }
+
+ weightsTuple.setIntegerBranchValue( "iExpt", iExpmt );
+
+ // Calculate and store the weights for the events in this experiment
+ for ( UInt_t iEvent { 0 }; iEvent < nEvents; ++iEvent ) {
+
+ weightsTuple.setIntegerBranchValue( "iEvtWithinExpt", iEvent );
+
+ const LauFitData& evtData = inputFitData->getData( iEvent );
+
+ const auto m13Sq_MC { evtData.at( "m13Sq_MC" ) };
+ const auto m23Sq_MC { evtData.at( "m23Sq_MC" ) };
+ const auto charge { static_cast<Int_t>( evtData.at( "charge" ) ) };
+
+ Double_t dpModelWeight { 0.0 };
+ Double_t jacobian { 1.0 };
+
+ LauKinematics* kinematics { nullptr };
+ LauIsobarDynamics* dpModel { nullptr };
+
+ if ( charge > 0 ) {
+ kinematics = posKinematics_;
+ dpModel = posSigModel_;
+ } else {
+ kinematics = negKinematics_;
+ dpModel = negSigModel_;
+ }
+
+ if ( kinematics->withinDPLimits( m13Sq_MC, m23Sq_MC ) ) {
+
+ kinematics->updateKinematics( m13Sq_MC, m23Sq_MC );
+ dpModelWeight = dpModel->getEventWeight();
+
+ if ( squareDP ) {
+ jacobian = kinematics->calcSqDPJacobian();
+ }
+
+ const Double_t norm { 0.5 *
+ ( negSigModel_->getDPNorm() + posSigModel_->getDPNorm() ) };
+ dpModelWeight /= norm;
+ }
+
+ weightsTuple.setDoubleBranchValue( "dpModelWeight", dpModelWeight );
+ if ( squareDP ) {
+ weightsTuple.setDoubleBranchValue( "sqDPJacobian", jacobian );
+ }
+ weightsTuple.fillBranches();
+ }
+ }
+
+ weightsTuple.buildIndex( "iExpt", "iEvtWithinExpt" );
+ weightsTuple.addFriendTree( dataFileName, dataTreeName );
+ weightsTuple.writeOutGenResults();
+}
+
+void LauCPFitModel::savePDFPlots( const TString& label )
+{
+ savePDFPlotsWave( label, 0 );
+ savePDFPlotsWave( label, 1 );
+ savePDFPlotsWave( label, 2 );
+
+ std::cout << "LauCPFitModel::plot" << std::endl;
+ // ((LauIsobarDynamics*)negSigModel_)->plot();
+
+ //Double_t minm13 = negSigModel_->getKinematics()->getm13Min();
+ Double_t minm13 = 0.0;
+ Double_t maxm13 = negSigModel_->getKinematics()->getm13Max();
+ //Double_t minm23 = negSigModel_->getKinematics()->getm23Min();
+ Double_t minm23 = 0.0;
+ Double_t maxm23 = negSigModel_->getKinematics()->getm23Max();
+
+ Double_t mins13 = minm13 * minm13;
+ Double_t maxs13 = maxm13 * maxm13;
+ Double_t mins23 = minm23 * minm23;
+ Double_t maxs23 = maxm23 * maxm23;
+
+ Double_t s13, s23, posChPdf, negChPdf;
+
+ TString xLabel = "s13";
+ TString yLabel = "s23";
+
+ if ( negSigModel_->getDaughters()->gotSymmetricalDP() ) {
+ xLabel = "sHigh";
+ yLabel = "sLow";
+ }
+
+ Int_t n13 = 200.00, n23 = 200.00;
+ Double_t delta13, delta23;
+ delta13 = ( maxs13 - mins13 ) / n13;
+ delta23 = ( maxs23 - mins23 ) / n23;
+ UInt_t nAmp = negSigModel_->getnCohAmp();
+ for ( UInt_t resID = 0; resID <= nAmp; ++resID ) {
+ TGraph2D* posDt = new TGraph2D();
+ TGraph2D* negDt = new TGraph2D();
+ TGraph2D* acpDt = new TGraph2D();
+
+ TString resName = "TotalAmp";
+ if ( resID != nAmp ) {
+ TString tStrResID = Form( "%d", resID );
+ const LauIsobarDynamics* model = negSigModel_;
+ const LauAbsResonance* resonance = model->getResonance( resID );
+ resName = resonance->getResonanceName();
+ std::cout << "resName = " << resName << std::endl;
+ }
+
+ resName.ReplaceAll( "(", "" );
+ resName.ReplaceAll( ")", "" );
+ resName.ReplaceAll( "*", "Star" );
+
+ posDt->SetName( resName + label );
+ posDt->SetTitle( resName + " (" + label + ") Positive" );
+ negDt->SetName( resName + label );
+ negDt->SetTitle( resName + " (" + label + ") Negative" );
+ acpDt->SetName( resName + label );
+ acpDt->SetTitle( resName + " (" + label + ") Asymmetry" );
+
+ Int_t count = 0;
+ for ( Int_t i = 0; i < n13; i++ ) {
+ s13 = mins13 + i * delta13;
+ for ( Int_t j = 0; j < n23; j++ ) {
+ s23 = mins23 + j * delta23;
+ if ( negSigModel_->getKinematics()->withinDPLimits2( s23, s13 ) ) {
+ if ( negSigModel_->getDaughters()->gotSymmetricalDP() && ( s13 > s23 ) )
+ continue;
+
+ negSigModel_->calcLikelihoodInfo( s13, s23 );
+ posSigModel_->calcLikelihoodInfo( s13, s23 );
+
+ LauComplex negChAmp = negSigModel_->getEvtDPAmp();
+ LauComplex posChAmp = posSigModel_->getEvtDPAmp();
+
+ if ( resID != nAmp ) {
+ negChAmp = negSigModel_->getFullAmplitude( resID );
+ posChAmp = posSigModel_->getFullAmplitude( resID );
+ }
+ negChPdf = negChAmp.abs2();
+ posChPdf = posChAmp.abs2();
+ negDt->SetPoint( count, s23, s13, negChPdf ); // s23=sHigh, s13 = sLow
+ posDt->SetPoint( count, s23, s13, posChPdf ); // s23=sHigh, s13 = sLow
+ acpDt->SetPoint( count, s23, s13, negChPdf - posChPdf ); // s23=sHigh, s13 = sLow
+ count++;
+ }
+ }
+ }
+ gStyle->SetPalette( 1 );
+ TCanvas* posC = new TCanvas( "c" + resName + label + "Positive",
+ resName + " (" + label + ") Positive",
+ 0,
+ 0,
+ 600,
+ 400 );
+ posDt->GetXaxis()->SetTitle( xLabel );
+ posDt->GetYaxis()->SetTitle( yLabel );
+ posDt->Draw( "SURF1" );
+ posDt->GetXaxis()->SetTitle( xLabel );
+ posDt->GetYaxis()->SetTitle( yLabel );
+ posC->SaveAs( "plot_2D_" + resName + "_" + label + "Positive.C" );
+
+ TCanvas* negC = new TCanvas( "c" + resName + label + "Negative",
+ resName + " (" + label + ") Negative",
+ 0,
+ 0,
+ 600,
+ 400 );
+ negDt->GetXaxis()->SetTitle( xLabel );
+ negDt->GetYaxis()->SetTitle( yLabel );
+ negDt->Draw( "SURF1" );
+ negDt->GetXaxis()->SetTitle( xLabel );
+ negDt->GetYaxis()->SetTitle( yLabel );
+ negC->SaveAs( "plot_2D_" + resName + "_" + label + "Negative.C" );
+
+ TCanvas* acpC = new TCanvas( "c" + resName + label + "Asymmetry",
+ resName + " (" + label + ") Asymmetry",
+ 0,
+ 0,
+ 600,
+ 400 );
+ acpDt->GetXaxis()->SetTitle( xLabel );
+ acpDt->GetYaxis()->SetTitle( yLabel );
+ acpDt->Draw( "SURF1" );
+ acpDt->GetXaxis()->SetTitle( xLabel );
+ acpDt->GetYaxis()->SetTitle( yLabel );
+ acpC->SaveAs( "plot_2D_" + resName + "_" + label + "Asymmetry.C" );
+ }
+}
+
+void LauCPFitModel::savePDFPlotsWave( const TString& label, const Int_t& spin )
+{
+
+ std::cout << "label = " << label << ", spin = " << spin << std::endl;
+
+ TString tStrResID = "S_Wave";
+ if ( spin == 1 )
+ tStrResID = "P_Wave";
+ if ( spin == 2 )
+ tStrResID = "D_Wave";
+
+ TString xLabel = "s13";
+ TString yLabel = "s23";
+
+ std::cout << "LauCPFitModel::savePDFPlotsWave: " << tStrResID << std::endl;
+
+ Double_t minm13 = 0.0;
+ Double_t maxm13 = negSigModel_->getKinematics()->getm13Max();
+ Double_t minm23 = 0.0;
+ Double_t maxm23 = negSigModel_->getKinematics()->getm23Max();
+
+ Double_t mins13 = minm13 * minm13;
+ Double_t maxs13 = maxm13 * maxm13;
+ Double_t mins23 = minm23 * minm23;
+ Double_t maxs23 = maxm23 * maxm23;
+
+ Double_t s13, s23, posChPdf, negChPdf;
+ TGraph2D* posDt = new TGraph2D();
+ TGraph2D* negDt = new TGraph2D();
+ TGraph2D* acpDt = new TGraph2D();
+
+ posDt->SetName( tStrResID + label );
+ posDt->SetTitle( tStrResID + " (" + label + ") Positive" );
+ negDt->SetName( tStrResID + label );
+ negDt->SetTitle( tStrResID + " (" + label + ") Negative" );
+ acpDt->SetName( tStrResID + label );
+ acpDt->SetTitle( tStrResID + " (" + label + ") Asymmetry" );
+
+ Int_t n13 = 200.00, n23 = 200.00;
+ Double_t delta13, delta23;
+ delta13 = ( maxs13 - mins13 ) / n13;
+ delta23 = ( maxs23 - mins23 ) / n23;
+ UInt_t nAmp = negSigModel_->getnCohAmp();
+
+ Int_t count = 0;
+ for ( Int_t i = 0; i < n13; i++ ) {
+ s13 = mins13 + i * delta13;
+ for ( Int_t j = 0; j < n23; j++ ) {
+ s23 = mins23 + j * delta23;
+ if ( negSigModel_->getKinematics()->withinDPLimits2( s23, s13 ) ) {
+ if ( negSigModel_->getDaughters()->gotSymmetricalDP() && ( s13 > s23 ) )
+ continue;
+
+ LauComplex negChAmp( 0, 0 );
+ LauComplex posChAmp( 0, 0 );
+ Bool_t noWaveRes = kTRUE;
+ negSigModel_->calcLikelihoodInfo( s13, s23 );
+ for ( UInt_t resID = 0; resID < nAmp; ++resID ) {
+ const LauIsobarDynamics* model = negSigModel_;
+ const LauAbsResonance* resonance = model->getResonance( resID );
+ Int_t spin_res = resonance->getSpin();
+ if ( spin != spin_res )
+ continue;
+ noWaveRes = kFALSE;
+ negChAmp += negSigModel_->getFullAmplitude( resID );
+ posChAmp += posSigModel_->getFullAmplitude( resID );
+ }
+
+ if ( noWaveRes )
+ return;
+
+ negChPdf = negChAmp.abs2();
+ posChPdf = posChAmp.abs2();
+
+ negDt->SetPoint( count, s23, s13, negChPdf ); // s23=sHigh, s13 = sLow
+ posDt->SetPoint( count, s23, s13, posChPdf ); // s23=sHigh, s13 = sLow
+ acpDt->SetPoint( count, s23, s13, negChPdf - posChPdf ); // s23=sHigh, s13 = sLow
+ count++;
+ }
+ }
+ }
+ gStyle->SetPalette( 1 );
+ TCanvas* posC = new TCanvas( "c" + tStrResID + label + "Positive",
+ tStrResID + " (" + label + ") Positive",
+ 0,
+ 0,
+ 600,
+ 400 );
+ posDt->GetXaxis()->SetTitle( xLabel );
+ posDt->GetYaxis()->SetTitle( yLabel );
+ posDt->Draw( "SURF1" );
+ posDt->GetXaxis()->SetTitle( xLabel );
+ posDt->GetYaxis()->SetTitle( yLabel );
+ posC->SaveAs( "plot_2D_" + tStrResID + "_" + label + "Positive.C" );
+
+ TCanvas* negC = new TCanvas( "c" + tStrResID + label + "Negative",
+ tStrResID + " (" + label + ") Negative",
+ 0,
+ 0,
+ 600,
+ 400 );
+ negDt->GetXaxis()->SetTitle( xLabel );
+ negDt->GetYaxis()->SetTitle( yLabel );
+ negDt->Draw( "SURF1" );
+ negDt->GetXaxis()->SetTitle( xLabel );
+ negDt->GetYaxis()->SetTitle( yLabel );
+ negC->SaveAs( "plot_2D_" + tStrResID + "_" + label + "Negative.C" );
+
+ TCanvas* acpC = new TCanvas( "c" + tStrResID + label + "Asymmetry",
+ tStrResID + " (" + label + ") Asymmetry",
+ 0,
+ 0,
+ 600,
+ 400 );
+ acpDt->GetXaxis()->SetTitle( xLabel );
+ acpDt->GetYaxis()->SetTitle( yLabel );
+ acpDt->Draw( "SURF1" );
+ acpDt->GetXaxis()->SetTitle( xLabel );
+ acpDt->GetYaxis()->SetTitle( yLabel );
+ acpC->SaveAs( "plot_2D_" + tStrResID + "_" + label + "Asymmetry.C" );
+}
+
+Double_t LauCPFitModel::getParamFromTree( TTree& tree, const TString& name )
+{
+ TBranch* branch { tree.FindBranch( name ) };
+ if ( branch ) {
+ TLeaf* leaf { branch->GetLeaf( name ) };
+ if ( leaf ) {
+ tree.GetEntry( 0 );
+ return leaf->GetValue();
+ } else {
+ std::cout << "ERROR in LauCPFitModel::getParamFromTree : Leaf name " + name +
+ " not found in parameter file!"
+ << std::endl;
+ }
+ } else {
+ std::cout << "ERROR in LauCPFitModel::getParamFromTree : Branch name " + name +
+ " not found in parameter file!"
+ << std::endl;
+ }
+
+ return -1.1;
+}
+
+void LauCPFitModel::fixParam( LauParameter* param, const Double_t val, const Bool_t fix )
+{
+ std::cout << "INFO in LauCPFitModel::fixParam : Setting " << param->name() << " to " << val
+ << std::endl;
+
+ param->value( val );
+ param->genValue( val );
+ param->initValue( val );
+
+ if ( fix ) {
+ param->fixed( kTRUE );
+ } else if ( ! param->fixed() ) {
+ // Add parameter name to list to indicate that this should not be randomised by randomiseInitFitPars
+ // (otherwise only those that are fixed are not randomised).
+ // This is only done to those that are not already fixed (see randomiseInitFitPars).
+ allImportedFreeParams_.insert( param );
+ }
+}
+
+void LauCPFitModel::fixParams( std::vector<LauParameter*>& params )
+{
+ const Bool_t fix { fixParams_ };
+
+ // TODO: Allow some parameters to be fixed and some to remain floating (but initialised)
+
+ if ( ! fixParamFileName_.IsNull() ) {
+
+ // Take param values from a file
+
+ TFile* paramFile = TFile::Open( fixParamFileName_, "READ" );
+ if ( ! paramFile ) {
+ std::cerr << "ERROR in LauCPFitModel::fixParams : File '" + fixParamFileName_ +
+ "' could not be opened for reading!"
+ << std::endl;
+ return;
+ }
+
+ TTree* paramTree = dynamic_cast<TTree*>( paramFile->Get( fixParamTreeName_ ) );
+ if ( ! paramTree ) {
+ std::cerr << "ERROR in LauCPFitModel::fixParams : Tree '" + fixParamTreeName_ +
+ "' not found in parameter file!"
+ << std::endl;
+ return;
+ }
+
+ if ( ! fixParamNames_.empty() ) {
+
+ // Fix params from file, according to vector of names
+
+ for ( auto itr = params.begin(); itr != params.end(); ++itr ) {
+ auto itrName = fixParamNames_.find( ( *itr )->name() );
+ if ( itrName != fixParamNames_.end() ) {
+ this->fixParam( *itr, this->getParamFromTree( *paramTree, *itrName ), fix );
+ }
+ }
+
+ } else {
+
+ // Fix some (unspecified) parameters from file, prioritising the map (if it exists)
+
+ for ( auto itr = params.begin(); itr != params.end(); ++itr ) {
+
+ const TString& name = ( *itr )->name();
+
+ if ( ! fixParamMap_.empty() ) {
+ auto nameValItr = fixParamMap_.find( name );
+ if ( nameValItr != fixParamMap_.end() ) {
+ this->fixParam( *itr, nameValItr->second, fix );
+ }
+ } else {
+ this->fixParam( *itr, this->getParamFromTree( *paramTree, name ), fix );
+ }
+ }
+
+ } // Vector of names?
+
+ } else {
+
+ // Fix param names fom map, leave others floating
+
+ for ( auto itr = params.begin(); itr != params.end(); ++itr ) {
+ auto nameValItr = this->fixParamMap_.find( ( *itr )->name() );
+ if ( nameValItr != this->fixParamMap_.end() ) {
+ this->fixParam( *itr, nameValItr->second, fix );
+ }
+ }
+ }
}
diff --git a/src/LauCacheData.cc b/src/LauCacheData.cc
index 4e134dd..96b792a 100644
--- a/src/LauCacheData.cc
+++ b/src/LauCacheData.cc
@@ -1,78 +1,75 @@
/*
Copyright 2005 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauCacheData.cc
\brief File containing implementation of LauCacheData class.
*/
#include "LauCacheData.hh"
-
-
LauCacheData::LauCacheData() :
- m13Sq_(0.0),
- m23Sq_(0.0),
- mPrime_(0.0),
- thPrime_(0.0),
- eff_(0.0),
- scfFraction_(0.0),
- jacobian_(0.0)
+ m13Sq_( 0.0 ),
+ m23Sq_( 0.0 ),
+ mPrime_( 0.0 ),
+ thPrime_( 0.0 ),
+ eff_( 0.0 ),
+ scfFraction_( 0.0 ),
+ jacobian_( 0.0 )
{
}
LauCacheData::~LauCacheData()
{
}
-LauCacheData::LauCacheData(const LauCacheData& rhs)
+LauCacheData::LauCacheData( const LauCacheData& rhs )
{
- this->storem13Sq(rhs.retrievem13Sq());
- this->storem23Sq(rhs.retrievem23Sq());
- this->storemPrime(rhs.retrievemPrime());
- this->storethPrime(rhs.retrievethPrime());
- this->storeEff(rhs.retrieveEff());
- this->storeScfFraction(rhs.retrieveScfFraction());
- this->storeJacobian(rhs.retrieveJacobian());
- this->storeRealAmp(rhs.retrieveRealAmp());
- this->storeImagAmp(rhs.retrieveImagAmp());
- this->storeIncohIntensities(rhs.retrieveIncohIntensities());
+ this->storem13Sq( rhs.retrievem13Sq() );
+ this->storem23Sq( rhs.retrievem23Sq() );
+ this->storemPrime( rhs.retrievemPrime() );
+ this->storethPrime( rhs.retrievethPrime() );
+ this->storeEff( rhs.retrieveEff() );
+ this->storeScfFraction( rhs.retrieveScfFraction() );
+ this->storeJacobian( rhs.retrieveJacobian() );
+ this->storeRealAmp( rhs.retrieveRealAmp() );
+ this->storeImagAmp( rhs.retrieveImagAmp() );
+ this->storeIncohIntensities( rhs.retrieveIncohIntensities() );
}
-LauCacheData& LauCacheData::operator=(const LauCacheData& rhs)
+LauCacheData& LauCacheData::operator=( const LauCacheData& rhs )
{
- if (&rhs != this) {
- this->storem13Sq(rhs.retrievem13Sq());
- this->storem23Sq(rhs.retrievem23Sq());
- this->storemPrime(rhs.retrievemPrime());
- this->storethPrime(rhs.retrievethPrime());
- this->storeEff(rhs.retrieveEff());
- this->storeScfFraction(rhs.retrieveScfFraction());
- this->storeJacobian(rhs.retrieveJacobian());
- this->storeRealAmp(rhs.retrieveRealAmp());
- this->storeImagAmp(rhs.retrieveImagAmp());
- this->storeIncohIntensities(rhs.retrieveIncohIntensities());
- }
- return *this;
+ if ( &rhs != this ) {
+ this->storem13Sq( rhs.retrievem13Sq() );
+ this->storem23Sq( rhs.retrievem23Sq() );
+ this->storemPrime( rhs.retrievemPrime() );
+ this->storethPrime( rhs.retrievethPrime() );
+ this->storeEff( rhs.retrieveEff() );
+ this->storeScfFraction( rhs.retrieveScfFraction() );
+ this->storeJacobian( rhs.retrieveJacobian() );
+ this->storeRealAmp( rhs.retrieveRealAmp() );
+ this->storeImagAmp( rhs.retrieveImagAmp() );
+ this->storeIncohIntensities( rhs.retrieveIncohIntensities() );
+ }
+ return *this;
}
-
diff --git a/src/LauCalcChiSq.cc b/src/LauCalcChiSq.cc
index b89a16f..492820c 100644
--- a/src/LauCalcChiSq.cc
+++ b/src/LauCalcChiSq.cc
@@ -1,542 +1,598 @@
/*
Copyright 2008 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauCalcChiSq.cc
- \brief File containing implementation of LauCalcChiSq class.
-
- Code to produce an adaptive binning scheme and calculate the 2D chi-square
- between two datasets (e.g. low-stat data and high-stat toyMC).
-
- Note that the low and high stat histograms must have the same bin axes ranges
- and number of bins.
-
- It works by using the low stat (first) histogram to find a binning scheme such
- that the total number of entries in each bin is >= Min_bin_content. The number
- of entries in the histogram is divided by the desired minimum bin content to
- give a target number of bins. The largest number of bins that can be expressed
- as a product of powers of 4, 9, 25, 49 and 121 that does not exceed the target
- value is chosen. The histogram is the recursively subdivided in 2x2, 3x3, 5x5,
- 7x7 or 11x11 bins. For each stage of the subdivision, each bin is first
- divided into equally populated bins in x then each of these is further divded
- into equally popiulated bins in y.
-
- The (Pearson) chi-squared is then the sum of the chi-squared contributions of
- all bins:
- (low_stat_number - high_stat_number)^2/(high_stat_number)
- The nDof = number of bins - number of free params - 1
- */
+ \brief File containing implementation of LauCalcChiSq class.
+
+ Code to produce an adaptive binning scheme and calculate the 2D chi-square
+ between two datasets (e.g. low-stat data and high-stat toyMC).
+
+ Note that the low and high stat histograms must have the same bin axes ranges
+ and number of bins.
+
+ It works by using the low stat (first) histogram to find a binning scheme such
+ that the total number of entries in each bin is >= Min_bin_content. The number
+ of entries in the histogram is divided by the desired minimum bin content to
+ give a target number of bins. The largest number of bins that can be expressed
+ as a product of powers of 4, 9, 25, 49 and 121 that does not exceed the target
+ value is chosen. The histogram is the recursively subdivided in 2x2, 3x3, 5x5,
+ 7x7 or 11x11 bins. For each stage of the subdivision, each bin is first
+ divided into equally populated bins in x then each of these is further divded
+ into equally popiulated bins in y.
+
+ The (Pearson) chi-squared is then the sum of the chi-squared contributions of
+ all bins:
+ (low_stat_number - high_stat_number)^2/(high_stat_number)
+ The nDof = number of bins - number of free params - 1
+*/
#include "LauCalcChiSq.hh"
#include "TAxis.h"
+#include "TCanvas.h"
+#include "TColor.h"
#include "TFile.h"
#include "TMath.h"
+#include "TStyle.h"
#include "TSystem.h"
#include "TTree.h"
-#include "TCanvas.h"
-#include "TColor.h"
-#include "TStyle.h"
-
-#include <iostream>
-#include <fstream>
-#include <cstdlib>
#include <cmath>
+#include <cstdlib>
+#include <fstream>
+#include <iostream>
-
-
-LauCalcChiSq::LauCalcChiSq(const TString& inputFileName) :
- inputFileName_(inputFileName),
- fileName1_(""),
- fileName2_(""),
- treeName1_(""),
- treeName2_(""),
- xName1_(""),
- xName2_(""),
- yName1_(""),
- yName2_(""),
- minContent_(10.0),
- histo1_(0),
- histo2_(0),
- chiSqHisto_(0),
- chiSqSignedHisto_(0),
- xMin_(0.0),
- xMax_(0.0),
- yMin_(0.0),
- yMax_(0.0),
- nParams_(0),
- scaleFactor_(1.0),
- verbose_(kFALSE)
+LauCalcChiSq::LauCalcChiSq( const TString& inputFileName ) :
+ inputFileName_( inputFileName ),
+ fileName1_( "" ),
+ fileName2_( "" ),
+ treeName1_( "" ),
+ treeName2_( "" ),
+ xName1_( "" ),
+ xName2_( "" ),
+ yName1_( "" ),
+ yName2_( "" ),
+ minContent_( 10.0 ),
+ histo1_( 0 ),
+ histo2_( 0 ),
+ chiSqHisto_( 0 ),
+ chiSqSignedHisto_( 0 ),
+ xMin_( 0.0 ),
+ xMax_( 0.0 ),
+ yMin_( 0.0 ),
+ yMax_( 0.0 ),
+ nParams_( 0 ),
+ scaleFactor_( 1.0 ),
+ verbose_( kFALSE )
{
}
LauCalcChiSq::~LauCalcChiSq()
{
}
void LauCalcChiSq::run()
{
- std::cout<<"Running chi-squared algorithm"<<std::endl;
- this->initialiseHistos();
+ std::cout << "Running chi-squared algorithm" << std::endl;
+ this->initialiseHistos();
- std::cout<<"Calculating chi-squared"<<std::endl;
- this->calculateChiSq();
+ std::cout << "Calculating chi-squared" << std::endl;
+ this->calculateChiSq();
- //make plots
- this->makePlots();
+ //make plots
+ this->makePlots();
- // Output the various histograms
- std::cout<<"Writing out histogram output"<<std::endl;
+ // Output the various histograms
+ std::cout << "Writing out histogram output" << std::endl;
- TFile* outFile = new TFile("checkHistos.root", "recreate");
+ TFile* outFile = new TFile( "checkHistos.root", "recreate" );
- histo1_->SetDirectory(outFile);
- histo2_->SetDirectory(outFile);
- pullHisto_->SetDirectory(outFile);
- chiSqHisto_->SetDirectory(outFile);
- chiSqSignedHisto_->SetDirectory(outFile);
+ histo1_->SetDirectory( outFile );
+ histo2_->SetDirectory( outFile );
+ pullHisto_->SetDirectory( outFile );
+ chiSqHisto_->SetDirectory( outFile );
+ chiSqSignedHisto_->SetDirectory( outFile );
- outFile->Write();
- outFile->Close();
+ outFile->Write();
+ outFile->Close();
- std::cout<<"Done"<<std::endl;
+ std::cout << "Done" << std::endl;
}
void LauCalcChiSq::calculateChiSq()
{
- Float_t toyVal(0.), dataVal(0.);
- Int_t minContent(0), ndof(0);
- Float_t diff(0.), chiSq(0.), totalChiSq(0.);
-
- minContent = histo1_->GetBinContent(1);
-
- for(Int_t i=1; i<=histo1_->GetNumberOfBins(); ++i) {
- //keep track of actual minimum
- if(histo1_->GetBinContent(i)<minContent) {
- minContent=histo1_->GetBinContent(i);
- }
-
- // Calculate Pearson chi-square for this bin, using the
- // second histogram for the expected distribution
- chiSq = 0.;
- toyVal = histo2_->GetBinContent(i);
- dataVal = histo1_->GetBinContent(i);
- diff = dataVal-toyVal;
- if(toyVal>0) chiSq = (diff*diff)/toyVal;
- totalChiSq += chiSq;
-
- chiSqHisto_->SetBinContent(i, chiSq);
-
- if(diff>0) {
- chiSqSignedHisto_->SetBinContent(i, chiSq);
- pullHisto_->SetBinContent(i, sqrt(chiSq));
- } else {
- chiSqSignedHisto_->SetBinContent(i, -chiSq);
- pullHisto_->SetBinContent(i, -sqrt(chiSq));
- }
- }
-
- ndof = histo1_->GetNumberOfBins()-nParams_-1;
-
- std::cout<<"Total ChiSq/nDof = "<<totalChiSq<<"/"<<ndof<<" = "<<totalChiSq/ndof<<std::endl;
- std::cout << "Actual minimum entries per bin: " << minContent << std::endl;
+ Float_t toyVal( 0. ), dataVal( 0. );
+ Int_t minContent( 0 ), ndof( 0 );
+ Float_t diff( 0. ), chiSq( 0. ), totalChiSq( 0. );
+
+ minContent = histo1_->GetBinContent( 1 );
+
+ for ( Int_t i = 1; i <= histo1_->GetNumberOfBins(); ++i ) {
+ //keep track of actual minimum
+ if ( histo1_->GetBinContent( i ) < minContent ) {
+ minContent = histo1_->GetBinContent( i );
+ }
+
+ // Calculate Pearson chi-square for this bin, using the
+ // second histogram for the expected distribution
+ chiSq = 0.;
+ toyVal = histo2_->GetBinContent( i );
+ dataVal = histo1_->GetBinContent( i );
+ diff = dataVal - toyVal;
+ if ( toyVal > 0 )
+ chiSq = ( diff * diff ) / toyVal;
+ totalChiSq += chiSq;
+
+ chiSqHisto_->SetBinContent( i, chiSq );
+
+ if ( diff > 0 ) {
+ chiSqSignedHisto_->SetBinContent( i, chiSq );
+ pullHisto_->SetBinContent( i, sqrt( chiSq ) );
+ } else {
+ chiSqSignedHisto_->SetBinContent( i, -chiSq );
+ pullHisto_->SetBinContent( i, -sqrt( chiSq ) );
+ }
+ }
+
+ ndof = histo1_->GetNumberOfBins() - nParams_ - 1;
+
+ std::cout << "Total ChiSq/nDof = " << totalChiSq << "/" << ndof << " = " << totalChiSq / ndof
+ << std::endl;
+ std::cout << "Actual minimum entries per bin: " << minContent << std::endl;
}
void LauCalcChiSq::makePlots()
{
- gStyle->SetPalette(1,0);
- const Int_t NRGBs = 5;
- const Int_t NCont = 255;
- Double_t stops[NRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00};
- Double_t red[NRGBs] = { 0.00, 0.00, 0.87, 1.00, 0.51};
- Double_t green[NRGBs] = { 0.00, 0.81, 1.00, 0.20, 0.00};
- Double_t blue[NRGBs] = { 0.51, 1.00, 0.12, 0.00, 0.00};
- TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
- gStyle->SetNumberContours(NCont);
- gStyle->SetOptStat(0000);
-
- TCanvas can;
-
- can.SetTopMargin(0.05);
- can.SetRightMargin(0.17);
- can.SetBottomMargin(0.16);
- can.SetLeftMargin(0.14);
-
- histo1_->SetLabelFont(62,"x");
- histo1_->SetLabelFont(62,"y");
- histo1_->SetTitleFont(62,"x");
- histo1_->SetTitleFont(62,"y");
- histo1_->SetTitleSize(0.06,"x");
- histo1_->SetTitleSize(0.06,"y");
- histo1_->SetLabelSize(0.05,"x");
- histo1_->SetLabelSize(0.05,"y");
- histo1_->SetXTitle(xName1_);
- histo1_->SetYTitle(yName1_);
- histo1_->Draw("colz");
- can.SaveAs("data.pdf");
-
- histo2_->SetLabelFont(62,"x");
- histo2_->SetLabelFont(62,"y");
- histo2_->SetTitleFont(62,"x");
- histo2_->SetTitleFont(62,"y");
- histo2_->SetTitleSize(0.06,"x");
- histo2_->SetTitleSize(0.06,"y");
- histo2_->SetLabelSize(0.05,"x");
- histo2_->SetLabelSize(0.05,"y");
- histo2_->SetXTitle(xName1_);
- histo2_->SetYTitle(yName1_);
- histo2_->Draw("colz");
- can.SaveAs("toy.pdf");
-
- if(-1.*pullHisto_->GetMinimum() > pullHisto_->GetMaximum()) pullHisto_->SetMaximum(-1.*pullHisto_->GetMinimum());
- else pullHisto_->SetMinimum(-1.*pullHisto_->GetMaximum());
-
- pullHisto_->SetLabelFont(62,"x");
- pullHisto_->SetLabelFont(62,"y");
- pullHisto_->SetTitleFont(62,"x");
- pullHisto_->SetTitleFont(62,"y");
- pullHisto_->SetTitleSize(0.06,"x");
- pullHisto_->SetTitleSize(0.06,"y");
- pullHisto_->SetLabelSize(0.05,"x");
- pullHisto_->SetLabelSize(0.05,"y");
- pullHisto_->SetXTitle(xName1_);
- pullHisto_->SetYTitle(yName1_);
- pullHisto_->Draw("colz");
- can.SaveAs("pull.pdf");
-
- chiSqHisto_->SetLabelFont(62,"x");
- chiSqHisto_->SetLabelFont(62,"y");
- chiSqHisto_->SetTitleFont(62,"x");
- chiSqHisto_->SetTitleFont(62,"y");
- chiSqHisto_->SetTitleSize(0.06,"x");
- chiSqHisto_->SetTitleSize(0.06,"y");
- chiSqHisto_->SetLabelSize(0.05,"x");
- chiSqHisto_->SetLabelSize(0.05,"y");
- chiSqHisto_->SetXTitle(xName1_);
- chiSqHisto_->SetYTitle(yName1_);
- chiSqHisto_->Draw("colz");
- can.SaveAs("chiSq.pdf");
-
- chiSqSignedHisto_->SetLabelFont(62,"x");
- chiSqSignedHisto_->SetLabelFont(62,"y");
- chiSqSignedHisto_->SetTitleFont(62,"x");
- chiSqSignedHisto_->SetTitleFont(62,"y");
- chiSqSignedHisto_->SetTitleSize(0.06,"x");
- chiSqSignedHisto_->SetTitleSize(0.06,"y");
- chiSqSignedHisto_->SetLabelSize(0.05,"x");
- chiSqSignedHisto_->SetLabelSize(0.05,"y");
- chiSqSignedHisto_->SetXTitle(xName1_);
- chiSqSignedHisto_->SetYTitle(yName1_);
- chiSqSignedHisto_->Draw("colz");
- can.SaveAs("chiSqSigned.pdf");
-
+ gStyle->SetPalette( 1, 0 );
+ const Int_t NRGBs = 5;
+ const Int_t NCont = 255;
+ Double_t stops[NRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 };
+ Double_t red[NRGBs] = { 0.00, 0.00, 0.87, 1.00, 0.51 };
+ Double_t green[NRGBs] = { 0.00, 0.81, 1.00, 0.20, 0.00 };
+ Double_t blue[NRGBs] = { 0.51, 1.00, 0.12, 0.00, 0.00 };
+ TColor::CreateGradientColorTable( NRGBs, stops, red, green, blue, NCont );
+ gStyle->SetNumberContours( NCont );
+ gStyle->SetOptStat( 0000 );
+
+ TCanvas can;
+
+ can.SetTopMargin( 0.05 );
+ can.SetRightMargin( 0.17 );
+ can.SetBottomMargin( 0.16 );
+ can.SetLeftMargin( 0.14 );
+
+ histo1_->SetLabelFont( 62, "x" );
+ histo1_->SetLabelFont( 62, "y" );
+ histo1_->SetTitleFont( 62, "x" );
+ histo1_->SetTitleFont( 62, "y" );
+ histo1_->SetTitleSize( 0.06, "x" );
+ histo1_->SetTitleSize( 0.06, "y" );
+ histo1_->SetLabelSize( 0.05, "x" );
+ histo1_->SetLabelSize( 0.05, "y" );
+ histo1_->SetXTitle( xName1_ );
+ histo1_->SetYTitle( yName1_ );
+ histo1_->Draw( "colz" );
+ can.SaveAs( "data.pdf" );
+
+ histo2_->SetLabelFont( 62, "x" );
+ histo2_->SetLabelFont( 62, "y" );
+ histo2_->SetTitleFont( 62, "x" );
+ histo2_->SetTitleFont( 62, "y" );
+ histo2_->SetTitleSize( 0.06, "x" );
+ histo2_->SetTitleSize( 0.06, "y" );
+ histo2_->SetLabelSize( 0.05, "x" );
+ histo2_->SetLabelSize( 0.05, "y" );
+ histo2_->SetXTitle( xName1_ );
+ histo2_->SetYTitle( yName1_ );
+ histo2_->Draw( "colz" );
+ can.SaveAs( "toy.pdf" );
+
+ if ( -1. * pullHisto_->GetMinimum() > pullHisto_->GetMaximum() )
+ pullHisto_->SetMaximum( -1. * pullHisto_->GetMinimum() );
+ else
+ pullHisto_->SetMinimum( -1. * pullHisto_->GetMaximum() );
+
+ pullHisto_->SetLabelFont( 62, "x" );
+ pullHisto_->SetLabelFont( 62, "y" );
+ pullHisto_->SetTitleFont( 62, "x" );
+ pullHisto_->SetTitleFont( 62, "y" );
+ pullHisto_->SetTitleSize( 0.06, "x" );
+ pullHisto_->SetTitleSize( 0.06, "y" );
+ pullHisto_->SetLabelSize( 0.05, "x" );
+ pullHisto_->SetLabelSize( 0.05, "y" );
+ pullHisto_->SetXTitle( xName1_ );
+ pullHisto_->SetYTitle( yName1_ );
+ pullHisto_->Draw( "colz" );
+ can.SaveAs( "pull.pdf" );
+
+ chiSqHisto_->SetLabelFont( 62, "x" );
+ chiSqHisto_->SetLabelFont( 62, "y" );
+ chiSqHisto_->SetTitleFont( 62, "x" );
+ chiSqHisto_->SetTitleFont( 62, "y" );
+ chiSqHisto_->SetTitleSize( 0.06, "x" );
+ chiSqHisto_->SetTitleSize( 0.06, "y" );
+ chiSqHisto_->SetLabelSize( 0.05, "x" );
+ chiSqHisto_->SetLabelSize( 0.05, "y" );
+ chiSqHisto_->SetXTitle( xName1_ );
+ chiSqHisto_->SetYTitle( yName1_ );
+ chiSqHisto_->Draw( "colz" );
+ can.SaveAs( "chiSq.pdf" );
+
+ chiSqSignedHisto_->SetLabelFont( 62, "x" );
+ chiSqSignedHisto_->SetLabelFont( 62, "y" );
+ chiSqSignedHisto_->SetTitleFont( 62, "x" );
+ chiSqSignedHisto_->SetTitleFont( 62, "y" );
+ chiSqSignedHisto_->SetTitleSize( 0.06, "x" );
+ chiSqSignedHisto_->SetTitleSize( 0.06, "y" );
+ chiSqSignedHisto_->SetLabelSize( 0.05, "x" );
+ chiSqSignedHisto_->SetLabelSize( 0.05, "y" );
+ chiSqSignedHisto_->SetXTitle( xName1_ );
+ chiSqSignedHisto_->SetYTitle( yName1_ );
+ chiSqSignedHisto_->Draw( "colz" );
+ can.SaveAs( "chiSqSigned.pdf" );
}
void LauCalcChiSq::initialiseHistos()
{
- // Open the input control file:
- // Low_stat_file_name Low_stat_tree_name Low_stat_x_axis_name Low_stat_y_axis_name
- // High_stat_file_name High_stat_tree_name High_stat_x_axis_name High_stat_y_axis_name
- // Min_bin_content N_free_params Low/high_stat_histo_ratio xMin xMax yMin yMax
- std::ifstream getData(inputFileName_.Data());
-
- // get the info on the low stat histo
- getData >> fileName1_ >> treeName1_ >> xName1_ >> yName1_;
- if (!getData.good()) {
- std::cerr<<"Error. Could not read first line of the input file "<<inputFileName_<<std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // open the file that contains the low stat histogram
- TFile * file1 = TFile::Open(fileName1_.Data(), "read");
-
- if (file1 == 0) {gSystem->Exit(EXIT_FAILURE);}
-
- // retrieve the low stat histogram
- TTree* tree1 = dynamic_cast<TTree*>(file1->Get(treeName1_.Data()));
-
- if (tree1 == 0) {
- std::cerr<<"Error. Could not find the tree "<<treeName1_
- <<" in the file "<<fileName1_<<std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // get the info on the high stat histogram
- getData >> fileName2_ >> treeName2_ >> xName2_ >> yName2_;
- if (!getData.good()) {
- std::cerr<<"Error. Could not read the second line of the input file "<<inputFileName_<<std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // if both histograms are in the same file then just retrieve the
- // high stat histogram from the file we already have open
- TFile * file2(0);
- TTree* tree2(0);
- if ( fileName2_ == fileName1_ ) {
- tree2 = dynamic_cast<TTree*>(file1->Get(treeName2_.Data()));
- }
- // otherwise open the other file and retrieve the high stat histogram from there
- else {
- file2 = TFile::Open(fileName2_.Data(), "read");
-
- if (file2 == 0) {gSystem->Exit(EXIT_FAILURE);}
-
- tree2 = dynamic_cast<TTree*>(file2->Get(treeName2_.Data()));
- }
-
- if (tree2 == 0) {
- std::cerr<<"Error. Could not find the tree "<<treeName2_
- <<" in the file "<<fileName2_<<std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // get the info on the minimum content, number of parameters and scalefactor
- Int_t nParameters(0);
- Float_t minContent(0.0), scaleFactor(1.0), xMin(0.0), xMax(1.0), yMin(0.0), yMax(1.0);
- getData >> minContent >> nParameters >> scaleFactor >> xMin >> xMax >> yMin >> yMax;
- if (getData.good()) {
- minContent_ = minContent;
- nParams_ = nParameters;
- scaleFactor_ = scaleFactor;
- xMin_ = xMin;
- xMax_ = xMax;
- yMin_ = yMin;
- yMax_ = yMax;
- }
-
- // close the text file
- getData.close();
-
- std::cout<<"Using the files and trees: "<<fileName1_<<"; "<<treeName1_
- <<" and "<<fileName2_<<"; "<<treeName2_<<std::endl;
- std::cout<<"Relative scaling factor histo1/histo2 set to "<<scaleFactor_<<std::endl;
- std::cout<<"Minimum bin content is "<<minContent_<<std::endl;
- std::cout<<"Number of free parameters is "<<nParams_<<std::endl;
-
- Double_t x;
- Double_t y;
-
- tree1->SetBranchAddress(xName1_.Data(),&x);
- tree1->SetBranchAddress(yName1_.Data(),&y);
-
- Int_t nEntries = tree1->GetEntries();
-
- Double_t* xs = new Double_t[nEntries];
- Double_t* ys = new Double_t[nEntries];
-
- for ( Int_t i=0; i < nEntries; ++i ) {
- tree1->GetEntry( i );
- xs[i] = x;
- ys[i] = y;
- }
-
- theHisto_ = new TH2Poly("theHisto_", "", xMin_, xMax_, yMin_, yMax_);
-
- //select the number of divisions to get us closest to minContent entries per bin
- std::vector<Int_t> divisions;
- this->pickBinning(xs,ys,nEntries,divisions);
-
- //perform the adaptive bining based on histo1_
- this->getHisto(xMin_, xMax_, yMin_, yMax_, xs, ys, nEntries, divisions);
-
- histo1_ = dynamic_cast<TH2Poly*>(theHisto_->Clone("histo1_"));
- histo2_ = dynamic_cast<TH2Poly*>(theHisto_->Clone("histo2_"));
- pullHisto_ = dynamic_cast<TH2Poly*>(theHisto_->Clone("pullHisto_"));
- chiSqHisto_ = dynamic_cast<TH2Poly*>(theHisto_->Clone("chiSqHisto_"));
- chiSqSignedHisto_ = dynamic_cast<TH2Poly*>(theHisto_->Clone("chiSqSignedHisto_"));
- delete[] xs;
- delete[] ys;
-
- //fill the two histograms from the trees
- TString drawString1, drawString2, weightString2;
- drawString1 += yName1_;
- drawString1 += ":";
- drawString1 += xName1_;
- drawString1 += ">>histo1_";
- drawString2 += yName2_;
- drawString2 += ":";
- drawString2 += xName2_;
- drawString2 += ">>histo2_";
- weightString2 += scaleFactor_;
-
- tree1->Draw(drawString1);
- tree2->Draw(drawString2,weightString2);
-
- histo1_->SetDirectory(0);
- histo2_->SetDirectory(0);
- pullHisto_->SetDirectory(0);
- chiSqHisto_->SetDirectory(0);
- chiSqSignedHisto_->SetDirectory(0);
-
- // close the file(s) containing the trees
- if (file1 != 0) {file1->Close();}
- delete file1;
- if (file2 != 0) {file2->Close();}
- delete file2;
+ // Open the input control file:
+ // Low_stat_file_name Low_stat_tree_name Low_stat_x_axis_name Low_stat_y_axis_name
+ // High_stat_file_name High_stat_tree_name High_stat_x_axis_name High_stat_y_axis_name
+ // Min_bin_content N_free_params Low/high_stat_histo_ratio xMin xMax yMin yMax
+ std::ifstream getData( inputFileName_.Data() );
+
+ // get the info on the low stat histo
+ getData >> fileName1_ >> treeName1_ >> xName1_ >> yName1_;
+ if ( ! getData.good() ) {
+ std::cerr << "Error. Could not read first line of the input file " << inputFileName_
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // open the file that contains the low stat histogram
+ TFile* file1 = TFile::Open( fileName1_.Data(), "read" );
+
+ if ( file1 == 0 ) {
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // retrieve the low stat histogram
+ TTree* tree1 = dynamic_cast<TTree*>( file1->Get( treeName1_.Data() ) );
+
+ if ( tree1 == 0 ) {
+ std::cerr << "Error. Could not find the tree " << treeName1_ << " in the file "
+ << fileName1_ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // get the info on the high stat histogram
+ getData >> fileName2_ >> treeName2_ >> xName2_ >> yName2_;
+ if ( ! getData.good() ) {
+ std::cerr << "Error. Could not read the second line of the input file " << inputFileName_
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // if both histograms are in the same file then just retrieve the
+ // high stat histogram from the file we already have open
+ TFile* file2( 0 );
+ TTree* tree2( 0 );
+ if ( fileName2_ == fileName1_ ) {
+ tree2 = dynamic_cast<TTree*>( file1->Get( treeName2_.Data() ) );
+ }
+ // otherwise open the other file and retrieve the high stat histogram from there
+ else {
+ file2 = TFile::Open( fileName2_.Data(), "read" );
+
+ if ( file2 == 0 ) {
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ tree2 = dynamic_cast<TTree*>( file2->Get( treeName2_.Data() ) );
+ }
+
+ if ( tree2 == 0 ) {
+ std::cerr << "Error. Could not find the tree " << treeName2_ << " in the file "
+ << fileName2_ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // get the info on the minimum content, number of parameters and scalefactor
+ Int_t nParameters( 0 );
+ Float_t minContent( 0.0 ), scaleFactor( 1.0 ), xMin( 0.0 ), xMax( 1.0 ), yMin( 0.0 ), yMax( 1.0 );
+ getData >> minContent >> nParameters >> scaleFactor >> xMin >> xMax >> yMin >> yMax;
+ if ( getData.good() ) {
+ minContent_ = minContent;
+ nParams_ = nParameters;
+ scaleFactor_ = scaleFactor;
+ xMin_ = xMin;
+ xMax_ = xMax;
+ yMin_ = yMin;
+ yMax_ = yMax;
+ }
+
+ // close the text file
+ getData.close();
+
+ std::cout << "Using the files and trees: " << fileName1_ << "; " << treeName1_ << " and "
+ << fileName2_ << "; " << treeName2_ << std::endl;
+ std::cout << "Relative scaling factor histo1/histo2 set to " << scaleFactor_ << std::endl;
+ std::cout << "Minimum bin content is " << minContent_ << std::endl;
+ std::cout << "Number of free parameters is " << nParams_ << std::endl;
+
+ Double_t x;
+ Double_t y;
+
+ tree1->SetBranchAddress( xName1_.Data(), &x );
+ tree1->SetBranchAddress( yName1_.Data(), &y );
+
+ Int_t nEntries = tree1->GetEntries();
+
+ Double_t* xs = new Double_t[nEntries];
+ Double_t* ys = new Double_t[nEntries];
+
+ for ( Int_t i = 0; i < nEntries; ++i ) {
+ tree1->GetEntry( i );
+ xs[i] = x;
+ ys[i] = y;
+ }
+
+ theHisto_ = new TH2Poly( "theHisto_", "", xMin_, xMax_, yMin_, yMax_ );
+
+ //select the number of divisions to get us closest to minContent entries per bin
+ std::vector<Int_t> divisions;
+ this->pickBinning( xs, ys, nEntries, divisions );
+
+ //perform the adaptive bining based on histo1_
+ this->getHisto( xMin_, xMax_, yMin_, yMax_, xs, ys, nEntries, divisions );
+
+ histo1_ = dynamic_cast<TH2Poly*>( theHisto_->Clone( "histo1_" ) );
+ histo2_ = dynamic_cast<TH2Poly*>( theHisto_->Clone( "histo2_" ) );
+ pullHisto_ = dynamic_cast<TH2Poly*>( theHisto_->Clone( "pullHisto_" ) );
+ chiSqHisto_ = dynamic_cast<TH2Poly*>( theHisto_->Clone( "chiSqHisto_" ) );
+ chiSqSignedHisto_ = dynamic_cast<TH2Poly*>( theHisto_->Clone( "chiSqSignedHisto_" ) );
+ delete[] xs;
+ delete[] ys;
+
+ //fill the two histograms from the trees
+ TString drawString1, drawString2, weightString2;
+ drawString1 += yName1_;
+ drawString1 += ":";
+ drawString1 += xName1_;
+ drawString1 += ">>histo1_";
+ drawString2 += yName2_;
+ drawString2 += ":";
+ drawString2 += xName2_;
+ drawString2 += ">>histo2_";
+ weightString2 += scaleFactor_;
+
+ tree1->Draw( drawString1 );
+ tree2->Draw( drawString2, weightString2 );
+
+ histo1_->SetDirectory( 0 );
+ histo2_->SetDirectory( 0 );
+ pullHisto_->SetDirectory( 0 );
+ chiSqHisto_->SetDirectory( 0 );
+ chiSqSignedHisto_->SetDirectory( 0 );
+
+ // close the file(s) containing the trees
+ if ( file1 != 0 ) {
+ file1->Close();
+ }
+ delete file1;
+ if ( file2 != 0 ) {
+ file2->Close();
+ }
+ delete file2;
}
-void LauCalcChiSq::pickBinning(const Double_t* xs, const Double_t* ys, const Int_t nEntries, std::vector<Int_t>& divisions)
+void LauCalcChiSq::pickBinning( const Double_t* xs,
+ const Double_t* ys,
+ const Int_t nEntries,
+ std::vector<Int_t>& divisions )
{
- //first check how many events we have within the histogram limits
- Int_t nIn(0);
- for(Int_t i=0; i<nEntries; ++i) {
- if(xs[i]<xMax_ && xs[i] >= xMin_ && ys[i]<yMax_ && ys[i] >= yMin_) {
- ++nIn;
- }
- }
-
- //aim to have exactly minContent events in each bin
- Int_t nBinsTarget = nIn / minContent_;
-
- std::cout << "Target is " << minContent_ << " entries per bin" << std::endl;
- std::cout << "Aiming to divide " << nIn << " entries between " << nBinsTarget << " bins" << std::endl;
-
- //we will iteratively sub-divide histogram bins into either 4, 9, 25, 49 or 121
- //here we figure out how many 4s, 9s, 25s, 49s and 121s to use to best match our target without exceeding it
- Int_t nDivisions(0), nNines(0), nTwentyFives(0), nFortyNines(0), nEleventyElevens(0), nBins(1);
- Int_t nDivisionsBest(0), nNinesBest(0), nTwentyFivesBest(0), nFortyNinesBest(0), nEleventyElevensBest(0), nBinsBest(1);
-
- do {
- ++nDivisions;
- for(nNines=0; nNines<=nDivisions; ++nNines) {
- for(nTwentyFives=0; nTwentyFives<=nDivisions-nNines; ++nTwentyFives) {
- for(nFortyNines=0; nFortyNines<=nDivisions-nNines-nTwentyFives; ++nFortyNines) {
- for(nEleventyElevens=0; nEleventyElevens<=nDivisions-nNines-nTwentyFives-nFortyNines; ++nEleventyElevens) {
- nBins = TMath::Power(4,nDivisions-nNines-nTwentyFives-nFortyNines-nEleventyElevens)
- *TMath::Power(9,nNines)*TMath::Power(25,nTwentyFives)
- *TMath::Power(49,nFortyNines)*TMath::Power(121,nEleventyElevens);
- if(nBins < nBinsTarget && nBins > nBinsBest) {
- //keep track of the best number of bins so far
- nBinsBest = nBins;
- nDivisionsBest = nDivisions;
- nNinesBest = nNines;
- nTwentyFivesBest = nTwentyFives;
- nFortyNinesBest = nFortyNines;
- nEleventyElevensBest = nEleventyElevens;
- }
- }
- }
- }
- }
- } while(TMath::Power(4,nDivisions+1) < nBinsTarget);//if 4^n > target then we've gone far enough
-
- std::cout << "Using " << nBinsBest << " bins" << std::endl;
-
- //fill the vector with the divisions that we want to make
- for(Int_t i=0; i<nEleventyElevensBest; ++i) {
- divisions.push_back(11);
- }
- for(Int_t i=0; i<nFortyNinesBest; ++i) {
- divisions.push_back(7);
- }
- for(Int_t i=0; i<nTwentyFivesBest; ++i) {
- divisions.push_back(5);
- }
- for(Int_t i=0; i<nNinesBest; ++i) {
- divisions.push_back(3);
- }
- for(Int_t i=0; i<nDivisionsBest-nNinesBest-nTwentyFivesBest-nFortyNinesBest-nEleventyElevensBest; ++i) {
- divisions.push_back(2);
- }
+ //first check how many events we have within the histogram limits
+ Int_t nIn( 0 );
+ for ( Int_t i = 0; i < nEntries; ++i ) {
+ if ( xs[i] < xMax_ && xs[i] >= xMin_ && ys[i] < yMax_ && ys[i] >= yMin_ ) {
+ ++nIn;
+ }
+ }
+
+ //aim to have exactly minContent events in each bin
+ Int_t nBinsTarget = nIn / minContent_;
+
+ std::cout << "Target is " << minContent_ << " entries per bin" << std::endl;
+ std::cout << "Aiming to divide " << nIn << " entries between " << nBinsTarget << " bins"
+ << std::endl;
+
+ //we will iteratively sub-divide histogram bins into either 4, 9, 25, 49 or 121
+ //here we figure out how many 4s, 9s, 25s, 49s and 121s to use to best match our target without exceeding it
+ Int_t nDivisions( 0 ), nNines( 0 ), nTwentyFives( 0 ), nFortyNines( 0 ), nEleventyElevens( 0 ),
+ nBins( 1 );
+ Int_t nDivisionsBest( 0 ), nNinesBest( 0 ), nTwentyFivesBest( 0 ), nFortyNinesBest( 0 ),
+ nEleventyElevensBest( 0 ), nBinsBest( 1 );
+
+ do {
+ ++nDivisions;
+ for ( nNines = 0; nNines <= nDivisions; ++nNines ) {
+ for ( nTwentyFives = 0; nTwentyFives <= nDivisions - nNines; ++nTwentyFives ) {
+ for ( nFortyNines = 0; nFortyNines <= nDivisions - nNines - nTwentyFives;
+ ++nFortyNines ) {
+ for ( nEleventyElevens = 0;
+ nEleventyElevens <= nDivisions - nNines - nTwentyFives - nFortyNines;
+ ++nEleventyElevens ) {
+ nBins = TMath::Power( 4,
+ nDivisions - nNines - nTwentyFives - nFortyNines -
+ nEleventyElevens ) *
+ TMath::Power( 9, nNines ) * TMath::Power( 25, nTwentyFives ) *
+ TMath::Power( 49, nFortyNines ) *
+ TMath::Power( 121, nEleventyElevens );
+ if ( nBins < nBinsTarget && nBins > nBinsBest ) {
+ //keep track of the best number of bins so far
+ nBinsBest = nBins;
+ nDivisionsBest = nDivisions;
+ nNinesBest = nNines;
+ nTwentyFivesBest = nTwentyFives;
+ nFortyNinesBest = nFortyNines;
+ nEleventyElevensBest = nEleventyElevens;
+ }
+ }
+ }
+ }
+ }
+ } while ( TMath::Power( 4, nDivisions + 1 ) <
+ nBinsTarget ); //if 4^n > target then we've gone far enough
+
+ std::cout << "Using " << nBinsBest << " bins" << std::endl;
+
+ //fill the vector with the divisions that we want to make
+ for ( Int_t i = 0; i < nEleventyElevensBest; ++i ) {
+ divisions.push_back( 11 );
+ }
+ for ( Int_t i = 0; i < nFortyNinesBest; ++i ) {
+ divisions.push_back( 7 );
+ }
+ for ( Int_t i = 0; i < nTwentyFivesBest; ++i ) {
+ divisions.push_back( 5 );
+ }
+ for ( Int_t i = 0; i < nNinesBest; ++i ) {
+ divisions.push_back( 3 );
+ }
+ for ( Int_t i = 0; i < nDivisionsBest - nNinesBest - nTwentyFivesBest - nFortyNinesBest -
+ nEleventyElevensBest;
+ ++i ) {
+ divisions.push_back( 2 );
+ }
}
-void LauCalcChiSq::getHisto(const Double_t xMin, const Double_t xMax, const Double_t yMin, const Double_t yMax, const Double_t* xs, const Double_t* ys, const Int_t nEntries, const std::vector<Int_t>& divisions, const UInt_t iter)
+void LauCalcChiSq::getHisto( const Double_t xMin,
+ const Double_t xMax,
+ const Double_t yMin,
+ const Double_t yMax,
+ const Double_t* xs,
+ const Double_t* ys,
+ const Int_t nEntries,
+ const std::vector<Int_t>& divisions,
+ const UInt_t iter )
{
- //If it's the last iteration create the bin and return
- if(iter == divisions.size()) {
- Double_t * x_new = new Double_t[5];
- Double_t * y_new = new Double_t[5];
- x_new[0] = xMin; x_new[1] = xMin; x_new[2] = xMax; x_new[3] = xMax; x_new[4] = xMin;
- y_new[0] = yMin; y_new[1] = yMax; y_new[2] = yMax; y_new[3] = yMin; y_new[4] = yMin;
- theHisto_->AddBin(5, x_new, y_new);
- if(verbose_) std::cout << "Adding bin from (" << xMin << "," << yMin << ") to (" << xMax << "," << yMax << ")" << std::endl;
- return;
- }
-
- //If not the last iteration then divide the bin
- Int_t n_divx=divisions[iter];
- Int_t n_divy=divisions[iter];
-
- if(verbose_) std::cout << "Dividing bin from (" << xMin << "," << yMin << ") to (" << xMax << "," << yMax << ") into " << n_divx << " by " << n_divy << " subbins" << std::endl;
-
- Double_t *xIn = new Double_t[nEntries];
- Double_t *yIn = new Double_t[nEntries];
- Int_t *xIndex = new Int_t [nEntries+2];
- Int_t *yIndex = new Int_t [nEntries+2];
-
- Int_t xCountIn = 0;
- for(Int_t i = 0; i<nEntries; ++i) {
- if ((xs[i]<xMin)||(xs[i]>xMax)||(ys[i]<yMin)||(ys[i]>yMax)) continue;
- xIn[xCountIn] = xs[i];
- ++xCountIn;
- }
-
- //find the delimitting x and y values for the sub bins
- Double_t xLimits[n_divx + 1];
- Double_t yLimits[n_divx][n_divy + 1];
-
- //first sort entries in x and divide bin into equally populated bins in x
- TMath::Sort(xCountIn, xIn, xIndex, false);
-
- xLimits[0] = xMin;
- xLimits[n_divx] = xMax;
- for (Int_t nDivx = 0; nDivx < n_divx; ++nDivx){
- if (nDivx < (n_divx-1)){
- xLimits[nDivx+1] = xIn[xIndex[xCountIn*(nDivx+1)/n_divx]];
- }
-
- //for each bin in x divide into equally populated bins in y
- yLimits[nDivx][0] = yMin;
- yLimits[nDivx][n_divy] = yMax;
- Int_t yCountIn = 0;
-
- for(Int_t i = 0; i<nEntries; ++i) {
- if ((xs[i]<xMin)||(xs[i]>xMax)||(ys[i]<yMin)||(ys[i]>yMax)) continue;
- if ((xs[i]<xLimits[nDivx])||(xs[i]>=xLimits[nDivx+1])||(ys[i]<yMin)||(ys[i]>yMax)) continue;
- yIn[yCountIn] = ys[i];
- ++yCountIn;
- }
-
- TMath::Sort(yCountIn, yIn, yIndex, false);
-
- for (Int_t nDivy = 1; nDivy < n_divy; ++nDivy){
- yLimits[nDivx][nDivy] = yIn[yIndex[yCountIn*nDivy/n_divy]];
- }
- }
-
- delete[] xIn;
- delete[] yIn;
- delete[] xIndex;
- delete[] yIndex;
-
- //call for each sub bin
- for (Int_t nDivx = 0; nDivx < n_divx; ++nDivx){
- for (Int_t nDivy = 0; nDivy < n_divy; ++nDivy){
- this->getHisto(xLimits[nDivx], xLimits[nDivx + 1], yLimits[nDivx][nDivy], yLimits[nDivx][nDivy + 1], xs, ys, nEntries, divisions,iter+1);
- }
- }
+ //If it's the last iteration create the bin and return
+ if ( iter == divisions.size() ) {
+ Double_t* x_new = new Double_t[5];
+ Double_t* y_new = new Double_t[5];
+ x_new[0] = xMin;
+ x_new[1] = xMin;
+ x_new[2] = xMax;
+ x_new[3] = xMax;
+ x_new[4] = xMin;
+ y_new[0] = yMin;
+ y_new[1] = yMax;
+ y_new[2] = yMax;
+ y_new[3] = yMin;
+ y_new[4] = yMin;
+ theHisto_->AddBin( 5, x_new, y_new );
+ if ( verbose_ )
+ std::cout << "Adding bin from (" << xMin << "," << yMin << ") to (" << xMax << ","
+ << yMax << ")" << std::endl;
+ return;
+ }
+
+ //If not the last iteration then divide the bin
+ Int_t n_divx = divisions[iter];
+ Int_t n_divy = divisions[iter];
+
+ if ( verbose_ )
+ std::cout << "Dividing bin from (" << xMin << "," << yMin << ") to (" << xMax << "," << yMax
+ << ") into " << n_divx << " by " << n_divy << " subbins" << std::endl;
+
+ Double_t* xIn = new Double_t[nEntries];
+ Double_t* yIn = new Double_t[nEntries];
+ Int_t* xIndex = new Int_t[nEntries + 2];
+ Int_t* yIndex = new Int_t[nEntries + 2];
+
+ Int_t xCountIn = 0;
+ for ( Int_t i = 0; i < nEntries; ++i ) {
+ if ( ( xs[i] < xMin ) || ( xs[i] > xMax ) || ( ys[i] < yMin ) || ( ys[i] > yMax ) )
+ continue;
+ xIn[xCountIn] = xs[i];
+ ++xCountIn;
+ }
+
+ //find the delimitting x and y values for the sub bins
+ Double_t xLimits[n_divx + 1];
+ Double_t yLimits[n_divx][n_divy + 1];
+
+ //first sort entries in x and divide bin into equally populated bins in x
+ TMath::Sort( xCountIn, xIn, xIndex, false );
+
+ xLimits[0] = xMin;
+ xLimits[n_divx] = xMax;
+ for ( Int_t nDivx = 0; nDivx < n_divx; ++nDivx ) {
+ if ( nDivx < ( n_divx - 1 ) ) {
+ xLimits[nDivx + 1] = xIn[xIndex[xCountIn * ( nDivx + 1 ) / n_divx]];
+ }
+
+ //for each bin in x divide into equally populated bins in y
+ yLimits[nDivx][0] = yMin;
+ yLimits[nDivx][n_divy] = yMax;
+ Int_t yCountIn = 0;
+
+ for ( Int_t i = 0; i < nEntries; ++i ) {
+ if ( ( xs[i] < xMin ) || ( xs[i] > xMax ) || ( ys[i] < yMin ) || ( ys[i] > yMax ) )
+ continue;
+ if ( ( xs[i] < xLimits[nDivx] ) || ( xs[i] >= xLimits[nDivx + 1] ) ||
+ ( ys[i] < yMin ) || ( ys[i] > yMax ) )
+ continue;
+ yIn[yCountIn] = ys[i];
+ ++yCountIn;
+ }
+
+ TMath::Sort( yCountIn, yIn, yIndex, false );
+
+ for ( Int_t nDivy = 1; nDivy < n_divy; ++nDivy ) {
+ yLimits[nDivx][nDivy] = yIn[yIndex[yCountIn * nDivy / n_divy]];
+ }
+ }
+
+ delete[] xIn;
+ delete[] yIn;
+ delete[] xIndex;
+ delete[] yIndex;
+
+ //call for each sub bin
+ for ( Int_t nDivx = 0; nDivx < n_divx; ++nDivx ) {
+ for ( Int_t nDivy = 0; nDivy < n_divy; ++nDivy ) {
+ this->getHisto( xLimits[nDivx],
+ xLimits[nDivx + 1],
+ yLimits[nDivx][nDivy],
+ yLimits[nDivx][nDivy + 1],
+ xs,
+ ys,
+ nEntries,
+ divisions,
+ iter + 1 );
+ }
+ }
}
-
diff --git a/src/LauCartesianCPCoeffSet.cc b/src/LauCartesianCPCoeffSet.cc
index 0a1eba1..4054e17 100644
--- a/src/LauCartesianCPCoeffSet.cc
+++ b/src/LauCartesianCPCoeffSet.cc
@@ -1,279 +1,325 @@
/*
Copyright 2006 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauCartesianCPCoeffSet.cc
\brief File containing implementation of LauCartesianCPCoeffSet class.
*/
-#include <iostream>
-#include <fstream>
-#include <vector>
-
-#include "TMath.h"
-#include "TRandom.h"
-
#include "LauCartesianCPCoeffSet.hh"
+
#include "LauComplex.hh"
#include "LauConstants.hh"
#include "LauParameter.hh"
#include "LauPrint.hh"
+#include "TMath.h"
+#include "TRandom.h"
+#include <fstream>
+#include <iostream>
+#include <vector>
-LauCartesianCPCoeffSet::LauCartesianCPCoeffSet(const TString& compName, Double_t x, Double_t y, Double_t deltaX, Double_t deltaY,
- Bool_t xFixed, Bool_t yFixed, Bool_t deltaXFixed, Bool_t deltaYFixed, Bool_t deltaXSecondStage, Bool_t deltaYSecondStage) :
- LauAbsCoeffSet(compName),
- x_(new LauParameter("X", x, minRealImagPart_, maxRealImagPart_, xFixed)),
- y_(new LauParameter("Y", y, minRealImagPart_, maxRealImagPart_, yFixed)),
- deltaX_(new LauParameter("DeltaX", deltaX, minDelta_, maxDelta_, deltaXFixed)),
- deltaY_(new LauParameter("DeltaY", deltaY, minDelta_, maxDelta_, deltaYFixed)),
- particleCoeff_( x+deltaX, y+deltaY ),
- antiparticleCoeff_( x-deltaX, y-deltaY ),
- acp_("ACP", -2.0*(x*deltaX + y*deltaY)/(x*x + deltaX*deltaX + y*y + deltaY*deltaY), -1.0, 1.0, deltaXFixed&&deltaYFixed)
+LauCartesianCPCoeffSet::LauCartesianCPCoeffSet( const TString& compName,
+ Double_t x,
+ Double_t y,
+ Double_t deltaX,
+ Double_t deltaY,
+ Bool_t xFixed,
+ Bool_t yFixed,
+ Bool_t deltaXFixed,
+ Bool_t deltaYFixed,
+ Bool_t deltaXSecondStage,
+ Bool_t deltaYSecondStage ) :
+ LauAbsCoeffSet( compName ),
+ x_( new LauParameter( "X", x, minRealImagPart_, maxRealImagPart_, xFixed ) ),
+ y_( new LauParameter( "Y", y, minRealImagPart_, maxRealImagPart_, yFixed ) ),
+ deltaX_( new LauParameter( "DeltaX", deltaX, minDelta_, maxDelta_, deltaXFixed ) ),
+ deltaY_( new LauParameter( "DeltaY", deltaY, minDelta_, maxDelta_, deltaYFixed ) ),
+ particleCoeff_( x + deltaX, y + deltaY ),
+ antiparticleCoeff_( x - deltaX, y - deltaY ),
+ acp_( "ACP",
+ -2.0 * ( x * deltaX + y * deltaY ) / ( x * x + deltaX * deltaX + y * y + deltaY * deltaY ),
+ -1.0,
+ 1.0,
+ deltaXFixed && deltaYFixed )
{
- if (deltaXSecondStage && !deltaXFixed) {
- deltaX_->secondStage(kTRUE);
- deltaX_->initValue(0.0);
- }
- if (deltaYSecondStage && !deltaYFixed) {
- deltaY_->secondStage(kTRUE);
- deltaY_->initValue(0.0);
- }
+ if ( deltaXSecondStage && ! deltaXFixed ) {
+ deltaX_->secondStage( kTRUE );
+ deltaX_->initValue( 0.0 );
+ }
+ if ( deltaYSecondStage && ! deltaYFixed ) {
+ deltaY_->secondStage( kTRUE );
+ deltaY_->initValue( 0.0 );
+ }
}
-LauCartesianCPCoeffSet::LauCartesianCPCoeffSet(const LauCartesianCPCoeffSet& rhs, CloneOption cloneOption, Double_t constFactor) : LauAbsCoeffSet(rhs.name()),
- x_(0),
- y_(0),
- deltaX_(0),
- deltaY_(0),
- particleCoeff_( rhs.particleCoeff_ ),
- antiparticleCoeff_( rhs.antiparticleCoeff_ ),
- acp_( rhs.acp_ )
+LauCartesianCPCoeffSet::LauCartesianCPCoeffSet( const LauCartesianCPCoeffSet& rhs,
+ CloneOption cloneOption,
+ Double_t constFactor ) :
+ LauAbsCoeffSet( rhs.name() ),
+ x_( 0 ),
+ y_( 0 ),
+ deltaX_( 0 ),
+ deltaY_( 0 ),
+ particleCoeff_( rhs.particleCoeff_ ),
+ antiparticleCoeff_( rhs.antiparticleCoeff_ ),
+ acp_( rhs.acp_ )
{
- if ( cloneOption == All || cloneOption == TieRealPart ) {
- x_ = rhs.x_->createClone(constFactor);
- } else {
- x_ = new LauParameter("X", rhs.x_->value(), minRealImagPart_, maxRealImagPart_, rhs.x_->fixed());
- if ( rhs.x_->blind() ) {
- const LauBlind* blinder = rhs.x_->blinder();
- x_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
- }
- }
-
- if ( cloneOption == All || cloneOption == TieImagPart ) {
- y_ = rhs.y_->createClone(constFactor);
- } else {
- y_ = new LauParameter("Y", rhs.y_->value(), minRealImagPart_, maxRealImagPart_, rhs.y_->fixed());
- if ( rhs.y_->blind() ) {
- const LauBlind* blinder = rhs.y_->blinder();
- y_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
- }
- }
-
- if ( cloneOption == All || cloneOption == TieCPPars ) {
- deltaX_ = rhs.deltaX_->createClone(constFactor);
- deltaY_ = rhs.deltaY_->createClone(constFactor);
- } else {
- deltaX_ = new LauParameter("DeltaX", rhs.deltaX_->value(), minDelta_, maxDelta_, rhs.deltaX_->fixed());
- deltaY_ = new LauParameter("DeltaY", rhs.deltaY_->value(), minDelta_, maxDelta_, rhs.deltaY_->fixed());
- if ( rhs.deltaX_->secondStage() && !rhs.deltaX_->fixed() ) {
- deltaX_->secondStage(kTRUE);
- deltaX_->initValue(0.0);
- }
- if ( rhs.deltaY_->secondStage() && !rhs.deltaY_->fixed() ) {
- deltaY_->secondStage(kTRUE);
- deltaY_->initValue(0.0);
- }
- if ( rhs.deltaX_->blind() ) {
- const LauBlind* blinder = rhs.deltaX_->blinder();
- deltaX_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
- }
- if ( rhs.deltaY_->blind() ) {
- const LauBlind* blinder = rhs.deltaY_->blinder();
- deltaY_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
- }
- }
+ if ( cloneOption == All || cloneOption == TieRealPart ) {
+ x_ = rhs.x_->createClone( constFactor );
+ } else {
+ x_ = new LauParameter( "X",
+ rhs.x_->value(),
+ minRealImagPart_,
+ maxRealImagPart_,
+ rhs.x_->fixed() );
+ if ( rhs.x_->blind() ) {
+ const LauBlind* blinder = rhs.x_->blinder();
+ x_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
+ }
+ }
+
+ if ( cloneOption == All || cloneOption == TieImagPart ) {
+ y_ = rhs.y_->createClone( constFactor );
+ } else {
+ y_ = new LauParameter( "Y",
+ rhs.y_->value(),
+ minRealImagPart_,
+ maxRealImagPart_,
+ rhs.y_->fixed() );
+ if ( rhs.y_->blind() ) {
+ const LauBlind* blinder = rhs.y_->blinder();
+ y_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
+ }
+ }
+
+ if ( cloneOption == All || cloneOption == TieCPPars ) {
+ deltaX_ = rhs.deltaX_->createClone( constFactor );
+ deltaY_ = rhs.deltaY_->createClone( constFactor );
+ } else {
+ deltaX_ = new LauParameter( "DeltaX",
+ rhs.deltaX_->value(),
+ minDelta_,
+ maxDelta_,
+ rhs.deltaX_->fixed() );
+ deltaY_ = new LauParameter( "DeltaY",
+ rhs.deltaY_->value(),
+ minDelta_,
+ maxDelta_,
+ rhs.deltaY_->fixed() );
+ if ( rhs.deltaX_->secondStage() && ! rhs.deltaX_->fixed() ) {
+ deltaX_->secondStage( kTRUE );
+ deltaX_->initValue( 0.0 );
+ }
+ if ( rhs.deltaY_->secondStage() && ! rhs.deltaY_->fixed() ) {
+ deltaY_->secondStage( kTRUE );
+ deltaY_->initValue( 0.0 );
+ }
+ if ( rhs.deltaX_->blind() ) {
+ const LauBlind* blinder = rhs.deltaX_->blinder();
+ deltaX_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
+ }
+ if ( rhs.deltaY_->blind() ) {
+ const LauBlind* blinder = rhs.deltaY_->blinder();
+ deltaY_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
+ }
+ }
}
std::vector<LauParameter*> LauCartesianCPCoeffSet::getParameters()
{
- std::vector<LauParameter*> pars;
- pars.push_back(x_);
- pars.push_back(y_);
- pars.push_back(deltaX_);
- pars.push_back(deltaY_);
- return pars;
+ std::vector<LauParameter*> pars;
+ pars.push_back( x_ );
+ pars.push_back( y_ );
+ pars.push_back( deltaX_ );
+ pars.push_back( deltaY_ );
+ return pars;
}
void LauCartesianCPCoeffSet::printParValues() const
{
- std::cout<<"INFO in LauCartesianCPCoeffSet::printParValues : Component \""<<this->name()<<"\" has ";
- std::cout<<"x = "<<x_->value()<<",\t";
- std::cout<<"y = "<<y_->value()<<",\t";
- std::cout<<"Delta x = "<<deltaX_->value()<<",\t";
- std::cout<<"Delta y = "<<deltaY_->value()<<"."<<std::endl;
+ std::cout << "INFO in LauCartesianCPCoeffSet::printParValues : Component \"" << this->name()
+ << "\" has ";
+ std::cout << "x = " << x_->value() << ",\t";
+ std::cout << "y = " << y_->value() << ",\t";
+ std::cout << "Delta x = " << deltaX_->value() << ",\t";
+ std::cout << "Delta y = " << deltaY_->value() << "." << std::endl;
}
-void LauCartesianCPCoeffSet::printTableHeading(std::ostream& stream) const
+void LauCartesianCPCoeffSet::printTableHeading( std::ostream& stream ) const
{
- stream<<"\\begin{tabular}{|l|c|c|c|c|}"<<std::endl;
- stream<<"\\hline"<<std::endl;
- stream<<"Component & Real Part & Imaginary Part & $\\Delta$ Real Part & $\\Delta$ Imaginary Part \\\\"<<std::endl;
- stream<<"\\hline"<<std::endl;
+ stream << "\\begin{tabular}{|l|c|c|c|c|}" << std::endl;
+ stream << "\\hline" << std::endl;
+ stream << "Component & Real Part & Imaginary Part & $\\Delta$ Real Part & $\\Delta$ Imaginary Part \\\\"
+ << std::endl;
+ stream << "\\hline" << std::endl;
}
-void LauCartesianCPCoeffSet::printTableRow(std::ostream& stream) const
+void LauCartesianCPCoeffSet::printTableRow( std::ostream& stream ) const
{
- LauPrint print;
- TString resName = this->name();
- resName = resName.ReplaceAll("_", "\\_");
- stream<<resName<<" & $";
- print.printFormat(stream, x_->value());
- stream<<" \\pm ";
- print.printFormat(stream, x_->error());
- stream<<"$ & $";
- print.printFormat(stream, y_->value());
- stream<<" \\pm ";
- print.printFormat(stream, y_->error());
- stream<<"$ & $";
- print.printFormat(stream, deltaX_->value());
- stream<<" \\pm ";
- print.printFormat(stream, deltaX_->error());
- stream<<"$ & $";
- print.printFormat(stream, deltaY_->value());
- stream<<" \\pm ";
- print.printFormat(stream, deltaY_->error());
- stream<<"$ \\\\"<<std::endl;
+ LauPrint print;
+ TString resName = this->name();
+ resName = resName.ReplaceAll( "_", "\\_" );
+ stream << resName << " & $";
+ print.printFormat( stream, x_->value() );
+ stream << " \\pm ";
+ print.printFormat( stream, x_->error() );
+ stream << "$ & $";
+ print.printFormat( stream, y_->value() );
+ stream << " \\pm ";
+ print.printFormat( stream, y_->error() );
+ stream << "$ & $";
+ print.printFormat( stream, deltaX_->value() );
+ stream << " \\pm ";
+ print.printFormat( stream, deltaX_->error() );
+ stream << "$ & $";
+ print.printFormat( stream, deltaY_->value() );
+ stream << " \\pm ";
+ print.printFormat( stream, deltaY_->error() );
+ stream << "$ \\\\" << std::endl;
}
void LauCartesianCPCoeffSet::randomiseInitValues()
{
- if (x_->fixed() == kFALSE) {
- // Choose a value for "X" between -3.0 and 3.0
- Double_t value = LauAbsCoeffSet::getRandomiser()->Rndm()*6.0 - 3.0;
- x_->initValue(value); x_->value(value);
- }
- if (y_->fixed() == kFALSE) {
- // Choose a value for "Y" between -3.0 and 3.0
- Double_t value = LauAbsCoeffSet::getRandomiser()->Rndm()*6.0 - 3.0;
- y_->initValue(value); y_->value(value);
- }
- if (deltaX_->fixed() == kFALSE && deltaX_->secondStage() == kFALSE) {
- // Choose a value for "Delta X" between -0.5 and 0.5
- Double_t value = LauAbsCoeffSet::getRandomiser()->Rndm()*1.0 - 0.5;
- deltaX_->initValue(value); deltaX_->value(value);
- }
- if (deltaY_->fixed() == kFALSE && deltaY_->secondStage() == kFALSE) {
- // Choose a value for "Delta Y" between -0.5 and 0.5
- Double_t value = LauAbsCoeffSet::getRandomiser()->Rndm()*1.0 - 0.5;
- deltaY_->initValue(value); deltaY_->value(value);
- }
+ if ( x_->fixed() == kFALSE ) {
+ // Choose a value for "X" between -3.0 and 3.0
+ Double_t value = LauAbsCoeffSet::getRandomiser()->Rndm() * 6.0 - 3.0;
+ x_->initValue( value );
+ x_->value( value );
+ }
+ if ( y_->fixed() == kFALSE ) {
+ // Choose a value for "Y" between -3.0 and 3.0
+ Double_t value = LauAbsCoeffSet::getRandomiser()->Rndm() * 6.0 - 3.0;
+ y_->initValue( value );
+ y_->value( value );
+ }
+ if ( deltaX_->fixed() == kFALSE && deltaX_->secondStage() == kFALSE ) {
+ // Choose a value for "Delta X" between -0.5 and 0.5
+ Double_t value = LauAbsCoeffSet::getRandomiser()->Rndm() * 1.0 - 0.5;
+ deltaX_->initValue( value );
+ deltaX_->value( value );
+ }
+ if ( deltaY_->fixed() == kFALSE && deltaY_->secondStage() == kFALSE ) {
+ // Choose a value for "Delta Y" between -0.5 and 0.5
+ Double_t value = LauAbsCoeffSet::getRandomiser()->Rndm() * 1.0 - 0.5;
+ deltaY_->initValue( value );
+ deltaY_->value( value );
+ }
}
void LauCartesianCPCoeffSet::finaliseValues()
{
- // update the pulls
- x_->updatePull();
- y_->updatePull();
- deltaX_->updatePull();
- deltaY_->updatePull();
+ // update the pulls
+ x_->updatePull();
+ y_->updatePull();
+ deltaX_->updatePull();
+ deltaY_->updatePull();
}
const LauComplex& LauCartesianCPCoeffSet::particleCoeff()
{
- particleCoeff_.setRealImagPart( x_->unblindValue()+deltaX_->unblindValue(), y_->unblindValue()+deltaY_->unblindValue() );
- return particleCoeff_;
+ particleCoeff_.setRealImagPart( x_->unblindValue() + deltaX_->unblindValue(),
+ y_->unblindValue() + deltaY_->unblindValue() );
+ return particleCoeff_;
}
const LauComplex& LauCartesianCPCoeffSet::antiparticleCoeff()
{
- antiparticleCoeff_.setRealImagPart( x_->unblindValue()-deltaX_->unblindValue(), y_->unblindValue()-deltaY_->unblindValue() );
- return antiparticleCoeff_;
+ antiparticleCoeff_.setRealImagPart( x_->unblindValue() - deltaX_->unblindValue(),
+ y_->unblindValue() - deltaY_->unblindValue() );
+ return antiparticleCoeff_;
}
-void LauCartesianCPCoeffSet::setCoeffValues( const LauComplex& coeff, const LauComplex& coeffBar, Bool_t init )
+void LauCartesianCPCoeffSet::setCoeffValues( const LauComplex& coeff,
+ const LauComplex& coeffBar,
+ Bool_t init )
{
- LauComplex average( coeff );
- average += coeffBar;
- average.rescale( 0.5 );
-
- Double_t xVal( average.re() );
- Double_t yVal( average.im() );
- Double_t deltaXVal( coeff.re() - average.re() );
- Double_t deltaYVal( coeff.im() - average.im() );
-
- x_->value( xVal );
- y_->value( yVal );
- deltaX_->value( deltaXVal );
- deltaY_->value( deltaYVal );
-
- if ( init ) {
- x_->genValue( xVal );
- y_->genValue( yVal );
- deltaX_->genValue( deltaXVal );
- deltaY_->genValue( deltaYVal );
-
- x_->initValue( xVal );
- y_->initValue( yVal );
- deltaX_->initValue( deltaXVal );
- deltaY_->initValue( deltaYVal );
- }
+ LauComplex average( coeff );
+ average += coeffBar;
+ average.rescale( 0.5 );
+
+ Double_t xVal( average.re() );
+ Double_t yVal( average.im() );
+ Double_t deltaXVal( coeff.re() - average.re() );
+ Double_t deltaYVal( coeff.im() - average.im() );
+
+ x_->value( xVal );
+ y_->value( yVal );
+ deltaX_->value( deltaXVal );
+ deltaY_->value( deltaYVal );
+
+ if ( init ) {
+ x_->genValue( xVal );
+ y_->genValue( yVal );
+ deltaX_->genValue( deltaXVal );
+ deltaY_->genValue( deltaYVal );
+
+ x_->initValue( xVal );
+ y_->initValue( yVal );
+ deltaX_->initValue( deltaXVal );
+ deltaY_->initValue( deltaYVal );
+ }
}
LauParameter LauCartesianCPCoeffSet::acp()
{
- // set the name
- TString parName(this->baseName()); parName += "_ACP";
- acp_.name(parName);
+ // set the name
+ TString parName( this->baseName() );
+ parName += "_ACP";
+ acp_.name( parName );
- // work out the ACP value
- Double_t numer = x_->value()*deltaX_->value() + y_->value()*deltaY_->value();
- Double_t denom = x_->value()*x_->value() + deltaX_->value()*deltaX_->value() + y_->value()*y_->value() + deltaY_->value()*deltaY_->value();
- Double_t value = -2.0*numer/denom;
+ // work out the ACP value
+ Double_t numer = x_->value() * deltaX_->value() + y_->value() * deltaY_->value();
+ Double_t denom = x_->value() * x_->value() + deltaX_->value() * deltaX_->value() +
+ y_->value() * y_->value() + deltaY_->value() * deltaY_->value();
+ Double_t value = -2.0 * numer / denom;
- // is it fixed?
- Bool_t fixed = deltaX_->fixed() && deltaY_->fixed();
- acp_.fixed(fixed);
+ // is it fixed?
+ Bool_t fixed = deltaX_->fixed() && deltaY_->fixed();
+ acp_.fixed( fixed );
- // we can't work out the error without the covariance matrix
- Double_t error(0.0);
+ // we can't work out the error without the covariance matrix
+ Double_t error( 0.0 );
- // set the value and error
- acp_.valueAndErrors(value,error);
+ // set the value and error
+ acp_.valueAndErrors( value, error );
- return acp_;
+ return acp_;
}
-LauAbsCoeffSet* LauCartesianCPCoeffSet::createClone(const TString& newName, CloneOption cloneOption, Double_t constFactor)
+LauAbsCoeffSet* LauCartesianCPCoeffSet::createClone( const TString& newName,
+ CloneOption cloneOption,
+ Double_t constFactor )
{
- LauAbsCoeffSet* clone(0);
- if ( cloneOption == All || cloneOption == TieRealPart || cloneOption == TieImagPart || cloneOption == TieCPPars ) {
- clone = new LauCartesianCPCoeffSet( *this, cloneOption, constFactor );
- clone->name( newName );
- } else {
- std::cerr << "ERROR in LauCartesianCPCoeffSet::createClone : Invalid clone option" << std::endl;
- }
- return clone;
+ LauAbsCoeffSet* clone( 0 );
+ if ( cloneOption == All || cloneOption == TieRealPart || cloneOption == TieImagPart ||
+ cloneOption == TieCPPars ) {
+ clone = new LauCartesianCPCoeffSet( *this, cloneOption, constFactor );
+ clone->name( newName );
+ } else {
+ std::cerr << "ERROR in LauCartesianCPCoeffSet::createClone : Invalid clone option"
+ << std::endl;
+ }
+ return clone;
}
-
diff --git a/src/LauCartesianGammaCPCoeffSet.cc b/src/LauCartesianGammaCPCoeffSet.cc
index 95d692a..4d4100e 100644
--- a/src/LauCartesianGammaCPCoeffSet.cc
+++ b/src/LauCartesianGammaCPCoeffSet.cc
@@ -1,311 +1,376 @@
/*
Copyright 2014 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauCartesianGammaCPCoeffSet.cc
\brief File containing implementation of LauCartesianGammaCPCoeffSet class.
*/
-#include <iostream>
-#include <fstream>
-#include <vector>
-
-#include "TMath.h"
-#include "TRandom.h"
-
#include "LauCartesianGammaCPCoeffSet.hh"
+
#include "LauComplex.hh"
#include "LauConstants.hh"
#include "LauParameter.hh"
#include "LauPrint.hh"
+#include "TMath.h"
+#include "TRandom.h"
+#include <fstream>
+#include <iostream>
+#include <vector>
-LauCartesianGammaCPCoeffSet::LauCartesianGammaCPCoeffSet(const TString& compName, const Double_t x, const Double_t y, const Double_t xCP, const Double_t yCP, const Double_t deltaXCP, const Double_t deltaYCP,
- const Bool_t xFixed, const Bool_t yFixed, const Bool_t xCPFixed, const Bool_t yCPFixed, const Bool_t deltaXCPFixed, const Bool_t deltaYCPFixed, const Bool_t deltaXCPSecondStage, const Bool_t deltaYCPSecondStage) :
- LauAbsCoeffSet(compName),
- x_(new LauParameter("X", x, minRealImagPart_, maxRealImagPart_, xFixed)),
- y_(new LauParameter("Y", y, minRealImagPart_, maxRealImagPart_, yFixed)),
- xCP_(new LauParameter("XCP", xCP, minRealImagPart_, maxRealImagPart_, xCPFixed)),
- yCP_(new LauParameter("YCP", yCP, minRealImagPart_, maxRealImagPart_, yCPFixed)),
- deltaXCP_(new LauParameter("DeltaXCP", deltaXCP, minDelta_, maxDelta_, deltaXCPFixed)),
- deltaYCP_(new LauParameter("DeltaYCP", deltaYCP, minDelta_, maxDelta_, deltaYCPFixed)),
- nonCPPart_( x, y),
- cpPart_( 1+xCP+deltaXCP, yCP+deltaYCP),
- cpAntiPart_( 1+xCP-deltaXCP, yCP-deltaYCP),
- particleCoeff_( nonCPPart_ * cpPart_ ),
- antiparticleCoeff_( nonCPPart_ * cpAntiPart_ ),
- acp_("ACP", (antiparticleCoeff_.abs2()-particleCoeff_.abs2())/(antiparticleCoeff_.abs2()+particleCoeff_.abs2()), -1.0, 1.0, deltaXCPFixed&&deltaYCPFixed)
+LauCartesianGammaCPCoeffSet::LauCartesianGammaCPCoeffSet( const TString& compName,
+ const Double_t x,
+ const Double_t y,
+ const Double_t xCP,
+ const Double_t yCP,
+ const Double_t deltaXCP,
+ const Double_t deltaYCP,
+ const Bool_t xFixed,
+ const Bool_t yFixed,
+ const Bool_t xCPFixed,
+ const Bool_t yCPFixed,
+ const Bool_t deltaXCPFixed,
+ const Bool_t deltaYCPFixed,
+ const Bool_t deltaXCPSecondStage,
+ const Bool_t deltaYCPSecondStage ) :
+ LauAbsCoeffSet( compName ),
+ x_( new LauParameter( "X", x, minRealImagPart_, maxRealImagPart_, xFixed ) ),
+ y_( new LauParameter( "Y", y, minRealImagPart_, maxRealImagPart_, yFixed ) ),
+ xCP_( new LauParameter( "XCP", xCP, minRealImagPart_, maxRealImagPart_, xCPFixed ) ),
+ yCP_( new LauParameter( "YCP", yCP, minRealImagPart_, maxRealImagPart_, yCPFixed ) ),
+ deltaXCP_( new LauParameter( "DeltaXCP", deltaXCP, minDelta_, maxDelta_, deltaXCPFixed ) ),
+ deltaYCP_( new LauParameter( "DeltaYCP", deltaYCP, minDelta_, maxDelta_, deltaYCPFixed ) ),
+ nonCPPart_( x, y ),
+ cpPart_( 1 + xCP + deltaXCP, yCP + deltaYCP ),
+ cpAntiPart_( 1 + xCP - deltaXCP, yCP - deltaYCP ),
+ particleCoeff_( nonCPPart_ * cpPart_ ),
+ antiparticleCoeff_( nonCPPart_ * cpAntiPart_ ),
+ acp_( "ACP",
+ ( antiparticleCoeff_.abs2() - particleCoeff_.abs2() ) /
+ ( antiparticleCoeff_.abs2() + particleCoeff_.abs2() ),
+ -1.0,
+ 1.0,
+ deltaXCPFixed && deltaYCPFixed )
{
- if (deltaXCPSecondStage && !deltaXCPFixed) {
- deltaXCP_->secondStage(kTRUE);
- deltaXCP_->initValue(0.0);
- }
- if (deltaYCPSecondStage && !deltaYCPFixed) {
- deltaYCP_->secondStage(kTRUE);
- deltaYCP_->initValue(0.0);
- }
+ if ( deltaXCPSecondStage && ! deltaXCPFixed ) {
+ deltaXCP_->secondStage( kTRUE );
+ deltaXCP_->initValue( 0.0 );
+ }
+ if ( deltaYCPSecondStage && ! deltaYCPFixed ) {
+ deltaYCP_->secondStage( kTRUE );
+ deltaYCP_->initValue( 0.0 );
+ }
}
-LauCartesianGammaCPCoeffSet::LauCartesianGammaCPCoeffSet(const LauCartesianGammaCPCoeffSet& rhs, CloneOption cloneOption, Double_t constFactor) : LauAbsCoeffSet(rhs.name()),
- x_(0),
- y_(0),
- xCP_(0),
- yCP_(0),
- deltaXCP_(0),
- deltaYCP_(0),
- nonCPPart_( rhs.nonCPPart_ ),
- cpPart_( rhs.cpPart_ ),
- cpAntiPart_( rhs.cpAntiPart_ ),
- particleCoeff_( rhs.particleCoeff_ ),
- antiparticleCoeff_( rhs.antiparticleCoeff_ ),
- acp_( rhs.acp_ )
+LauCartesianGammaCPCoeffSet::LauCartesianGammaCPCoeffSet( const LauCartesianGammaCPCoeffSet& rhs,
+ CloneOption cloneOption,
+ Double_t constFactor ) :
+ LauAbsCoeffSet( rhs.name() ),
+ x_( 0 ),
+ y_( 0 ),
+ xCP_( 0 ),
+ yCP_( 0 ),
+ deltaXCP_( 0 ),
+ deltaYCP_( 0 ),
+ nonCPPart_( rhs.nonCPPart_ ),
+ cpPart_( rhs.cpPart_ ),
+ cpAntiPart_( rhs.cpAntiPart_ ),
+ particleCoeff_( rhs.particleCoeff_ ),
+ antiparticleCoeff_( rhs.antiparticleCoeff_ ),
+ acp_( rhs.acp_ )
{
- if ( cloneOption == All || cloneOption == TieRealPart ) {
- x_ = rhs.x_->createClone(constFactor);
- } else {
- x_ = new LauParameter("X", rhs.x_->value(), minRealImagPart_, maxRealImagPart_, rhs.x_->fixed());
- if ( rhs.x_->blind() ) {
- const LauBlind* blinder = rhs.x_->blinder();
- x_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
- }
- }
-
- if ( cloneOption == All || cloneOption == TieImagPart ) {
- y_ = rhs.y_->createClone(constFactor);
- } else {
- y_ = new LauParameter("Y", rhs.y_->value(), minRealImagPart_, maxRealImagPart_, rhs.y_->fixed());
- if ( rhs.y_->blind() ) {
- const LauBlind* blinder = rhs.y_->blinder();
- y_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
- }
- }
-
- if ( cloneOption == All || cloneOption == TieCPPars ) {
- xCP_ = rhs.xCP_->createClone(constFactor);
- yCP_ = rhs.yCP_->createClone(constFactor);
- deltaXCP_ = rhs.deltaXCP_->createClone(constFactor);
- deltaYCP_ = rhs.deltaYCP_->createClone(constFactor);
- } else {
- xCP_ = new LauParameter("XCP", rhs.xCP_->value(), minRealImagPart_, maxRealImagPart_, rhs.xCP_->fixed());
- if ( rhs.xCP_->blind() ) {
- const LauBlind* blinder = rhs.xCP_->blinder();
- xCP_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
- }
- yCP_ = new LauParameter("YCP", rhs.yCP_->value(), minRealImagPart_, maxRealImagPart_, rhs.yCP_->fixed());
- if ( rhs.yCP_->blind() ) {
- const LauBlind* blinder = rhs.yCP_->blinder();
- yCP_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
- }
- deltaXCP_ = new LauParameter("DeltaXCP", rhs.deltaXCP_->value(), minDelta_, maxDelta_, rhs.deltaXCP_->fixed());
- deltaYCP_ = new LauParameter("DeltaYCP", rhs.deltaYCP_->value(), minDelta_, maxDelta_, rhs.deltaYCP_->fixed());
- if ( rhs.deltaXCP_->secondStage() && !rhs.deltaXCP_->fixed() ) {
- deltaXCP_->secondStage(kTRUE);
- deltaXCP_->initValue(0.0);
- }
- if ( rhs.deltaYCP_->secondStage() && !rhs.deltaYCP_->fixed() ) {
- deltaYCP_->secondStage(kTRUE);
- deltaYCP_->initValue(0.0);
- }
- if ( rhs.deltaXCP_->blind() ) {
- const LauBlind* blinder = rhs.deltaXCP_->blinder();
- deltaXCP_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
- }
- if ( rhs.deltaYCP_->blind() ) {
- const LauBlind* blinder = rhs.deltaYCP_->blinder();
- deltaYCP_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
- }
- }
+ if ( cloneOption == All || cloneOption == TieRealPart ) {
+ x_ = rhs.x_->createClone( constFactor );
+ } else {
+ x_ = new LauParameter( "X",
+ rhs.x_->value(),
+ minRealImagPart_,
+ maxRealImagPart_,
+ rhs.x_->fixed() );
+ if ( rhs.x_->blind() ) {
+ const LauBlind* blinder = rhs.x_->blinder();
+ x_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
+ }
+ }
+
+ if ( cloneOption == All || cloneOption == TieImagPart ) {
+ y_ = rhs.y_->createClone( constFactor );
+ } else {
+ y_ = new LauParameter( "Y",
+ rhs.y_->value(),
+ minRealImagPart_,
+ maxRealImagPart_,
+ rhs.y_->fixed() );
+ if ( rhs.y_->blind() ) {
+ const LauBlind* blinder = rhs.y_->blinder();
+ y_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
+ }
+ }
+
+ if ( cloneOption == All || cloneOption == TieCPPars ) {
+ xCP_ = rhs.xCP_->createClone( constFactor );
+ yCP_ = rhs.yCP_->createClone( constFactor );
+ deltaXCP_ = rhs.deltaXCP_->createClone( constFactor );
+ deltaYCP_ = rhs.deltaYCP_->createClone( constFactor );
+ } else {
+ xCP_ = new LauParameter( "XCP",
+ rhs.xCP_->value(),
+ minRealImagPart_,
+ maxRealImagPart_,
+ rhs.xCP_->fixed() );
+ if ( rhs.xCP_->blind() ) {
+ const LauBlind* blinder = rhs.xCP_->blinder();
+ xCP_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
+ }
+ yCP_ = new LauParameter( "YCP",
+ rhs.yCP_->value(),
+ minRealImagPart_,
+ maxRealImagPart_,
+ rhs.yCP_->fixed() );
+ if ( rhs.yCP_->blind() ) {
+ const LauBlind* blinder = rhs.yCP_->blinder();
+ yCP_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
+ }
+ deltaXCP_ = new LauParameter( "DeltaXCP",
+ rhs.deltaXCP_->value(),
+ minDelta_,
+ maxDelta_,
+ rhs.deltaXCP_->fixed() );
+ deltaYCP_ = new LauParameter( "DeltaYCP",
+ rhs.deltaYCP_->value(),
+ minDelta_,
+ maxDelta_,
+ rhs.deltaYCP_->fixed() );
+ if ( rhs.deltaXCP_->secondStage() && ! rhs.deltaXCP_->fixed() ) {
+ deltaXCP_->secondStage( kTRUE );
+ deltaXCP_->initValue( 0.0 );
+ }
+ if ( rhs.deltaYCP_->secondStage() && ! rhs.deltaYCP_->fixed() ) {
+ deltaYCP_->secondStage( kTRUE );
+ deltaYCP_->initValue( 0.0 );
+ }
+ if ( rhs.deltaXCP_->blind() ) {
+ const LauBlind* blinder = rhs.deltaXCP_->blinder();
+ deltaXCP_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
+ }
+ if ( rhs.deltaYCP_->blind() ) {
+ const LauBlind* blinder = rhs.deltaYCP_->blinder();
+ deltaYCP_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
+ }
+ }
}
std::vector<LauParameter*> LauCartesianGammaCPCoeffSet::getParameters()
{
- std::vector<LauParameter*> pars;
- pars.push_back(x_);
- pars.push_back(y_);
- if(!xCP_->fixed()) pars.push_back(xCP_);
- if(!yCP_->fixed()) pars.push_back(yCP_);
- if(!deltaXCP_->fixed()) pars.push_back(deltaXCP_);
- if(!deltaYCP_->fixed()) pars.push_back(deltaYCP_);
- return pars;
+ std::vector<LauParameter*> pars;
+ pars.push_back( x_ );
+ pars.push_back( y_ );
+ if ( ! xCP_->fixed() )
+ pars.push_back( xCP_ );
+ if ( ! yCP_->fixed() )
+ pars.push_back( yCP_ );
+ if ( ! deltaXCP_->fixed() )
+ pars.push_back( deltaXCP_ );
+ if ( ! deltaYCP_->fixed() )
+ pars.push_back( deltaYCP_ );
+ return pars;
}
void LauCartesianGammaCPCoeffSet::printParValues() const
{
- std::cout<<"INFO in LauCartesianGammaCPCoeffSet::printParValues : Component \""<<this->name()<<"\" has ";
- std::cout<<"x = "<<x_->value()<<",\t";
- std::cout<<"y = "<<y_->value()<<",\t";
- std::cout<<"xCP = "<<xCP_->value()<<",\t";
- std::cout<<"yCP = "<<yCP_->value()<<",\t";
- std::cout<<"Delta xCP = "<<deltaXCP_->value()<<",\t";
- std::cout<<"Delta yCP = "<<deltaYCP_->value()<<"."<<std::endl;
+ std::cout << "INFO in LauCartesianGammaCPCoeffSet::printParValues : Component \""
+ << this->name() << "\" has ";
+ std::cout << "x = " << x_->value() << ",\t";
+ std::cout << "y = " << y_->value() << ",\t";
+ std::cout << "xCP = " << xCP_->value() << ",\t";
+ std::cout << "yCP = " << yCP_->value() << ",\t";
+ std::cout << "Delta xCP = " << deltaXCP_->value() << ",\t";
+ std::cout << "Delta yCP = " << deltaYCP_->value() << "." << std::endl;
}
-void LauCartesianGammaCPCoeffSet::printTableHeading(std::ostream& stream) const
+void LauCartesianGammaCPCoeffSet::printTableHeading( std::ostream& stream ) const
{
- stream<<"\\begin{tabular}{|l|c|c|c|c|c|c|}"<<std::endl;
- stream<<"\\hline"<<std::endl;
- stream<<"Component & Real Part & Imaginary Part & Real CP Part & Imaginary CP Part & $\\Delta$ Real CP Part & $\\Delta$ Imaginary CP Part \\\\"<<std::endl;
- stream<<"\\hline"<<std::endl;
+ stream << "\\begin{tabular}{|l|c|c|c|c|c|c|}" << std::endl;
+ stream << "\\hline" << std::endl;
+ stream << "Component & Real Part & Imaginary Part & Real CP Part & Imaginary CP Part & $\\Delta$ Real CP Part & $\\Delta$ Imaginary CP Part \\\\"
+ << std::endl;
+ stream << "\\hline" << std::endl;
}
-void LauCartesianGammaCPCoeffSet::printTableRow(std::ostream& stream) const
+void LauCartesianGammaCPCoeffSet::printTableRow( std::ostream& stream ) const
{
- LauPrint print;
- TString resName = this->name();
- resName = resName.ReplaceAll("_", "\\_");
- stream<<resName<<" & $";
- print.printFormat(stream, x_->value());
- stream<<" \\pm ";
- print.printFormat(stream, x_->error());
- stream<<"$ & $";
- print.printFormat(stream, y_->value());
- stream<<" \\pm ";
- print.printFormat(stream, y_->error());
- stream<<"$ & $";
- print.printFormat(stream, xCP_->value());
- stream<<" \\pm ";
- print.printFormat(stream, xCP_->error());
- stream<<"$ & $";
- print.printFormat(stream, yCP_->value());
- stream<<" \\pm ";
- print.printFormat(stream, yCP_->error());
- stream<<"$ & $";
- print.printFormat(stream, deltaXCP_->value());
- stream<<" \\pm ";
- print.printFormat(stream, deltaXCP_->error());
- stream<<"$ & $";
- print.printFormat(stream, deltaYCP_->value());
- stream<<" \\pm ";
- print.printFormat(stream, deltaYCP_->error());
- stream<<"$ \\\\"<<std::endl;
+ LauPrint print;
+ TString resName = this->name();
+ resName = resName.ReplaceAll( "_", "\\_" );
+ stream << resName << " & $";
+ print.printFormat( stream, x_->value() );
+ stream << " \\pm ";
+ print.printFormat( stream, x_->error() );
+ stream << "$ & $";
+ print.printFormat( stream, y_->value() );
+ stream << " \\pm ";
+ print.printFormat( stream, y_->error() );
+ stream << "$ & $";
+ print.printFormat( stream, xCP_->value() );
+ stream << " \\pm ";
+ print.printFormat( stream, xCP_->error() );
+ stream << "$ & $";
+ print.printFormat( stream, yCP_->value() );
+ stream << " \\pm ";
+ print.printFormat( stream, yCP_->error() );
+ stream << "$ & $";
+ print.printFormat( stream, deltaXCP_->value() );
+ stream << " \\pm ";
+ print.printFormat( stream, deltaXCP_->error() );
+ stream << "$ & $";
+ print.printFormat( stream, deltaYCP_->value() );
+ stream << " \\pm ";
+ print.printFormat( stream, deltaYCP_->error() );
+ stream << "$ \\\\" << std::endl;
}
void LauCartesianGammaCPCoeffSet::randomiseInitValues()
{
- if (x_->fixed() == kFALSE) {
- // Choose a value for "X" between -3.0 and 3.0
- Double_t value = LauAbsCoeffSet::getRandomiser()->Rndm()*6.0 - 3.0;
- x_->initValue(value); x_->value(value);
- }
- if (y_->fixed() == kFALSE) {
- // Choose a value for "Y" between -3.0 and 3.0
- Double_t value = LauAbsCoeffSet::getRandomiser()->Rndm()*6.0 - 3.0;
- y_->initValue(value); y_->value(value);
- }
- if (xCP_->fixed() == kFALSE) {
- // Choose a value for "XCP" between -3.0 and 3.0
- Double_t value = LauAbsCoeffSet::getRandomiser()->Rndm()*6.0 - 3.0;
- xCP_->initValue(value); xCP_->value(value);
- }
- if (yCP_->fixed() == kFALSE) {
- // Choose a value for "YCP" between -3.0 and 3.0
- Double_t value = LauAbsCoeffSet::getRandomiser()->Rndm()*6.0 - 3.0;
- yCP_->initValue(value); yCP_->value(value);
- }
- if (deltaXCP_->fixed() == kFALSE && deltaXCP_->secondStage() == kFALSE) {
- // Choose a value for "Delta XCP" between -0.5 and 0.5
- Double_t value = LauAbsCoeffSet::getRandomiser()->Rndm()*1.0 - 0.5;
- deltaXCP_->initValue(value); deltaXCP_->value(value);
- }
- if (deltaYCP_->fixed() == kFALSE && deltaYCP_->secondStage() == kFALSE) {
- // Choose a value for "Delta YCP" between -0.5 and 0.5
- Double_t value = LauAbsCoeffSet::getRandomiser()->Rndm()*1.0 - 0.5;
- deltaYCP_->initValue(value); deltaYCP_->value(value);
- }
+ if ( x_->fixed() == kFALSE ) {
+ // Choose a value for "X" between -3.0 and 3.0
+ Double_t value = LauAbsCoeffSet::getRandomiser()->Rndm() * 6.0 - 3.0;
+ x_->initValue( value );
+ x_->value( value );
+ }
+ if ( y_->fixed() == kFALSE ) {
+ // Choose a value for "Y" between -3.0 and 3.0
+ Double_t value = LauAbsCoeffSet::getRandomiser()->Rndm() * 6.0 - 3.0;
+ y_->initValue( value );
+ y_->value( value );
+ }
+ if ( xCP_->fixed() == kFALSE ) {
+ // Choose a value for "XCP" between -3.0 and 3.0
+ Double_t value = LauAbsCoeffSet::getRandomiser()->Rndm() * 6.0 - 3.0;
+ xCP_->initValue( value );
+ xCP_->value( value );
+ }
+ if ( yCP_->fixed() == kFALSE ) {
+ // Choose a value for "YCP" between -3.0 and 3.0
+ Double_t value = LauAbsCoeffSet::getRandomiser()->Rndm() * 6.0 - 3.0;
+ yCP_->initValue( value );
+ yCP_->value( value );
+ }
+ if ( deltaXCP_->fixed() == kFALSE && deltaXCP_->secondStage() == kFALSE ) {
+ // Choose a value for "Delta XCP" between -0.5 and 0.5
+ Double_t value = LauAbsCoeffSet::getRandomiser()->Rndm() * 1.0 - 0.5;
+ deltaXCP_->initValue( value );
+ deltaXCP_->value( value );
+ }
+ if ( deltaYCP_->fixed() == kFALSE && deltaYCP_->secondStage() == kFALSE ) {
+ // Choose a value for "Delta YCP" between -0.5 and 0.5
+ Double_t value = LauAbsCoeffSet::getRandomiser()->Rndm() * 1.0 - 0.5;
+ deltaYCP_->initValue( value );
+ deltaYCP_->value( value );
+ }
}
void LauCartesianGammaCPCoeffSet::finaliseValues()
{
- // update the pulls
- x_->updatePull();
- y_->updatePull();
- xCP_->updatePull();
- yCP_->updatePull();
- deltaXCP_->updatePull();
- deltaYCP_->updatePull();
+ // update the pulls
+ x_->updatePull();
+ y_->updatePull();
+ xCP_->updatePull();
+ yCP_->updatePull();
+ deltaXCP_->updatePull();
+ deltaYCP_->updatePull();
}
const LauComplex& LauCartesianGammaCPCoeffSet::particleCoeff()
{
- nonCPPart_.setRealImagPart( x_->unblindValue(), y_->unblindValue() );
- cpPart_.setRealImagPart( 1.0+xCP_->unblindValue()+deltaXCP_->unblindValue(), yCP_->unblindValue()+deltaYCP_->unblindValue() );
- particleCoeff_ = nonCPPart_ * cpPart_;
- return particleCoeff_;
+ nonCPPart_.setRealImagPart( x_->unblindValue(), y_->unblindValue() );
+ cpPart_.setRealImagPart( 1.0 + xCP_->unblindValue() + deltaXCP_->unblindValue(),
+ yCP_->unblindValue() + deltaYCP_->unblindValue() );
+ particleCoeff_ = nonCPPart_ * cpPart_;
+ return particleCoeff_;
}
const LauComplex& LauCartesianGammaCPCoeffSet::antiparticleCoeff()
{
- nonCPPart_.setRealImagPart( x_->unblindValue(), y_->unblindValue() );
- cpAntiPart_.setRealImagPart( 1.0+xCP_->unblindValue()-deltaXCP_->unblindValue(), yCP_->unblindValue()-deltaYCP_->unblindValue() );
- antiparticleCoeff_ = nonCPPart_ * cpAntiPart_;
- return antiparticleCoeff_;
+ nonCPPart_.setRealImagPart( x_->unblindValue(), y_->unblindValue() );
+ cpAntiPart_.setRealImagPart( 1.0 + xCP_->unblindValue() - deltaXCP_->unblindValue(),
+ yCP_->unblindValue() - deltaYCP_->unblindValue() );
+ antiparticleCoeff_ = nonCPPart_ * cpAntiPart_;
+ return antiparticleCoeff_;
}
void LauCartesianGammaCPCoeffSet::setCoeffValues( const LauComplex&, const LauComplex&, Bool_t )
{
- std::cerr << "ERROR in LauCartesianGammaCPCoeffSet::setCoeffValues : Method not supported by this class - too many parameters" << std::endl;
+ std::cerr << "ERROR in LauCartesianGammaCPCoeffSet::setCoeffValues : Method not supported by this class - too many parameters"
+ << std::endl;
}
LauParameter LauCartesianGammaCPCoeffSet::acp()
{
- // set the name
- TString parName(this->baseName()); parName += "_ACP";
- acp_.name(parName);
-
- // work out the ACP value
- const LauComplex nonCPPart( x_->value(), y_->value() );
- const LauComplex cpPart( 1.0+xCP_->value()+deltaXCP_->value(), yCP_->value()+deltaYCP_->value() );
- const LauComplex cpAntiPart( 1.0+xCP_->value()-deltaXCP_->value(), yCP_->value()-deltaYCP_->value() );
- const LauComplex partCoeff = nonCPPart * cpPart;
- const LauComplex antiCoeff = nonCPPart * cpAntiPart;
-
- const Double_t numer = antiCoeff.abs2() - partCoeff.abs2();
- const Double_t denom = antiCoeff.abs2() + partCoeff.abs2();
- const Double_t value = numer/denom;
-
- // is it fixed?
- const Bool_t fixed = deltaXCP_->fixed() && deltaYCP_->fixed();
- acp_.fixed(fixed);
-
- // we can't work out the error without the covariance matrix
- const Double_t error(0.0);
-
- // set the value and error
- acp_.valueAndErrors(value,error);
-
- return acp_;
+ // set the name
+ TString parName( this->baseName() );
+ parName += "_ACP";
+ acp_.name( parName );
+
+ // work out the ACP value
+ const LauComplex nonCPPart( x_->value(), y_->value() );
+ const LauComplex cpPart( 1.0 + xCP_->value() + deltaXCP_->value(),
+ yCP_->value() + deltaYCP_->value() );
+ const LauComplex cpAntiPart( 1.0 + xCP_->value() - deltaXCP_->value(),
+ yCP_->value() - deltaYCP_->value() );
+ const LauComplex partCoeff = nonCPPart * cpPart;
+ const LauComplex antiCoeff = nonCPPart * cpAntiPart;
+
+ const Double_t numer = antiCoeff.abs2() - partCoeff.abs2();
+ const Double_t denom = antiCoeff.abs2() + partCoeff.abs2();
+ const Double_t value = numer / denom;
+
+ // is it fixed?
+ const Bool_t fixed = deltaXCP_->fixed() && deltaYCP_->fixed();
+ acp_.fixed( fixed );
+
+ // we can't work out the error without the covariance matrix
+ const Double_t error( 0.0 );
+
+ // set the value and error
+ acp_.valueAndErrors( value, error );
+
+ return acp_;
}
-LauAbsCoeffSet* LauCartesianGammaCPCoeffSet::createClone(const TString& newName, CloneOption cloneOption, Double_t constFactor)
+LauAbsCoeffSet* LauCartesianGammaCPCoeffSet::createClone( const TString& newName,
+ CloneOption cloneOption,
+ Double_t constFactor )
{
- LauAbsCoeffSet* clone(0);
- if ( cloneOption == All || cloneOption == TieRealPart || cloneOption == TieImagPart || cloneOption == TieCPPars ) {
- clone = new LauCartesianGammaCPCoeffSet( *this, cloneOption, constFactor );
- clone->name( newName );
- } else {
- std::cerr << "ERROR in LauCartesianGammaCPCoeffSet::createClone : Invalid clone option" << std::endl;
- }
- return clone;
+ LauAbsCoeffSet* clone( 0 );
+ if ( cloneOption == All || cloneOption == TieRealPart || cloneOption == TieImagPart ||
+ cloneOption == TieCPPars ) {
+ clone = new LauCartesianGammaCPCoeffSet( *this, cloneOption, constFactor );
+ clone->name( newName );
+ } else {
+ std::cerr << "ERROR in LauCartesianGammaCPCoeffSet::createClone : Invalid clone option"
+ << std::endl;
+ }
+ return clone;
}
-
diff --git a/src/LauChebychevPdf.cc b/src/LauChebychevPdf.cc
index 7078357..d47d6fc 100644
--- a/src/LauChebychevPdf.cc
+++ b/src/LauChebychevPdf.cc
@@ -1,176 +1,216 @@
/*
Copyright 2009 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauChebychevPdf.cc
\brief File containing implementation of LauChebychevPdf class.
*/
/*****************************************************************************
* Class based on RooFit/RooChebychev. *
* Original copyright given below. *
*****************************************************************************
* Authors: *
* WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
* DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
* *
* Copyright (c) 2000-2005, Regents of the University of California *
* and Stanford University. All rights reserved. *
* *
* Redistribution and use in source and binary forms, *
* with or without modification, are permitted according to the terms *
* listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
*****************************************************************************/
-#include <iostream>
-#include <vector>
+#include "LauChebychevPdf.hh"
#include "TMath.h"
#include "TSystem.h"
-#include "LauChebychevPdf.hh"
-
+#include <iostream>
+#include <vector>
-LauChebychevPdf::LauChebychevPdf(const TString& theVarName, const std::vector<LauAbsRValue*>& params, Double_t minAbscissa, Double_t maxAbscissa) :
- LauAbsPdf(theVarName, params, minAbscissa, maxAbscissa),
- coeffs_(params.size(),0)
+LauChebychevPdf::LauChebychevPdf( const TString& theVarName,
+ const std::vector<LauAbsRValue*>& params,
+ Double_t minAbscissa,
+ Double_t maxAbscissa ) :
+ LauAbsPdf( theVarName, params, minAbscissa, maxAbscissa ),
+ coeffs_( params.size(), 0 )
{
- // Constructor for the Chebychev Polynomial PDF.
- //
- // The parameters in params are the coefficients of the polynomial
- // (polynomial can be anything from 0 to 7 orders).
- // The last two arguments specify the range in which the PDF is defined, and the PDF
- // will be normalised w.r.t. these limits.
-
- if ( (this->nParameters() > 7) ) {
- std::cerr << "ERROR in LauChebychevPdf constructor: Too many coeffs - can only cope with order <=7 polynomial." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- for ( UInt_t i(0); i < this->nParameters(); ++i ) {
- TString name = "c";
- name += i+1;
- coeffs_[i] = this->findParameter( name );
- }
-
- // Cache the normalisation factor
- this->calcNorm();
+ // Constructor for the Chebychev Polynomial PDF.
+ //
+ // The parameters in params are the coefficients of the polynomial
+ // (polynomial can be anything from 0 to 7 orders).
+ // The last two arguments specify the range in which the PDF is defined, and the PDF
+ // will be normalised w.r.t. these limits.
+
+ if ( ( this->nParameters() > 7 ) ) {
+ std::cerr << "ERROR in LauChebychevPdf constructor: Too many coeffs - can only cope with order <=7 polynomial."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ for ( UInt_t i( 0 ); i < this->nParameters(); ++i ) {
+ TString name = "c";
+ name += i + 1;
+ coeffs_[i] = this->findParameter( name );
+ }
+
+ // Cache the normalisation factor
+ this->calcNorm();
}
-LauChebychevPdf::~LauChebychevPdf()
+LauChebychevPdf::~LauChebychevPdf()
{
- // Destructor
+ // Destructor
}
//inline static double p0(double ,double a) { return a; }
-inline static double p1(double t,double a,double b) { return a*t+b; }
-inline static double p2(double t,double a,double b,double c) { return p1(t,p1(t,a,b),c); }
-inline static double p3(double t,double a,double b,double c,double d) { return p2(t,p1(t,a,b),c,d); }
-//inline static double p4(double t,double a,double b,double c,double d,double e) { return p3(t,p1(t,a,b),c,d,e); }
-
-void LauChebychevPdf::calcLikelihoodInfo(const LauAbscissas& abscissas)
+inline static double p1( double t, double a, double b )
{
- // Check that the given abscissa is within the allowed range
- if (!this->checkRange(abscissas)) {
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // Get our abscissa
- Double_t abscissa = abscissas[0];
-
- Double_t xmin = this->getMinAbscissa();
- Double_t xmax = this->getMaxAbscissa();
- Double_t x(-1.0+2.0*(abscissa-xmin)/(xmax-xmin));
- Double_t x2(x*x);
- Double_t sum(0) ;
- switch ( coeffs_.size() ) {
- case 7: sum += coeffs_[6]->unblindValue()*x*p3(x2,64,-112,56,-7); [[fallthrough]];
- case 6: sum += coeffs_[5]->unblindValue()*p3(x2,32,-48,18,-1); [[fallthrough]];
- case 5: sum += coeffs_[4]->unblindValue()*x*p2(x2,16,-20,5); [[fallthrough]];
- case 4: sum += coeffs_[3]->unblindValue()*p2(x2,8,-8,1); [[fallthrough]];
- case 3: sum += coeffs_[2]->unblindValue()*x*p1(x2,4,-3); [[fallthrough]];
- case 2: sum += coeffs_[1]->unblindValue()*p1(x2,2,-1); [[fallthrough]];
- case 1: sum += coeffs_[0]->unblindValue()*x; [[fallthrough]];
- case 0: sum +=1;
- }
-
- this->setUnNormPDFVal( sum );
-
- // if the parameters are floating then we
- // need to recalculate the normalisation
- if (!this->cachePDF() && !this->withinNormCalc() && !this->withinGeneration()) {
- this->calcNorm();
- }
+ return a * t + b;
}
-void LauChebychevPdf::calcNorm()
+inline static double p2( double t, double a, double b, double c )
{
- Double_t xmin = this->getMinAbscissa();
- Double_t xmax = this->getMaxAbscissa();
-
- Double_t norm(0) ;
- switch( coeffs_.size() ) {
- case 7: case 6: norm += coeffs_[5]->unblindValue()*(-1 + 18./3. - 48./5. + 32./7.); [[fallthrough]];
- case 5: case 4: norm += coeffs_[3]->unblindValue()*( 1 - 8./3. + 8./5.); [[fallthrough]];
- case 3: case 2: norm += coeffs_[1]->unblindValue()*(-1 + 2./3.); [[fallthrough]];
- case 1: case 0: norm += 1;
- }
- norm *= xmax-xmin;
-
- this->setNorm(norm);
+ return p1( t, p1( t, a, b ), c );
}
-void LauChebychevPdf::calcPDFHeight(const LauKinematics* /*kinematics*/)
+inline static double p3( double t, double a, double b, double c, double d )
{
- // TODO - this method can hopefully be improved
- // At present it scans through the range and then increases by a 20% safety factor
- // Maybe there's a better way?
-
- if (this->heightUpToDate()) {
- return;
- }
-
- // Calculate the PDF height
- LauAbscissas maxPoint(1);
-
- Double_t minAbs = this->getMinAbscissa();
- Double_t maxAbs = this->getMaxAbscissa();
- Double_t range = maxAbs - minAbs;
- Double_t maxHeight(0.0);
+ return p2( t, p1( t, a, b ), c, d );
+}
- // Just scan through the range
- for ( Double_t point = minAbs; point <= maxAbs; point += range/1000.0 ) {
- maxPoint[0] = point;
- this->calcLikelihoodInfo(maxPoint);
- Double_t heightAtPoint = this->getUnNormLikelihood();
- if ( heightAtPoint > maxHeight ) {
- maxHeight = heightAtPoint;
- }
- }
+//inline static double p4(double t,double a,double b,double c,double d,double e) { return p3(t,p1(t,a,b),c,d,e); }
+void LauChebychevPdf::calcLikelihoodInfo( const LauAbscissas& abscissas )
+{
+ // Check that the given abscissa is within the allowed range
+ if ( ! this->checkRange( abscissas ) ) {
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // Get our abscissa
+ Double_t abscissa = abscissas[0];
+
+ Double_t xmin = this->getMinAbscissa();
+ Double_t xmax = this->getMaxAbscissa();
+ Double_t x( -1.0 + 2.0 * ( abscissa - xmin ) / ( xmax - xmin ) );
+ Double_t x2( x * x );
+ Double_t sum( 0 );
+ switch ( coeffs_.size() ) {
+ case 7 :
+ sum += coeffs_[6]->unblindValue() * x * p3( x2, 64, -112, 56, -7 );
+ [[fallthrough]];
+ case 6 :
+ sum += coeffs_[5]->unblindValue() * p3( x2, 32, -48, 18, -1 );
+ [[fallthrough]];
+ case 5 :
+ sum += coeffs_[4]->unblindValue() * x * p2( x2, 16, -20, 5 );
+ [[fallthrough]];
+ case 4 :
+ sum += coeffs_[3]->unblindValue() * p2( x2, 8, -8, 1 );
+ [[fallthrough]];
+ case 3 :
+ sum += coeffs_[2]->unblindValue() * x * p1( x2, 4, -3 );
+ [[fallthrough]];
+ case 2 :
+ sum += coeffs_[1]->unblindValue() * p1( x2, 2, -1 );
+ [[fallthrough]];
+ case 1 :
+ sum += coeffs_[0]->unblindValue() * x;
+ [[fallthrough]];
+ case 0 :
+ sum += 1;
+ }
+
+ this->setUnNormPDFVal( sum );
+
+ // if the parameters are floating then we
+ // need to recalculate the normalisation
+ if ( ! this->cachePDF() && ! this->withinNormCalc() && ! this->withinGeneration() ) {
+ this->calcNorm();
+ }
+}
- // Mutliply by 120% to be on the safe side
- maxHeight *= 1.2;
+void LauChebychevPdf::calcNorm()
+{
+ Double_t xmin = this->getMinAbscissa();
+ Double_t xmax = this->getMaxAbscissa();
+
+ Double_t norm( 0 );
+ switch ( coeffs_.size() ) {
+ case 7 :
+ case 6 :
+ norm += coeffs_[5]->unblindValue() * ( -1 + 18. / 3. - 48. / 5. + 32. / 7. );
+ [[fallthrough]];
+ case 5 :
+ case 4 :
+ norm += coeffs_[3]->unblindValue() * ( 1 - 8. / 3. + 8. / 5. );
+ [[fallthrough]];
+ case 3 :
+ case 2 :
+ norm += coeffs_[1]->unblindValue() * ( -1 + 2. / 3. );
+ [[fallthrough]];
+ case 1 :
+ case 0 :
+ norm += 1;
+ }
+ norm *= xmax - xmin;
+
+ this->setNorm( norm );
+}
- this->setMaxHeight(maxHeight);
+void LauChebychevPdf::calcPDFHeight( const LauKinematics* /*kinematics*/ )
+{
+ // TODO - this method can hopefully be improved
+ // At present it scans through the range and then increases by a 20% safety factor
+ // Maybe there's a better way?
+
+ if ( this->heightUpToDate() ) {
+ return;
+ }
+
+ // Calculate the PDF height
+ LauAbscissas maxPoint( 1 );
+
+ Double_t minAbs = this->getMinAbscissa();
+ Double_t maxAbs = this->getMaxAbscissa();
+ Double_t range = maxAbs - minAbs;
+ Double_t maxHeight( 0.0 );
+
+ // Just scan through the range
+ for ( Double_t point = minAbs; point <= maxAbs; point += range / 1000.0 ) {
+ maxPoint[0] = point;
+ this->calcLikelihoodInfo( maxPoint );
+ Double_t heightAtPoint = this->getUnNormLikelihood();
+ if ( heightAtPoint > maxHeight ) {
+ maxHeight = heightAtPoint;
+ }
+ }
+
+ // Mutliply by 120% to be on the safe side
+ maxHeight *= 1.2;
+
+ this->setMaxHeight( maxHeight );
}
diff --git a/src/LauCleoCPCoeffSet.cc b/src/LauCleoCPCoeffSet.cc
index d6d3041..3f1983f 100644
--- a/src/LauCleoCPCoeffSet.cc
+++ b/src/LauCleoCPCoeffSet.cc
@@ -1,341 +1,370 @@
/*
Copyright 2006 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauCleoCPCoeffSet.cc
\brief File containing implementation of LauCleoCPCoeffSet class.
*/
-#include <iostream>
-#include <fstream>
-#include <vector>
-
-#include "TMath.h"
-#include "TRandom.h"
-
#include "LauCleoCPCoeffSet.hh"
+
#include "LauComplex.hh"
#include "LauConstants.hh"
#include "LauParameter.hh"
#include "LauPrint.hh"
+#include "TMath.h"
+#include "TRandom.h"
+#include <fstream>
+#include <iostream>
+#include <vector>
-LauCleoCPCoeffSet::LauCleoCPCoeffSet(const TString& compName, Double_t a, Double_t delta, Double_t b, Double_t phi,
- Bool_t aFixed, Bool_t deltaFixed, Bool_t bFixed, Bool_t phiFixed, Bool_t bSecondStage, Bool_t phiSecondStage) :
- LauAbsCoeffSet(compName),
- a_(new LauParameter("A", a, minMagnitude_, maxMagnitude_, aFixed)),
- b_(new LauParameter("B", b, minMagnitude_, maxMagnitude_, bFixed)),
- delta_(new LauParameter("Delta", delta, minPhase_, maxPhase_, deltaFixed)),
- phi_(new LauParameter("Phi", phi, minPhase_, maxPhase_, phiFixed)),
- particleCoeff_( (a+b)*TMath::Cos(delta+phi), (a+b)*TMath::Sin(delta+phi) ),
- antiparticleCoeff_( (a-b)*TMath::Cos(delta-phi), (a-b)*TMath::Sin(delta-phi) ),
- acp_("ACP", (-2.0*a*b)/(a*a+b*b), -1.0, 1.0, bFixed&&phiFixed)
+LauCleoCPCoeffSet::LauCleoCPCoeffSet( const TString& compName,
+ Double_t a,
+ Double_t delta,
+ Double_t b,
+ Double_t phi,
+ Bool_t aFixed,
+ Bool_t deltaFixed,
+ Bool_t bFixed,
+ Bool_t phiFixed,
+ Bool_t bSecondStage,
+ Bool_t phiSecondStage ) :
+ LauAbsCoeffSet( compName ),
+ a_( new LauParameter( "A", a, minMagnitude_, maxMagnitude_, aFixed ) ),
+ b_( new LauParameter( "B", b, minMagnitude_, maxMagnitude_, bFixed ) ),
+ delta_( new LauParameter( "Delta", delta, minPhase_, maxPhase_, deltaFixed ) ),
+ phi_( new LauParameter( "Phi", phi, minPhase_, maxPhase_, phiFixed ) ),
+ particleCoeff_( ( a + b ) * TMath::Cos( delta + phi ), ( a + b ) * TMath::Sin( delta + phi ) ),
+ antiparticleCoeff_( ( a - b ) * TMath::Cos( delta - phi ), ( a - b ) * TMath::Sin( delta - phi ) ),
+ acp_( "ACP", ( -2.0 * a * b ) / ( a * a + b * b ), -1.0, 1.0, bFixed && phiFixed )
{
- if (bSecondStage && !bFixed) {
- b_->secondStage(kTRUE);
- b_->initValue(0.0);
- }
- if (phiSecondStage && !phiFixed) {
- phi_->secondStage(kTRUE);
- phi_->initValue(0.0);
- }
+ if ( bSecondStage && ! bFixed ) {
+ b_->secondStage( kTRUE );
+ b_->initValue( 0.0 );
+ }
+ if ( phiSecondStage && ! phiFixed ) {
+ phi_->secondStage( kTRUE );
+ phi_->initValue( 0.0 );
+ }
}
-LauCleoCPCoeffSet::LauCleoCPCoeffSet(const LauCleoCPCoeffSet& rhs, CloneOption cloneOption, Double_t constFactor) : LauAbsCoeffSet(rhs.name()),
- a_(0),
- b_(0),
- delta_(0),
- phi_(0),
- particleCoeff_( rhs.particleCoeff_ ),
- antiparticleCoeff_( rhs.antiparticleCoeff_ ),
- acp_( rhs.acp_ )
+LauCleoCPCoeffSet::LauCleoCPCoeffSet( const LauCleoCPCoeffSet& rhs,
+ CloneOption cloneOption,
+ Double_t constFactor ) :
+ LauAbsCoeffSet( rhs.name() ),
+ a_( 0 ),
+ b_( 0 ),
+ delta_( 0 ),
+ phi_( 0 ),
+ particleCoeff_( rhs.particleCoeff_ ),
+ antiparticleCoeff_( rhs.antiparticleCoeff_ ),
+ acp_( rhs.acp_ )
{
- if ( cloneOption == All || cloneOption == TieMagnitude ) {
- a_ = rhs.a_->createClone(constFactor);
- } else {
- a_ = new LauParameter("A", rhs.a_->value(), minMagnitude_, maxMagnitude_, rhs.a_->fixed());
- if ( rhs.a_->blind() ) {
- const LauBlind* blinder = rhs.a_->blinder();
- a_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
- }
- }
-
- if ( cloneOption == All || cloneOption == TieCPPars ) {
- b_ = rhs.b_->createClone(constFactor);
- } else {
- b_ = new LauParameter("B", rhs.b_->value(), minMagnitude_, maxMagnitude_, rhs.b_->fixed());
- if ( rhs.b_->blind() ) {
- const LauBlind* blinder = rhs.b_->blinder();
- b_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
- }
- }
-
- if ( cloneOption == All || cloneOption == TiePhase ) {
- delta_ = rhs.delta_->createClone(constFactor);
- } else {
- delta_ = new LauParameter("Delta", rhs.delta_->value(), minPhase_, maxPhase_, rhs.delta_->fixed());
- if ( rhs.delta_->blind() ) {
- const LauBlind* blinder = rhs.delta_->blinder();
- delta_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
- }
- }
-
- if ( cloneOption == All || cloneOption == TieCPPars ) {
- phi_ = rhs.phi_->createClone(constFactor);
- } else {
- phi_ = new LauParameter("Phi", rhs.phi_->value(), minPhase_, maxPhase_, rhs.phi_->fixed());
- if ( rhs.phi_->blind() ) {
- const LauBlind* blinder = rhs.phi_->blinder();
- phi_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
- }
- }
+ if ( cloneOption == All || cloneOption == TieMagnitude ) {
+ a_ = rhs.a_->createClone( constFactor );
+ } else {
+ a_ = new LauParameter( "A", rhs.a_->value(), minMagnitude_, maxMagnitude_, rhs.a_->fixed() );
+ if ( rhs.a_->blind() ) {
+ const LauBlind* blinder = rhs.a_->blinder();
+ a_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
+ }
+ }
+
+ if ( cloneOption == All || cloneOption == TieCPPars ) {
+ b_ = rhs.b_->createClone( constFactor );
+ } else {
+ b_ = new LauParameter( "B", rhs.b_->value(), minMagnitude_, maxMagnitude_, rhs.b_->fixed() );
+ if ( rhs.b_->blind() ) {
+ const LauBlind* blinder = rhs.b_->blinder();
+ b_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
+ }
+ }
+
+ if ( cloneOption == All || cloneOption == TiePhase ) {
+ delta_ = rhs.delta_->createClone( constFactor );
+ } else {
+ delta_ =
+ new LauParameter( "Delta", rhs.delta_->value(), minPhase_, maxPhase_, rhs.delta_->fixed() );
+ if ( rhs.delta_->blind() ) {
+ const LauBlind* blinder = rhs.delta_->blinder();
+ delta_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
+ }
+ }
+
+ if ( cloneOption == All || cloneOption == TieCPPars ) {
+ phi_ = rhs.phi_->createClone( constFactor );
+ } else {
+ phi_ = new LauParameter( "Phi", rhs.phi_->value(), minPhase_, maxPhase_, rhs.phi_->fixed() );
+ if ( rhs.phi_->blind() ) {
+ const LauBlind* blinder = rhs.phi_->blinder();
+ phi_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
+ }
+ }
}
std::vector<LauParameter*> LauCleoCPCoeffSet::getParameters()
{
- std::vector<LauParameter*> pars;
- pars.push_back(a_);
- pars.push_back(b_);
- pars.push_back(delta_);
- pars.push_back(phi_);
- return pars;
+ std::vector<LauParameter*> pars;
+ pars.push_back( a_ );
+ pars.push_back( b_ );
+ pars.push_back( delta_ );
+ pars.push_back( phi_ );
+ return pars;
}
void LauCleoCPCoeffSet::printParValues() const
{
- std::cout<<"INFO in LauCleoCPCoeffSet::printParValues : Component \""<<this->name()<<"\" has ";
- std::cout<<"a-magnitude = "<<a_->value()<<",\t";
- std::cout<<"delta = "<<delta_->value()<<",\t";
- std::cout<<"b-magnitude = "<<b_->value()<<",\t";
- std::cout<<"phi = "<<phi_->value()<<"."<<std::endl;
+ std::cout << "INFO in LauCleoCPCoeffSet::printParValues : Component \"" << this->name()
+ << "\" has ";
+ std::cout << "a-magnitude = " << a_->value() << ",\t";
+ std::cout << "delta = " << delta_->value() << ",\t";
+ std::cout << "b-magnitude = " << b_->value() << ",\t";
+ std::cout << "phi = " << phi_->value() << "." << std::endl;
}
-void LauCleoCPCoeffSet::printTableHeading(std::ostream& stream) const
+void LauCleoCPCoeffSet::printTableHeading( std::ostream& stream ) const
{
- stream<<"\\begin{tabular}{|l|c|c|c|c|}"<<std::endl;
- stream<<"\\hline"<<std::endl;
- stream<<"Component & a-Magnitude & delta & b-Magnitude & phi \\\\"<<std::endl;
- stream<<"\\hline"<<std::endl;
+ stream << "\\begin{tabular}{|l|c|c|c|c|}" << std::endl;
+ stream << "\\hline" << std::endl;
+ stream << "Component & a-Magnitude & delta & b-Magnitude & phi \\\\" << std::endl;
+ stream << "\\hline" << std::endl;
}
-void LauCleoCPCoeffSet::printTableRow(std::ostream& stream) const
+void LauCleoCPCoeffSet::printTableRow( std::ostream& stream ) const
{
- LauPrint print;
- TString resName = this->name();
- resName = resName.ReplaceAll("_", "\\_");
- stream<<resName<<" & $";
- print.printFormat(stream, a_->value());
- stream<<" \\pm ";
- print.printFormat(stream, a_->error());
- stream<<"$ & $";
- print.printFormat(stream, delta_->value());
- stream<<" \\pm ";
- print.printFormat(stream, delta_->error());
- stream<<"$ & $";
- print.printFormat(stream, b_->value());
- stream<<" \\pm ";
- print.printFormat(stream, b_->error());
- stream<<"$ & $";
- print.printFormat(stream, phi_->value());
- stream<<" \\pm ";
- print.printFormat(stream, phi_->error());
- stream<<"$ \\\\"<<std::endl;
+ LauPrint print;
+ TString resName = this->name();
+ resName = resName.ReplaceAll( "_", "\\_" );
+ stream << resName << " & $";
+ print.printFormat( stream, a_->value() );
+ stream << " \\pm ";
+ print.printFormat( stream, a_->error() );
+ stream << "$ & $";
+ print.printFormat( stream, delta_->value() );
+ stream << " \\pm ";
+ print.printFormat( stream, delta_->error() );
+ stream << "$ & $";
+ print.printFormat( stream, b_->value() );
+ stream << " \\pm ";
+ print.printFormat( stream, b_->error() );
+ stream << "$ & $";
+ print.printFormat( stream, phi_->value() );
+ stream << " \\pm ";
+ print.printFormat( stream, phi_->error() );
+ stream << "$ \\\\" << std::endl;
}
void LauCleoCPCoeffSet::randomiseInitValues()
{
- if (a_->fixed() == kFALSE) {
- // Choose an a-magnitude between 0.0 and 2.0
- Double_t mag = LauAbsCoeffSet::getRandomiser()->Rndm()*2.0;
- a_->initValue(mag); a_->value(mag);
- }
- if (b_->fixed() == kFALSE && b_->secondStage() == kFALSE) {
- // Choose a b-magnitude between 0.0 and 0.1
- Double_t mag = LauAbsCoeffSet::getRandomiser()->Rndm()*0.1;
- b_->initValue(mag); b_->value(mag);
- }
- if (delta_->fixed() == kFALSE) {
- // Choose a phase between +- pi
- Double_t phase = LauAbsCoeffSet::getRandomiser()->Rndm()*LauConstants::twoPi - LauConstants::pi;
- delta_->initValue(phase); delta_->value(phase);
- }
- if (phi_->fixed() == kFALSE && phi_->secondStage() == kFALSE) {
- // Choose a phase between +- pi
- Double_t phase = LauAbsCoeffSet::getRandomiser()->Rndm()*LauConstants::twoPi - LauConstants::pi;
- phi_->initValue(phase); phi_->value(phase);
- }
+ if ( a_->fixed() == kFALSE ) {
+ // Choose an a-magnitude between 0.0 and 2.0
+ Double_t mag = LauAbsCoeffSet::getRandomiser()->Rndm() * 2.0;
+ a_->initValue( mag );
+ a_->value( mag );
+ }
+ if ( b_->fixed() == kFALSE && b_->secondStage() == kFALSE ) {
+ // Choose a b-magnitude between 0.0 and 0.1
+ Double_t mag = LauAbsCoeffSet::getRandomiser()->Rndm() * 0.1;
+ b_->initValue( mag );
+ b_->value( mag );
+ }
+ if ( delta_->fixed() == kFALSE ) {
+ // Choose a phase between +- pi
+ Double_t phase = LauAbsCoeffSet::getRandomiser()->Rndm() * LauConstants::twoPi -
+ LauConstants::pi;
+ delta_->initValue( phase );
+ delta_->value( phase );
+ }
+ if ( phi_->fixed() == kFALSE && phi_->secondStage() == kFALSE ) {
+ // Choose a phase between +- pi
+ Double_t phase = LauAbsCoeffSet::getRandomiser()->Rndm() * LauConstants::twoPi -
+ LauConstants::pi;
+ phi_->initValue( phase );
+ phi_->value( phase );
+ }
}
void LauCleoCPCoeffSet::finaliseValues()
{
- // retrieve the current values from the parameters
- Double_t aVal = a_->value();
- Double_t bVal = b_->value();
- Double_t deltaVal = delta_->value();
- Double_t phiVal = phi_->value();
- Double_t genDelta = delta_->genValue();
- Double_t genPhi = phi_->genValue();
-
- // Check whether we have a negative "a" magnitude.
- // If so make it positive and add pi to the "delta" phase.
- if (aVal < 0.0) {
- aVal *= -1.0;
- bVal *= -1.0;
- deltaVal += LauConstants::pi;
- }
-
- // Check now whether the phases lies in the right range (-pi to pi).
- Bool_t deltaWithinRange(kFALSE);
- Bool_t phiWithinRange(kFALSE);
- while (deltaWithinRange == kFALSE && phiWithinRange == kFALSE) {
- if (deltaVal > -LauConstants::pi && deltaVal < LauConstants::pi) {
- deltaWithinRange = kTRUE;
- } else {
- // Not within the specified range
- if (deltaVal > LauConstants::pi) {
- deltaVal -= LauConstants::twoPi;
- } else if (deltaVal < -LauConstants::pi) {
- deltaVal += LauConstants::twoPi;
- }
- }
-
- if (phiVal > -LauConstants::pi && phiVal < LauConstants::pi) {
- phiWithinRange = kTRUE;
- } else {
- // Not within the specified range
- if (phiVal > LauConstants::pi) {
- phiVal -= LauConstants::twoPi;
- } else if (phiVal < -LauConstants::pi) {
- phiVal += LauConstants::twoPi;
- }
- }
- }
-
- // A further problem can occur when the generated phase is close to -pi or pi.
- // The phase can wrap over to the other end of the scale -
- // this leads to artificially large pulls so we wrap it back.
- Double_t diff = deltaVal - genDelta;
- if (diff > LauConstants::pi) {
- deltaVal -= LauConstants::twoPi;
- } else if (diff < -LauConstants::pi) {
- deltaVal += LauConstants::twoPi;
- }
-
- diff = phiVal - genPhi;
- if (diff > LauConstants::pi) {
- phiVal -= LauConstants::twoPi;
- } else if (diff < -LauConstants::pi) {
- phiVal += LauConstants::twoPi;
- }
-
- // finally store the new values in the parameters
- // and update the pulls
- a_->value(aVal); a_->updatePull();
- b_->value(bVal); b_->updatePull();
- delta_->value(deltaVal); delta_->updatePull();
- phi_->value(phiVal); phi_->updatePull();
+ // retrieve the current values from the parameters
+ Double_t aVal = a_->value();
+ Double_t bVal = b_->value();
+ Double_t deltaVal = delta_->value();
+ Double_t phiVal = phi_->value();
+ Double_t genDelta = delta_->genValue();
+ Double_t genPhi = phi_->genValue();
+
+ // Check whether we have a negative "a" magnitude.
+ // If so make it positive and add pi to the "delta" phase.
+ if ( aVal < 0.0 ) {
+ aVal *= -1.0;
+ bVal *= -1.0;
+ deltaVal += LauConstants::pi;
+ }
+
+ // Check now whether the phases lies in the right range (-pi to pi).
+ Bool_t deltaWithinRange( kFALSE );
+ Bool_t phiWithinRange( kFALSE );
+ while ( deltaWithinRange == kFALSE && phiWithinRange == kFALSE ) {
+ if ( deltaVal > -LauConstants::pi && deltaVal < LauConstants::pi ) {
+ deltaWithinRange = kTRUE;
+ } else {
+ // Not within the specified range
+ if ( deltaVal > LauConstants::pi ) {
+ deltaVal -= LauConstants::twoPi;
+ } else if ( deltaVal < -LauConstants::pi ) {
+ deltaVal += LauConstants::twoPi;
+ }
+ }
+
+ if ( phiVal > -LauConstants::pi && phiVal < LauConstants::pi ) {
+ phiWithinRange = kTRUE;
+ } else {
+ // Not within the specified range
+ if ( phiVal > LauConstants::pi ) {
+ phiVal -= LauConstants::twoPi;
+ } else if ( phiVal < -LauConstants::pi ) {
+ phiVal += LauConstants::twoPi;
+ }
+ }
+ }
+
+ // A further problem can occur when the generated phase is close to -pi or pi.
+ // The phase can wrap over to the other end of the scale -
+ // this leads to artificially large pulls so we wrap it back.
+ Double_t diff = deltaVal - genDelta;
+ if ( diff > LauConstants::pi ) {
+ deltaVal -= LauConstants::twoPi;
+ } else if ( diff < -LauConstants::pi ) {
+ deltaVal += LauConstants::twoPi;
+ }
+
+ diff = phiVal - genPhi;
+ if ( diff > LauConstants::pi ) {
+ phiVal -= LauConstants::twoPi;
+ } else if ( diff < -LauConstants::pi ) {
+ phiVal += LauConstants::twoPi;
+ }
+
+ // finally store the new values in the parameters
+ // and update the pulls
+ a_->value( aVal );
+ a_->updatePull();
+ b_->value( bVal );
+ b_->updatePull();
+ delta_->value( deltaVal );
+ delta_->updatePull();
+ phi_->value( phiVal );
+ phi_->updatePull();
}
const LauComplex& LauCleoCPCoeffSet::particleCoeff()
{
- Double_t magnitude = a_->unblindValue() + b_->unblindValue();
- Double_t phase = delta_->unblindValue() + phi_->unblindValue();
- particleCoeff_.setRealImagPart(magnitude*TMath::Cos(phase), magnitude*TMath::Sin(phase));
- return particleCoeff_;
+ Double_t magnitude = a_->unblindValue() + b_->unblindValue();
+ Double_t phase = delta_->unblindValue() + phi_->unblindValue();
+ particleCoeff_.setRealImagPart( magnitude * TMath::Cos( phase ), magnitude * TMath::Sin( phase ) );
+ return particleCoeff_;
}
const LauComplex& LauCleoCPCoeffSet::antiparticleCoeff()
{
- Double_t magnitude = a_->unblindValue() - b_->unblindValue();
- Double_t phase = delta_->unblindValue() - phi_->unblindValue();
- antiparticleCoeff_.setRealImagPart(magnitude*TMath::Cos(phase), magnitude*TMath::Sin(phase));
- return antiparticleCoeff_;
+ Double_t magnitude = a_->unblindValue() - b_->unblindValue();
+ Double_t phase = delta_->unblindValue() - phi_->unblindValue();
+ antiparticleCoeff_.setRealImagPart( magnitude * TMath::Cos( phase ),
+ magnitude * TMath::Sin( phase ) );
+ return antiparticleCoeff_;
}
-void LauCleoCPCoeffSet::setCoeffValues( const LauComplex& coeff, const LauComplex& coeffBar, Bool_t init )
+void LauCleoCPCoeffSet::setCoeffValues( const LauComplex& coeff,
+ const LauComplex& coeffBar,
+ Bool_t init )
{
- Double_t mag = coeff.abs();
- Double_t magBar = coeffBar.abs();
- Double_t phase = coeff.arg();
- Double_t phaseBar = coeffBar.arg();
-
- Double_t aVal( 0.5 * ( mag + magBar ) );
- Double_t deltaVal( 0.5 * ( phase + phaseBar ) );
- Double_t bVal( 0.5 * ( mag - magBar ) );
- Double_t phiVal( 0.5 * ( phase - phaseBar ) );
-
- a_->value( aVal );
- delta_->value( deltaVal );
- b_->value( bVal );
- phi_->value( phiVal );
-
- if ( init ) {
- a_->genValue( aVal );
- delta_->genValue( deltaVal );
- b_->genValue( bVal );
- phi_->genValue( phiVal );
-
- a_->initValue( aVal );
- delta_->initValue( deltaVal );
- b_->initValue( bVal );
- phi_->initValue( phiVal );
- }
+ Double_t mag = coeff.abs();
+ Double_t magBar = coeffBar.abs();
+ Double_t phase = coeff.arg();
+ Double_t phaseBar = coeffBar.arg();
+
+ Double_t aVal( 0.5 * ( mag + magBar ) );
+ Double_t deltaVal( 0.5 * ( phase + phaseBar ) );
+ Double_t bVal( 0.5 * ( mag - magBar ) );
+ Double_t phiVal( 0.5 * ( phase - phaseBar ) );
+
+ a_->value( aVal );
+ delta_->value( deltaVal );
+ b_->value( bVal );
+ phi_->value( phiVal );
+
+ if ( init ) {
+ a_->genValue( aVal );
+ delta_->genValue( deltaVal );
+ b_->genValue( bVal );
+ phi_->genValue( phiVal );
+
+ a_->initValue( aVal );
+ delta_->initValue( deltaVal );
+ b_->initValue( bVal );
+ phi_->initValue( phiVal );
+ }
}
LauParameter LauCleoCPCoeffSet::acp()
{
- // set the name
- TString parName(this->baseName()); parName += "_ACP";
- acp_.name(parName);
+ // set the name
+ TString parName( this->baseName() );
+ parName += "_ACP";
+ acp_.name( parName );
- // work out the ACP value
- Double_t numer = -2.0*a_->value()*b_->value();
- Double_t denom = a_->value()*a_->value()+b_->value()*b_->value();
- Double_t value = numer/denom;
+ // work out the ACP value
+ Double_t numer = -2.0 * a_->value() * b_->value();
+ Double_t denom = a_->value() * a_->value() + b_->value() * b_->value();
+ Double_t value = numer / denom;
- // is it fixed?
- Bool_t fixed = a_->fixed() && b_->fixed();
- acp_.fixed(fixed);
+ // is it fixed?
+ Bool_t fixed = a_->fixed() && b_->fixed();
+ acp_.fixed( fixed );
- // we can't work out the error without the covariance matrix
- Double_t error(0.0);
+ // we can't work out the error without the covariance matrix
+ Double_t error( 0.0 );
- // set the value and error
- acp_.valueAndErrors(value,error);
+ // set the value and error
+ acp_.valueAndErrors( value, error );
- return acp_;
+ return acp_;
}
-LauAbsCoeffSet* LauCleoCPCoeffSet::createClone(const TString& newName, CloneOption cloneOption, Double_t constFactor)
+LauAbsCoeffSet* LauCleoCPCoeffSet::createClone( const TString& newName,
+ CloneOption cloneOption,
+ Double_t constFactor )
{
- LauAbsCoeffSet* clone(0);
- if ( cloneOption == All || cloneOption == TiePhase || cloneOption == TieMagnitude || cloneOption == TieCPPars ) {
- clone = new LauCleoCPCoeffSet( *this, cloneOption, constFactor );
- clone->name( newName );
- } else {
- std::cerr << "ERROR in LauCleoCPCoeffSet::createClone : Invalid clone option" << std::endl;
- }
- return clone;
+ LauAbsCoeffSet* clone( 0 );
+ if ( cloneOption == All || cloneOption == TiePhase || cloneOption == TieMagnitude ||
+ cloneOption == TieCPPars ) {
+ clone = new LauCleoCPCoeffSet( *this, cloneOption, constFactor );
+ clone->name( newName );
+ } else {
+ std::cerr << "ERROR in LauCleoCPCoeffSet::createClone : Invalid clone option" << std::endl;
+ }
+ return clone;
}
-
diff --git a/src/LauComplex.cc b/src/LauComplex.cc
index c5ecc53..b42c209 100644
--- a/src/LauComplex.cc
+++ b/src/LauComplex.cc
@@ -1,69 +1,66 @@
/*
Copyright 2004 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauComplex.cc
\brief File containing implementation of LauComplex class.
*/
/*****************************************************************************
* Class based on RooFit/RooComplex. *
* Original copyright given below. *
*****************************************************************************
* Authors: *
* WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
* DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
* *
* Copyright (c) 2000-2005, Regents of the University of California *
* and Stanford University. All rights reserved. *
* *
* Redistribution and use in source and binary forms, *
* with or without modification, are permitted according to the terms *
* listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
*****************************************************************************/
-#include <iostream>
-
#include "LauComplex.hh"
-
+#include <iostream>
void LauComplex::print() const
{
- std::cout << (*this) << std::endl;
+ std::cout << ( *this ) << std::endl;
}
-std::ostream& operator<<(std::ostream& os, const LauComplex& z)
+std::ostream& operator<<( std::ostream& os, const LauComplex& z )
{
- return os<<"("<<z.re()<<","<<z.im()<<")";
+ return os << "(" << z.re() << "," << z.im() << ")";
}
-std::istream& operator>>(std::istream& ios, LauComplex& z)
+std::istream& operator>>( std::istream& ios, LauComplex& z )
{
- Double_t a(0.0), b(0.0);
- char temp;
- ios >> temp >> a >> temp >> b >> temp;
- z.setRealImagPart( a, b );
- return ios;
+ Double_t a( 0.0 ), b( 0.0 );
+ char temp;
+ ios >> temp >> a >> temp >> b >> temp;
+ z.setRealImagPart( a, b );
+ return ios;
}
-
diff --git a/src/LauCruijffPdf.cc b/src/LauCruijffPdf.cc
index 3010d54..a884d4f 100644
--- a/src/LauCruijffPdf.cc
+++ b/src/LauCruijffPdf.cc
@@ -1,166 +1,168 @@
/*
Copyright 2008 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauCruijffPdf.cc
\brief File containing implementation of LauCruijffPdf class.
*/
/*****************************************************************************
* Class based on RooFit/RooCruijff. *
* Original copyright given below. *
*****************************************************************************
* Authors: *
* WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
* DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
* *
* Copyright (c) 2000-2005, Regents of the University of California *
* and Stanford University. All rights reserved. *
* *
* Redistribution and use in source and binary forms, *
* with or without modification, are permitted according to the terms *
* listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
*****************************************************************************/
#include <iostream>
#include <vector>
-using std::cout;
using std::cerr;
+using std::cout;
using std::endl;
-#include "TMath.h"
-#include "TSystem.h"
-
-#include "LauCruijffPdf.hh"
#include "LauConstants.hh"
+#include "LauCruijffPdf.hh"
+#include "TMath.h"
+#include "TSystem.h"
-LauCruijffPdf::LauCruijffPdf(const TString& theVarName, const std::vector<LauAbsRValue*>& params, Double_t minAbscissa, Double_t maxAbscissa) :
- LauAbsPdf(theVarName, params, minAbscissa, maxAbscissa),
- mean_(0),
- sigmaL_(0),
- sigmaR_(0),
- alphaL_(0),
- alphaR_(0)
+LauCruijffPdf::LauCruijffPdf( const TString& theVarName,
+ const std::vector<LauAbsRValue*>& params,
+ Double_t minAbscissa,
+ Double_t maxAbscissa ) :
+ LauAbsPdf( theVarName, params, minAbscissa, maxAbscissa ),
+ mean_( 0 ),
+ sigmaL_( 0 ),
+ sigmaR_( 0 ),
+ alphaL_( 0 ),
+ alphaR_( 0 )
{
- // Constructor for the Cruijff PDF.
- //
- // The parameters in params are the mean, sigmaR, sigmaL, alphaR
- // and alphaL.
- // The last two arguments specify the range in which the PDF is defined, and the PDF
- // will be normalised w.r.t. these limits.
-
- mean_ = this->findParameter("mean");
- sigmaR_ = this->findParameter("sigmaR");
- sigmaL_ = this->findParameter("sigmaL");
- alphaR_ = this->findParameter("alphaR");
- alphaL_ = this->findParameter("alphaL");
-
- if ((this->nParameters() != 5) || (mean_ == 0) || (sigmaR_ == 0) || (sigmaL_ == 0) || (alphaL_ == 0) || (alphaR_ == 0)) {
- cerr<<"ERROR in LauCruijffPdf constructor: LauCruijffPdf requires 5 parameters: \"mean\", \"sigmaL\", \"sigmaR\", \"alphaR\" and \"alphaL\"."<<endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // Cache the normalisation factor
- this->calcNorm();
+ // Constructor for the Cruijff PDF.
+ //
+ // The parameters in params are the mean, sigmaR, sigmaL, alphaR
+ // and alphaL.
+ // The last two arguments specify the range in which the PDF is defined, and the PDF
+ // will be normalised w.r.t. these limits.
+
+ mean_ = this->findParameter( "mean" );
+ sigmaR_ = this->findParameter( "sigmaR" );
+ sigmaL_ = this->findParameter( "sigmaL" );
+ alphaR_ = this->findParameter( "alphaR" );
+ alphaL_ = this->findParameter( "alphaL" );
+
+ if ( ( this->nParameters() != 5 ) || ( mean_ == 0 ) || ( sigmaR_ == 0 ) || ( sigmaL_ == 0 ) ||
+ ( alphaL_ == 0 ) || ( alphaR_ == 0 ) ) {
+ cerr << "ERROR in LauCruijffPdf constructor: LauCruijffPdf requires 5 parameters: \"mean\", \"sigmaL\", \"sigmaR\", \"alphaR\" and \"alphaL\"."
+ << endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // Cache the normalisation factor
+ this->calcNorm();
}
-LauCruijffPdf::~LauCruijffPdf()
+LauCruijffPdf::~LauCruijffPdf()
{
- // Destructor
+ // Destructor
}
-void LauCruijffPdf::calcLikelihoodInfo(const LauAbscissas& abscissas)
+void LauCruijffPdf::calcLikelihoodInfo( const LauAbscissas& abscissas )
{
- // Check that the given abscissa is within the allowed range
- if (!this->checkRange(abscissas)) {
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // Get our abscissa
- Double_t abscissa = abscissas[0];
-
- // Get the up to date parameter values
- Double_t mean = mean_->unblindValue();
- Double_t sigmaL = sigmaL_->unblindValue();
- Double_t sigmaR = sigmaR_->unblindValue();
- Double_t alphaL = alphaL_->unblindValue();
- Double_t alphaR = alphaR_->unblindValue();
-
- // Evaluate the LauCruijff PDF value
-
-
- Double_t arg = abscissa - mean;
- Double_t coef(0.0);
- Double_t value(0.0);
-
- if (arg < 0.0){
- if (TMath::Abs(sigmaL) > 1e-30) {
- coef = -1.0/(2.0*sigmaL*sigmaL + alphaL*arg*arg);
- }
- } else {
- if (TMath::Abs(sigmaR) > 1e-30) {
- coef = -1.0/(2.0*sigmaR*sigmaR+ alphaR*arg*arg);
- }
- }
- value = TMath::Exp(coef*arg*arg);
-
-
- // if the parameters are floating then we
- // need to recalculate the normalisation
- if (!this->cachePDF() && !this->withinNormCalc() && !this->withinGeneration()) {
- this->calcNorm();
- }
-
- this->setUnNormPDFVal(value);
+ // Check that the given abscissa is within the allowed range
+ if ( ! this->checkRange( abscissas ) ) {
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // Get our abscissa
+ Double_t abscissa = abscissas[0];
+
+ // Get the up to date parameter values
+ Double_t mean = mean_->unblindValue();
+ Double_t sigmaL = sigmaL_->unblindValue();
+ Double_t sigmaR = sigmaR_->unblindValue();
+ Double_t alphaL = alphaL_->unblindValue();
+ Double_t alphaR = alphaR_->unblindValue();
+
+ // Evaluate the LauCruijff PDF value
+
+ Double_t arg = abscissa - mean;
+ Double_t coef( 0.0 );
+ Double_t value( 0.0 );
+
+ if ( arg < 0.0 ) {
+ if ( TMath::Abs( sigmaL ) > 1e-30 ) {
+ coef = -1.0 / ( 2.0 * sigmaL * sigmaL + alphaL * arg * arg );
+ }
+ } else {
+ if ( TMath::Abs( sigmaR ) > 1e-30 ) {
+ coef = -1.0 / ( 2.0 * sigmaR * sigmaR + alphaR * arg * arg );
+ }
+ }
+ value = TMath::Exp( coef * arg * arg );
+
+ // if the parameters are floating then we
+ // need to recalculate the normalisation
+ if ( ! this->cachePDF() && ! this->withinNormCalc() && ! this->withinGeneration() ) {
+ this->calcNorm();
+ }
+
+ this->setUnNormPDFVal( value );
}
void LauCruijffPdf::calcPDFHeight( const LauKinematics* /*kinematics*/ )
{
- if (this->heightUpToDate()) {
- return;
- }
+ if ( this->heightUpToDate() ) {
+ return;
+ }
+
+ // Get the up to date parameter values
+ Double_t mean = mean_->unblindValue();
- // Get the up to date parameter values
- Double_t mean = mean_->unblindValue();
+ LauAbscissas maxPoint( 1 );
+ maxPoint[0] = mean;
- LauAbscissas maxPoint(1);
- maxPoint[0] = mean;
+ // Calculate the PDF height
- // Calculate the PDF height
-
- if (mean < this->getMinAbscissa()) {
- maxPoint[0] = this->getMinAbscissa();
- } else if (mean > this->getMaxAbscissa()) {
- maxPoint[0] = this->getMaxAbscissa();
- }
+ if ( mean < this->getMinAbscissa() ) {
+ maxPoint[0] = this->getMinAbscissa();
+ } else if ( mean > this->getMaxAbscissa() ) {
+ maxPoint[0] = this->getMaxAbscissa();
+ }
- this->calcLikelihoodInfo(maxPoint);
- Double_t height = this->getUnNormLikelihood();
+ this->calcLikelihoodInfo( maxPoint );
+ Double_t height = this->getUnNormLikelihood();
- // Multiply by a small factor to avoid problems from rounding errors
- height *= (1.0 + 1e-1);
+ // Multiply by a small factor to avoid problems from rounding errors
+ height *= ( 1.0 + 1e-1 );
- this->setMaxHeight(height);
+ this->setMaxHeight( height );
}
diff --git a/src/LauCrystalBallPdf.cc b/src/LauCrystalBallPdf.cc
index 2b9b3b3..f9e843b 100644
--- a/src/LauCrystalBallPdf.cc
+++ b/src/LauCrystalBallPdf.cc
@@ -1,228 +1,233 @@
/*
Copyright 2006 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauCrystalBallPdf.cc
\brief File containing implementation of LauCrystalBallPdf class.
*/
/*****************************************************************************
* Class based on RooFit/RooCBShape. *
* Original copyright given below. *
*****************************************************************************
* Authors: *
* WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
* DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
* *
* Copyright (c) 2000-2005, Regents of the University of California *
* and Stanford University. All rights reserved. *
* *
* Redistribution and use in source and binary forms, *
* with or without modification, are permitted according to the terms *
* listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
*****************************************************************************/
#include <iostream>
#include <vector>
-using std::cout;
using std::cerr;
+using std::cout;
using std::endl;
-#include "TMath.h"
-#include "TSystem.h"
-
#include "LauConstants.hh"
#include "LauCrystalBallPdf.hh"
+#include "TMath.h"
+#include "TSystem.h"
-
-LauCrystalBallPdf::LauCrystalBallPdf(const TString& theVarName, const std::vector<LauAbsRValue*>& params, Double_t minAbscissa, Double_t maxAbscissa) :
- LauAbsPdf(theVarName, params, minAbscissa, maxAbscissa),
- mean_(0),
- sigma_(0),
- alpha_(0),
- n_(0)
+LauCrystalBallPdf::LauCrystalBallPdf( const TString& theVarName,
+ const std::vector<LauAbsRValue*>& params,
+ Double_t minAbscissa,
+ Double_t maxAbscissa ) :
+ LauAbsPdf( theVarName, params, minAbscissa, maxAbscissa ),
+ mean_( 0 ),
+ sigma_( 0 ),
+ alpha_( 0 ),
+ n_( 0 )
{
- // Constructor for the Crystal Ball PDF, which is a gaussian and a decaying tail
- // smoothly matched up. The tail goes as a 1/x^n
- //
- // The parameters in params are the mean and the sigma (half the width) of the gaussian,
- // the distance from the mean in which the gaussian and the tail are matched up (which
- // can be negative or positive), and the power "n" for the tail.
- // The last two arguments specify the range in which the PDF is defined, and the PDF
- // will be normalised w.r.t. these limits.
-
- mean_ = this->findParameter("mean");
- sigma_ = this->findParameter("sigma");
- alpha_ = this->findParameter("alpha");
- n_ = this->findParameter("order");
-
- if ((this->nParameters() != 4) || (mean_ == 0) || (sigma_ == 0) || (alpha_ == 0) || (n_ == 0)) {
- cerr<<"ERROR in LauCrystalBallPdf constructor: LauCrystalBallPdf requires 4 parameters: \"mean\", \"sigma\", \"alpha\" and \"order\"."<<endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // Cache the normalisation factor
- this->calcNorm();
+ // Constructor for the Crystal Ball PDF, which is a gaussian and a decaying tail
+ // smoothly matched up. The tail goes as a 1/x^n
+ //
+ // The parameters in params are the mean and the sigma (half the width) of the gaussian,
+ // the distance from the mean in which the gaussian and the tail are matched up (which
+ // can be negative or positive), and the power "n" for the tail.
+ // The last two arguments specify the range in which the PDF is defined, and the PDF
+ // will be normalised w.r.t. these limits.
+
+ mean_ = this->findParameter( "mean" );
+ sigma_ = this->findParameter( "sigma" );
+ alpha_ = this->findParameter( "alpha" );
+ n_ = this->findParameter( "order" );
+
+ if ( ( this->nParameters() != 4 ) || ( mean_ == 0 ) || ( sigma_ == 0 ) || ( alpha_ == 0 ) ||
+ ( n_ == 0 ) ) {
+ cerr << "ERROR in LauCrystalBallPdf constructor: LauCrystalBallPdf requires 4 parameters: \"mean\", \"sigma\", \"alpha\" and \"order\"."
+ << endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // Cache the normalisation factor
+ this->calcNorm();
}
-LauCrystalBallPdf::~LauCrystalBallPdf()
+LauCrystalBallPdf::~LauCrystalBallPdf()
{
- // Destructor
+ // Destructor
}
-void LauCrystalBallPdf::calcLikelihoodInfo(const LauAbscissas& abscissas)
+void LauCrystalBallPdf::calcLikelihoodInfo( const LauAbscissas& abscissas )
{
- // Check that the given abscissa is within the allowed range
- if (!this->checkRange(abscissas)) {
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // Get our abscissa
- Double_t abscissa = abscissas[0];
-
- // Get the up to date parameter values
- Double_t mean = mean_->unblindValue();
- Double_t sigma = sigma_->unblindValue();
- Double_t alpha = alpha_->unblindValue();
- Double_t n = n_->unblindValue();
-
- Double_t result(0.0);
- Double_t t = (abscissa - mean)/sigma;
- if (alpha < 0.0) {
- t = -t;
- }
-
- Double_t absAlpha = TMath::Abs(alpha);
-
- if (t >= -absAlpha) {
- result = TMath::Exp(-0.5*t*t);
- } else {
- Double_t a = TMath::Power(n/absAlpha,n)*TMath::Exp(-0.5*absAlpha*absAlpha);
- Double_t b = n/absAlpha - absAlpha;
-
- result = a/TMath::Power(b - t, n);
- }
-
- this->setUnNormPDFVal(result);
-
- // if the parameters are floating then we
- // need to recalculate the normalisation
- if (!this->cachePDF() && !this->withinNormCalc() && !this->withinGeneration()) {
- this->calcNorm();
- }
-
+ // Check that the given abscissa is within the allowed range
+ if ( ! this->checkRange( abscissas ) ) {
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // Get our abscissa
+ Double_t abscissa = abscissas[0];
+
+ // Get the up to date parameter values
+ Double_t mean = mean_->unblindValue();
+ Double_t sigma = sigma_->unblindValue();
+ Double_t alpha = alpha_->unblindValue();
+ Double_t n = n_->unblindValue();
+
+ Double_t result( 0.0 );
+ Double_t t = ( abscissa - mean ) / sigma;
+ if ( alpha < 0.0 ) {
+ t = -t;
+ }
+
+ Double_t absAlpha = TMath::Abs( alpha );
+
+ if ( t >= -absAlpha ) {
+ result = TMath::Exp( -0.5 * t * t );
+ } else {
+ Double_t a = TMath::Power( n / absAlpha, n ) * TMath::Exp( -0.5 * absAlpha * absAlpha );
+ Double_t b = n / absAlpha - absAlpha;
+
+ result = a / TMath::Power( b - t, n );
+ }
+
+ this->setUnNormPDFVal( result );
+
+ // if the parameters are floating then we
+ // need to recalculate the normalisation
+ if ( ! this->cachePDF() && ! this->withinNormCalc() && ! this->withinGeneration() ) {
+ this->calcNorm();
+ }
}
-void LauCrystalBallPdf::calcNorm()
+void LauCrystalBallPdf::calcNorm()
{
- // Get the up to date parameter values
- Double_t mean = mean_->unblindValue();
- Double_t sigma = sigma_->unblindValue();
- Double_t alpha = alpha_->unblindValue();
- Double_t n = n_->unblindValue();
-
- Double_t result = 0.0;
- Bool_t useLog = kFALSE;
-
- if ( TMath::Abs(n-1.0) < 1.0e-05 ) {
- useLog = kTRUE;
- }
-
- Double_t sig = TMath::Abs(sigma);
-
- Double_t tmin = (this->getMinAbscissa() - mean)/sig;
- Double_t tmax = (this->getMaxAbscissa() - mean)/sig;
-
- if (alpha < 0) {
- Double_t tmp = tmin;
- tmin = -tmax;
- tmax = -tmp;
- }
-
- Double_t absAlpha = TMath::Abs(alpha);
-
- if ( tmin >= -absAlpha ) {
- result += sig*LauConstants::rootPiBy2*( this->approxErf( tmax / LauConstants::root2 )
- - approxErf( tmin / LauConstants::root2 ) );
- } else if ( tmax <= -absAlpha ) {
- Double_t a = TMath::Power(n/absAlpha, n)*TMath::Exp( -0.5*absAlpha*absAlpha);
- Double_t b = n/absAlpha - absAlpha;
-
- if ( useLog == kTRUE ) {
- result += a*sig*( TMath::Log(b - tmin) - TMath::Log(b - tmax) );
- } else {
- result += a*sig/(1.0 - n)*( 1.0/(TMath::Power( b - tmin, n - 1.0))
- - 1.0/(TMath::Power( b - tmax, n - 1.0)) );
- }
- } else {
- Double_t a = TMath::Power(n/absAlpha, n)*TMath::Exp( -0.5*absAlpha*absAlpha );
- Double_t b = n/absAlpha - absAlpha;
-
- Double_t term1 = 0.0;
- if ( useLog == kTRUE )
- term1 = a*sig*( TMath::Log(b - tmin) - TMath::Log(n / absAlpha));
- else
- term1 = a*sig/(1.0 - n)*( 1.0/(TMath::Power( b - tmin, n - 1.0))
- - 1.0/(TMath::Power( n/absAlpha, n - 1.0)) );
-
- Double_t term2 = sig*LauConstants::rootPiBy2*( this->approxErf( tmax / LauConstants::root2 )
- - this->approxErf( -absAlpha / LauConstants::root2 ) );
-
- result += term1 + term2;
- }
- this->setNorm(result);
+ // Get the up to date parameter values
+ Double_t mean = mean_->unblindValue();
+ Double_t sigma = sigma_->unblindValue();
+ Double_t alpha = alpha_->unblindValue();
+ Double_t n = n_->unblindValue();
+
+ Double_t result = 0.0;
+ Bool_t useLog = kFALSE;
+
+ if ( TMath::Abs( n - 1.0 ) < 1.0e-05 ) {
+ useLog = kTRUE;
+ }
+
+ Double_t sig = TMath::Abs( sigma );
+
+ Double_t tmin = ( this->getMinAbscissa() - mean ) / sig;
+ Double_t tmax = ( this->getMaxAbscissa() - mean ) / sig;
+
+ if ( alpha < 0 ) {
+ Double_t tmp = tmin;
+ tmin = -tmax;
+ tmax = -tmp;
+ }
+
+ Double_t absAlpha = TMath::Abs( alpha );
+
+ if ( tmin >= -absAlpha ) {
+ result += sig * LauConstants::rootPiBy2 *
+ ( this->approxErf( tmax / LauConstants::root2 ) -
+ approxErf( tmin / LauConstants::root2 ) );
+ } else if ( tmax <= -absAlpha ) {
+ Double_t a = TMath::Power( n / absAlpha, n ) * TMath::Exp( -0.5 * absAlpha * absAlpha );
+ Double_t b = n / absAlpha - absAlpha;
+
+ if ( useLog == kTRUE ) {
+ result += a * sig * ( TMath::Log( b - tmin ) - TMath::Log( b - tmax ) );
+ } else {
+ result += a * sig / ( 1.0 - n ) *
+ ( 1.0 / ( TMath::Power( b - tmin, n - 1.0 ) ) -
+ 1.0 / ( TMath::Power( b - tmax, n - 1.0 ) ) );
+ }
+ } else {
+ Double_t a = TMath::Power( n / absAlpha, n ) * TMath::Exp( -0.5 * absAlpha * absAlpha );
+ Double_t b = n / absAlpha - absAlpha;
+
+ Double_t term1 = 0.0;
+ if ( useLog == kTRUE )
+ term1 = a * sig * ( TMath::Log( b - tmin ) - TMath::Log( n / absAlpha ) );
+ else
+ term1 = a * sig / ( 1.0 - n ) *
+ ( 1.0 / ( TMath::Power( b - tmin, n - 1.0 ) ) -
+ 1.0 / ( TMath::Power( n / absAlpha, n - 1.0 ) ) );
+
+ Double_t term2 = sig * LauConstants::rootPiBy2 *
+ ( this->approxErf( tmax / LauConstants::root2 ) -
+ this->approxErf( -absAlpha / LauConstants::root2 ) );
+
+ result += term1 + term2;
+ }
+ this->setNorm( result );
}
void LauCrystalBallPdf::calcPDFHeight( const LauKinematics* /*kinematics*/ )
{
- if (this->heightUpToDate()) {
- return;
- }
+ if ( this->heightUpToDate() ) {
+ return;
+ }
- // Get the up to date parameter values
- Double_t mean = mean_->unblindValue();
+ // Get the up to date parameter values
+ Double_t mean = mean_->unblindValue();
- // The Crystall Ball function is a Gaussian with an exponentially decaying tail
- // Therefore, calculate the PDF height for the Gaussian function.
- LauAbscissas abscissa(1);
- abscissa[0] = mean;
- this->calcLikelihoodInfo(abscissa);
+ // The Crystall Ball function is a Gaussian with an exponentially decaying tail
+ // Therefore, calculate the PDF height for the Gaussian function.
+ LauAbscissas abscissa( 1 );
+ abscissa[0] = mean;
+ this->calcLikelihoodInfo( abscissa );
- Double_t height = this->getUnNormLikelihood();
- this->setMaxHeight(height);
+ Double_t height = this->getUnNormLikelihood();
+ this->setMaxHeight( height );
}
-Double_t LauCrystalBallPdf::approxErf(Double_t arg) const
+Double_t LauCrystalBallPdf::approxErf( Double_t arg ) const
{
- static const Double_t erflim = 5.0;
- if ( arg > erflim ) {
- return 1.0;
- }
- if ( arg < -erflim ) {
- return -1.0;
- }
-
- return TMath::Erf(arg);
+ static const Double_t erflim = 5.0;
+ if ( arg > erflim ) {
+ return 1.0;
+ }
+ if ( arg < -erflim ) {
+ return -1.0;
+ }
+
+ return TMath::Erf( arg );
}
-
diff --git a/src/LauDPDepBifurGaussPdf.cc b/src/LauDPDepBifurGaussPdf.cc
index 04965a3..bbb4d38 100644
--- a/src/LauDPDepBifurGaussPdf.cc
+++ b/src/LauDPDepBifurGaussPdf.cc
@@ -1,281 +1,293 @@
/*
Copyright 2007 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauDPDepBifurGaussPdf.cc
\brief File containing implementation of LauDPDepBifurGaussPdf class.
*/
#include <iostream>
#include <vector>
-using std::cout;
using std::cerr;
+using std::cout;
using std::endl;
-#include "TMath.h"
-#include "TRandom.h"
-#include "TSystem.h"
-
#include "Lau1DHistPdf.hh"
-#include "LauConstants.hh"
#include "LauComplex.hh"
+#include "LauConstants.hh"
+#include "LauDPDepBifurGaussPdf.hh"
#include "LauDaughters.hh"
#include "LauFitDataTree.hh"
#include "LauKinematics.hh"
-#include "LauDPDepBifurGaussPdf.hh"
-
+#include "TMath.h"
+#include "TRandom.h"
+#include "TSystem.h"
-LauDPDepBifurGaussPdf::LauDPDepBifurGaussPdf(const TString& theVarName, const std::vector<LauAbsRValue*>& params,
- Double_t minAbscissa, Double_t maxAbscissa,
- const LauDaughters* daughters,
- const std::vector<Double_t>& meanCoeffs,
- const std::vector<Double_t>& sigmaLCoeffs,
- const std::vector<Double_t>& sigmaRCoeffs,
- DPAxis dpAxis) :
- LauAbsPdf(theVarName, params, minAbscissa, maxAbscissa),
- kinematics_(daughters ? daughters->getKinematics() : 0),
- mean_(0),
- sigmaL_(0),
- sigmaR_(0),
- meanVal_(0.0),
- sigmaLVal_(0.0),
- sigmaRVal_(0.0),
- meanCoeffs_(meanCoeffs),
- sigmaLCoeffs_(sigmaLCoeffs),
- sigmaRCoeffs_(sigmaRCoeffs),
- dpAxis_(dpAxis),
- scaleMethod_(poly)
+LauDPDepBifurGaussPdf::LauDPDepBifurGaussPdf( const TString& theVarName,
+ const std::vector<LauAbsRValue*>& params,
+ Double_t minAbscissa,
+ Double_t maxAbscissa,
+ const LauDaughters* daughters,
+ const std::vector<Double_t>& meanCoeffs,
+ const std::vector<Double_t>& sigmaLCoeffs,
+ const std::vector<Double_t>& sigmaRCoeffs,
+ DPAxis dpAxis ) :
+ LauAbsPdf( theVarName, params, minAbscissa, maxAbscissa ),
+ kinematics_( daughters ? daughters->getKinematics() : 0 ),
+ mean_( 0 ),
+ sigmaL_( 0 ),
+ sigmaR_( 0 ),
+ meanVal_( 0.0 ),
+ sigmaLVal_( 0.0 ),
+ sigmaRVal_( 0.0 ),
+ meanCoeffs_( meanCoeffs ),
+ sigmaLCoeffs_( sigmaLCoeffs ),
+ sigmaRCoeffs_( sigmaRCoeffs ),
+ dpAxis_( dpAxis ),
+ scaleMethod_( poly )
{
- // Check we have a valid kinematics object
- if ( ! kinematics_ ) {
- cerr<<"ERROR in LauDPDepBifurGaussPdf::LauDPDepBifurGaussPdf : Have not been provided with a valid DP kinematics object."<<endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // The parameters are:
- // - the mean, the sigmaL and the sigmaR of the Bifurcated Gaussian
- //
- // The next two arguments specify the range in which the PDF is defined,
- // and the PDF will be normalised w.r.t. these limits.
- //
- // The final three argument define whether the BF Gaussian parameters should be scaled or not
-
- mean_ = this->findParameter("mean");
- sigmaL_ = this->findParameter("sigmaL");
- sigmaR_ = this->findParameter("sigmaR");
-
- if ((this->nParameters() != 3) || (mean_ == 0) || (sigmaL_ == 0) || (sigmaR_ == 0) ) {
- cerr<<"ERROR in LauDPDepBifurGaussPdf constructor: LauDPDepBifurGaussPdf requires 3 parameters:"
- <<" \"mean\", \"sigmaL\" and \"sigmaR\"."<<endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // Cache the normalisation factor
- this->calcNorm();
+ // Check we have a valid kinematics object
+ if ( ! kinematics_ ) {
+ cerr << "ERROR in LauDPDepBifurGaussPdf::LauDPDepBifurGaussPdf : Have not been provided with a valid DP kinematics object."
+ << endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // The parameters are:
+ // - the mean, the sigmaL and the sigmaR of the Bifurcated Gaussian
+ //
+ // The next two arguments specify the range in which the PDF is defined,
+ // and the PDF will be normalised w.r.t. these limits.
+ //
+ // The final three argument define whether the BF Gaussian parameters should be scaled or not
+
+ mean_ = this->findParameter( "mean" );
+ sigmaL_ = this->findParameter( "sigmaL" );
+ sigmaR_ = this->findParameter( "sigmaR" );
+
+ if ( ( this->nParameters() != 3 ) || ( mean_ == 0 ) || ( sigmaL_ == 0 ) || ( sigmaR_ == 0 ) ) {
+ cerr << "ERROR in LauDPDepBifurGaussPdf constructor: LauDPDepBifurGaussPdf requires 3 parameters:"
+ << " \"mean\", \"sigmaL\" and \"sigmaR\"." << endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // Cache the normalisation factor
+ this->calcNorm();
}
-LauDPDepBifurGaussPdf::~LauDPDepBifurGaussPdf()
+LauDPDepBifurGaussPdf::~LauDPDepBifurGaussPdf()
{
- // Destructor
+ // Destructor
}
-void LauDPDepBifurGaussPdf::calcLikelihoodInfo(const LauAbscissas& abscissas)
+void LauDPDepBifurGaussPdf::calcLikelihoodInfo( const LauAbscissas& abscissas )
{
- // Check that the given abscissas are within the allowed range
- if (!this->checkRange(abscissas)) {
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // Get our abscissa
- Double_t abscissa = abscissas[0];
-
- // Get the up to date parameter values
- meanVal_ = mean_->unblindValue();
- sigmaLVal_ = sigmaL_->unblindValue();
- sigmaRVal_ = sigmaR_->unblindValue();
-
- // Find out the DP position
- Double_t dpPos(0.0);
- UInt_t nVars = this->nInputVars();
- if ( abscissas.size() == nVars+2 ) {
- Double_t m13Sq = abscissas[nVars];
- Double_t m23Sq = abscissas[nVars+1];
-
- if ( dpAxis_ == M12 ) {
- dpPos = kinematics_->calcThirdMassSq(m13Sq,m23Sq);
- } else if ( dpAxis_ == M13 ) {
- dpPos = m13Sq;
- } else if ( dpAxis_ == M23 ) {
- dpPos = m23Sq;
- } else if ( dpAxis_ == MMIN ) {
- dpPos = TMath::Min( m13Sq, m23Sq );
- } else if ( dpAxis_ == MMAX ) {
- dpPos = TMath::Max( m13Sq, m23Sq );
- } else {
- dpPos = kinematics_->distanceFromDPCentre(m13Sq,m23Sq);
- }
- }
-
- // Scale the gaussian parameters by the dpPos (if appropriate)
- ScaleMethod scale = this->scaleMethod();
- if ( scale==poly ) {
- this->scalePars_poly(dpPos);
- } else if ( scale==polyNegPower ) {
- this->scalePars_polyNegPower(dpPos);
- } else {
- cerr<<"Scaling method unknown! Methods available: <poly> and <polyNegPower>."<<endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // Evaluate the Birfucated Gaussian PDF value
- Double_t arg = abscissa - meanVal_;
- Double_t coef(0.0);
- Double_t value(0.0);
-
- if (arg < 0.0) {
- if (TMath::Abs(sigmaLVal_) > 1e-30) {
- coef = -0.5/(sigmaLVal_*sigmaLVal_);
- }
- } else {
- if (TMath::Abs(sigmaRVal_) > 1e-30) {
- coef = -0.5/(sigmaRVal_*sigmaRVal_);
- }
- }
- value = TMath::Exp(coef*arg*arg);
-
- // Calculate the norm
- Double_t xscaleL = LauConstants::root2*sigmaLVal_;
- Double_t xscaleR = LauConstants::root2*sigmaRVal_;
-
- Double_t integral(0.0);
- Double_t norm(0.0);
- Double_t result(0.0);
-
-
- if ( this->getMaxAbscissa() < meanVal_ ) {
- integral = sigmaLVal_ * ( TMath::Erf((this->getMaxAbscissa() - meanVal_)/xscaleL) - TMath::Erf((this->getMinAbscissa() - meanVal_)/xscaleL));
- } else if ( this->getMinAbscissa() > meanVal_ ) {
- integral = sigmaRVal_ * (TMath::Erf((this->getMaxAbscissa() - meanVal_)/xscaleR) - TMath::Erf((this->getMinAbscissa() - meanVal_)/xscaleR));
- } else {
- integral = sigmaRVal_*TMath::Erf((this->getMaxAbscissa() -meanVal_)/xscaleR) - sigmaLVal_*TMath::Erf((this->getMinAbscissa() - meanVal_)/xscaleL);
- }
-
- norm = LauConstants::rootPiBy2*integral;
-
- // the result
- result = value/norm;
- this->setUnNormPDFVal(result);
+ // Check that the given abscissas are within the allowed range
+ if ( ! this->checkRange( abscissas ) ) {
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // Get our abscissa
+ Double_t abscissa = abscissas[0];
+
+ // Get the up to date parameter values
+ meanVal_ = mean_->unblindValue();
+ sigmaLVal_ = sigmaL_->unblindValue();
+ sigmaRVal_ = sigmaR_->unblindValue();
+
+ // Find out the DP position
+ Double_t dpPos( 0.0 );
+ UInt_t nVars = this->nInputVars();
+ if ( abscissas.size() == nVars + 2 ) {
+ Double_t m13Sq = abscissas[nVars];
+ Double_t m23Sq = abscissas[nVars + 1];
+
+ if ( dpAxis_ == M12 ) {
+ dpPos = kinematics_->calcThirdMassSq( m13Sq, m23Sq );
+ } else if ( dpAxis_ == M13 ) {
+ dpPos = m13Sq;
+ } else if ( dpAxis_ == M23 ) {
+ dpPos = m23Sq;
+ } else if ( dpAxis_ == MMIN ) {
+ dpPos = TMath::Min( m13Sq, m23Sq );
+ } else if ( dpAxis_ == MMAX ) {
+ dpPos = TMath::Max( m13Sq, m23Sq );
+ } else {
+ dpPos = kinematics_->distanceFromDPCentre( m13Sq, m23Sq );
+ }
+ }
+
+ // Scale the gaussian parameters by the dpPos (if appropriate)
+ ScaleMethod scale = this->scaleMethod();
+ if ( scale == poly ) {
+ this->scalePars_poly( dpPos );
+ } else if ( scale == polyNegPower ) {
+ this->scalePars_polyNegPower( dpPos );
+ } else {
+ cerr << "Scaling method unknown! Methods available: <poly> and <polyNegPower>." << endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // Evaluate the Birfucated Gaussian PDF value
+ Double_t arg = abscissa - meanVal_;
+ Double_t coef( 0.0 );
+ Double_t value( 0.0 );
+
+ if ( arg < 0.0 ) {
+ if ( TMath::Abs( sigmaLVal_ ) > 1e-30 ) {
+ coef = -0.5 / ( sigmaLVal_ * sigmaLVal_ );
+ }
+ } else {
+ if ( TMath::Abs( sigmaRVal_ ) > 1e-30 ) {
+ coef = -0.5 / ( sigmaRVal_ * sigmaRVal_ );
+ }
+ }
+ value = TMath::Exp( coef * arg * arg );
+
+ // Calculate the norm
+ Double_t xscaleL = LauConstants::root2 * sigmaLVal_;
+ Double_t xscaleR = LauConstants::root2 * sigmaRVal_;
+
+ Double_t integral( 0.0 );
+ Double_t norm( 0.0 );
+ Double_t result( 0.0 );
+
+ if ( this->getMaxAbscissa() < meanVal_ ) {
+ integral = sigmaLVal_ * ( TMath::Erf( ( this->getMaxAbscissa() - meanVal_ ) / xscaleL ) -
+ TMath::Erf( ( this->getMinAbscissa() - meanVal_ ) / xscaleL ) );
+ } else if ( this->getMinAbscissa() > meanVal_ ) {
+ integral = sigmaRVal_ * ( TMath::Erf( ( this->getMaxAbscissa() - meanVal_ ) / xscaleR ) -
+ TMath::Erf( ( this->getMinAbscissa() - meanVal_ ) / xscaleR ) );
+ } else {
+ integral = sigmaRVal_ * TMath::Erf( ( this->getMaxAbscissa() - meanVal_ ) / xscaleR ) -
+ sigmaLVal_ * TMath::Erf( ( this->getMinAbscissa() - meanVal_ ) / xscaleL );
+ }
+
+ norm = LauConstants::rootPiBy2 * integral;
+
+ // the result
+ result = value / norm;
+ this->setUnNormPDFVal( result );
}
-void LauDPDepBifurGaussPdf::scalePars_poly(Double_t dpPos)
+void LauDPDepBifurGaussPdf::scalePars_poly( Double_t dpPos )
{
- Int_t power = 1;
- for (std::vector<Double_t>::const_iterator iter = meanCoeffs_.begin(); iter != meanCoeffs_.end(); ++iter) {
- Double_t coeff = (*iter);
- meanVal_ += coeff * TMath::Power(dpPos,power);
- ++power;
- }
-
- power = 1;
- for (std::vector<Double_t>::const_iterator iter = sigmaLCoeffs_.begin(); iter != sigmaLCoeffs_.end(); ++iter) {
- Double_t coeff = (*iter);
- sigmaLVal_ += coeff * TMath::Power(dpPos,power);
- ++power;
- }
-
- power = 1;
- for (std::vector<Double_t>::const_iterator iter = sigmaRCoeffs_.begin(); iter != sigmaRCoeffs_.end(); ++iter) {
- Double_t coeff = (*iter);
- sigmaRVal_ += coeff * TMath::Power(dpPos,power);
- ++power;
- }
+ Int_t power = 1;
+ for ( std::vector<Double_t>::const_iterator iter = meanCoeffs_.begin(); iter != meanCoeffs_.end();
+ ++iter ) {
+ Double_t coeff = ( *iter );
+ meanVal_ += coeff * TMath::Power( dpPos, power );
+ ++power;
+ }
+
+ power = 1;
+ for ( std::vector<Double_t>::const_iterator iter = sigmaLCoeffs_.begin();
+ iter != sigmaLCoeffs_.end();
+ ++iter ) {
+ Double_t coeff = ( *iter );
+ sigmaLVal_ += coeff * TMath::Power( dpPos, power );
+ ++power;
+ }
+
+ power = 1;
+ for ( std::vector<Double_t>::const_iterator iter = sigmaRCoeffs_.begin();
+ iter != sigmaRCoeffs_.end();
+ ++iter ) {
+ Double_t coeff = ( *iter );
+ sigmaRVal_ += coeff * TMath::Power( dpPos, power );
+ ++power;
+ }
}
-void LauDPDepBifurGaussPdf::scalePars_polyNegPower(Double_t dpPos)
+void LauDPDepBifurGaussPdf::scalePars_polyNegPower( Double_t dpPos )
{
- Int_t power = -1;
- for (std::vector<Double_t>::const_iterator iter = meanCoeffs_.begin(); iter != meanCoeffs_.end(); ++iter) {
- Double_t coeff = (*iter);
- meanVal_ += coeff * TMath::Power(dpPos,power);
- --power;
- }
-
- power = -1;
- for (std::vector<Double_t>::const_iterator iter = sigmaLCoeffs_.begin(); iter != sigmaLCoeffs_.end(); ++iter) {
- Double_t coeff = (*iter);
- sigmaLVal_ += coeff * TMath::Power(dpPos,power);
- --power;
- }
-
- power = -1;
- for (std::vector<Double_t>::const_iterator iter = sigmaRCoeffs_.begin(); iter != sigmaRCoeffs_.end(); ++iter) {
- Double_t coeff = (*iter);
- sigmaRVal_ += coeff * TMath::Power(dpPos,power);
- --power;
- }
+ Int_t power = -1;
+ for ( std::vector<Double_t>::const_iterator iter = meanCoeffs_.begin(); iter != meanCoeffs_.end();
+ ++iter ) {
+ Double_t coeff = ( *iter );
+ meanVal_ += coeff * TMath::Power( dpPos, power );
+ --power;
+ }
+
+ power = -1;
+ for ( std::vector<Double_t>::const_iterator iter = sigmaLCoeffs_.begin();
+ iter != sigmaLCoeffs_.end();
+ ++iter ) {
+ Double_t coeff = ( *iter );
+ sigmaLVal_ += coeff * TMath::Power( dpPos, power );
+ --power;
+ }
+
+ power = -1;
+ for ( std::vector<Double_t>::const_iterator iter = sigmaRCoeffs_.begin();
+ iter != sigmaRCoeffs_.end();
+ ++iter ) {
+ Double_t coeff = ( *iter );
+ sigmaRVal_ += coeff * TMath::Power( dpPos, power );
+ --power;
+ }
}
-void LauDPDepBifurGaussPdf::calcNorm()
+void LauDPDepBifurGaussPdf::calcNorm()
{
- this->setNorm(1.0);
+ this->setNorm( 1.0 );
}
void LauDPDepBifurGaussPdf::calcPDFHeight( const LauKinematics* kinematics )
{
- // Get the up to date parameter values
- meanVal_ = mean_->unblindValue();
- sigmaLVal_ = sigmaL_->unblindValue();
- sigmaRVal_ = sigmaR_->unblindValue();
-
- // Scale the gaussian parameters by the dpCentreDist (if appropriate)
- Double_t dpCentreDist = kinematics->distanceFromDPCentre();
- ScaleMethod scale = this->scaleMethod();
- if ( scale==poly ) {
- this->scalePars_poly(dpCentreDist);
- } else if ( scale==polyNegPower ) {
- this->scalePars_polyNegPower(dpCentreDist);
- } else {
- cerr<<"Scaling method unknown! Methods available: <poly> and <polyNegPower>."<<endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // Calculate the PDF height for the Bifurcated Gaussian function.
- LauAbscissas maxPoint(3);
- maxPoint[0] = meanVal_;
- maxPoint[1] = kinematics->getm13Sq();
- maxPoint[2] = kinematics->getm23Sq();
- if ( meanVal_ > this->getMaxAbscissa() ) {
- maxPoint[0] = this->getMaxAbscissa();
- } else if ( meanVal_ < this->getMinAbscissa() ) {
- maxPoint[0] = this->getMinAbscissa();
- }
- this->calcLikelihoodInfo(maxPoint);
- Double_t height = this->getUnNormLikelihood();
-
- // Multiply by a small factor to avoid problems from rounding errors
- height *= 1.001;
-
- this->setMaxHeight(height);
+ // Get the up to date parameter values
+ meanVal_ = mean_->unblindValue();
+ sigmaLVal_ = sigmaL_->unblindValue();
+ sigmaRVal_ = sigmaR_->unblindValue();
+
+ // Scale the gaussian parameters by the dpCentreDist (if appropriate)
+ Double_t dpCentreDist = kinematics->distanceFromDPCentre();
+ ScaleMethod scale = this->scaleMethod();
+ if ( scale == poly ) {
+ this->scalePars_poly( dpCentreDist );
+ } else if ( scale == polyNegPower ) {
+ this->scalePars_polyNegPower( dpCentreDist );
+ } else {
+ cerr << "Scaling method unknown! Methods available: <poly> and <polyNegPower>." << endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // Calculate the PDF height for the Bifurcated Gaussian function.
+ LauAbscissas maxPoint( 3 );
+ maxPoint[0] = meanVal_;
+ maxPoint[1] = kinematics->getm13Sq();
+ maxPoint[2] = kinematics->getm23Sq();
+ if ( meanVal_ > this->getMaxAbscissa() ) {
+ maxPoint[0] = this->getMaxAbscissa();
+ } else if ( meanVal_ < this->getMinAbscissa() ) {
+ maxPoint[0] = this->getMinAbscissa();
+ }
+ this->calcLikelihoodInfo( maxPoint );
+ Double_t height = this->getUnNormLikelihood();
+
+ // Multiply by a small factor to avoid problems from rounding errors
+ height *= 1.001;
+
+ this->setMaxHeight( height );
}
-
diff --git a/src/LauDPDepCruijffPdf.cc b/src/LauDPDepCruijffPdf.cc
index 41cc2d6..abb4795 100644
--- a/src/LauDPDepCruijffPdf.cc
+++ b/src/LauDPDepCruijffPdf.cc
@@ -1,320 +1,334 @@
/*
Copyright 2009 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauDPDepCruijffPdf.cc
\brief File containing implementation of LauDPDepCruijffPdf class.
*/
#include <iostream>
#include <vector>
-using std::cout;
using std::cerr;
+using std::cout;
using std::endl;
-#include "TMath.h"
-#include "TSystem.h"
-
#include "LauConstants.hh"
-#include "LauDaughters.hh"
#include "LauDPDepCruijffPdf.hh"
+#include "LauDaughters.hh"
#include "LauKinematics.hh"
+#include "TMath.h"
+#include "TSystem.h"
-
-LauDPDepCruijffPdf::LauDPDepCruijffPdf(const TString& theVarName, const std::vector<LauAbsRValue*>& params,
- Double_t minAbscissa, Double_t maxAbscissa,
- const LauDaughters* daughters,
- const std::vector<Double_t>& meanCoeffs,
- const std::vector<Double_t>& sigmaLCoeffs,
- const std::vector<Double_t>& sigmaRCoeffs,
- const std::vector<Double_t>& alphaLCoeffs,
- const std::vector<Double_t>& alphaRCoeffs,
- DPAxis dpAxis) :
- LauAbsPdf(theVarName, params, minAbscissa, maxAbscissa),
- kinematics_(daughters ? daughters->getKinematics() : 0),
- mean_(0),
- sigmaL_(0),
- sigmaR_(0),
- alphaL_(0),
- alphaR_(0),
- meanVal_(0.0),
- sigmaLVal_(0.0),
- sigmaRVal_(0.0),
- alphaLVal_(0.0),
- alphaRVal_(0.0),
- meanCoeffs_(meanCoeffs),
- sigmaLCoeffs_(sigmaLCoeffs),
- sigmaRCoeffs_(sigmaRCoeffs),
- alphaLCoeffs_(alphaLCoeffs),
- alphaRCoeffs_(alphaRCoeffs),
- dpAxis_(dpAxis)
+LauDPDepCruijffPdf::LauDPDepCruijffPdf( const TString& theVarName,
+ const std::vector<LauAbsRValue*>& params,
+ Double_t minAbscissa,
+ Double_t maxAbscissa,
+ const LauDaughters* daughters,
+ const std::vector<Double_t>& meanCoeffs,
+ const std::vector<Double_t>& sigmaLCoeffs,
+ const std::vector<Double_t>& sigmaRCoeffs,
+ const std::vector<Double_t>& alphaLCoeffs,
+ const std::vector<Double_t>& alphaRCoeffs,
+ DPAxis dpAxis ) :
+ LauAbsPdf( theVarName, params, minAbscissa, maxAbscissa ),
+ kinematics_( daughters ? daughters->getKinematics() : 0 ),
+ mean_( 0 ),
+ sigmaL_( 0 ),
+ sigmaR_( 0 ),
+ alphaL_( 0 ),
+ alphaR_( 0 ),
+ meanVal_( 0.0 ),
+ sigmaLVal_( 0.0 ),
+ sigmaRVal_( 0.0 ),
+ alphaLVal_( 0.0 ),
+ alphaRVal_( 0.0 ),
+ meanCoeffs_( meanCoeffs ),
+ sigmaLCoeffs_( sigmaLCoeffs ),
+ sigmaRCoeffs_( sigmaRCoeffs ),
+ alphaLCoeffs_( alphaLCoeffs ),
+ alphaRCoeffs_( alphaRCoeffs ),
+ dpAxis_( dpAxis )
{
- // Constructor for the Dalitz-plot dependent Cruijff PDF.
-
- // Check we have a valid kinematics object
- if ( ! kinematics_ ) {
- cerr<<"ERROR in LauDPDepCruijffPdf::LauDPDepCruijffPdf : Have not been provided with a valid DP kinematics object."<<endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // The parameters in params are the mean, sigmaR, sigmaL, alphaR and alphaL.
- // The last two arguments specify the range in which the PDF is defined, and the PDF
- // will be normalised w.r.t. these limits.
-
- mean_ = this->findParameter("mean");
- sigmaR_ = this->findParameter("sigmaR");
- sigmaL_ = this->findParameter("sigmaL");
- alphaR_ = this->findParameter("alphaR");
- alphaL_ = this->findParameter("alphaL");
-
- if ((this->nParameters() != 5) || (mean_ == 0) || (sigmaR_ == 0) || (sigmaL_ == 0) || (alphaL_ == 0) || (alphaR_ == 0)) {
- cerr<<"ERROR in LauDPDepCruijffPdf constructor: LauDPDepCruijffPdf requires 5 parameters: \"mean\", \"sigmaL\", \"sigmaR\", \"alphaR\" and \"alphaL\"."<<endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // Cache the normalisation factor
- this->calcNorm();
+ // Constructor for the Dalitz-plot dependent Cruijff PDF.
+
+ // Check we have a valid kinematics object
+ if ( ! kinematics_ ) {
+ cerr << "ERROR in LauDPDepCruijffPdf::LauDPDepCruijffPdf : Have not been provided with a valid DP kinematics object."
+ << endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // The parameters in params are the mean, sigmaR, sigmaL, alphaR and alphaL.
+ // The last two arguments specify the range in which the PDF is defined, and the PDF
+ // will be normalised w.r.t. these limits.
+
+ mean_ = this->findParameter( "mean" );
+ sigmaR_ = this->findParameter( "sigmaR" );
+ sigmaL_ = this->findParameter( "sigmaL" );
+ alphaR_ = this->findParameter( "alphaR" );
+ alphaL_ = this->findParameter( "alphaL" );
+
+ if ( ( this->nParameters() != 5 ) || ( mean_ == 0 ) || ( sigmaR_ == 0 ) || ( sigmaL_ == 0 ) ||
+ ( alphaL_ == 0 ) || ( alphaR_ == 0 ) ) {
+ cerr << "ERROR in LauDPDepCruijffPdf constructor: LauDPDepCruijffPdf requires 5 parameters: \"mean\", \"sigmaL\", \"sigmaR\", \"alphaR\" and \"alphaL\"."
+ << endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // Cache the normalisation factor
+ this->calcNorm();
}
-LauDPDepCruijffPdf::~LauDPDepCruijffPdf()
+LauDPDepCruijffPdf::~LauDPDepCruijffPdf()
{
- // Destructor
+ // Destructor
}
-void LauDPDepCruijffPdf::calcNorm()
+void LauDPDepCruijffPdf::calcNorm()
{
- this->setNorm(1.0);
+ this->setNorm( 1.0 );
}
-void LauDPDepCruijffPdf::calcLikelihoodInfo(const LauAbscissas& abscissas)
+void LauDPDepCruijffPdf::calcLikelihoodInfo( const LauAbscissas& abscissas )
{
- // Check that the given abscissa is within the allowed range
- if (!this->checkRange(abscissas)) {
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // Get our abscissa
- Double_t abscissa = abscissas[0];
-
- // Get the up to date parameter values
- meanVal_ = mean_->unblindValue();
- sigmaLVal_ = sigmaL_->unblindValue();
- sigmaRVal_ = sigmaR_->unblindValue();
- alphaLVal_ = alphaL_->unblindValue();
- alphaRVal_ = alphaR_->unblindValue();
-
- // Find out the DP position
- Double_t dpPos(0.0);
- UInt_t nVars = this->nInputVars();
- if ( abscissas.size() == nVars+2 ) {
- Double_t m13Sq = abscissas[nVars];
- Double_t m23Sq = abscissas[nVars+1];
-
- if ( dpAxis_ == M12 ) {
- dpPos = kinematics_->calcThirdMassSq(m13Sq,m23Sq);
- } else if ( dpAxis_ == M13 ) {
- dpPos = m13Sq;
- } else if ( dpAxis_ == M23 ) {
- dpPos = m23Sq;
- } else if ( dpAxis_ == MMIN ) {
- dpPos = TMath::Min( m13Sq, m23Sq );
- } else if ( dpAxis_ == MMAX ) {
- dpPos = TMath::Max( m13Sq, m23Sq );
- } else {
- dpPos = kinematics_->distanceFromDPCentre(m13Sq,m23Sq);
- }
- }
-
- // Scale the parameters according to the DP position
- this->scalePars( dpPos );
-
- // Calculate the PDF value
- Double_t value = this->currentPDFValue( abscissa );
-
- // Calculate the normalisation
- IntMethod sumMethod = this->integMethod();
- Double_t normFac = (sumMethod == GaussLegendre) ? this->integrGaussLegendre() : this->integTrapezoid();
-
- value /= normFac;
-
- this->setUnNormPDFVal(value);
+ // Check that the given abscissa is within the allowed range
+ if ( ! this->checkRange( abscissas ) ) {
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // Get our abscissa
+ Double_t abscissa = abscissas[0];
+
+ // Get the up to date parameter values
+ meanVal_ = mean_->unblindValue();
+ sigmaLVal_ = sigmaL_->unblindValue();
+ sigmaRVal_ = sigmaR_->unblindValue();
+ alphaLVal_ = alphaL_->unblindValue();
+ alphaRVal_ = alphaR_->unblindValue();
+
+ // Find out the DP position
+ Double_t dpPos( 0.0 );
+ UInt_t nVars = this->nInputVars();
+ if ( abscissas.size() == nVars + 2 ) {
+ Double_t m13Sq = abscissas[nVars];
+ Double_t m23Sq = abscissas[nVars + 1];
+
+ if ( dpAxis_ == M12 ) {
+ dpPos = kinematics_->calcThirdMassSq( m13Sq, m23Sq );
+ } else if ( dpAxis_ == M13 ) {
+ dpPos = m13Sq;
+ } else if ( dpAxis_ == M23 ) {
+ dpPos = m23Sq;
+ } else if ( dpAxis_ == MMIN ) {
+ dpPos = TMath::Min( m13Sq, m23Sq );
+ } else if ( dpAxis_ == MMAX ) {
+ dpPos = TMath::Max( m13Sq, m23Sq );
+ } else {
+ dpPos = kinematics_->distanceFromDPCentre( m13Sq, m23Sq );
+ }
+ }
+
+ // Scale the parameters according to the DP position
+ this->scalePars( dpPos );
+
+ // Calculate the PDF value
+ Double_t value = this->currentPDFValue( abscissa );
+
+ // Calculate the normalisation
+ IntMethod sumMethod = this->integMethod();
+ Double_t normFac = ( sumMethod == GaussLegendre ) ? this->integrGaussLegendre()
+ : this->integTrapezoid();
+
+ value /= normFac;
+
+ this->setUnNormPDFVal( value );
}
-Double_t LauDPDepCruijffPdf::currentPDFValue(Double_t abscissa) const
+Double_t LauDPDepCruijffPdf::currentPDFValue( Double_t abscissa ) const
{
- Double_t arg = abscissa - meanVal_;
- Double_t coef(0.0);
- if (arg < 0.0){
- if (TMath::Abs(sigmaLVal_) > 1e-30) {
- coef = -1.0/(2.0*sigmaLVal_*sigmaLVal_ + alphaLVal_*arg*arg);
- }
- } else {
- if (TMath::Abs(sigmaRVal_) > 1e-30) {
- coef = -1.0/(2.0*sigmaRVal_*sigmaRVal_ + alphaRVal_*arg*arg);
- }
- }
- return TMath::Exp(coef*arg*arg);
+ Double_t arg = abscissa - meanVal_;
+ Double_t coef( 0.0 );
+ if ( arg < 0.0 ) {
+ if ( TMath::Abs( sigmaLVal_ ) > 1e-30 ) {
+ coef = -1.0 / ( 2.0 * sigmaLVal_ * sigmaLVal_ + alphaLVal_ * arg * arg );
+ }
+ } else {
+ if ( TMath::Abs( sigmaRVal_ ) > 1e-30 ) {
+ coef = -1.0 / ( 2.0 * sigmaRVal_ * sigmaRVal_ + alphaRVal_ * arg * arg );
+ }
+ }
+ return TMath::Exp( coef * arg * arg );
}
Double_t LauDPDepCruijffPdf::integrGaussLegendre()
{
- if (!this->normWeightsDone()) {
- this->getNormWeights();
- }
-
- const std::vector<LauAbscissas>& norm_abscissas = this->normAbscissas();
- const std::vector<Double_t>& norm_weights = this->normWeights();
-
- // Now compute the integral
- Double_t norm(0.0);
- for (UInt_t i = 0; i < norm_weights.size(); i++) {
- Double_t fun = this->currentPDFValue( norm_abscissas[i][0] );
- Double_t intFactor = 0.5 * this->getRange();
- norm += norm_weights[i]*intFactor*fun;
- }
-
- return norm;
+ if ( ! this->normWeightsDone() ) {
+ this->getNormWeights();
+ }
+
+ const std::vector<LauAbscissas>& norm_abscissas = this->normAbscissas();
+ const std::vector<Double_t>& norm_weights = this->normWeights();
+
+ // Now compute the integral
+ Double_t norm( 0.0 );
+ for ( UInt_t i = 0; i < norm_weights.size(); i++ ) {
+ Double_t fun = this->currentPDFValue( norm_abscissas[i][0] );
+ Double_t intFactor = 0.5 * this->getRange();
+ norm += norm_weights[i] * intFactor * fun;
+ }
+
+ return norm;
}
Double_t LauDPDepCruijffPdf::integTrapezoid()
{
- static Double_t norm(0.0);
- Double_t range = this->getRange();
+ static Double_t norm( 0.0 );
+ Double_t range = this->getRange();
- if (this->nNormPoints()==1){
+ if ( this->nNormPoints() == 1 ) {
- Double_t abscissa = this->getMinAbscissa();
- Double_t funAbsMin = this->currentPDFValue(abscissa);
+ Double_t abscissa = this->getMinAbscissa();
+ Double_t funAbsMin = this->currentPDFValue( abscissa );
- abscissa = this->getMaxAbscissa();
- Double_t funAbsMax = this->currentPDFValue(abscissa);
+ abscissa = this->getMaxAbscissa();
+ Double_t funAbsMax = this->currentPDFValue( abscissa );
- norm = 0.5*range*(funAbsMin+funAbsMax);
- return norm;
+ norm = 0.5 * range * ( funAbsMin + funAbsMax );
+ return norm;
- } else {
+ } else {
- Double_t abscVal(0.0), tnm(0.0), sum(0.0), del(0.0);
- Int_t it(0), j(0);
+ Double_t abscVal( 0.0 ), tnm( 0.0 ), sum( 0.0 ), del( 0.0 );
+ Int_t it( 0 ), j( 0 );
- for (it=1, j=1; j< this->nNormPoints()-1; j++) {it<<=1;}
- tnm=it;
- del=range/tnm;
- abscVal= this->getMinAbscissa()+ 0.5*del;
+ for ( it = 1, j = 1; j < this->nNormPoints() - 1; j++ ) {
+ it <<= 1;
+ }
+ tnm = it;
+ del = range / tnm;
+ abscVal = this->getMinAbscissa() + 0.5 * del;
- for (sum = 0.0, j=1; j<it; j++, abscVal+=del) {
+ for ( sum = 0.0, j = 1; j < it; j++, abscVal += del ) {
- Double_t funVal = this->currentPDFValue(abscVal);
- sum+=funVal;
- }
+ Double_t funVal = this->currentPDFValue( abscVal );
+ sum += funVal;
+ }
- norm = 0.5*(norm + sum*range/tnm);
- return norm;
- }
+ norm = 0.5 * ( norm + sum * range / tnm );
+ return norm;
+ }
}
-void LauDPDepCruijffPdf::scalePars(Double_t dpPos)
+void LauDPDepCruijffPdf::scalePars( Double_t dpPos )
{
- Int_t power = 1;
- for (std::vector<Double_t>::const_iterator iter = meanCoeffs_.begin(); iter != meanCoeffs_.end(); ++iter) {
- Double_t coeff = (*iter);
- meanVal_ += coeff * TMath::Power(dpPos,power);
- ++power;
- }
-
- power = 1;
- for (std::vector<Double_t>::const_iterator iter = sigmaLCoeffs_.begin(); iter != sigmaLCoeffs_.end(); ++iter) {
- Double_t coeff = (*iter);
- sigmaLVal_ += coeff * TMath::Power(dpPos,power);
- ++power;
- }
-
- power = 1;
- for (std::vector<Double_t>::const_iterator iter = sigmaRCoeffs_.begin(); iter != sigmaRCoeffs_.end(); ++iter) {
- Double_t coeff = (*iter);
- sigmaRVal_ += coeff * TMath::Power(dpPos,power);
- ++power;
- }
-
- power = 1;
- for (std::vector<Double_t>::const_iterator iter = alphaLCoeffs_.begin(); iter != alphaLCoeffs_.end(); ++iter) {
- Double_t coeff = (*iter);
- alphaLVal_ += coeff * TMath::Power(dpPos,power);
- ++power;
- }
-
- power = 1;
- for (std::vector<Double_t>::const_iterator iter = alphaRCoeffs_.begin(); iter != alphaRCoeffs_.end(); ++iter) {
- Double_t coeff = (*iter);
- alphaRVal_ += coeff * TMath::Power(dpPos,power);
- ++power;
- }
+ Int_t power = 1;
+ for ( std::vector<Double_t>::const_iterator iter = meanCoeffs_.begin(); iter != meanCoeffs_.end();
+ ++iter ) {
+ Double_t coeff = ( *iter );
+ meanVal_ += coeff * TMath::Power( dpPos, power );
+ ++power;
+ }
+
+ power = 1;
+ for ( std::vector<Double_t>::const_iterator iter = sigmaLCoeffs_.begin();
+ iter != sigmaLCoeffs_.end();
+ ++iter ) {
+ Double_t coeff = ( *iter );
+ sigmaLVal_ += coeff * TMath::Power( dpPos, power );
+ ++power;
+ }
+
+ power = 1;
+ for ( std::vector<Double_t>::const_iterator iter = sigmaRCoeffs_.begin();
+ iter != sigmaRCoeffs_.end();
+ ++iter ) {
+ Double_t coeff = ( *iter );
+ sigmaRVal_ += coeff * TMath::Power( dpPos, power );
+ ++power;
+ }
+
+ power = 1;
+ for ( std::vector<Double_t>::const_iterator iter = alphaLCoeffs_.begin();
+ iter != alphaLCoeffs_.end();
+ ++iter ) {
+ Double_t coeff = ( *iter );
+ alphaLVal_ += coeff * TMath::Power( dpPos, power );
+ ++power;
+ }
+
+ power = 1;
+ for ( std::vector<Double_t>::const_iterator iter = alphaRCoeffs_.begin();
+ iter != alphaRCoeffs_.end();
+ ++iter ) {
+ Double_t coeff = ( *iter );
+ alphaRVal_ += coeff * TMath::Power( dpPos, power );
+ ++power;
+ }
}
void LauDPDepCruijffPdf::calcPDFHeight( const LauKinematics* kinematics )
{
- // Get the up to date parameter values
- meanVal_ = mean_->unblindValue();
- sigmaLVal_ = sigmaL_->unblindValue();
- sigmaRVal_ = sigmaR_->unblindValue();
- alphaLVal_ = alphaL_->unblindValue();
- alphaRVal_ = alphaR_->unblindValue();
-
- // Find out the DP position
- Double_t dpPos(0.0);
- if ( dpAxis_ == M12 ) {
- dpPos = kinematics->getm12Sq();
- } else if ( dpAxis_ == M13 ) {
- dpPos = kinematics->getm13Sq();
- } else if ( dpAxis_ == M23 ) {
- dpPos = kinematics->getm23Sq();
- } else {
- dpPos = kinematics->distanceFromDPCentre();
- }
-
- // Scale the parameters according to the DP position
- this->scalePars( dpPos );
-
- // Calculate the PDF height
-
- LauAbscissas maxPoint(3);
- maxPoint[0] = meanVal_;
- maxPoint[1] = kinematics->getm13Sq();
- maxPoint[2] = kinematics->getm23Sq();
-
- if (meanVal_ < this->getMinAbscissa()) {
- maxPoint[0] = this->getMinAbscissa();
- } else if (meanVal_ > this->getMaxAbscissa()) {
- maxPoint[0] = this->getMaxAbscissa();
- }
-
- this->calcLikelihoodInfo(maxPoint);
- Double_t height = this->getUnNormLikelihood();
-
- // Multiply by a small factor to avoid problems from rounding errors
- height *= 1.01;
-
- this->setMaxHeight(height);
+ // Get the up to date parameter values
+ meanVal_ = mean_->unblindValue();
+ sigmaLVal_ = sigmaL_->unblindValue();
+ sigmaRVal_ = sigmaR_->unblindValue();
+ alphaLVal_ = alphaL_->unblindValue();
+ alphaRVal_ = alphaR_->unblindValue();
+
+ // Find out the DP position
+ Double_t dpPos( 0.0 );
+ if ( dpAxis_ == M12 ) {
+ dpPos = kinematics->getm12Sq();
+ } else if ( dpAxis_ == M13 ) {
+ dpPos = kinematics->getm13Sq();
+ } else if ( dpAxis_ == M23 ) {
+ dpPos = kinematics->getm23Sq();
+ } else {
+ dpPos = kinematics->distanceFromDPCentre();
+ }
+
+ // Scale the parameters according to the DP position
+ this->scalePars( dpPos );
+
+ // Calculate the PDF height
+
+ LauAbscissas maxPoint( 3 );
+ maxPoint[0] = meanVal_;
+ maxPoint[1] = kinematics->getm13Sq();
+ maxPoint[2] = kinematics->getm23Sq();
+
+ if ( meanVal_ < this->getMinAbscissa() ) {
+ maxPoint[0] = this->getMinAbscissa();
+ } else if ( meanVal_ > this->getMaxAbscissa() ) {
+ maxPoint[0] = this->getMaxAbscissa();
+ }
+
+ this->calcLikelihoodInfo( maxPoint );
+ Double_t height = this->getUnNormLikelihood();
+
+ // Multiply by a small factor to avoid problems from rounding errors
+ height *= 1.01;
+
+ this->setMaxHeight( height );
}
-
diff --git a/src/LauDPDepGaussPdf.cc b/src/LauDPDepGaussPdf.cc
index aeecdc7..bf65b5f 100644
--- a/src/LauDPDepGaussPdf.cc
+++ b/src/LauDPDepGaussPdf.cc
@@ -1,216 +1,222 @@
/*
Copyright 2009 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauDPDepGaussPdf.cc
\brief File containing implementation of LauDPDepGaussPdf class.
*/
#include <iostream>
#include <vector>
-using std::cout;
using std::cerr;
+using std::cout;
using std::endl;
-#include "TMath.h"
-#include "TSystem.h"
-
#include "LauConstants.hh"
-#include "LauDaughters.hh"
#include "LauDPDepGaussPdf.hh"
+#include "LauDaughters.hh"
#include "LauKinematics.hh"
+#include "TMath.h"
+#include "TSystem.h"
-
-LauDPDepGaussPdf::LauDPDepGaussPdf(const TString& theVarName, const std::vector<LauAbsRValue*>& params,
- Double_t minAbscissa, Double_t maxAbscissa,
- const LauDaughters* daughters,
- const std::vector<Double_t>& meanCoeffs,
- const std::vector<Double_t>& sigmaCoeffs,
- DPAxis dpAxis) :
- LauAbsPdf(theVarName, params, minAbscissa, maxAbscissa),
- kinematics_(daughters ? daughters->getKinematics() : 0),
- mean_(0),
- sigma_(0),
- meanVal_(0.0),
- sigmaVal_(0.0),
- meanCoeffs_(meanCoeffs),
- sigmaCoeffs_(sigmaCoeffs),
- dpAxis_(dpAxis)
+LauDPDepGaussPdf::LauDPDepGaussPdf( const TString& theVarName,
+ const std::vector<LauAbsRValue*>& params,
+ Double_t minAbscissa,
+ Double_t maxAbscissa,
+ const LauDaughters* daughters,
+ const std::vector<Double_t>& meanCoeffs,
+ const std::vector<Double_t>& sigmaCoeffs,
+ DPAxis dpAxis ) :
+ LauAbsPdf( theVarName, params, minAbscissa, maxAbscissa ),
+ kinematics_( daughters ? daughters->getKinematics() : 0 ),
+ mean_( 0 ),
+ sigma_( 0 ),
+ meanVal_( 0.0 ),
+ sigmaVal_( 0.0 ),
+ meanCoeffs_( meanCoeffs ),
+ sigmaCoeffs_( sigmaCoeffs ),
+ dpAxis_( dpAxis )
{
- // Constructor for the Gaussian PDF.
-
- // Check we have a valid kinematics object
- if ( ! kinematics_ ) {
- cerr<<"ERROR in LauDPDepGaussPdf::LauDPDepGaussPdf : Have not been provided with a valid DP kinematics object."<<endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // The parameters in params are the mean and the sigma (half the width) of the gaussian.
- // The last two arguments specify the range in which the PDF is defined, and the PDF
- // will be normalised w.r.t. these limits.
-
- mean_ = this->findParameter("mean");
- sigma_ = this->findParameter("sigma");
-
- if ((this->nParameters() != 2) || (mean_ == 0) || (sigma_ == 0)) {
- cerr<<"ERROR in LauDPDepGaussPdf constructor: LauDPDepGaussPdf requires 2 parameters: \"mean\" and \"sigma\"."<<endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // Cache the normalisation factor
- this->calcNorm();
+ // Constructor for the Gaussian PDF.
+
+ // Check we have a valid kinematics object
+ if ( ! kinematics_ ) {
+ cerr << "ERROR in LauDPDepGaussPdf::LauDPDepGaussPdf : Have not been provided with a valid DP kinematics object."
+ << endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // The parameters in params are the mean and the sigma (half the width) of the gaussian.
+ // The last two arguments specify the range in which the PDF is defined, and the PDF
+ // will be normalised w.r.t. these limits.
+
+ mean_ = this->findParameter( "mean" );
+ sigma_ = this->findParameter( "sigma" );
+
+ if ( ( this->nParameters() != 2 ) || ( mean_ == 0 ) || ( sigma_ == 0 ) ) {
+ cerr << "ERROR in LauDPDepGaussPdf constructor: LauDPDepGaussPdf requires 2 parameters: \"mean\" and \"sigma\"."
+ << endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // Cache the normalisation factor
+ this->calcNorm();
}
-LauDPDepGaussPdf::~LauDPDepGaussPdf()
+LauDPDepGaussPdf::~LauDPDepGaussPdf()
{
- // Destructor
+ // Destructor
}
-void LauDPDepGaussPdf::calcNorm()
+void LauDPDepGaussPdf::calcNorm()
{
- this->setNorm(1.0);
+ this->setNorm( 1.0 );
}
-void LauDPDepGaussPdf::calcLikelihoodInfo(const LauAbscissas& abscissas)
+void LauDPDepGaussPdf::calcLikelihoodInfo( const LauAbscissas& abscissas )
{
- // Check that the given abscissa is within the allowed range
- if (!this->checkRange(abscissas)) {
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // Get our abscissa
- Double_t abscissa = abscissas[0];
-
- // Get the up to date parameter values
- meanVal_ = mean_->unblindValue();
- sigmaVal_ = sigma_->unblindValue();
-
- // Find out the DP position
- Double_t dpPos(0.0);
- UInt_t nVars = this->nInputVars();
- if ( abscissas.size() == nVars+2 ) {
- Double_t m13Sq = abscissas[nVars];
- Double_t m23Sq = abscissas[nVars+1];
-
- if ( dpAxis_ == M12 ) {
- dpPos = kinematics_->calcThirdMassSq(m13Sq,m23Sq);
- } else if ( dpAxis_ == M13 ) {
- dpPos = m13Sq;
- } else if ( dpAxis_ == M23 ) {
- dpPos = m23Sq;
- } else if ( dpAxis_ == MMIN ) {
- dpPos = TMath::Min( m13Sq, m23Sq );
- } else if ( dpAxis_ == MMAX ) {
- dpPos = TMath::Max( m13Sq, m23Sq );
- } else {
- dpPos = kinematics_->distanceFromDPCentre(m13Sq,m23Sq);
- }
- }
-
- // Scale the parameters according to the DP position
- this->scalePars( dpPos );
-
- // Calculate the value of the Gaussian for the given value of the abscissa.
- Double_t arg = abscissa - meanVal_;
-
- Double_t exponent(0.0);
- if (TMath::Abs(sigmaVal_) > 1e-10) {
- exponent = -0.5*arg*arg/(sigmaVal_*sigmaVal_);
- }
-
- Double_t value = TMath::Exp(exponent);
-
- Double_t norm(0.0);
- Double_t scale = LauConstants::root2*sigmaVal_;
- if (TMath::Abs(sigmaVal_) > 1e-10) {
- norm = LauConstants::rootPiBy2*sigmaVal_*(TMath::Erf((this->getMaxAbscissa() - meanVal_)/scale) - TMath::Erf((this->getMinAbscissa() - meanVal_)/scale));
- }
-
- value /= norm;
-
- this->setUnNormPDFVal(value);
+ // Check that the given abscissa is within the allowed range
+ if ( ! this->checkRange( abscissas ) ) {
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // Get our abscissa
+ Double_t abscissa = abscissas[0];
+
+ // Get the up to date parameter values
+ meanVal_ = mean_->unblindValue();
+ sigmaVal_ = sigma_->unblindValue();
+
+ // Find out the DP position
+ Double_t dpPos( 0.0 );
+ UInt_t nVars = this->nInputVars();
+ if ( abscissas.size() == nVars + 2 ) {
+ Double_t m13Sq = abscissas[nVars];
+ Double_t m23Sq = abscissas[nVars + 1];
+
+ if ( dpAxis_ == M12 ) {
+ dpPos = kinematics_->calcThirdMassSq( m13Sq, m23Sq );
+ } else if ( dpAxis_ == M13 ) {
+ dpPos = m13Sq;
+ } else if ( dpAxis_ == M23 ) {
+ dpPos = m23Sq;
+ } else if ( dpAxis_ == MMIN ) {
+ dpPos = TMath::Min( m13Sq, m23Sq );
+ } else if ( dpAxis_ == MMAX ) {
+ dpPos = TMath::Max( m13Sq, m23Sq );
+ } else {
+ dpPos = kinematics_->distanceFromDPCentre( m13Sq, m23Sq );
+ }
+ }
+
+ // Scale the parameters according to the DP position
+ this->scalePars( dpPos );
+
+ // Calculate the value of the Gaussian for the given value of the abscissa.
+ Double_t arg = abscissa - meanVal_;
+
+ Double_t exponent( 0.0 );
+ if ( TMath::Abs( sigmaVal_ ) > 1e-10 ) {
+ exponent = -0.5 * arg * arg / ( sigmaVal_ * sigmaVal_ );
+ }
+
+ Double_t value = TMath::Exp( exponent );
+
+ Double_t norm( 0.0 );
+ Double_t scale = LauConstants::root2 * sigmaVal_;
+ if ( TMath::Abs( sigmaVal_ ) > 1e-10 ) {
+ norm = LauConstants::rootPiBy2 * sigmaVal_ *
+ ( TMath::Erf( ( this->getMaxAbscissa() - meanVal_ ) / scale ) -
+ TMath::Erf( ( this->getMinAbscissa() - meanVal_ ) / scale ) );
+ }
+
+ value /= norm;
+
+ this->setUnNormPDFVal( value );
}
-void LauDPDepGaussPdf::scalePars(Double_t dpPos)
+void LauDPDepGaussPdf::scalePars( Double_t dpPos )
{
- Int_t power = 1;
- for (std::vector<Double_t>::const_iterator iter = meanCoeffs_.begin(); iter != meanCoeffs_.end(); ++iter) {
- Double_t coeff = (*iter);
- meanVal_ += coeff * TMath::Power(dpPos,power);
- ++power;
- }
-
- power = 1;
- for (std::vector<Double_t>::const_iterator iter = sigmaCoeffs_.begin(); iter != sigmaCoeffs_.end(); ++iter) {
- Double_t coeff = (*iter);
- sigmaVal_ += coeff * TMath::Power(dpPos,power);
- ++power;
- }
+ Int_t power = 1;
+ for ( std::vector<Double_t>::const_iterator iter = meanCoeffs_.begin(); iter != meanCoeffs_.end();
+ ++iter ) {
+ Double_t coeff = ( *iter );
+ meanVal_ += coeff * TMath::Power( dpPos, power );
+ ++power;
+ }
+
+ power = 1;
+ for ( std::vector<Double_t>::const_iterator iter = sigmaCoeffs_.begin();
+ iter != sigmaCoeffs_.end();
+ ++iter ) {
+ Double_t coeff = ( *iter );
+ sigmaVal_ += coeff * TMath::Power( dpPos, power );
+ ++power;
+ }
}
-void LauDPDepGaussPdf::calcPDFHeight(const LauKinematics* kinematics)
+void LauDPDepGaussPdf::calcPDFHeight( const LauKinematics* kinematics )
{
- // Get the up to date parameter values
- meanVal_ = mean_->unblindValue();
-
- // Find out the DP position
- Double_t dpPos(0.0);
- if ( dpAxis_ == M12 ) {
- dpPos = kinematics->getm12Sq();
- } else if ( dpAxis_ == M13 ) {
- dpPos = kinematics->getm13Sq();
- } else if ( dpAxis_ == M23 ) {
- dpPos = kinematics->getm23Sq();
- } else if ( dpAxis_ == MMIN ) {
- Double_t m13Sq = kinematics->getm13Sq();
- Double_t m23Sq = kinematics->getm23Sq();
- dpPos = TMath::Min( m13Sq, m23Sq );
- } else if ( dpAxis_ == MMAX ) {
- Double_t m13Sq = kinematics->getm13Sq();
- Double_t m23Sq = kinematics->getm23Sq();
- dpPos = TMath::Max( m13Sq, m23Sq );
- } else {
- dpPos = kinematics->distanceFromDPCentre();
- }
-
- // Scale the parameters according to the DP position
- this->scalePars( dpPos );
-
- LauAbscissas maxPoint(3);
- maxPoint[0] = meanVal_;
- maxPoint[1] = kinematics->getm13Sq();
- maxPoint[2] = kinematics->getm23Sq();
-
- // Calculate the PDF height for the Gaussian function.
- if (meanVal_>this->getMaxAbscissa()) {
- maxPoint[0] = this->getMaxAbscissa();
- } else if (meanVal_<this->getMinAbscissa()) {
- maxPoint[0] = this->getMinAbscissa();
- }
- this->calcLikelihoodInfo(maxPoint);
-
- Double_t height = this->getUnNormLikelihood();
- this->setMaxHeight(height);
+ // Get the up to date parameter values
+ meanVal_ = mean_->unblindValue();
+
+ // Find out the DP position
+ Double_t dpPos( 0.0 );
+ if ( dpAxis_ == M12 ) {
+ dpPos = kinematics->getm12Sq();
+ } else if ( dpAxis_ == M13 ) {
+ dpPos = kinematics->getm13Sq();
+ } else if ( dpAxis_ == M23 ) {
+ dpPos = kinematics->getm23Sq();
+ } else if ( dpAxis_ == MMIN ) {
+ Double_t m13Sq = kinematics->getm13Sq();
+ Double_t m23Sq = kinematics->getm23Sq();
+ dpPos = TMath::Min( m13Sq, m23Sq );
+ } else if ( dpAxis_ == MMAX ) {
+ Double_t m13Sq = kinematics->getm13Sq();
+ Double_t m23Sq = kinematics->getm23Sq();
+ dpPos = TMath::Max( m13Sq, m23Sq );
+ } else {
+ dpPos = kinematics->distanceFromDPCentre();
+ }
+
+ // Scale the parameters according to the DP position
+ this->scalePars( dpPos );
+
+ LauAbscissas maxPoint( 3 );
+ maxPoint[0] = meanVal_;
+ maxPoint[1] = kinematics->getm13Sq();
+ maxPoint[2] = kinematics->getm23Sq();
+
+ // Calculate the PDF height for the Gaussian function.
+ if ( meanVal_ > this->getMaxAbscissa() ) {
+ maxPoint[0] = this->getMaxAbscissa();
+ } else if ( meanVal_ < this->getMinAbscissa() ) {
+ maxPoint[0] = this->getMinAbscissa();
+ }
+ this->calcLikelihoodInfo( maxPoint );
+
+ Double_t height = this->getUnNormLikelihood();
+ this->setMaxHeight( height );
}
-
diff --git a/src/LauDPDepMapPdf.cc b/src/LauDPDepMapPdf.cc
index 087d45d..559500a 100644
--- a/src/LauDPDepMapPdf.cc
+++ b/src/LauDPDepMapPdf.cc
@@ -1,368 +1,384 @@
/*
Copyright 2013 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauDPDepMapPdf.cc
\brief File containing implementation of LauDPDepMapPdf class.
*/
#include <iostream>
#include <vector>
-using std::cout;
using std::cerr;
+using std::cout;
using std::endl;
-#include "TH1.h"
-#include "TMath.h"
-#include "TSystem.h"
-
+#include "Lau2DHistDP.hh"
#include "LauConstants.hh"
+#include "LauDPDepMapPdf.hh"
#include "LauDaughters.hh"
-#include "Lau2DHistDP.hh"
#include "LauParameter.hh"
-#include "LauDPDepMapPdf.hh"
-
+#include "TH1.h"
+#include "TMath.h"
+#include "TSystem.h"
-LauDPDepMapPdf::LauDPDepMapPdf(const std::vector<LauAbsPdf*>& pdfs,
- const LauDaughters* daughters,
- const TH2* dpHisto, Bool_t upperHalf) :
- LauAbsPdf((!pdfs.empty() && pdfs[0]) ? pdfs[0]->varNames() : std::vector<TString>(), std::vector<LauAbsRValue*>(), (!pdfs.empty() && pdfs[0]) ? pdfs[0]->getMinAbscissas() : LauFitData(), (!pdfs.empty() && pdfs[0]) ? pdfs[0]->getMaxAbscissas() : LauFitData()),
- daughters_( new LauDaughters(*daughters) ),
- pdfs_(pdfs),
- dpDependence_( new Lau2DHistDP(dpHisto, daughters, kFALSE, kFALSE, 0, 0, upperHalf, daughters->squareDP()) ),
- dpAxisDependence_(0),
- dpAxis_( CentreDist ),
- indices_(0)
+LauDPDepMapPdf::LauDPDepMapPdf( const std::vector<LauAbsPdf*>& pdfs,
+ const LauDaughters* daughters,
+ const TH2* dpHisto,
+ Bool_t upperHalf ) :
+ LauAbsPdf( ( ! pdfs.empty() && pdfs[0] ) ? pdfs[0]->varNames() : std::vector<TString>(),
+ std::vector<LauAbsRValue*>(),
+ ( ! pdfs.empty() && pdfs[0] ) ? pdfs[0]->getMinAbscissas() : LauFitData(),
+ ( ! pdfs.empty() && pdfs[0] ) ? pdfs[0]->getMaxAbscissas() : LauFitData() ),
+ daughters_( new LauDaughters( *daughters ) ),
+ pdfs_( pdfs ),
+ dpDependence_(
+ new Lau2DHistDP( dpHisto, daughters, kFALSE, kFALSE, 0, 0, upperHalf, daughters->squareDP() ) ),
+ dpAxisDependence_( 0 ),
+ dpAxis_( CentreDist ),
+ indices_( 0 )
{
- // Constructor for the PDF map.
- // The index into the PDF collection is read from the DP histogram.
-
-
- // So the first thing we have to do is check the pointers are all valid.
- for ( std::vector<LauAbsPdf*>::const_iterator iter = pdfs_.begin(); iter != pdfs_.end(); ++iter){
-
- if (!(*iter)) {
- cerr<<"ERROR in LauDPDepMapPdf constructor: one of the PDF pointers is null."<<endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // Next check that the abscissa ranges are the same for each PDF
- if (pdfs_[0]->getMinAbscissa() != (*iter)->getMinAbscissa()) {
- cerr<<"ERROR in LauDPDepMapPdf constructor: minimum abscissa values not the same for two PDFs."<<endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- if (pdfs_[0]->getMaxAbscissa() != (*iter)->getMaxAbscissa()) {
- cerr<<"ERROR in LauDPDepMapPdf constructor: maximum abscissa values not the same for two PDFs."<<endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // Also check that both PDFs are expecting the same number of input variables
- if (pdfs_[0]->nInputVars() != (*iter)->nInputVars()) {
- cerr<<"ERROR in LauDPDepMapPdf constructor: number of input variables not the same for two PDFs."<<endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // Also check that both PDFs are expecting the same variable name(s)
- if (pdfs_[0]->varNames() != (*iter)->varNames()) {
- cerr<<"ERROR in LauDPDepMapPdf constructor: variable name(s) not the same for two PDFs."<<endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- }
-
- // Then we need to grab all the parameters and pass them to the base class.
- // This is so that when we are asked for them they can be put into the fit.
-
-
- for ( std::vector<LauAbsPdf*>::const_iterator iter = pdfs_.begin(); iter != pdfs_.end(); ++iter){
- std::vector<LauAbsRValue*>& pdfpars = (*iter)->getParameters();
- this->addParameters(pdfpars);
-
- }
-
- // Cache the normalisation factor
- this->calcNorm();
+ // Constructor for the PDF map.
+ // The index into the PDF collection is read from the DP histogram.
+
+ // So the first thing we have to do is check the pointers are all valid.
+ for ( std::vector<LauAbsPdf*>::const_iterator iter = pdfs_.begin(); iter != pdfs_.end(); ++iter ) {
+
+ if ( ! ( *iter ) ) {
+ cerr << "ERROR in LauDPDepMapPdf constructor: one of the PDF pointers is null." << endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // Next check that the abscissa ranges are the same for each PDF
+ if ( pdfs_[0]->getMinAbscissa() != ( *iter )->getMinAbscissa() ) {
+ cerr << "ERROR in LauDPDepMapPdf constructor: minimum abscissa values not the same for two PDFs."
+ << endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ if ( pdfs_[0]->getMaxAbscissa() != ( *iter )->getMaxAbscissa() ) {
+ cerr << "ERROR in LauDPDepMapPdf constructor: maximum abscissa values not the same for two PDFs."
+ << endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // Also check that both PDFs are expecting the same number of input variables
+ if ( pdfs_[0]->nInputVars() != ( *iter )->nInputVars() ) {
+ cerr << "ERROR in LauDPDepMapPdf constructor: number of input variables not the same for two PDFs."
+ << endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // Also check that both PDFs are expecting the same variable name(s)
+ if ( pdfs_[0]->varNames() != ( *iter )->varNames() ) {
+ cerr << "ERROR in LauDPDepMapPdf constructor: variable name(s) not the same for two PDFs."
+ << endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ }
+
+ // Then we need to grab all the parameters and pass them to the base class.
+ // This is so that when we are asked for them they can be put into the fit.
+
+ for ( std::vector<LauAbsPdf*>::const_iterator iter = pdfs_.begin(); iter != pdfs_.end(); ++iter ) {
+ std::vector<LauAbsRValue*>& pdfpars = ( *iter )->getParameters();
+ this->addParameters( pdfpars );
+ }
+
+ // Cache the normalisation factor
+ this->calcNorm();
}
-LauDPDepMapPdf::LauDPDepMapPdf(const std::vector<LauAbsPdf*>& pdfs,
- const LauDaughters* daughters,
- const TH1* dpAxisHisto,
- DPAxis dpAxis) :
- LauAbsPdf((!pdfs.empty() && pdfs[0]) ? pdfs[0]->varNames() : std::vector<TString>(), std::vector<LauAbsRValue*>(), (!pdfs.empty() && pdfs[0]) ? pdfs[0]->getMinAbscissas() : LauFitData(), (!pdfs.empty() && pdfs[0]) ? pdfs[0]->getMaxAbscissas() : LauFitData()),
- daughters_( new LauDaughters(*daughters) ),
- pdfs_(pdfs),
- dpDependence_( 0 ),
- dpAxisDependence_(dpAxisHisto ? dynamic_cast<TH1*>(dpAxisHisto->Clone()) : 0),
- dpAxis_( dpAxis ),
- indices_( 0 )
+LauDPDepMapPdf::LauDPDepMapPdf( const std::vector<LauAbsPdf*>& pdfs,
+ const LauDaughters* daughters,
+ const TH1* dpAxisHisto,
+ DPAxis dpAxis ) :
+ LauAbsPdf( ( ! pdfs.empty() && pdfs[0] ) ? pdfs[0]->varNames() : std::vector<TString>(),
+ std::vector<LauAbsRValue*>(),
+ ( ! pdfs.empty() && pdfs[0] ) ? pdfs[0]->getMinAbscissas() : LauFitData(),
+ ( ! pdfs.empty() && pdfs[0] ) ? pdfs[0]->getMaxAbscissas() : LauFitData() ),
+ daughters_( new LauDaughters( *daughters ) ),
+ pdfs_( pdfs ),
+ dpDependence_( 0 ),
+ dpAxisDependence_( dpAxisHisto ? dynamic_cast<TH1*>( dpAxisHisto->Clone() ) : 0 ),
+ dpAxis_( dpAxis ),
+ indices_( 0 )
{
- // Constructor for the PDFs map.
- // The index into the PDF collection is read from one of
- // the DP axes.
-
- if ( dpAxisDependence_ ) {
- dpAxisDependence_->SetDirectory(0);
- }
-
- // So the first thing we have to do is check the pointers are all valid.
- for ( std::vector<LauAbsPdf*>::const_iterator iter = pdfs_.begin(); iter != pdfs_.end(); ++iter){
-
- if (!(*iter)) {
- cerr<<"ERROR in LauDPDepMapPdf constructor: one of the PDF pointers is null."<<endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // Next check that the abscissa ranges are the same for each PDF
- if (pdfs_[0]->getMinAbscissa() != (*iter)->getMinAbscissa()) {
- cerr<<"ERROR in LauDPDepMapPdf constructor: minimum abscissa values not the same for two PDFs."<<endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- if (pdfs_[0]->getMaxAbscissa() != (*iter)->getMaxAbscissa()) {
- cerr<<"ERROR in LauDPDepMapPdf constructor: maximum abscissa values not the same for two PDFs."<<endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // Also check that both PDFs are expecting the same number of input variables
- if (pdfs_[0]->nInputVars() != (*iter)->nInputVars()) {
- cerr<<"ERROR in LauDPDepMapPdf constructor: number of input variables not the same for two PDFs."<<endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // Also check that both PDFs are expecting the same variable name(s)
- if (pdfs_[0]->varNames() != (*iter)->varNames()) {
- cerr<<"ERROR in LauDPDepMapPdf constructor: variable name(s) not the same for two PDFs."<<endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- }
-
-
- // Then we need to grab all the parameters and pass them to the base class.
- // This is so that when we are asked for them they can be put into the fit.
-
- for ( std::vector<LauAbsPdf*>::const_iterator iter = pdfs_.begin(); iter != pdfs_.end(); ++iter){
- std::vector<LauAbsRValue*>& pdfpars = (*iter)->getParameters();
- this->addParameters(pdfpars);
-
- }
-
- // Cache the normalisation factor
- this->calcNorm();
+ // Constructor for the PDFs map.
+ // The index into the PDF collection is read from one of
+ // the DP axes.
+
+ if ( dpAxisDependence_ ) {
+ dpAxisDependence_->SetDirectory( 0 );
+ }
+
+ // So the first thing we have to do is check the pointers are all valid.
+ for ( std::vector<LauAbsPdf*>::const_iterator iter = pdfs_.begin(); iter != pdfs_.end(); ++iter ) {
+
+ if ( ! ( *iter ) ) {
+ cerr << "ERROR in LauDPDepMapPdf constructor: one of the PDF pointers is null." << endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // Next check that the abscissa ranges are the same for each PDF
+ if ( pdfs_[0]->getMinAbscissa() != ( *iter )->getMinAbscissa() ) {
+ cerr << "ERROR in LauDPDepMapPdf constructor: minimum abscissa values not the same for two PDFs."
+ << endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ if ( pdfs_[0]->getMaxAbscissa() != ( *iter )->getMaxAbscissa() ) {
+ cerr << "ERROR in LauDPDepMapPdf constructor: maximum abscissa values not the same for two PDFs."
+ << endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // Also check that both PDFs are expecting the same number of input variables
+ if ( pdfs_[0]->nInputVars() != ( *iter )->nInputVars() ) {
+ cerr << "ERROR in LauDPDepMapPdf constructor: number of input variables not the same for two PDFs."
+ << endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // Also check that both PDFs are expecting the same variable name(s)
+ if ( pdfs_[0]->varNames() != ( *iter )->varNames() ) {
+ cerr << "ERROR in LauDPDepMapPdf constructor: variable name(s) not the same for two PDFs."
+ << endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ }
+
+ // Then we need to grab all the parameters and pass them to the base class.
+ // This is so that when we are asked for them they can be put into the fit.
+
+ for ( std::vector<LauAbsPdf*>::const_iterator iter = pdfs_.begin(); iter != pdfs_.end(); ++iter ) {
+ std::vector<LauAbsRValue*>& pdfpars = ( *iter )->getParameters();
+ this->addParameters( pdfpars );
+ }
+
+ // Cache the normalisation factor
+ this->calcNorm();
}
-LauDPDepMapPdf::~LauDPDepMapPdf()
+LauDPDepMapPdf::~LauDPDepMapPdf()
{
- // Destructor
- delete daughters_; daughters_ = 0;
- delete dpDependence_; dpDependence_ = 0;
- delete dpAxisDependence_; dpAxisDependence_ = 0;
+ // Destructor
+ delete daughters_;
+ daughters_ = 0;
+ delete dpDependence_;
+ dpDependence_ = 0;
+ delete dpAxisDependence_;
+ dpAxisDependence_ = 0;
}
UInt_t LauDPDepMapPdf::determineDPRegion( Double_t m13Sq, Double_t m23Sq ) const
{
- UInt_t regionIndex(0);
-
- LauKinematics* kinematics = daughters_->getKinematics();
- kinematics->updateKinematics( m13Sq, m23Sq );
-
- if ( dpDependence_ ) {
- if (daughters_->squareDP()){
- Double_t mprime = kinematics->getmPrime();
- Double_t thprime = kinematics->getThetaPrime();
- regionIndex = static_cast<UInt_t>( dpDependence_->interpolateXY( mprime, thprime ) );
- } else {
- regionIndex = static_cast<UInt_t>( dpDependence_->interpolateXY( m13Sq, m23Sq ) );
- }
- } else if ( dpAxisDependence_ ) {
- Double_t dpPos(0.0);
- if ( dpAxis_ == M12 ) {
- dpPos = kinematics->calcThirdMassSq(m13Sq,m23Sq);
- } else if ( dpAxis_ == M13 ) {
- dpPos = m13Sq;
- } else if ( dpAxis_ == M23 ) {
- dpPos = m23Sq;
- } else if ( dpAxis_ == MMIN ) {
- dpPos = TMath::Min( m13Sq, m23Sq );
- } else if ( dpAxis_ == MMAX ) {
- dpPos = TMath::Max( m13Sq, m23Sq );
- } else {
- dpPos = kinematics->distanceFromDPCentre(m13Sq,m23Sq);
- }
- Int_t bin = dpAxisDependence_->FindFixBin( dpPos );
- regionIndex = static_cast<UInt_t>( dpAxisDependence_->GetBinContent( bin ) );
- } else {
- // This should never happen
- cerr << "ERROR in LauDPDepMapPdf::determineDPRegion : No means of determining the region!" << endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- return regionIndex;
+ UInt_t regionIndex( 0 );
+
+ LauKinematics* kinematics = daughters_->getKinematics();
+ kinematics->updateKinematics( m13Sq, m23Sq );
+
+ if ( dpDependence_ ) {
+ if ( daughters_->squareDP() ) {
+ Double_t mprime = kinematics->getmPrime();
+ Double_t thprime = kinematics->getThetaPrime();
+ regionIndex = static_cast<UInt_t>( dpDependence_->interpolateXY( mprime, thprime ) );
+ } else {
+ regionIndex = static_cast<UInt_t>( dpDependence_->interpolateXY( m13Sq, m23Sq ) );
+ }
+ } else if ( dpAxisDependence_ ) {
+ Double_t dpPos( 0.0 );
+ if ( dpAxis_ == M12 ) {
+ dpPos = kinematics->calcThirdMassSq( m13Sq, m23Sq );
+ } else if ( dpAxis_ == M13 ) {
+ dpPos = m13Sq;
+ } else if ( dpAxis_ == M23 ) {
+ dpPos = m23Sq;
+ } else if ( dpAxis_ == MMIN ) {
+ dpPos = TMath::Min( m13Sq, m23Sq );
+ } else if ( dpAxis_ == MMAX ) {
+ dpPos = TMath::Max( m13Sq, m23Sq );
+ } else {
+ dpPos = kinematics->distanceFromDPCentre( m13Sq, m23Sq );
+ }
+ Int_t bin = dpAxisDependence_->FindFixBin( dpPos );
+ regionIndex = static_cast<UInt_t>( dpAxisDependence_->GetBinContent( bin ) );
+ } else {
+ // This should never happen
+ cerr << "ERROR in LauDPDepMapPdf::determineDPRegion : No means of determining the region!"
+ << endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ return regionIndex;
}
-void LauDPDepMapPdf::calcLikelihoodInfo(const LauAbscissas& abscissas)
+void LauDPDepMapPdf::calcLikelihoodInfo( const LauAbscissas& abscissas )
{
- // Check that the given abscissa is within the allowed range
- if (!this->checkRange(abscissas)) {
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // Create a set of absissas that doesn't contain the DP variables
- UInt_t nVars = this->nInputVars();
- LauAbscissas noDPVars( nVars );
- for ( UInt_t i(0); i < nVars; ++i ) {
- noDPVars[i] = abscissas[i];
- }
-
- // Find which region of the DP we're in
- // The DP variables will be abscissas[nInputVars] and
- // abscissas[nInputVars+1] (if present).
- UInt_t regionIndex(0);
- if ( abscissas.size() == nVars+2 ) {
- Double_t m13Sq = abscissas[nVars];
- Double_t m23Sq = abscissas[nVars+1];
- regionIndex = this->determineDPRegion( m13Sq, m23Sq );
- } else {
- // This should never happen
- cerr << "ERROR in LauDPDepMapPdf::calcLikelihoodInfo : DP vars not supplied, no means of determining the region!" << endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // Check that the region index is valid
- if ( regionIndex >= pdfs_.size() ) {
- cerr << "ERROR in LauDPDepMapPdf::calcLikelihoodInfo : No PDF supplied for region " << regionIndex << endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // Evaluate the normalised PDF values
- LauAbsPdf* pdf = pdfs_[regionIndex];
-
- if ( pdf->isDPDependent() ) {
- pdf->calcLikelihoodInfo(abscissas);
- } else {
- pdf->calcLikelihoodInfo(noDPVars);
- }
-
- Double_t result = pdf->getUnNormLikelihood();
- this->setUnNormPDFVal(result);
-
- Double_t norm = pdf->getNorm();
- this->setNorm(norm);
+ // Check that the given abscissa is within the allowed range
+ if ( ! this->checkRange( abscissas ) ) {
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // Create a set of absissas that doesn't contain the DP variables
+ UInt_t nVars = this->nInputVars();
+ LauAbscissas noDPVars( nVars );
+ for ( UInt_t i( 0 ); i < nVars; ++i ) {
+ noDPVars[i] = abscissas[i];
+ }
+
+ // Find which region of the DP we're in
+ // The DP variables will be abscissas[nInputVars] and
+ // abscissas[nInputVars+1] (if present).
+ UInt_t regionIndex( 0 );
+ if ( abscissas.size() == nVars + 2 ) {
+ Double_t m13Sq = abscissas[nVars];
+ Double_t m23Sq = abscissas[nVars + 1];
+ regionIndex = this->determineDPRegion( m13Sq, m23Sq );
+ } else {
+ // This should never happen
+ cerr << "ERROR in LauDPDepMapPdf::calcLikelihoodInfo : DP vars not supplied, no means of determining the region!"
+ << endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // Check that the region index is valid
+ if ( regionIndex >= pdfs_.size() ) {
+ cerr << "ERROR in LauDPDepMapPdf::calcLikelihoodInfo : No PDF supplied for region "
+ << regionIndex << endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // Evaluate the normalised PDF values
+ LauAbsPdf* pdf = pdfs_[regionIndex];
+
+ if ( pdf->isDPDependent() ) {
+ pdf->calcLikelihoodInfo( abscissas );
+ } else {
+ pdf->calcLikelihoodInfo( noDPVars );
+ }
+
+ Double_t result = pdf->getUnNormLikelihood();
+ this->setUnNormPDFVal( result );
+
+ Double_t norm = pdf->getNorm();
+ this->setNorm( norm );
}
-void LauDPDepMapPdf::calcNorm()
+void LauDPDepMapPdf::calcNorm()
{
- // Nothing to do here, since it is already normalized
- this->setNorm(1.0);
+ // Nothing to do here, since it is already normalized
+ this->setNorm( 1.0 );
}
void LauDPDepMapPdf::calcPDFHeight( const LauKinematics* kinematics )
{
- // This method gives you the maximum possible height of the PDF.
- // It combines the maximum heights of the two individual PDFs.
- // So it would give the true maximum if the two individual maxima coincided.
- // It is guaranteed to always be >= the true maximum.
+ // This method gives you the maximum possible height of the PDF.
+ // It combines the maximum heights of the two individual PDFs.
+ // So it would give the true maximum if the two individual maxima coincided.
+ // It is guaranteed to always be >= the true maximum.
- Double_t m13Sq = kinematics->getm13Sq();
- Double_t m23Sq = kinematics->getm23Sq();
+ Double_t m13Sq = kinematics->getm13Sq();
+ Double_t m23Sq = kinematics->getm23Sq();
- // Find which region of the DP we're in
- UInt_t regionIndex = this->determineDPRegion( m13Sq, m23Sq );
+ // Find which region of the DP we're in
+ UInt_t regionIndex = this->determineDPRegion( m13Sq, m23Sq );
- // Check that the region index is valid
- if ( regionIndex >= pdfs_.size() ) {
- cerr << "ERROR in LauDPDepMapPdf::calcPDFHeight : No PDF supplied for region " << regionIndex << endl;
- gSystem->Exit(EXIT_FAILURE);
- }
+ // Check that the region index is valid
+ if ( regionIndex >= pdfs_.size() ) {
+ cerr << "ERROR in LauDPDepMapPdf::calcPDFHeight : No PDF supplied for region "
+ << regionIndex << endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
- // Evaluate the normalised PDF values
- LauAbsPdf* pdf = pdfs_[regionIndex];
+ // Evaluate the normalised PDF values
+ LauAbsPdf* pdf = pdfs_[regionIndex];
- // Update the heights of the individual PDFs
- pdf->calcPDFHeight( kinematics );
+ // Update the heights of the individual PDFs
+ pdf->calcPDFHeight( kinematics );
- // Find the PDF maximum
- Double_t height = pdf->getMaxHeight();
- this->setMaxHeight(height);
+ // Find the PDF maximum
+ Double_t height = pdf->getMaxHeight();
+ this->setMaxHeight( height );
}
// Override the base class methods for cacheInfo and calcLikelihoodInfo(UInt_t iEvt).
// For both of these we delegate some functionality to the constituent PDFs.
-void LauDPDepMapPdf::cacheInfo(const LauFitDataTree& inputData)
+void LauDPDepMapPdf::cacheInfo( const LauFitDataTree& inputData )
{
- // delegate to the sub-PDFs to cache their information
- for ( std::vector<LauAbsPdf*>::const_iterator iter = pdfs_.begin(); iter != pdfs_.end(); ++iter){
- (*iter)->cacheInfo( inputData );
- }
-
- // now check that the DP variables are included in the data
- Bool_t hasBranch = inputData.haveBranch( "m13Sq" );
- hasBranch &= inputData.haveBranch( "m23Sq" );
- if (!hasBranch) {
- cerr<<"ERROR in LauDPDepMapPdf::cacheInfo : Input data does not contain Dalitz plot variables m13Sq and/or m23Sq."<<endl;
- return;
- }
-
- // determine whether we are caching our PDF value
- Bool_t doCaching( this->nFixedParameters() == this->nParameters() );
- this->cachePDF( doCaching );
-
- if ( !doCaching ) {
- // in this case we seem to be doing a fit where the parameters are floating
- // so need to mark that the PDF height is no longer up to date
- this->heightUpToDate(kFALSE);
- }
-
- // clear the vector and reserve enough space
- UInt_t nEvents = inputData.nEvents();
- indices_.clear();
- indices_.reserve(nEvents);
-
- // loop through the events, determine the fraction and store
- for (UInt_t iEvt = 0; iEvt < nEvents; ++iEvt) {
-
- const LauFitData& dataValues = inputData.getData(iEvt);
-
- Double_t m13Sq = dataValues.find("m13Sq")->second;
- Double_t m23Sq = dataValues.find("m23Sq")->second;
-
- UInt_t regionIndex = this->determineDPRegion( m13Sq, m23Sq );
- indices_.push_back( regionIndex );
- }
+ // delegate to the sub-PDFs to cache their information
+ for ( std::vector<LauAbsPdf*>::const_iterator iter = pdfs_.begin(); iter != pdfs_.end(); ++iter ) {
+ ( *iter )->cacheInfo( inputData );
+ }
+
+ // now check that the DP variables are included in the data
+ Bool_t hasBranch = inputData.haveBranch( "m13Sq" );
+ hasBranch &= inputData.haveBranch( "m23Sq" );
+ if ( ! hasBranch ) {
+ cerr << "ERROR in LauDPDepMapPdf::cacheInfo : Input data does not contain Dalitz plot variables m13Sq and/or m23Sq."
+ << endl;
+ return;
+ }
+
+ // determine whether we are caching our PDF value
+ Bool_t doCaching( this->nFixedParameters() == this->nParameters() );
+ this->cachePDF( doCaching );
+
+ if ( ! doCaching ) {
+ // in this case we seem to be doing a fit where the parameters are floating
+ // so need to mark that the PDF height is no longer up to date
+ this->heightUpToDate( kFALSE );
+ }
+
+ // clear the vector and reserve enough space
+ UInt_t nEvents = inputData.nEvents();
+ indices_.clear();
+ indices_.reserve( nEvents );
+
+ // loop through the events, determine the fraction and store
+ for ( UInt_t iEvt = 0; iEvt < nEvents; ++iEvt ) {
+
+ const LauFitData& dataValues = inputData.getData( iEvt );
+
+ Double_t m13Sq = dataValues.find( "m13Sq" )->second;
+ Double_t m23Sq = dataValues.find( "m23Sq" )->second;
+
+ UInt_t regionIndex = this->determineDPRegion( m13Sq, m23Sq );
+ indices_.push_back( regionIndex );
+ }
}
-void LauDPDepMapPdf::calcLikelihoodInfo(UInt_t iEvt)
+void LauDPDepMapPdf::calcLikelihoodInfo( UInt_t iEvt )
{
- // Get the fraction value for this event
- UInt_t regionIndex = indices_[iEvt];
+ // Get the fraction value for this event
+ UInt_t regionIndex = indices_[iEvt];
- // Evaluate the normalised PDF value
- LauAbsPdf* pdf = pdfs_[regionIndex];
- pdf->calcLikelihoodInfo(iEvt);
+ // Evaluate the normalised PDF value
+ LauAbsPdf* pdf = pdfs_[regionIndex];
+ pdf->calcLikelihoodInfo( iEvt );
- Double_t result = pdf->getUnNormLikelihood();
- this->setUnNormPDFVal(result);
+ Double_t result = pdf->getUnNormLikelihood();
+ this->setUnNormPDFVal( result );
- Double_t norm = pdf->getNorm();
- this->setNorm(norm);
+ Double_t norm = pdf->getNorm();
+ this->setNorm( norm );
}
-
diff --git a/src/LauDPDepSumPdf.cc b/src/LauDPDepSumPdf.cc
index 8285819..b5c3255 100644
--- a/src/LauDPDepSumPdf.cc
+++ b/src/LauDPDepSumPdf.cc
@@ -1,430 +1,456 @@
/*
Copyright 2009 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauDPDepSumPdf.cc
\brief File containing implementation of LauDPDepSumPdf class.
*/
#include <iostream>
#include <vector>
-using std::cout;
using std::cerr;
+using std::cout;
using std::endl;
-#include "TMath.h"
-#include "TSystem.h"
-
#include "LauConstants.hh"
+#include "LauDPDepSumPdf.hh"
#include "LauDaughters.hh"
#include "LauEffModel.hh"
#include "LauParameter.hh"
-#include "LauDPDepSumPdf.hh"
-
+#include "TMath.h"
+#include "TSystem.h"
-LauDPDepSumPdf::LauDPDepSumPdf(LauAbsPdf* pdf1, LauAbsPdf* pdf2,
- const LauDaughters* daughters,
- const TH2* dpHisto, Bool_t upperHalf, Bool_t useSpline) :
- LauAbsPdf(pdf1 ? pdf1->varNames() : std::vector<TString>(), std::vector<LauAbsRValue*>(), pdf1 ? pdf1->getMinAbscissas() : LauFitData(), pdf1 ? pdf1->getMaxAbscissas() : LauFitData()),
- daughters_( new LauDaughters(*daughters) ),
- pdf1_(pdf1),
- pdf2_(pdf2),
- frac_(0),
- fracVal_(0.5),
- dpDependence_( new LauEffModel(daughters, 0) ),
- dpAxis_( CentreDist )
+LauDPDepSumPdf::LauDPDepSumPdf( LauAbsPdf* pdf1,
+ LauAbsPdf* pdf2,
+ const LauDaughters* daughters,
+ const TH2* dpHisto,
+ Bool_t upperHalf,
+ Bool_t useSpline ) :
+ LauAbsPdf( pdf1 ? pdf1->varNames() : std::vector<TString>(),
+ std::vector<LauAbsRValue*>(),
+ pdf1 ? pdf1->getMinAbscissas() : LauFitData(),
+ pdf1 ? pdf1->getMaxAbscissas() : LauFitData() ),
+ daughters_( new LauDaughters( *daughters ) ),
+ pdf1_( pdf1 ),
+ pdf2_( pdf2 ),
+ frac_( 0 ),
+ fracVal_( 0.5 ),
+ dpDependence_( new LauEffModel( daughters, 0 ) ),
+ dpAxis_( CentreDist )
{
- // Constructor for the sum PDF.
- // We are defining the sum as:
- // f x (PDF1/S(PDF1)) + (1-f) x (PDF2/S(PDF2))
- // where f is the fraction, x is multiplication, PDFi is the i'th PDF,
- // and S(PDFi) is the integral of the i'th PDF.
- // The value of the fraction is read from the DP histogram.
-
- if(useSpline) {
- dpDependence_->setEffSpline( dpHisto, kFALSE, 0.0, 0.0, upperHalf, daughters->squareDP());
- } else {
- dpDependence_->setEffHisto( dpHisto, kTRUE, kFALSE, 0.0, 0.0, upperHalf, daughters->squareDP() );
- }
-
- // So the first thing we have to do is check the pointers are all valid.
- if (!pdf1 || !pdf2) {
- cerr<<"ERROR in LauDPDepSumPdf constructor: one of the 2 PDF pointers is null."<<endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // Next check that the abscissa ranges are the same for each PDF
- if (pdf1->getMinAbscissa() != pdf2->getMinAbscissa()) {
- cerr<<"ERROR in LauDPDepSumPdf constructor: minimum abscissa values not the same for the two PDFs."<<endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- if (pdf1->getMaxAbscissa() != pdf2->getMaxAbscissa()) {
- cerr<<"ERROR in LauDPDepSumPdf constructor: maximum abscissa values not the same for the two PDFs."<<endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // Also check that both PDFs are expecting the same number of input variables
- if (pdf1->nInputVars() != pdf2->nInputVars()) {
- cerr<<"ERROR in LauDPDepSumPdf constructor: number of input variables not the same for the two PDFs."<<endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // Also check that both PDFs are expecting the same variable name(s)
- if (pdf1->varNames() != pdf2->varNames()) {
- cerr<<"ERROR in LauDPDepSumPdf constructor: variable name(s) not the same for the two PDFs."<<endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // Then we need to grab all the parameters and pass them to the base class.
- // This is so that when we are asked for them they can be put into the fit.
- // The number of parameters is the number in PDF1 + the number in PDF2.
- UInt_t nPar(pdf1->nParameters()+pdf2->nParameters());
- std::vector<LauAbsRValue*> params; params.reserve(nPar);
- std::vector<LauAbsRValue*>& pdf1pars = pdf1->getParameters();
- std::vector<LauAbsRValue*>& pdf2pars = pdf2->getParameters();
- for (std::vector<LauAbsRValue*>::iterator iter = pdf1pars.begin(); iter != pdf1pars.end(); ++iter) {
- params.push_back(*iter);
- }
- for (std::vector<LauAbsRValue*>::iterator iter = pdf2pars.begin(); iter != pdf2pars.end(); ++iter) {
- params.push_back(*iter);
- }
- this->addParameters(params);
-
- // Cache the normalisation factor
- this->calcNorm();
+ // Constructor for the sum PDF.
+ // We are defining the sum as:
+ // f x (PDF1/S(PDF1)) + (1-f) x (PDF2/S(PDF2))
+ // where f is the fraction, x is multiplication, PDFi is the i'th PDF,
+ // and S(PDFi) is the integral of the i'th PDF.
+ // The value of the fraction is read from the DP histogram.
+
+ if ( useSpline ) {
+ dpDependence_->setEffSpline( dpHisto, kFALSE, 0.0, 0.0, upperHalf, daughters->squareDP() );
+ } else {
+ dpDependence_->setEffHisto( dpHisto, kTRUE, kFALSE, 0.0, 0.0, upperHalf, daughters->squareDP() );
+ }
+
+ // So the first thing we have to do is check the pointers are all valid.
+ if ( ! pdf1 || ! pdf2 ) {
+ cerr << "ERROR in LauDPDepSumPdf constructor: one of the 2 PDF pointers is null." << endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // Next check that the abscissa ranges are the same for each PDF
+ if ( pdf1->getMinAbscissa() != pdf2->getMinAbscissa() ) {
+ cerr << "ERROR in LauDPDepSumPdf constructor: minimum abscissa values not the same for the two PDFs."
+ << endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ if ( pdf1->getMaxAbscissa() != pdf2->getMaxAbscissa() ) {
+ cerr << "ERROR in LauDPDepSumPdf constructor: maximum abscissa values not the same for the two PDFs."
+ << endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // Also check that both PDFs are expecting the same number of input variables
+ if ( pdf1->nInputVars() != pdf2->nInputVars() ) {
+ cerr << "ERROR in LauDPDepSumPdf constructor: number of input variables not the same for the two PDFs."
+ << endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // Also check that both PDFs are expecting the same variable name(s)
+ if ( pdf1->varNames() != pdf2->varNames() ) {
+ cerr << "ERROR in LauDPDepSumPdf constructor: variable name(s) not the same for the two PDFs."
+ << endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // Then we need to grab all the parameters and pass them to the base class.
+ // This is so that when we are asked for them they can be put into the fit.
+ // The number of parameters is the number in PDF1 + the number in PDF2.
+ UInt_t nPar( pdf1->nParameters() + pdf2->nParameters() );
+ std::vector<LauAbsRValue*> params;
+ params.reserve( nPar );
+ std::vector<LauAbsRValue*>& pdf1pars = pdf1->getParameters();
+ std::vector<LauAbsRValue*>& pdf2pars = pdf2->getParameters();
+ for ( std::vector<LauAbsRValue*>::iterator iter = pdf1pars.begin(); iter != pdf1pars.end();
+ ++iter ) {
+ params.push_back( *iter );
+ }
+ for ( std::vector<LauAbsRValue*>::iterator iter = pdf2pars.begin(); iter != pdf2pars.end();
+ ++iter ) {
+ params.push_back( *iter );
+ }
+ this->addParameters( params );
+
+ // Cache the normalisation factor
+ this->calcNorm();
}
-LauDPDepSumPdf::LauDPDepSumPdf(LauAbsPdf* pdf1, LauAbsPdf* pdf2,
- LauParameter* frac,
- const LauDaughters* daughters,
- const std::vector<Double_t>& fracCoeffs,
- DPAxis dpAxis) :
- LauAbsPdf(pdf1 ? pdf1->varNames() : std::vector<TString>(), std::vector<LauAbsRValue*>(), pdf1 ? pdf1->getMinAbscissas() : LauFitData(), pdf1 ? pdf1->getMaxAbscissas() : LauFitData()),
- daughters_( new LauDaughters(*daughters) ),
- pdf1_(pdf1),
- pdf2_(pdf2),
- frac_(frac),
- fracVal_( frac ? frac->unblindValue() : 0.0 ),
- dpDependence_( 0 ),
- fracCoeffs_( fracCoeffs ),
- dpAxis_( dpAxis )
+LauDPDepSumPdf::LauDPDepSumPdf( LauAbsPdf* pdf1,
+ LauAbsPdf* pdf2,
+ LauParameter* frac,
+ const LauDaughters* daughters,
+ const std::vector<Double_t>& fracCoeffs,
+ DPAxis dpAxis ) :
+ LauAbsPdf( pdf1 ? pdf1->varNames() : std::vector<TString>(),
+ std::vector<LauAbsRValue*>(),
+ pdf1 ? pdf1->getMinAbscissas() : LauFitData(),
+ pdf1 ? pdf1->getMaxAbscissas() : LauFitData() ),
+ daughters_( new LauDaughters( *daughters ) ),
+ pdf1_( pdf1 ),
+ pdf2_( pdf2 ),
+ frac_( frac ),
+ fracVal_( frac ? frac->unblindValue() : 0.0 ),
+ dpDependence_( 0 ),
+ fracCoeffs_( fracCoeffs ),
+ dpAxis_( dpAxis )
{
- // Constructor for the sum PDF.
- // We are defining the sum as:
- // f x (PDF1/S(PDF1)) + (1-f) x (PDF2/S(PDF2))
- // where f is the fraction, x is multiplication, PDFi is the i'th PDF,
- // and S(PDFi) is the integral of the i'th PDF.
- // The value of the fraction has a polynomial dependence on one of
- // the DP axes.
-
- // So the first thing we have to do is check the pointers are all valid.
- if (!pdf1 || !pdf2) {
- cerr<<"ERROR in LauDPDepSumPdf constructor: one of the 2 PDF pointers is null."<<endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- if ( !frac ) {
- cerr<<"ERROR in LauDPDepSumPdf constructor: the fraction parameter pointer is null."<<endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // Next check that the abscissa ranges are the same for each PDF
- if (pdf1->getMinAbscissa() != pdf2->getMinAbscissa()) {
- cerr<<"ERROR in LauDPDepSumPdf constructor: minimum abscissa values not the same for the two PDFs."<<endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- if (pdf1->getMaxAbscissa() != pdf2->getMaxAbscissa()) {
- cerr<<"ERROR in LauDPDepSumPdf constructor: maximum abscissa values not the same for the two PDFs."<<endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // Also check that both PDFs are expecting the same number of input variables
- if (pdf1->nInputVars() != pdf2->nInputVars()) {
- cerr<<"ERROR in LauDPDepSumPdf constructor: number of input variables not the same for the two PDFs."<<endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // Also check that both PDFs are expecting the same variable name(s)
- if (pdf1->varNames() != pdf2->varNames()) {
- cerr<<"ERROR in LauDPDepSumPdf constructor: variable name(s) not the same for the two PDFs."<<endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // Then we need to grab all the parameters and pass them to the base class.
- // This is so that when we are asked for them they can be put into the fit.
- // The number of parameters is the number in PDF1 + the number in PDF2.
- UInt_t nPar( pdf1->nParameters() + pdf2->nParameters() + 1 );
- std::vector<LauAbsRValue*> params; params.reserve(nPar);
- params.push_back(frac);
- std::vector<LauAbsRValue*>& pdf1pars = pdf1->getParameters();
- std::vector<LauAbsRValue*>& pdf2pars = pdf2->getParameters();
- for (std::vector<LauAbsRValue*>::iterator iter = pdf1pars.begin(); iter != pdf1pars.end(); ++iter) {
- params.push_back(*iter);
- }
- for (std::vector<LauAbsRValue*>::iterator iter = pdf2pars.begin(); iter != pdf2pars.end(); ++iter) {
- params.push_back(*iter);
- }
- this->addParameters(params);
-
- // Now check that we can find the fraction parameter ok
- frac_ = this->findParameter("frac");
- if (frac_ == 0) {
- cerr<<"ERROR in LauDPDepSumPdf constructor: parameter \"frac\" not found."<<endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // Cache the normalisation factor
- this->calcNorm();
+ // Constructor for the sum PDF.
+ // We are defining the sum as:
+ // f x (PDF1/S(PDF1)) + (1-f) x (PDF2/S(PDF2))
+ // where f is the fraction, x is multiplication, PDFi is the i'th PDF,
+ // and S(PDFi) is the integral of the i'th PDF.
+ // The value of the fraction has a polynomial dependence on one of
+ // the DP axes.
+
+ // So the first thing we have to do is check the pointers are all valid.
+ if ( ! pdf1 || ! pdf2 ) {
+ cerr << "ERROR in LauDPDepSumPdf constructor: one of the 2 PDF pointers is null." << endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ if ( ! frac ) {
+ cerr << "ERROR in LauDPDepSumPdf constructor: the fraction parameter pointer is null."
+ << endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // Next check that the abscissa ranges are the same for each PDF
+ if ( pdf1->getMinAbscissa() != pdf2->getMinAbscissa() ) {
+ cerr << "ERROR in LauDPDepSumPdf constructor: minimum abscissa values not the same for the two PDFs."
+ << endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ if ( pdf1->getMaxAbscissa() != pdf2->getMaxAbscissa() ) {
+ cerr << "ERROR in LauDPDepSumPdf constructor: maximum abscissa values not the same for the two PDFs."
+ << endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // Also check that both PDFs are expecting the same number of input variables
+ if ( pdf1->nInputVars() != pdf2->nInputVars() ) {
+ cerr << "ERROR in LauDPDepSumPdf constructor: number of input variables not the same for the two PDFs."
+ << endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // Also check that both PDFs are expecting the same variable name(s)
+ if ( pdf1->varNames() != pdf2->varNames() ) {
+ cerr << "ERROR in LauDPDepSumPdf constructor: variable name(s) not the same for the two PDFs."
+ << endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // Then we need to grab all the parameters and pass them to the base class.
+ // This is so that when we are asked for them they can be put into the fit.
+ // The number of parameters is the number in PDF1 + the number in PDF2.
+ UInt_t nPar( pdf1->nParameters() + pdf2->nParameters() + 1 );
+ std::vector<LauAbsRValue*> params;
+ params.reserve( nPar );
+ params.push_back( frac );
+ std::vector<LauAbsRValue*>& pdf1pars = pdf1->getParameters();
+ std::vector<LauAbsRValue*>& pdf2pars = pdf2->getParameters();
+ for ( std::vector<LauAbsRValue*>::iterator iter = pdf1pars.begin(); iter != pdf1pars.end();
+ ++iter ) {
+ params.push_back( *iter );
+ }
+ for ( std::vector<LauAbsRValue*>::iterator iter = pdf2pars.begin(); iter != pdf2pars.end();
+ ++iter ) {
+ params.push_back( *iter );
+ }
+ this->addParameters( params );
+
+ // Now check that we can find the fraction parameter ok
+ frac_ = this->findParameter( "frac" );
+ if ( frac_ == 0 ) {
+ cerr << "ERROR in LauDPDepSumPdf constructor: parameter \"frac\" not found." << endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // Cache the normalisation factor
+ this->calcNorm();
}
-LauDPDepSumPdf::~LauDPDepSumPdf()
+LauDPDepSumPdf::~LauDPDepSumPdf()
{
- // Destructor
- delete daughters_; daughters_ = 0;
- delete dpDependence_; dpDependence_ = 0;
+ // Destructor
+ delete daughters_;
+ daughters_ = 0;
+ delete dpDependence_;
+ dpDependence_ = 0;
}
-void LauDPDepSumPdf::calcLikelihoodInfo(const LauAbscissas& abscissas)
+void LauDPDepSumPdf::calcLikelihoodInfo( const LauAbscissas& abscissas )
{
- // Check that the given abscissa is within the allowed range
- if (!this->checkRange(abscissas)) {
- gSystem->Exit(EXIT_FAILURE);
- }
-
- LauAbscissas noDPVars(1);
- noDPVars[0] = abscissas[0];
-
- // Evaluate the normalised PDF values
- if ( pdf1_->isDPDependent() ) {
- pdf1_->calcLikelihoodInfo(abscissas);
- } else {
- pdf1_->calcLikelihoodInfo(noDPVars);
- }
- if ( pdf2_->isDPDependent() ) {
- pdf2_->calcLikelihoodInfo(abscissas);
- } else {
- pdf2_->calcLikelihoodInfo(noDPVars);
- }
- Double_t result1 = pdf1_->getLikelihood();
- Double_t result2 = pdf2_->getLikelihood();
-
- // Determine the fraction
- // The DP variables will be abscissas[nInputVars] and
- // abscissas[nInputVars+1] (if present).
- UInt_t nVars = this->nInputVars();
- if ( abscissas.size() == nVars+2 ) {
- Double_t m13Sq = abscissas[nVars];
- Double_t m23Sq = abscissas[nVars+1];
- LauKinematics* kinematics = daughters_->getKinematics();
- if ( dpDependence_ ) {
- kinematics->updateKinematics( m13Sq, m23Sq );
- fracVal_ = dpDependence_->calcEfficiency( kinematics );
- } else {
- fracVal_ = frac_->unblindValue();
- Double_t dpPos(0.0);
- if ( dpAxis_ == M12 ) {
- dpPos = kinematics->calcThirdMassSq(m13Sq,m23Sq);
- } else if ( dpAxis_ == M13 ) {
- dpPos = m13Sq;
- } else if ( dpAxis_ == M23 ) {
- dpPos = m23Sq;
- } else if ( dpAxis_ == MMIN ) {
- dpPos = TMath::Min( m13Sq, m23Sq );
- } else if ( dpAxis_ == MMAX ) {
- dpPos = TMath::Max( m13Sq, m23Sq );
- } else {
- dpPos = kinematics->distanceFromDPCentre(m13Sq,m23Sq);
- }
- this->scaleFrac( dpPos );
- }
- }
-
- // Add them together
- Double_t result = fracVal_ * result1 + (1.0-fracVal_) * result2;
- this->setUnNormPDFVal(result);
+ // Check that the given abscissa is within the allowed range
+ if ( ! this->checkRange( abscissas ) ) {
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ LauAbscissas noDPVars( 1 );
+ noDPVars[0] = abscissas[0];
+
+ // Evaluate the normalised PDF values
+ if ( pdf1_->isDPDependent() ) {
+ pdf1_->calcLikelihoodInfo( abscissas );
+ } else {
+ pdf1_->calcLikelihoodInfo( noDPVars );
+ }
+ if ( pdf2_->isDPDependent() ) {
+ pdf2_->calcLikelihoodInfo( abscissas );
+ } else {
+ pdf2_->calcLikelihoodInfo( noDPVars );
+ }
+ Double_t result1 = pdf1_->getLikelihood();
+ Double_t result2 = pdf2_->getLikelihood();
+
+ // Determine the fraction
+ // The DP variables will be abscissas[nInputVars] and
+ // abscissas[nInputVars+1] (if present).
+ UInt_t nVars = this->nInputVars();
+ if ( abscissas.size() == nVars + 2 ) {
+ Double_t m13Sq = abscissas[nVars];
+ Double_t m23Sq = abscissas[nVars + 1];
+ LauKinematics* kinematics = daughters_->getKinematics();
+ if ( dpDependence_ ) {
+ kinematics->updateKinematics( m13Sq, m23Sq );
+ fracVal_ = dpDependence_->calcEfficiency( kinematics );
+ } else {
+ fracVal_ = frac_->unblindValue();
+ Double_t dpPos( 0.0 );
+ if ( dpAxis_ == M12 ) {
+ dpPos = kinematics->calcThirdMassSq( m13Sq, m23Sq );
+ } else if ( dpAxis_ == M13 ) {
+ dpPos = m13Sq;
+ } else if ( dpAxis_ == M23 ) {
+ dpPos = m23Sq;
+ } else if ( dpAxis_ == MMIN ) {
+ dpPos = TMath::Min( m13Sq, m23Sq );
+ } else if ( dpAxis_ == MMAX ) {
+ dpPos = TMath::Max( m13Sq, m23Sq );
+ } else {
+ dpPos = kinematics->distanceFromDPCentre( m13Sq, m23Sq );
+ }
+ this->scaleFrac( dpPos );
+ }
+ }
+
+ // Add them together
+ Double_t result = fracVal_ * result1 + ( 1.0 - fracVal_ ) * result2;
+ this->setUnNormPDFVal( result );
}
void LauDPDepSumPdf::scaleFrac( Double_t dpPos )
{
- Int_t power = 1;
- for (std::vector<Double_t>::const_iterator iter = fracCoeffs_.begin(); iter != fracCoeffs_.end(); ++iter) {
- Double_t coeff = (*iter);
- fracVal_ += coeff * TMath::Power(dpPos,power);
- ++power;
- }
+ Int_t power = 1;
+ for ( std::vector<Double_t>::const_iterator iter = fracCoeffs_.begin(); iter != fracCoeffs_.end();
+ ++iter ) {
+ Double_t coeff = ( *iter );
+ fracVal_ += coeff * TMath::Power( dpPos, power );
+ ++power;
+ }
}
-void LauDPDepSumPdf::calcNorm()
+void LauDPDepSumPdf::calcNorm()
{
- // Nothing to do here, since it is already normalized
- this->setNorm(1.0);
+ // Nothing to do here, since it is already normalized
+ this->setNorm( 1.0 );
}
void LauDPDepSumPdf::calcPDFHeight( const LauKinematics* kinematics )
{
- // This method gives you the maximum possible height of the PDF.
- // It combines the maximum heights of the two individual PDFs.
- // So it would give the true maximum if the two individual maxima coincided.
- // It is guaranteed to always be >= the true maximum.
-
- // Update the heights of the individual PDFs
- pdf1_->calcPDFHeight( kinematics );
- pdf2_->calcPDFHeight( kinematics );
-
- // Get the up to date parameter values
- if ( dpDependence_ ) {
- fracVal_ = dpDependence_->calcEfficiency( kinematics );
- } else {
- fracVal_ = frac_->unblindValue();
- Double_t dpPos(0.0);
- if ( dpAxis_ == M12 ) {
- dpPos = kinematics->getm12Sq();
- } else if ( dpAxis_ == M13 ) {
- dpPos = kinematics->getm13Sq();
- } else if ( dpAxis_ == M23 ) {
- dpPos = kinematics->getm23Sq();
- } else if ( dpAxis_ == MMIN ) {
- Double_t m13Sq = kinematics->getm13Sq();
- Double_t m23Sq = kinematics->getm23Sq();
- dpPos = TMath::Min( m13Sq, m23Sq );
- } else if ( dpAxis_ == MMAX ) {
- Double_t m13Sq = kinematics->getm13Sq();
- Double_t m23Sq = kinematics->getm23Sq();
- dpPos = TMath::Max( m13Sq, m23Sq );
- } else {
- dpPos = kinematics->distanceFromDPCentre();
- }
- this->scaleFrac( dpPos );
- }
-
- // Find the (un-normalised) individual PDF maxima
- Double_t height1 = pdf1_->getMaxHeight();
- Double_t height2 = pdf2_->getMaxHeight();
-
- // Get the individual PDF normalisation factors
- Double_t norm1 = pdf1_->getNorm();
- Double_t norm2 = pdf2_->getNorm();
-
- // Calculate the normalised individual PDF maxima
- height1 /= norm1;
- height2 /= norm2;
-
- // Combine these heights together
- Double_t height = fracVal_ * height1 + (1-fracVal_) * height2;
- this->setMaxHeight(height);
+ // This method gives you the maximum possible height of the PDF.
+ // It combines the maximum heights of the two individual PDFs.
+ // So it would give the true maximum if the two individual maxima coincided.
+ // It is guaranteed to always be >= the true maximum.
+
+ // Update the heights of the individual PDFs
+ pdf1_->calcPDFHeight( kinematics );
+ pdf2_->calcPDFHeight( kinematics );
+
+ // Get the up to date parameter values
+ if ( dpDependence_ ) {
+ fracVal_ = dpDependence_->calcEfficiency( kinematics );
+ } else {
+ fracVal_ = frac_->unblindValue();
+ Double_t dpPos( 0.0 );
+ if ( dpAxis_ == M12 ) {
+ dpPos = kinematics->getm12Sq();
+ } else if ( dpAxis_ == M13 ) {
+ dpPos = kinematics->getm13Sq();
+ } else if ( dpAxis_ == M23 ) {
+ dpPos = kinematics->getm23Sq();
+ } else if ( dpAxis_ == MMIN ) {
+ Double_t m13Sq = kinematics->getm13Sq();
+ Double_t m23Sq = kinematics->getm23Sq();
+ dpPos = TMath::Min( m13Sq, m23Sq );
+ } else if ( dpAxis_ == MMAX ) {
+ Double_t m13Sq = kinematics->getm13Sq();
+ Double_t m23Sq = kinematics->getm23Sq();
+ dpPos = TMath::Max( m13Sq, m23Sq );
+ } else {
+ dpPos = kinematics->distanceFromDPCentre();
+ }
+ this->scaleFrac( dpPos );
+ }
+
+ // Find the (un-normalised) individual PDF maxima
+ Double_t height1 = pdf1_->getMaxHeight();
+ Double_t height2 = pdf2_->getMaxHeight();
+
+ // Get the individual PDF normalisation factors
+ Double_t norm1 = pdf1_->getNorm();
+ Double_t norm2 = pdf2_->getNorm();
+
+ // Calculate the normalised individual PDF maxima
+ height1 /= norm1;
+ height2 /= norm2;
+
+ // Combine these heights together
+ Double_t height = fracVal_ * height1 + ( 1 - fracVal_ ) * height2;
+ this->setMaxHeight( height );
}
// Override the base class methods for cacheInfo and calcLikelihoodInfo(UInt_t iEvt).
// For both of these we delegate to the two constituent PDFs.
-void LauDPDepSumPdf::cacheInfo(const LauFitDataTree& inputData)
+void LauDPDepSumPdf::cacheInfo( const LauFitDataTree& inputData )
{
- // delegate to the two sub-PDFs to cache their information
- pdf1_->cacheInfo(inputData);
- pdf2_->cacheInfo(inputData);
-
- // now check that the DP variables are included in the data
- Bool_t hasBranch = inputData.haveBranch( "m13Sq" );
- hasBranch &= inputData.haveBranch( "m23Sq" );
- if (!hasBranch) {
- cerr<<"ERROR in LauDPDepSumPdf::cacheInfo : Input data does not contain Dalitz plot variables m13Sq and/or m23Sq."<<endl;
- return;
- }
-
- // determine whether we are caching our PDF value
- Bool_t doCaching( this->nFixedParameters() == this->nParameters() );
- this->cachePDF( doCaching );
-
- if ( !doCaching ) {
- // in this case we seem to be doing a fit where the parameters are floating
- // so need to mark that the PDF height is no longer up to date
- this->heightUpToDate(kFALSE);
- }
-
- // clear the vector and reserve enough space
- UInt_t nEvents = inputData.nEvents();
- fractions_.clear();
- fractions_.reserve(nEvents);
-
- // loop through the events, determine the fraction and store
- for (UInt_t iEvt = 0; iEvt < nEvents; iEvt++) {
-
- const LauFitData& dataValues = inputData.getData(iEvt);
-
- Double_t m13Sq = dataValues.find("m13Sq")->second;
- Double_t m23Sq = dataValues.find("m23Sq")->second;
-
- LauKinematics* kinematics = daughters_->getKinematics();
- if ( dpDependence_ ) {
- // if we're using the histogram then just
- // determine the fraction and store
- kinematics->updateKinematics( m13Sq, m23Sq );
- fracVal_ = dpDependence_->calcEfficiency( kinematics );
- } else {
- // if we're scaling the fraction parameter then we
- // just store the scaling info since the parameter
- // might be floating
- fracVal_ = frac_->unblindValue();
- Double_t dpPos(0.0);
- if ( dpAxis_ == M12 ) {
- dpPos = kinematics->calcThirdMassSq(m13Sq,m23Sq);
- } else if ( dpAxis_ == M13 ) {
- dpPos = m13Sq;
- } else if ( dpAxis_ == M23 ) {
- dpPos = m23Sq;
- } else if ( dpAxis_ == MMIN ) {
- dpPos = TMath::Min( m13Sq, m23Sq );
- } else if ( dpAxis_ == MMAX ) {
- dpPos = TMath::Max( m13Sq, m23Sq );
- } else {
- dpPos = kinematics->distanceFromDPCentre(m13Sq,m23Sq);
- }
- this->scaleFrac( dpPos );
- fracVal_ -= frac_->unblindValue();
- }
-
- fractions_.push_back( fracVal_ );
- }
+ // delegate to the two sub-PDFs to cache their information
+ pdf1_->cacheInfo( inputData );
+ pdf2_->cacheInfo( inputData );
+
+ // now check that the DP variables are included in the data
+ Bool_t hasBranch = inputData.haveBranch( "m13Sq" );
+ hasBranch &= inputData.haveBranch( "m23Sq" );
+ if ( ! hasBranch ) {
+ cerr << "ERROR in LauDPDepSumPdf::cacheInfo : Input data does not contain Dalitz plot variables m13Sq and/or m23Sq."
+ << endl;
+ return;
+ }
+
+ // determine whether we are caching our PDF value
+ Bool_t doCaching( this->nFixedParameters() == this->nParameters() );
+ this->cachePDF( doCaching );
+
+ if ( ! doCaching ) {
+ // in this case we seem to be doing a fit where the parameters are floating
+ // so need to mark that the PDF height is no longer up to date
+ this->heightUpToDate( kFALSE );
+ }
+
+ // clear the vector and reserve enough space
+ UInt_t nEvents = inputData.nEvents();
+ fractions_.clear();
+ fractions_.reserve( nEvents );
+
+ // loop through the events, determine the fraction and store
+ for ( UInt_t iEvt = 0; iEvt < nEvents; iEvt++ ) {
+
+ const LauFitData& dataValues = inputData.getData( iEvt );
+
+ Double_t m13Sq = dataValues.find( "m13Sq" )->second;
+ Double_t m23Sq = dataValues.find( "m23Sq" )->second;
+
+ LauKinematics* kinematics = daughters_->getKinematics();
+ if ( dpDependence_ ) {
+ // if we're using the histogram then just
+ // determine the fraction and store
+ kinematics->updateKinematics( m13Sq, m23Sq );
+ fracVal_ = dpDependence_->calcEfficiency( kinematics );
+ } else {
+ // if we're scaling the fraction parameter then we
+ // just store the scaling info since the parameter
+ // might be floating
+ fracVal_ = frac_->unblindValue();
+ Double_t dpPos( 0.0 );
+ if ( dpAxis_ == M12 ) {
+ dpPos = kinematics->calcThirdMassSq( m13Sq, m23Sq );
+ } else if ( dpAxis_ == M13 ) {
+ dpPos = m13Sq;
+ } else if ( dpAxis_ == M23 ) {
+ dpPos = m23Sq;
+ } else if ( dpAxis_ == MMIN ) {
+ dpPos = TMath::Min( m13Sq, m23Sq );
+ } else if ( dpAxis_ == MMAX ) {
+ dpPos = TMath::Max( m13Sq, m23Sq );
+ } else {
+ dpPos = kinematics->distanceFromDPCentre( m13Sq, m23Sq );
+ }
+ this->scaleFrac( dpPos );
+ fracVal_ -= frac_->unblindValue();
+ }
+
+ fractions_.push_back( fracVal_ );
+ }
}
-void LauDPDepSumPdf::calcLikelihoodInfo(UInt_t iEvt)
+void LauDPDepSumPdf::calcLikelihoodInfo( UInt_t iEvt )
{
- // Get the fraction value for this event
- fracVal_ = fractions_[iEvt];
- if ( frac_ ) {
- // if we're scaling the parameter then need to add the
- // current value of the parameter
- fracVal_ += frac_->unblindValue();
- }
-
- // Evaluate the normalised PDF values
- pdf1_->calcLikelihoodInfo(iEvt);
- pdf2_->calcLikelihoodInfo(iEvt);
- Double_t result1 = pdf1_->getLikelihood();
- Double_t result2 = pdf2_->getLikelihood();
-
- // Add them together
- Double_t result = fracVal_ * result1 + (1-fracVal_) * result2;
- this->setUnNormPDFVal(result);
+ // Get the fraction value for this event
+ fracVal_ = fractions_[iEvt];
+ if ( frac_ ) {
+ // if we're scaling the parameter then need to add the
+ // current value of the parameter
+ fracVal_ += frac_->unblindValue();
+ }
+
+ // Evaluate the normalised PDF values
+ pdf1_->calcLikelihoodInfo( iEvt );
+ pdf2_->calcLikelihoodInfo( iEvt );
+ Double_t result1 = pdf1_->getLikelihood();
+ Double_t result2 = pdf2_->getLikelihood();
+
+ // Add them together
+ Double_t result = fracVal_ * result1 + ( 1 - fracVal_ ) * result2;
+ this->setUnNormPDFVal( result );
}
-
diff --git a/src/LauDPPartialIntegralInfo.cc b/src/LauDPPartialIntegralInfo.cc
index 35f5427..fd79e06 100644
--- a/src/LauDPPartialIntegralInfo.cc
+++ b/src/LauDPPartialIntegralInfo.cc
@@ -1,186 +1,199 @@
/*
Copyright 2014 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauDPPartialIntegralInfo.cc
\brief File containing implementation of LauDPPartialIntegralInfo class.
*/
-#include <iostream>
-
#include "LauDPPartialIntegralInfo.hh"
+
#include "LauIntegrals.hh"
#include "LauKinematics.hh"
+#include <iostream>
-
-LauDPPartialIntegralInfo::LauDPPartialIntegralInfo(const Double_t minm13, const Double_t maxm13,
- const Double_t minm23, const Double_t maxm23,
- const Double_t m13BinWidth, const Double_t m23BinWidth,
- const Double_t precision,
- const UInt_t nAmp,
- const UInt_t nIncohAmp,
- const Bool_t squareDP,
- const LauKinematics* kinematics) :
- minm13_(minm13),
- maxm13_(maxm13),
- minm23_(minm23),
- maxm23_(maxm23),
- m13BinWidth_(m13BinWidth),
- m23BinWidth_(m23BinWidth),
- nm13Points_(static_cast<UInt_t>((maxm13-minm13)/m13BinWidth)),
- nm23Points_(static_cast<UInt_t>((maxm23-minm23)/m23BinWidth)),
- nAmp_(nAmp),
- nIncohAmp_(nIncohAmp),
- squareDP_(squareDP)
+LauDPPartialIntegralInfo::LauDPPartialIntegralInfo( const Double_t minm13,
+ const Double_t maxm13,
+ const Double_t minm23,
+ const Double_t maxm23,
+ const Double_t m13BinWidth,
+ const Double_t m23BinWidth,
+ const Double_t precision,
+ const UInt_t nAmp,
+ const UInt_t nIncohAmp,
+ const Bool_t squareDP,
+ const LauKinematics* kinematics ) :
+ minm13_( minm13 ),
+ maxm13_( maxm13 ),
+ minm23_( minm23 ),
+ maxm23_( maxm23 ),
+ m13BinWidth_( m13BinWidth ),
+ m23BinWidth_( m23BinWidth ),
+ nm13Points_( static_cast<UInt_t>( ( maxm13 - minm13 ) / m13BinWidth ) ),
+ nm23Points_( static_cast<UInt_t>( ( maxm23 - minm23 ) / m23BinWidth ) ),
+ nAmp_( nAmp ),
+ nIncohAmp_( nIncohAmp ),
+ squareDP_( squareDP )
{
- const Double_t meanm13 = 0.5*(minm13 + maxm13);
- const Double_t rangem13 = maxm13 - minm13;
- const Double_t halfRangem13 = 0.5*rangem13;
-
- const Double_t meanm23 = 0.5*(minm23 + maxm23);
- const Double_t rangem23 = maxm23 - minm23;
- const Double_t halfRangem23 = 0.5*rangem23;
-
- const Double_t intFactor = halfRangem13*halfRangem23;
-
- // Raise error if squareDP is true but the kinematics object is not provided
- if ( squareDP_ && kinematics == 0 ) {
- std::cerr << "ERROR in LauDPPartialIntegralInfo constructor : Integration in the square DP has been specified but no valid kinematics object has been provided!" << std::endl;
- return;
- }
-
- // Avoid integral if we have no points in either x or y space
- if (nm13Points_ == 0 || nm23Points_ == 0) {
- std::cerr << "ERROR in LauDPPartialIntegralInfo constructor : Range has zero grid points in one or both of the dimensions!" << std::endl;
- return;
- }
-
- // Print a warning if we have a very large number of points
- if ( (nm13Points_ * nm23Points_) > 8000000 ) {
- std::cerr << "WARNING in LauDPPartialIntegralInfo constructor : The integration binning scheme has a very large number of bins, this could cause high memory consumption!" << std::endl;
- std::cerr << " : In case of problems, consider using LauIsobarDynamics::setNarrowResonanceThreshold and/or LauIsobarDynamics::setIntegralBinningFactor to tune the binning behaviour." << std::endl;
- }
-
- LauIntegrals dpIntegrals(precision);
- dpIntegrals.calcGaussLegendreWeights(nm13Points_, m13Points_, m13Weights_);
- dpIntegrals.calcGaussLegendreWeights(nm23Points_, m23Points_, m23Weights_);
-
- // Print out total weights for the integration
- Double_t totm13Weight(0.0), totm23Weight(0.0);
- for (UInt_t i = 0; i < nm13Points_; ++i) {
- totm13Weight += m13Weights_[i];
- }
- for (UInt_t i = 0; i < nm23Points_; ++i) {
- totm23Weight += m23Weights_[i];
- }
-
- if ( squareDP_ ) {
- std::cout<<"INFO in LauDPPartialIntegralInfo constructor : nmPrimePoints = "<<nm13Points_<<", nthPrimePoints = "<<nm23Points_<<std::endl;
- std::cout<<" : mPrimeBinWidth = "<<m13BinWidth_<<", thPrimeBinWidth = "<<m23BinWidth_<<std::endl;
- std::cout<<" : Integrating over mPrime = "<<minm13_<<" to "<<maxm13_<<", thPrime = "<<minm23_<<" to "<<maxm23_<<std::endl;
- std::cout<<" : totmPrimeWeight = "<<totm13Weight<<", totthPrimeWeight = "<<totm23Weight<<std::endl;
- } else {
- std::cout<<"INFO in LauDPPartialIntegralInfo constructor : nm13Points = "<<nm13Points_<<", nm23Points = "<<nm23Points_<<std::endl;
- std::cout<<" : m13BinWidth = "<<m13BinWidth_<<", m23BinWidth = "<<m23BinWidth_<<std::endl;
- std::cout<<" : Integrating over m13 = "<<minm13_<<" to "<<maxm13_<<", m23 = "<<minm23_<<" to "<<maxm23_<<std::endl;
- std::cout<<" : totm13Weight = "<<totm13Weight<<", totm23Weight = "<<totm23Weight<<std::endl;
- }
-
- // Calculate the m13 and m23 values at the grid points
-
- UInt_t midpoint = (nm13Points_ + 1)/2;
- for (UInt_t i = 0; i < midpoint; ++i) {
-
- UInt_t ii = nm13Points_ - 1 - i; // symmetric i index
-
- Double_t dm13 = halfRangem13*m13Points_[i];
- Double_t m13Val = meanm13 - dm13;
- m13Points_[i] = m13Val;
-
- m13Val = meanm13 + dm13;
- m13Points_[ii] = m13Val;
-
- }
-
- midpoint = (nm23Points_ +1)/2;
- for (UInt_t i = 0; i < midpoint; i++) {
-
- UInt_t ii = nm23Points_ - 1 - i; // symmetric i index
-
- Double_t dm23 = halfRangem23*m23Points_[i];
- Double_t m23Val = meanm23 - dm23;
- m23Points_[i] = m23Val;
-
- m23Val = meanm23 + dm23;
- m23Points_[ii] = m23Val;
- }
-
- // Now compute the combined weights at each grid point
- weights_.resize( nm13Points_ );
- efficiencies_.resize( nm13Points_ );
- amplitudes_.resize( nm13Points_ );
- incohIntensities_.resize( nm13Points_ );
- for (UInt_t i = 0; i < nm13Points_; ++i) {
-
- weights_[i].resize( nm23Points_ );
- efficiencies_[i].resize( nm23Points_ );
- amplitudes_[i].resize( nm23Points_ );
- incohIntensities_[i].resize( nm23Points_ );
-
- for (UInt_t j = 0; j < nm23Points_; ++j) {
-
- Double_t weight = m13Weights_[i]*m23Weights_[j];
-
- Double_t jacobian(0.0);
- if ( squareDP_ ) {
- jacobian = kinematics->calcSqDPJacobian( m13Points_[i], m23Points_[j] );
- } else {
- jacobian = 4.0*m13Points_[i]*m23Points_[j];
- }
- weight *= (jacobian*intFactor);
-
- weights_[i][j] = weight;
-
- amplitudes_[i][j].resize( nAmp_ );
- incohIntensities_[i][j].resize( nIncohAmp_ );
-
- } // j weights loop
- } // i weights loop
+ const Double_t meanm13 = 0.5 * ( minm13 + maxm13 );
+ const Double_t rangem13 = maxm13 - minm13;
+ const Double_t halfRangem13 = 0.5 * rangem13;
+
+ const Double_t meanm23 = 0.5 * ( minm23 + maxm23 );
+ const Double_t rangem23 = maxm23 - minm23;
+ const Double_t halfRangem23 = 0.5 * rangem23;
+
+ const Double_t intFactor = halfRangem13 * halfRangem23;
+
+ // Raise error if squareDP is true but the kinematics object is not provided
+ if ( squareDP_ && kinematics == 0 ) {
+ std::cerr << "ERROR in LauDPPartialIntegralInfo constructor : Integration in the square DP has been specified but no valid kinematics object has been provided!"
+ << std::endl;
+ return;
+ }
+
+ // Avoid integral if we have no points in either x or y space
+ if ( nm13Points_ == 0 || nm23Points_ == 0 ) {
+ std::cerr << "ERROR in LauDPPartialIntegralInfo constructor : Range has zero grid points in one or both of the dimensions!"
+ << std::endl;
+ return;
+ }
+
+ // Print a warning if we have a very large number of points
+ if ( ( nm13Points_ * nm23Points_ ) > 8000000 ) {
+ std::cerr << "WARNING in LauDPPartialIntegralInfo constructor : The integration binning scheme has a very large number of bins, this could cause high memory consumption!"
+ << std::endl;
+ std::cerr << " : In case of problems, consider using LauIsobarDynamics::setNarrowResonanceThreshold and/or LauIsobarDynamics::setIntegralBinningFactor to tune the binning behaviour."
+ << std::endl;
+ }
+
+ LauIntegrals dpIntegrals( precision );
+ dpIntegrals.calcGaussLegendreWeights( nm13Points_, m13Points_, m13Weights_ );
+ dpIntegrals.calcGaussLegendreWeights( nm23Points_, m23Points_, m23Weights_ );
+
+ // Print out total weights for the integration
+ Double_t totm13Weight( 0.0 ), totm23Weight( 0.0 );
+ for ( UInt_t i = 0; i < nm13Points_; ++i ) {
+ totm13Weight += m13Weights_[i];
+ }
+ for ( UInt_t i = 0; i < nm23Points_; ++i ) {
+ totm23Weight += m23Weights_[i];
+ }
+
+ if ( squareDP_ ) {
+ std::cout << "INFO in LauDPPartialIntegralInfo constructor : nmPrimePoints = " << nm13Points_
+ << ", nthPrimePoints = " << nm23Points_ << std::endl;
+ std::cout << " : mPrimeBinWidth = "
+ << m13BinWidth_ << ", thPrimeBinWidth = " << m23BinWidth_ << std::endl;
+ std::cout << " : Integrating over mPrime = "
+ << minm13_ << " to " << maxm13_ << ", thPrime = " << minm23_ << " to " << maxm23_
+ << std::endl;
+ std::cout << " : totmPrimeWeight = "
+ << totm13Weight << ", totthPrimeWeight = " << totm23Weight << std::endl;
+ } else {
+ std::cout << "INFO in LauDPPartialIntegralInfo constructor : nm13Points = " << nm13Points_
+ << ", nm23Points = " << nm23Points_ << std::endl;
+ std::cout << " : m13BinWidth = " << m13BinWidth_
+ << ", m23BinWidth = " << m23BinWidth_ << std::endl;
+ std::cout << " : Integrating over m13 = " << minm13_
+ << " to " << maxm13_ << ", m23 = " << minm23_ << " to " << maxm23_ << std::endl;
+ std::cout << " : totm13Weight = " << totm13Weight
+ << ", totm23Weight = " << totm23Weight << std::endl;
+ }
+
+ // Calculate the m13 and m23 values at the grid points
+
+ UInt_t midpoint = ( nm13Points_ + 1 ) / 2;
+ for ( UInt_t i = 0; i < midpoint; ++i ) {
+
+ UInt_t ii = nm13Points_ - 1 - i; // symmetric i index
+
+ Double_t dm13 = halfRangem13 * m13Points_[i];
+ Double_t m13Val = meanm13 - dm13;
+ m13Points_[i] = m13Val;
+
+ m13Val = meanm13 + dm13;
+ m13Points_[ii] = m13Val;
+ }
+
+ midpoint = ( nm23Points_ + 1 ) / 2;
+ for ( UInt_t i = 0; i < midpoint; i++ ) {
+
+ UInt_t ii = nm23Points_ - 1 - i; // symmetric i index
+
+ Double_t dm23 = halfRangem23 * m23Points_[i];
+ Double_t m23Val = meanm23 - dm23;
+ m23Points_[i] = m23Val;
+
+ m23Val = meanm23 + dm23;
+ m23Points_[ii] = m23Val;
+ }
+
+ // Now compute the combined weights at each grid point
+ weights_.resize( nm13Points_ );
+ efficiencies_.resize( nm13Points_ );
+ amplitudes_.resize( nm13Points_ );
+ incohIntensities_.resize( nm13Points_ );
+ for ( UInt_t i = 0; i < nm13Points_; ++i ) {
+
+ weights_[i].resize( nm23Points_ );
+ efficiencies_[i].resize( nm23Points_ );
+ amplitudes_[i].resize( nm23Points_ );
+ incohIntensities_[i].resize( nm23Points_ );
+
+ for ( UInt_t j = 0; j < nm23Points_; ++j ) {
+
+ Double_t weight = m13Weights_[i] * m23Weights_[j];
+
+ Double_t jacobian( 0.0 );
+ if ( squareDP_ ) {
+ jacobian = kinematics->calcSqDPJacobian( m13Points_[i], m23Points_[j] );
+ } else {
+ jacobian = 4.0 * m13Points_[i] * m23Points_[j];
+ }
+ weight *= ( jacobian * intFactor );
+
+ weights_[i][j] = weight;
+
+ amplitudes_[i][j].resize( nAmp_ );
+ incohIntensities_[i][j].resize( nIncohAmp_ );
+
+ } // j weights loop
+ } // i weights loop
}
LauDPPartialIntegralInfo::~LauDPPartialIntegralInfo()
{
}
std::ostream& operator<<( std::ostream& stream, const LauDPPartialIntegralInfo& infoRecord )
{
- stream << "minm13 = " << infoRecord.getMinm13() << ", ";
- stream << "maxm13 = " << infoRecord.getMaxm13() << ", ";
- stream << "minm23 = " << infoRecord.getMinm23() << ", ";
- stream << "maxm23 = " << infoRecord.getMaxm23() << ", ";
- stream << "m13BinWidth = " << infoRecord.getM13BinWidth() << ", ";
- stream << "m23BinWidth = " << infoRecord.getM23BinWidth() << std::endl;
- return stream;
+ stream << "minm13 = " << infoRecord.getMinm13() << ", ";
+ stream << "maxm13 = " << infoRecord.getMaxm13() << ", ";
+ stream << "minm23 = " << infoRecord.getMinm23() << ", ";
+ stream << "maxm23 = " << infoRecord.getMaxm23() << ", ";
+ stream << "m13BinWidth = " << infoRecord.getM13BinWidth() << ", ";
+ stream << "m23BinWidth = " << infoRecord.getM23BinWidth() << std::endl;
+ return stream;
}
-
diff --git a/src/LauDabbaRes.cc b/src/LauDabbaRes.cc
index 348dbfe..da38ca7 100644
--- a/src/LauDabbaRes.cc
+++ b/src/LauDabbaRes.cc
@@ -1,267 +1,282 @@
/*
Copyright 2010 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauDabbaRes.cc
\brief File containing implementation of LauDabbaRes class.
Formulae and data values from arXiv:0901.2217 - author D.V.Bugg
*/
-#include <iostream>
+#include "LauDabbaRes.hh"
#include "LauConstants.hh"
-#include "LauDabbaRes.hh"
#include "LauResonanceInfo.hh"
+#include <iostream>
-
-LauDabbaRes::LauDabbaRes(LauResonanceInfo* resInfo, const Int_t resPairAmpInt, const LauDaughters* daughters) :
- LauAbsResonance(resInfo, resPairAmpInt, daughters),
- mSumSq_(0.0),
- sAdler_(0.0),
- b_(0),
- alpha_(0),
- beta_(0)
+LauDabbaRes::LauDabbaRes( LauResonanceInfo* resInfo,
+ const Int_t resPairAmpInt,
+ const LauDaughters* daughters ) :
+ LauAbsResonance( resInfo, resPairAmpInt, daughters ),
+ mSumSq_( 0.0 ),
+ sAdler_( 0.0 ),
+ b_( 0 ),
+ alpha_( 0 ),
+ beta_( 0 )
{
- // Default constant factors
- const Double_t bVal = 24.49;
- const Double_t alphaVal = 0.1;
- const Double_t betaVal = 0.1;
-
- const TString& parNameBase = this->getSanitisedName();
-
- TString bName(parNameBase);
- bName += "_b";
- b_ = resInfo->getExtraParameter( bName );
- if ( b_ == 0 ) {
- b_ = new LauParameter( bName, bVal, 0.0, 100.0, kTRUE );
- b_->secondStage(kTRUE);
- resInfo->addExtraParameter( b_ );
- }
-
- TString alphaName(parNameBase);
- alphaName += "_alpha";
- alpha_ = resInfo->getExtraParameter( alphaName );
- if ( alpha_ == 0 ) {
- alpha_ = new LauParameter( alphaName, alphaVal, 0.0, 10.0, kTRUE );
- alpha_->secondStage(kTRUE);
- resInfo->addExtraParameter( alpha_ );
- }
-
- TString betaName(parNameBase);
- betaName += "_beta";
- beta_ = resInfo->getExtraParameter( betaName );
- if ( beta_ == 0 ) {
- beta_ = new LauParameter( betaName, betaVal, 0.0, 10.0, kTRUE );
- beta_->secondStage(kTRUE);
- resInfo->addExtraParameter( beta_ );
- }
+ // Default constant factors
+ const Double_t bVal = 24.49;
+ const Double_t alphaVal = 0.1;
+ const Double_t betaVal = 0.1;
+
+ const TString& parNameBase = this->getSanitisedName();
+
+ TString bName( parNameBase );
+ bName += "_b";
+ b_ = resInfo->getExtraParameter( bName );
+ if ( b_ == 0 ) {
+ b_ = new LauParameter( bName, bVal, 0.0, 100.0, kTRUE );
+ b_->secondStage( kTRUE );
+ resInfo->addExtraParameter( b_ );
+ }
+
+ TString alphaName( parNameBase );
+ alphaName += "_alpha";
+ alpha_ = resInfo->getExtraParameter( alphaName );
+ if ( alpha_ == 0 ) {
+ alpha_ = new LauParameter( alphaName, alphaVal, 0.0, 10.0, kTRUE );
+ alpha_->secondStage( kTRUE );
+ resInfo->addExtraParameter( alpha_ );
+ }
+
+ TString betaName( parNameBase );
+ betaName += "_beta";
+ beta_ = resInfo->getExtraParameter( betaName );
+ if ( beta_ == 0 ) {
+ beta_ = new LauParameter( betaName, betaVal, 0.0, 10.0, kTRUE );
+ beta_->secondStage( kTRUE );
+ resInfo->addExtraParameter( beta_ );
+ }
}
LauDabbaRes::~LauDabbaRes()
{
}
void LauDabbaRes::initialise()
{
- // check that we have a D and a pi
- this->checkDaughterTypes();
-
- // Initialise various constants
- Double_t massDaug1 = this->getMassDaug1();
- Double_t massDaug2 = this->getMassDaug2();
-
- Double_t mSum = massDaug1 + massDaug2;
- mSumSq_ = mSum*mSum;
-
- Double_t massDaug1Sq = massDaug1*massDaug1;
- Double_t massDaug2Sq = massDaug2*massDaug2;
- sAdler_ = TMath::Max(massDaug1Sq,massDaug2Sq) - 0.5*TMath::Min(massDaug1Sq,massDaug2Sq); // Adler zero at (mD)^2 - 0.5*(mpi)^2
-
- Int_t resSpin = this->getSpin();
- if (resSpin != 0) {
- std::cerr << "WARNING in LauDabbaRes::initialise : Spin = " << resSpin << " is not zero! It will be ignored anyway!" << std::endl;
- }
+ // check that we have a D and a pi
+ this->checkDaughterTypes();
+
+ // Initialise various constants
+ Double_t massDaug1 = this->getMassDaug1();
+ Double_t massDaug2 = this->getMassDaug2();
+
+ Double_t mSum = massDaug1 + massDaug2;
+ mSumSq_ = mSum * mSum;
+
+ Double_t massDaug1Sq = massDaug1 * massDaug1;
+ Double_t massDaug2Sq = massDaug2 * massDaug2;
+ sAdler_ = TMath::Max( massDaug1Sq, massDaug2Sq ) -
+ 0.5 * TMath::Min( massDaug1Sq, massDaug2Sq ); // Adler zero at (mD)^2 - 0.5*(mpi)^2
+
+ Int_t resSpin = this->getSpin();
+ if ( resSpin != 0 ) {
+ std::cerr << "WARNING in LauDabbaRes::initialise : Spin = " << resSpin
+ << " is not zero! It will be ignored anyway!" << std::endl;
+ }
}
void LauDabbaRes::checkDaughterTypes() const
{
- // Check that the daughter tracks are D and pi. Otherwise issue a warning.
- Int_t resPairAmpInt = this->getPairInt();
- if (resPairAmpInt < 1 || resPairAmpInt > 3) {
- std::cerr << "WARNING in LauDabbaRes::checkDaughterTypes : resPairAmpInt = " << resPairAmpInt << " is out of the range [1,2,3]." << std::endl;
- return;
- }
-
- // Check that daughter types agree
- const TString& nameDaug1 = this->getNameDaug1();
- const TString& nameDaug2 = this->getNameDaug2();
- if ( !( nameDaug1.Contains("pi", TString::kIgnoreCase) && nameDaug2.Contains("d", TString::kIgnoreCase) ) ) {
- if ( !( nameDaug2.Contains("pi", TString::kIgnoreCase) && nameDaug1.Contains("d", TString::kIgnoreCase) ) ) {
- std::cerr << "ERROR in LauDabbaRes::checkDaughterTypes : Dabba model is using daughters \"" << nameDaug1 << "\" and \"" << nameDaug2 << "\" that are not a D meson and a pion." << std::endl;
- }
- }
+ // Check that the daughter tracks are D and pi. Otherwise issue a warning.
+ Int_t resPairAmpInt = this->getPairInt();
+ if ( resPairAmpInt < 1 || resPairAmpInt > 3 ) {
+ std::cerr << "WARNING in LauDabbaRes::checkDaughterTypes : resPairAmpInt = " << resPairAmpInt
+ << " is out of the range [1,2,3]." << std::endl;
+ return;
+ }
+
+ // Check that daughter types agree
+ const TString& nameDaug1 = this->getNameDaug1();
+ const TString& nameDaug2 = this->getNameDaug2();
+ if ( ! ( nameDaug1.Contains( "pi", TString::kIgnoreCase ) &&
+ nameDaug2.Contains( "d", TString::kIgnoreCase ) ) ) {
+ if ( ! ( nameDaug2.Contains( "pi", TString::kIgnoreCase ) &&
+ nameDaug1.Contains( "d", TString::kIgnoreCase ) ) ) {
+ std::cerr << "ERROR in LauDabbaRes::checkDaughterTypes : Dabba model is using daughters \""
+ << nameDaug1 << "\" and \"" << nameDaug2
+ << "\" that are not a D meson and a pion." << std::endl;
+ }
+ }
}
-LauComplex LauDabbaRes::resAmp(Double_t mass, Double_t spinTerm)
+LauComplex LauDabbaRes::resAmp( Double_t mass, Double_t spinTerm )
{
- // This function returns the complex dynamical amplitude for a Dabba distribution
- // given the invariant mass and cos(helicity) values.
+ // This function returns the complex dynamical amplitude for a Dabba distribution
+ // given the invariant mass and cos(helicity) values.
- // Invariant mass squared combination for the system
- Double_t s = mass*mass;
+ // Invariant mass squared combination for the system
+ Double_t s = mass * mass;
- // Dabba is spin zero - so there are no helicity factors.
- // Just set it to 1.0 in case anyone decides to use it at a later date.
- spinTerm = 1.0;
+ // Dabba is spin zero - so there are no helicity factors.
+ // Just set it to 1.0 in case anyone decides to use it at a later date.
+ spinTerm = 1.0;
- // Phase-space factor
- Double_t rho(0.0);
- Double_t sDiff = s - mSumSq_;
- if ( sDiff > 0.0 ) {
- rho = TMath::Sqrt(1.0 - mSumSq_/s);
- }
+ // Phase-space factor
+ Double_t rho( 0.0 );
+ Double_t sDiff = s - mSumSq_;
+ if ( sDiff > 0.0 ) {
+ rho = TMath::Sqrt( 1.0 - mSumSq_ / s );
+ }
- const Double_t bVal = this->getBValue();
- const Double_t alphaVal = this->getAlphaValue();
- const Double_t betaVal = this->getBetaValue();
+ const Double_t bVal = this->getBValue();
+ const Double_t alphaVal = this->getAlphaValue();
+ const Double_t betaVal = this->getBetaValue();
- Double_t realPart = 1.0 - betaVal * sDiff;
+ Double_t realPart = 1.0 - betaVal * sDiff;
- Double_t imagPart = bVal * TMath::Exp( - alphaVal * sDiff ) * ( s - sAdler_ ) * rho;
+ Double_t imagPart = bVal * TMath::Exp( -alphaVal * sDiff ) * ( s - sAdler_ ) * rho;
- LauComplex resAmplitude( realPart, imagPart );
+ LauComplex resAmplitude( realPart, imagPart );
- Double_t denomFactor = realPart*realPart + imagPart*imagPart;
+ Double_t denomFactor = realPart * realPart + imagPart * imagPart;
- Double_t invDenomFactor = 0.0;
- if (denomFactor > 1e-10) {invDenomFactor = 1.0/denomFactor;}
+ Double_t invDenomFactor = 0.0;
+ if ( denomFactor > 1e-10 ) {
+ invDenomFactor = 1.0 / denomFactor;
+ }
- resAmplitude.rescale(spinTerm*invDenomFactor);
+ resAmplitude.rescale( spinTerm * invDenomFactor );
- return resAmplitude;
+ return resAmplitude;
}
const std::vector<LauParameter*>& LauDabbaRes::getFloatingParameters()
{
- this->clearFloatingParameters();
+ this->clearFloatingParameters();
- if ( ! this->fixBValue() ) {
- this->addFloatingParameter( b_ );
- }
+ if ( ! this->fixBValue() ) {
+ this->addFloatingParameter( b_ );
+ }
- if ( ! this->fixAlphaValue() ) {
- this->addFloatingParameter( alpha_ );
- }
+ if ( ! this->fixAlphaValue() ) {
+ this->addFloatingParameter( alpha_ );
+ }
- if ( ! this->fixBetaValue() ) {
- this->addFloatingParameter( beta_ );
- }
+ if ( ! this->fixBetaValue() ) {
+ this->addFloatingParameter( beta_ );
+ }
- return this->getParameters();
+ return this->getParameters();
}
-void LauDabbaRes::setResonanceParameter(const TString& name, const Double_t value)
+void LauDabbaRes::setResonanceParameter( const TString& name, const Double_t value )
{
- // Set various parameters for the lineshape
- if (name == "b") {
- this->setBValue(value);
- std::cout << "INFO in LauDabbaRes::setResonanceParameter : Setting parameter b = " << this->getBValue() << std::endl;
- }
- else if (name == "alpha") {
- this->setAlphaValue(value);
- std::cout << "INFO in LauDabbaRes::setResonanceParameter : Setting parameter alpha = " << this->getAlphaValue() << std::endl;
- }
- else if (name == "beta") {
- this->setBetaValue(value);
- std::cout << "INFO in LauDabbaRes::setResonanceParameter : Setting parameter beta = " << this->getBetaValue() << std::endl;
- }
- else {
- std::cerr << "WARNING in LauDabbaRes::setResonanceParameter: Parameter name not reconised. No parameter changes made." << std::endl;
- }
+ // Set various parameters for the lineshape
+ if ( name == "b" ) {
+ this->setBValue( value );
+ std::cout << "INFO in LauDabbaRes::setResonanceParameter : Setting parameter b = "
+ << this->getBValue() << std::endl;
+ } else if ( name == "alpha" ) {
+ this->setAlphaValue( value );
+ std::cout << "INFO in LauDabbaRes::setResonanceParameter : Setting parameter alpha = "
+ << this->getAlphaValue() << std::endl;
+ } else if ( name == "beta" ) {
+ this->setBetaValue( value );
+ std::cout << "INFO in LauDabbaRes::setResonanceParameter : Setting parameter beta = "
+ << this->getBetaValue() << std::endl;
+ } else {
+ std::cerr << "WARNING in LauDabbaRes::setResonanceParameter: Parameter name not reconised. No parameter changes made."
+ << std::endl;
+ }
}
-void LauDabbaRes::floatResonanceParameter(const TString& name)
+void LauDabbaRes::floatResonanceParameter( const TString& name )
{
- if (name == "b") {
- if ( b_->fixed() ) {
- b_->fixed( kFALSE );
- this->addFloatingParameter( b_ );
- } else {
- std::cerr << "WARNING in LauDabbaRes::floatResonanceParameter: Parameter already floating. No parameter changes made." << std::endl;
- }
- } else if (name == "alpha") {
- if ( alpha_->fixed() ) {
- alpha_->fixed( kFALSE );
- this->addFloatingParameter( alpha_ );
- } else {
- std::cerr << "WARNING in LauDabbaRes::floatResonanceParameter: Parameter already floating. No parameter changes made." << std::endl;
- }
- } else if (name == "beta") {
- if ( beta_->fixed() ) {
- beta_->fixed( kFALSE );
- this->addFloatingParameter( beta_ );
- } else {
- std::cerr << "WARNING in LauDabbaRes::floatResonanceParameter: Parameter already floating. No parameter changes made." << std::endl;
- }
- } else {
- std::cerr << "WARNING in LauDabbaRes::fixResonanceParameter: Parameter name not reconised. No parameter changes made." << std::endl;
- }
+ if ( name == "b" ) {
+ if ( b_->fixed() ) {
+ b_->fixed( kFALSE );
+ this->addFloatingParameter( b_ );
+ } else {
+ std::cerr << "WARNING in LauDabbaRes::floatResonanceParameter: Parameter already floating. No parameter changes made."
+ << std::endl;
+ }
+ } else if ( name == "alpha" ) {
+ if ( alpha_->fixed() ) {
+ alpha_->fixed( kFALSE );
+ this->addFloatingParameter( alpha_ );
+ } else {
+ std::cerr << "WARNING in LauDabbaRes::floatResonanceParameter: Parameter already floating. No parameter changes made."
+ << std::endl;
+ }
+ } else if ( name == "beta" ) {
+ if ( beta_->fixed() ) {
+ beta_->fixed( kFALSE );
+ this->addFloatingParameter( beta_ );
+ } else {
+ std::cerr << "WARNING in LauDabbaRes::floatResonanceParameter: Parameter already floating. No parameter changes made."
+ << std::endl;
+ }
+ } else {
+ std::cerr << "WARNING in LauDabbaRes::fixResonanceParameter: Parameter name not reconised. No parameter changes made."
+ << std::endl;
+ }
}
-LauParameter* LauDabbaRes::getResonanceParameter(const TString& name)
+LauParameter* LauDabbaRes::getResonanceParameter( const TString& name )
{
- if (name == "b") {
- return b_;
- } else if (name == "alpha") {
- return alpha_;
- } else if (name == "beta") {
- return beta_;
- } else {
- std::cerr << "WARNING in LauDabbaRes::getResonanceParameter: Parameter name not reconised." << std::endl;
- return 0;
- }
+ if ( name == "b" ) {
+ return b_;
+ } else if ( name == "alpha" ) {
+ return alpha_;
+ } else if ( name == "beta" ) {
+ return beta_;
+ } else {
+ std::cerr << "WARNING in LauDabbaRes::getResonanceParameter: Parameter name not reconised."
+ << std::endl;
+ return 0;
+ }
}
-void LauDabbaRes::setBValue(const Double_t b)
+void LauDabbaRes::setBValue( const Double_t b )
{
- b_->value( b );
- b_->genValue( b );
- b_->initValue( b );
+ b_->value( b );
+ b_->genValue( b );
+ b_->initValue( b );
}
-void LauDabbaRes::setAlphaValue(const Double_t alpha)
+void LauDabbaRes::setAlphaValue( const Double_t alpha )
{
- alpha_->value( alpha );
- alpha_->genValue( alpha );
- alpha_->initValue( alpha );
+ alpha_->value( alpha );
+ alpha_->genValue( alpha );
+ alpha_->initValue( alpha );
}
-void LauDabbaRes::setBetaValue(const Double_t beta)
+void LauDabbaRes::setBetaValue( const Double_t beta )
{
- beta_->value( beta );
- beta_->genValue( beta );
- beta_->initValue( beta );
+ beta_->value( beta );
+ beta_->genValue( beta );
+ beta_->initValue( beta );
}
-
diff --git a/src/LauDatabasePDG.cc b/src/LauDatabasePDG.cc
index ec03665..f9d6cf8 100644
--- a/src/LauDatabasePDG.cc
+++ b/src/LauDatabasePDG.cc
@@ -1,268 +1,291 @@
/*
Copyright 2008 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauDatabasePDG.cc
\brief File containing implementation of LauDatabasePDG class.
*/
#include <iostream>
-using std::cout;
using std::cerr;
+using std::cout;
using std::endl;
-#include "TDatabasePDG.h"
-
#include "LauDatabasePDG.hh"
#include "LauParticlePDG.hh"
-LauDatabasePDG* LauDatabasePDG::theInstance_ = 0;
+#include "TDatabasePDG.h"
+LauDatabasePDG* LauDatabasePDG::theInstance_ = 0;
// Constructor
LauDatabasePDG::LauDatabasePDG() :
- theDatabase_( new TDatabasePDG() ),
- particles_(),
- debug_(kFALSE)
+ theDatabase_( new TDatabasePDG() ),
+ particles_(),
+ debug_( kFALSE )
{
}
// Destructor
LauDatabasePDG::~LauDatabasePDG()
{
- delete theDatabase_; theDatabase_ = 0;
- for (LauPDGList::iterator iter = particles_.begin(); iter != particles_.end(); ++iter) {
- delete iter->second; iter->second = 0;
- }
+ delete theDatabase_;
+ theDatabase_ = 0;
+ for ( LauPDGList::iterator iter = particles_.begin(); iter != particles_.end(); ++iter ) {
+ delete iter->second;
+ iter->second = 0;
+ }
}
// Private static method to access the instance
// Will create it and add the missing particles if it doesn't already exist
LauDatabasePDG& LauDatabasePDG::get()
{
- if (theInstance_ == 0) {
- theInstance_ = new LauDatabasePDG();
- theInstance_->addMissingParticles();
- }
- return *theInstance_;
+ if ( theInstance_ == 0 ) {
+ theInstance_ = new LauDatabasePDG();
+ theInstance_->addMissingParticles();
+ }
+ return *theInstance_;
}
// All static methods grab the instance and call the private non-static
// methods - this ensures that the database exists and that the missing
// particles are added to it.
-const LauParticlePDG* LauDatabasePDG::particle(Int_t theCode)
+const LauParticlePDG* LauDatabasePDG::particle( Int_t theCode )
{
- return LauDatabasePDG::get().createParticle( theCode );
+ return LauDatabasePDG::get().createParticle( theCode );
}
-const LauParticlePDG* LauDatabasePDG::particle(const TString& theString)
+const LauParticlePDG* LauDatabasePDG::particle( const TString& theString )
{
- return LauDatabasePDG::get().createParticle( theString );
+ return LauDatabasePDG::get().createParticle( theString );
}
-Int_t LauDatabasePDG::code(const TString& theString)
+Int_t LauDatabasePDG::code( const TString& theString )
{
- return LauDatabasePDG::get().pdgCode( theString );
+ return LauDatabasePDG::get().pdgCode( theString );
}
-TString LauDatabasePDG::string(Int_t theCode)
+TString LauDatabasePDG::string( Int_t theCode )
{
- return LauDatabasePDG::get().pdgName( theCode );
+ return LauDatabasePDG::get().pdgName( theCode );
}
// The following method adds particles to the ROOT database that are
// missing from it's default setup. This should only be called once,
// immediately after the creation of the instance.
void LauDatabasePDG::addMissingParticles()
{
- TParticlePDG* part(0);
- TParticlePDG* antipart(0);
-
- // format is:
- // name, title, mass, stable?, width, 3*Q, category, PDG code
-
- part = theDatabase_->AddParticle("deuteron", "deuteron", 1.8756134, kTRUE, 0.0, 3, "Nucleus", 1011);
- antipart = theDatabase_->AddAntiParticle("anti-deuteron", -1011);
- part->SetAntiParticle(antipart); antipart->SetAntiParticle(part);
-
- part = theDatabase_->AddParticle("tritium", "tritium", 2.80925, kTRUE, 0.0, 3, "Nucleus", 1021);
- antipart = theDatabase_->AddAntiParticle("anti-tritium", -1021);
- part->SetAntiParticle(antipart); antipart->SetAntiParticle(part);
-
- part = theDatabase_->AddParticle("He3", "He3", 2.80923, kTRUE, 0.0, 6, "Nucleus", 1012);
- antipart = theDatabase_->AddAntiParticle("anti-He3", -1012);
- part->SetAntiParticle(antipart); antipart->SetAntiParticle(part);
-
- part = theDatabase_->AddParticle("alpha", "alpha", 3.727417, kTRUE, 0.0, 3, "Nucleus", 1022);
- antipart = theDatabase_->AddAntiParticle("anti-alpha", -1022);
- part->SetAntiParticle(antipart); antipart->SetAntiParticle(part);
-
- part = theDatabase_->AddParticle("eta_c(2S)", "eta_c(2S)", 3.628, kTRUE, 0.0195, 0, "Meson", 20441);
-
- part = theDatabase_->AddParticle("psi(3770)", "psi(3770)", 3.7699, kTRUE, 0.0236, 0, "Meson", 40443);
-
- part = theDatabase_->AddParticle("rho(2S)0", "rho(2S)0", 1.46, kTRUE, 0.31, 0, "Meson", 30113);
- part = theDatabase_->AddParticle("rho(2S)+", "rho(2S)+", 1.46, kTRUE, 0.31, 3, "Meson", 30213);
- antipart = theDatabase_->AddAntiParticle("rho(2S)-", -30213);
- part->SetAntiParticle(antipart); antipart->SetAntiParticle(part);
-
- part = theDatabase_->AddParticle("rho(3S)0", "rho(3S)0", 1.46, kTRUE, 0.31, 0, "Meson", 40113);
- part = theDatabase_->AddParticle("rho(3S)+", "rho(3S)+", 1.46, kTRUE, 0.31, 3, "Meson", 40213);
- antipart = theDatabase_->AddAntiParticle("rho(3S)-", -40213);
- part->SetAntiParticle(antipart); antipart->SetAntiParticle(part);
-
- part = theDatabase_->AddParticle("Xsu", "Xsu", 1.6, kTRUE, 0.5, 3, "Meson", 30353);
- antipart = theDatabase_->AddAntiParticle("anti-Xsu", -30353);
- part->SetAntiParticle(antipart); antipart->SetAntiParticle(part);
-
- part = theDatabase_->AddParticle("Xu0", "Xu0", 1., kTRUE, 0., 0, "Special", 41);
- part = theDatabase_->AddParticle("Xu+", "Xu+", 1., kTRUE, 0., 3, "Special", 42);
- antipart = theDatabase_->AddAntiParticle("Xu-", -42);
- part->SetAntiParticle(antipart); antipart->SetAntiParticle(part);
-
- part = theDatabase_->AddParticle("Xsd", "Xsd", 1.6, kTRUE, 0.5, 0, "Meson", 30343);
- antipart = theDatabase_->AddAntiParticle("anti-Xsd", -30343);
- part->SetAntiParticle(antipart); antipart->SetAntiParticle(part);
-
- part = theDatabase_->AddParticle("K'*0", "K'*0", 1.414, kTRUE, 0.232, 0, "Meson", 100313);
- antipart = theDatabase_->AddAntiParticle("anti-K'*0", -100313);
- part->SetAntiParticle(antipart); antipart->SetAntiParticle(part);
-
- part = theDatabase_->AddParticle("K'*+", "K'*+", 1.414, kTRUE, 0.232, 3, "Meson", 100323);
- antipart = theDatabase_->AddAntiParticle("K'*-", -100323);
- part->SetAntiParticle(antipart); antipart->SetAntiParticle(part);
-
- part = theDatabase_->AddParticle("K''*0", "K''*0", 1.717, kTRUE, 0.322, 0, "Meson", 30313);
- antipart = theDatabase_->AddAntiParticle("anti-K''*0", -30313);
- part->SetAntiParticle(antipart); antipart->SetAntiParticle(part);
-
- part = theDatabase_->AddParticle("K''*+", "K''*+", 1.717, kTRUE, 0.322, 3, "Meson", 30323);
- antipart = theDatabase_->AddAntiParticle("K''*-", -30323);
- part->SetAntiParticle(antipart); antipart->SetAntiParticle(part);
+ TParticlePDG* part( 0 );
+ TParticlePDG* antipart( 0 );
+
+ // format is:
+ // name, title, mass, stable?, width, 3*Q, category, PDG code
+
+ part =
+ theDatabase_->AddParticle( "deuteron", "deuteron", 1.8756134, kTRUE, 0.0, 3, "Nucleus", 1011 );
+ antipart = theDatabase_->AddAntiParticle( "anti-deuteron", -1011 );
+ part->SetAntiParticle( antipart );
+ antipart->SetAntiParticle( part );
+
+ part = theDatabase_->AddParticle( "tritium", "tritium", 2.80925, kTRUE, 0.0, 3, "Nucleus", 1021 );
+ antipart = theDatabase_->AddAntiParticle( "anti-tritium", -1021 );
+ part->SetAntiParticle( antipart );
+ antipart->SetAntiParticle( part );
+
+ part = theDatabase_->AddParticle( "He3", "He3", 2.80923, kTRUE, 0.0, 6, "Nucleus", 1012 );
+ antipart = theDatabase_->AddAntiParticle( "anti-He3", -1012 );
+ part->SetAntiParticle( antipart );
+ antipart->SetAntiParticle( part );
+
+ part = theDatabase_->AddParticle( "alpha", "alpha", 3.727417, kTRUE, 0.0, 3, "Nucleus", 1022 );
+ antipart = theDatabase_->AddAntiParticle( "anti-alpha", -1022 );
+ part->SetAntiParticle( antipart );
+ antipart->SetAntiParticle( part );
+
+ part =
+ theDatabase_->AddParticle( "eta_c(2S)", "eta_c(2S)", 3.628, kTRUE, 0.0195, 0, "Meson", 20441 );
+
+ part =
+ theDatabase_->AddParticle( "psi(3770)", "psi(3770)", 3.7699, kTRUE, 0.0236, 0, "Meson", 40443 );
+
+ part = theDatabase_->AddParticle( "rho(2S)0", "rho(2S)0", 1.46, kTRUE, 0.31, 0, "Meson", 30113 );
+ part = theDatabase_->AddParticle( "rho(2S)+", "rho(2S)+", 1.46, kTRUE, 0.31, 3, "Meson", 30213 );
+ antipart = theDatabase_->AddAntiParticle( "rho(2S)-", -30213 );
+ part->SetAntiParticle( antipart );
+ antipart->SetAntiParticle( part );
+
+ part = theDatabase_->AddParticle( "rho(3S)0", "rho(3S)0", 1.46, kTRUE, 0.31, 0, "Meson", 40113 );
+ part = theDatabase_->AddParticle( "rho(3S)+", "rho(3S)+", 1.46, kTRUE, 0.31, 3, "Meson", 40213 );
+ antipart = theDatabase_->AddAntiParticle( "rho(3S)-", -40213 );
+ part->SetAntiParticle( antipart );
+ antipart->SetAntiParticle( part );
+
+ part = theDatabase_->AddParticle( "Xsu", "Xsu", 1.6, kTRUE, 0.5, 3, "Meson", 30353 );
+ antipart = theDatabase_->AddAntiParticle( "anti-Xsu", -30353 );
+ part->SetAntiParticle( antipart );
+ antipart->SetAntiParticle( part );
+
+ part = theDatabase_->AddParticle( "Xu0", "Xu0", 1., kTRUE, 0., 0, "Special", 41 );
+ part = theDatabase_->AddParticle( "Xu+", "Xu+", 1., kTRUE, 0., 3, "Special", 42 );
+ antipart = theDatabase_->AddAntiParticle( "Xu-", -42 );
+ part->SetAntiParticle( antipart );
+ antipart->SetAntiParticle( part );
+
+ part = theDatabase_->AddParticle( "Xsd", "Xsd", 1.6, kTRUE, 0.5, 0, "Meson", 30343 );
+ antipart = theDatabase_->AddAntiParticle( "anti-Xsd", -30343 );
+ part->SetAntiParticle( antipart );
+ antipart->SetAntiParticle( part );
+
+ part = theDatabase_->AddParticle( "K'*0", "K'*0", 1.414, kTRUE, 0.232, 0, "Meson", 100313 );
+ antipart = theDatabase_->AddAntiParticle( "anti-K'*0", -100313 );
+ part->SetAntiParticle( antipart );
+ antipart->SetAntiParticle( part );
+
+ part = theDatabase_->AddParticle( "K'*+", "K'*+", 1.414, kTRUE, 0.232, 3, "Meson", 100323 );
+ antipart = theDatabase_->AddAntiParticle( "K'*-", -100323 );
+ part->SetAntiParticle( antipart );
+ antipart->SetAntiParticle( part );
+
+ part = theDatabase_->AddParticle( "K''*0", "K''*0", 1.717, kTRUE, 0.322, 0, "Meson", 30313 );
+ antipart = theDatabase_->AddAntiParticle( "anti-K''*0", -30313 );
+ part->SetAntiParticle( antipart );
+ antipart->SetAntiParticle( part );
+
+ part = theDatabase_->AddParticle( "K''*+", "K''*+", 1.717, kTRUE, 0.322, 3, "Meson", 30323 );
+ antipart = theDatabase_->AddAntiParticle( "K''*-", -30323 );
+ part->SetAntiParticle( antipart );
+ antipart->SetAntiParticle( part );
}
// These next two methods are the ones that actually build-up our database.
-const LauParticlePDG* LauDatabasePDG::createParticle(Int_t theCode)
+const LauParticlePDG* LauDatabasePDG::createParticle( Int_t theCode )
{
- // if we've already created this one simply return it
- LauPDGList::iterator iter = particles_.find(theCode);
- if ( iter != particles_.end() ) {
- return iter->second;
- }
-
- // otherwise we'll have to make it...
-
- // first get the particle from the database
- TParticlePDG* theTParticle = theDatabase_->GetParticle( theCode );
- if (theTParticle == 0) {
- cerr<<"ERROR in LauDatabasePDG::createParticle : Invalid PDG code: "<<theCode<<endl;
- return 0;
- }
-
- // then create a new particle from it and store it in the map
- LauParticlePDG * theParticle = new LauParticlePDG( theTParticle );
- std::pair< LauPDGList::iterator, bool > insertResult = particles_.insert( std::make_pair( theCode, theParticle ) );
- if ( ! insertResult.second ) {
- cerr<<"ERROR in LauDatabasePDG::createParticle : Something went wrong inserting particle "<<theCode<<" into the map."<<endl;
- delete theParticle;
- return 0;
- }
-
- // then get the anti-particle from the database
- TParticlePDG* theTAntiParticle = theTParticle->AntiParticle();
-
- // check if we have a self-conjugate particle
- if ( theTAntiParticle == 0 || theTAntiParticle == theTParticle ) {
- // if so then set it to be it's own anti-particle and return
- theParticle->setAntiParticle( theParticle );
- if ( debug_ ) {
- cout<<"INFO in LauDatabasePDG::createParticle : Created self-conjugate particle "<<theTParticle->GetName()<<endl;
- }
- return theParticle;
- }
-
- // otherwise make the particle's antiparticle and store it in the map
- LauParticlePDG * antiParticle = new LauParticlePDG( theTAntiParticle );
- Int_t conjCode = antiParticle->code();
- insertResult = particles_.insert( std::make_pair( conjCode, antiParticle ) );
- if ( ! insertResult.second ) {
- cerr<<"ERROR in LauDatabasePDG::createParticle : Something went wrong inserting anti-particle "<<conjCode<<" into the map."<<endl;
- particles_.erase( theCode );
- delete theParticle;
- delete antiParticle;
- return 0;
- }
-
- // set the particle and anti-particle to be each others conjugate
- theParticle->setAntiParticle( antiParticle );
- antiParticle->setAntiParticle( theParticle );
-
- // and finally return the particle we've created
- if ( debug_ ) {
- cout<<"INFO in LauDatabasePDG::createParticle : Created particle "<<theTParticle->GetName()<<" and its conjugate "<<theTAntiParticle->GetName()<<endl;
- }
- return theParticle;
+ // if we've already created this one simply return it
+ LauPDGList::iterator iter = particles_.find( theCode );
+ if ( iter != particles_.end() ) {
+ return iter->second;
+ }
+
+ // otherwise we'll have to make it...
+
+ // first get the particle from the database
+ TParticlePDG* theTParticle = theDatabase_->GetParticle( theCode );
+ if ( theTParticle == 0 ) {
+ cerr << "ERROR in LauDatabasePDG::createParticle : Invalid PDG code: " << theCode << endl;
+ return 0;
+ }
+
+ // then create a new particle from it and store it in the map
+ LauParticlePDG* theParticle = new LauParticlePDG( theTParticle );
+ std::pair<LauPDGList::iterator, bool> insertResult = particles_.insert(
+ std::make_pair( theCode, theParticle ) );
+ if ( ! insertResult.second ) {
+ cerr << "ERROR in LauDatabasePDG::createParticle : Something went wrong inserting particle "
+ << theCode << " into the map." << endl;
+ delete theParticle;
+ return 0;
+ }
+
+ // then get the anti-particle from the database
+ TParticlePDG* theTAntiParticle = theTParticle->AntiParticle();
+
+ // check if we have a self-conjugate particle
+ if ( theTAntiParticle == 0 || theTAntiParticle == theTParticle ) {
+ // if so then set it to be it's own anti-particle and return
+ theParticle->setAntiParticle( theParticle );
+ if ( debug_ ) {
+ cout << "INFO in LauDatabasePDG::createParticle : Created self-conjugate particle "
+ << theTParticle->GetName() << endl;
+ }
+ return theParticle;
+ }
+
+ // otherwise make the particle's antiparticle and store it in the map
+ LauParticlePDG* antiParticle = new LauParticlePDG( theTAntiParticle );
+ Int_t conjCode = antiParticle->code();
+ insertResult = particles_.insert( std::make_pair( conjCode, antiParticle ) );
+ if ( ! insertResult.second ) {
+ cerr << "ERROR in LauDatabasePDG::createParticle : Something went wrong inserting anti-particle "
+ << conjCode << " into the map." << endl;
+ particles_.erase( theCode );
+ delete theParticle;
+ delete antiParticle;
+ return 0;
+ }
+
+ // set the particle and anti-particle to be each others conjugate
+ theParticle->setAntiParticle( antiParticle );
+ antiParticle->setAntiParticle( theParticle );
+
+ // and finally return the particle we've created
+ if ( debug_ ) {
+ cout << "INFO in LauDatabasePDG::createParticle : Created particle "
+ << theTParticle->GetName() << " and its conjugate " << theTAntiParticle->GetName()
+ << endl;
+ }
+ return theParticle;
}
-const LauParticlePDG* LauDatabasePDG::createParticle(const TString& theString)
+const LauParticlePDG* LauDatabasePDG::createParticle( const TString& theString )
{
- // turn the string into a PDG code
- Int_t theCode = this->pdgCode(theString);
- if ( theCode == 0 ) {
- cerr<<"ERROR in LauDatabasePDG::createParticle : Invalid particle string: "<<theString<<endl;
- return 0;
- }
- // self-message to get the particle
- return this->createParticle(theCode);
+ // turn the string into a PDG code
+ Int_t theCode = this->pdgCode( theString );
+ if ( theCode == 0 ) {
+ cerr << "ERROR in LauDatabasePDG::createParticle : Invalid particle string: " << theString
+ << endl;
+ return 0;
+ }
+ // self-message to get the particle
+ return this->createParticle( theCode );
}
// These last two methods have to be independent of our own database since
// they are used by the methods that create the particles and so we'd end
// up with an infinite loop.
-Int_t LauDatabasePDG::pdgCode(const TString& theString)
+Int_t LauDatabasePDG::pdgCode( const TString& theString )
{
- TParticlePDG* theParticle = theDatabase_->GetParticle(theString);
- if (theParticle == 0) {
- cerr<<"ERROR in LauDatabasePDG::pdgCode : Invalid particle string: "<<theString<<endl;
- return 0;
- }
- return theParticle->PdgCode();
+ TParticlePDG* theParticle = theDatabase_->GetParticle( theString );
+ if ( theParticle == 0 ) {
+ cerr << "ERROR in LauDatabasePDG::pdgCode : Invalid particle string: " << theString << endl;
+ return 0;
+ }
+ return theParticle->PdgCode();
}
-TString LauDatabasePDG::pdgName(Int_t theCode)
+TString LauDatabasePDG::pdgName( Int_t theCode )
{
- TParticlePDG* theParticle = theDatabase_->GetParticle(theCode);
- if (theParticle == 0) {
- cerr<<"ERROR in LauDatabasePDG::pdgName : Invalid particle code: "<<theCode<<endl;
- return "";
- }
- return theParticle->GetName();
+ TParticlePDG* theParticle = theDatabase_->GetParticle( theCode );
+ if ( theParticle == 0 ) {
+ cerr << "ERROR in LauDatabasePDG::pdgName : Invalid particle code: " << theCode << endl;
+ return "";
+ }
+ return theParticle->GetName();
}
-
diff --git a/src/LauDaughters.cc b/src/LauDaughters.cc
index 08705c1..2d525f2 100644
--- a/src/LauDaughters.cc
+++ b/src/LauDaughters.cc
@@ -1,344 +1,391 @@
/*
Copyright 2004 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauDaughters.cc
\brief File containing implementation of LauDaughters class.
*/
-#include <iostream>
-
-#include "TSystem.h"
+#include "LauDaughters.hh"
#include "LauDatabasePDG.hh"
-#include "LauDaughters.hh"
#include "LauKinematics.hh"
#include "LauParticlePDG.hh"
+#include "TSystem.h"
+#include <iostream>
-LauDaughters::LauDaughters(Int_t codeParent, Int_t code1, Int_t code2, Int_t code3, Bool_t useSquareDP) :
- kinematics_(0),
- parent_(0),
- symmetricalDP_(kFALSE),
- fullySymmetricDP_(kFALSE),
- flavourConjugateDP_(kFALSE)
+LauDaughters::LauDaughters( Int_t codeParent, Int_t code1, Int_t code2, Int_t code3, Bool_t useSquareDP ) :
+ kinematics_( 0 ),
+ parent_( 0 ),
+ symmetricalDP_( kFALSE ),
+ fullySymmetricDP_( kFALSE ),
+ flavourConjugateDP_( kFALSE )
{
- this->createParticleLists();
-
- TString nameParent = LauDatabasePDG::string( codeParent );
- TString name1 = LauDatabasePDG::string( code1 );
- TString name2 = LauDatabasePDG::string( code2 );
- TString name3 = LauDatabasePDG::string( code3 );
- this->setParentType(nameParent);
- this->setDaugType(name1, name2, name3);
-
- // Create kinematics object
- kinematics_ = new LauKinematics(this->getMassDaug1(), this->getMassDaug2(), this->getMassDaug3(), this->getMassParent(), useSquareDP, symmetricalDP_, fullySymmetricDP_);
+ this->createParticleLists();
+
+ TString nameParent = LauDatabasePDG::string( codeParent );
+ TString name1 = LauDatabasePDG::string( code1 );
+ TString name2 = LauDatabasePDG::string( code2 );
+ TString name3 = LauDatabasePDG::string( code3 );
+ this->setParentType( nameParent );
+ this->setDaugType( name1, name2, name3 );
+
+ // Create kinematics object
+ kinematics_ = new LauKinematics( this->getMassDaug1(),
+ this->getMassDaug2(),
+ this->getMassDaug3(),
+ this->getMassParent(),
+ useSquareDP,
+ symmetricalDP_,
+ fullySymmetricDP_ );
}
-LauDaughters::LauDaughters(const TString& nameParent, const TString& name1, const TString& name2, const TString& name3, Bool_t useSquareDP) :
- kinematics_(0),
- parent_(0),
- symmetricalDP_(kFALSE),
- fullySymmetricDP_(kFALSE),
- flavourConjugateDP_(kFALSE)
+LauDaughters::LauDaughters( const TString& nameParent,
+ const TString& name1,
+ const TString& name2,
+ const TString& name3,
+ Bool_t useSquareDP ) :
+ kinematics_( 0 ),
+ parent_( 0 ),
+ symmetricalDP_( kFALSE ),
+ fullySymmetricDP_( kFALSE ),
+ flavourConjugateDP_( kFALSE )
{
- this->createParticleLists();
-
- this->setParentType(nameParent);
- this->setDaugType(name1, name2, name3);
-
- // Create kinematics object
- kinematics_ = new LauKinematics(this->getMassDaug1(), this->getMassDaug2(), this->getMassDaug3(), this->getMassParent(), useSquareDP, symmetricalDP_, fullySymmetricDP_);
+ this->createParticleLists();
+
+ this->setParentType( nameParent );
+ this->setDaugType( name1, name2, name3 );
+
+ // Create kinematics object
+ kinematics_ = new LauKinematics( this->getMassDaug1(),
+ this->getMassDaug2(),
+ this->getMassDaug3(),
+ this->getMassParent(),
+ useSquareDP,
+ symmetricalDP_,
+ fullySymmetricDP_ );
}
LauDaughters::~LauDaughters()
{
- delete kinematics_; kinematics_ = 0;
+ delete kinematics_;
+ kinematics_ = 0;
}
LauDaughters::LauDaughters( const LauDaughters& rhs ) :
- kinematics_(0),
- parent_(0),
- symmetricalDP_(kFALSE),
- fullySymmetricDP_(kFALSE),
- flavourConjugateDP_(kFALSE)
+ kinematics_( 0 ),
+ parent_( 0 ),
+ symmetricalDP_( kFALSE ),
+ fullySymmetricDP_( kFALSE ),
+ flavourConjugateDP_( kFALSE )
{
- this->createParticleLists();
-
- this->setParentType( rhs.getNameParent() );
- this->setDaugType( rhs.getNameDaug1() , rhs.getNameDaug2() , rhs.getNameDaug3() );
-
- // Create kinematics object
- kinematics_ = new LauKinematics(this->getMassDaug1(), this->getMassDaug2(), this->getMassDaug3(), this->getMassParent(), rhs.squareDP(), rhs.gotSymmetricalDP(), rhs.gotFullySymmetricDP());
+ this->createParticleLists();
+
+ this->setParentType( rhs.getNameParent() );
+ this->setDaugType( rhs.getNameDaug1(), rhs.getNameDaug2(), rhs.getNameDaug3() );
+
+ // Create kinematics object
+ kinematics_ = new LauKinematics( this->getMassDaug1(),
+ this->getMassDaug2(),
+ this->getMassDaug3(),
+ this->getMassParent(),
+ rhs.squareDP(),
+ rhs.gotSymmetricalDP(),
+ rhs.gotFullySymmetricDP() );
}
void LauDaughters::createParticleLists()
{
- // Create list of allowed daughters
- allowedDaughters_.clear();
- allowedDaughters_.push_back(LauDatabasePDG::particle("pi+"));
- allowedDaughters_.push_back(LauDatabasePDG::particle("pi-"));
- allowedDaughters_.push_back(LauDatabasePDG::particle("pi0"));
- allowedDaughters_.push_back(LauDatabasePDG::particle("K+"));
- allowedDaughters_.push_back(LauDatabasePDG::particle("K-"));
- allowedDaughters_.push_back(LauDatabasePDG::particle("K_S0"));
- allowedDaughters_.push_back(LauDatabasePDG::particle("eta"));
- allowedDaughters_.push_back(LauDatabasePDG::particle("eta'"));
- allowedDaughters_.push_back(LauDatabasePDG::particle("D+"));
- allowedDaughters_.push_back(LauDatabasePDG::particle("D-"));
- allowedDaughters_.push_back(LauDatabasePDG::particle("D0"));
- allowedDaughters_.push_back(LauDatabasePDG::particle("D0_bar"));
- allowedDaughters_.push_back(LauDatabasePDG::particle("D_s+"));
- allowedDaughters_.push_back(LauDatabasePDG::particle("D_s-"));
-
- // Create list of allowed parents
- allowedParents_.clear();
- allowedParents_.push_back(LauDatabasePDG::particle("B+"));
- allowedParents_.push_back(LauDatabasePDG::particle("B-"));
- allowedParents_.push_back(LauDatabasePDG::particle("B0"));
- allowedParents_.push_back(LauDatabasePDG::particle("B0_bar"));
- allowedParents_.push_back(LauDatabasePDG::particle("B_s0"));
- allowedParents_.push_back(LauDatabasePDG::particle("B_s0_bar"));
- allowedParents_.push_back(LauDatabasePDG::particle("D+"));
- allowedParents_.push_back(LauDatabasePDG::particle("D-"));
- allowedParents_.push_back(LauDatabasePDG::particle("D0"));
- allowedParents_.push_back(LauDatabasePDG::particle("D0_bar"));
- allowedParents_.push_back(LauDatabasePDG::particle("D_s+"));
- allowedParents_.push_back(LauDatabasePDG::particle("D_s-"));
+ // Create list of allowed daughters
+ allowedDaughters_.clear();
+ allowedDaughters_.push_back( LauDatabasePDG::particle( "pi+" ) );
+ allowedDaughters_.push_back( LauDatabasePDG::particle( "pi-" ) );
+ allowedDaughters_.push_back( LauDatabasePDG::particle( "pi0" ) );
+ allowedDaughters_.push_back( LauDatabasePDG::particle( "K+" ) );
+ allowedDaughters_.push_back( LauDatabasePDG::particle( "K-" ) );
+ allowedDaughters_.push_back( LauDatabasePDG::particle( "K_S0" ) );
+ allowedDaughters_.push_back( LauDatabasePDG::particle( "eta" ) );
+ allowedDaughters_.push_back( LauDatabasePDG::particle( "eta'" ) );
+ allowedDaughters_.push_back( LauDatabasePDG::particle( "D+" ) );
+ allowedDaughters_.push_back( LauDatabasePDG::particle( "D-" ) );
+ allowedDaughters_.push_back( LauDatabasePDG::particle( "D0" ) );
+ allowedDaughters_.push_back( LauDatabasePDG::particle( "D0_bar" ) );
+ allowedDaughters_.push_back( LauDatabasePDG::particle( "D_s+" ) );
+ allowedDaughters_.push_back( LauDatabasePDG::particle( "D_s-" ) );
+
+ // Create list of allowed parents
+ allowedParents_.clear();
+ allowedParents_.push_back( LauDatabasePDG::particle( "B+" ) );
+ allowedParents_.push_back( LauDatabasePDG::particle( "B-" ) );
+ allowedParents_.push_back( LauDatabasePDG::particle( "B0" ) );
+ allowedParents_.push_back( LauDatabasePDG::particle( "B0_bar" ) );
+ allowedParents_.push_back( LauDatabasePDG::particle( "B_s0" ) );
+ allowedParents_.push_back( LauDatabasePDG::particle( "B_s0_bar" ) );
+ allowedParents_.push_back( LauDatabasePDG::particle( "D+" ) );
+ allowedParents_.push_back( LauDatabasePDG::particle( "D-" ) );
+ allowedParents_.push_back( LauDatabasePDG::particle( "D0" ) );
+ allowedParents_.push_back( LauDatabasePDG::particle( "D0_bar" ) );
+ allowedParents_.push_back( LauDatabasePDG::particle( "D_s+" ) );
+ allowedParents_.push_back( LauDatabasePDG::particle( "D_s-" ) );
}
-void LauDaughters::setParentType(const TString& nameParent)
+void LauDaughters::setParentType( const TString& nameParent )
{
- parent_ = 0;
-
- const Int_t codeParent = LauDatabasePDG::code( nameParent );
-
- for ( std::vector<const LauParticlePDG*>::const_iterator iter = allowedParents_.begin(); iter != allowedParents_.end(); ++iter ) {
- const Int_t code = (*iter)->code();
- if ( codeParent == code ) {
- parent_ = (*iter);
- std::cout<<"INFO in LauDaughters::setParentType : Setting parent to be "<<parent_->string()<<" == "<<parent_->code()<<std::endl;
- break;
- }
- }
-
- if ( ! parent_ ) {
- std::cerr<<"ERROR in LauDaughters::setParentType : Couldn't find a valid parent called \""<<nameParent<<"\"."<<std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
+ parent_ = 0;
+
+ const Int_t codeParent = LauDatabasePDG::code( nameParent );
+
+ for ( std::vector<const LauParticlePDG*>::const_iterator iter = allowedParents_.begin();
+ iter != allowedParents_.end();
+ ++iter ) {
+ const Int_t code = ( *iter )->code();
+ if ( codeParent == code ) {
+ parent_ = ( *iter );
+ std::cout << "INFO in LauDaughters::setParentType : Setting parent to be "
+ << parent_->string() << " == " << parent_->code() << std::endl;
+ break;
+ }
+ }
+
+ if ( ! parent_ ) {
+ std::cerr << "ERROR in LauDaughters::setParentType : Couldn't find a valid parent called \""
+ << nameParent << "\"." << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
}
-void LauDaughters::setDaugType(const TString& name1, const TString& name2, const TString& name3)
+void LauDaughters::setDaugType( const TString& name1, const TString& name2, const TString& name3 )
{
- const TString names[3] = { name1, name2, name3 };
- const Int_t codes[3] = { LauDatabasePDG::code( name1 ), LauDatabasePDG::code( name2 ), LauDatabasePDG::code( name3 ) };
-
- daughters_.clear();
- daughters_.resize(3);
-
- for ( int i(0); i<3; ++i ) {
- for ( std::vector<const LauParticlePDG*>::const_iterator iter = allowedDaughters_.begin(); iter != allowedDaughters_.end(); ++iter ) {
- Int_t code = (*iter)->code();
- if ( codes[i] == code ) {
- daughters_[i] = (*iter);
- std::cout<<"INFO in LauDaughters::setDaugType : Setting daughter "<<i+1<<" to be "<<daughters_[i]->string()<<" == "<<daughters_[i]->code()<<std::endl;
- break;
- }
- }
- if ( ! daughters_[i] ) {
- std::cerr<<"ERROR in LauDaughters::setDaugType : Couldn't find a valid daughter called \""<<names[i]<<"\"."<<std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- }
-
- // Initialise the various data members concerning particle masses
- this->sanityCheck();
-
- // Check whether we have a symmetrical Dalitz plot
- this->testDPSymmetry();
+ const TString names[3] = { name1, name2, name3 };
+ const Int_t codes[3] = { LauDatabasePDG::code( name1 ),
+ LauDatabasePDG::code( name2 ),
+ LauDatabasePDG::code( name3 ) };
+
+ daughters_.clear();
+ daughters_.resize( 3 );
+
+ for ( int i( 0 ); i < 3; ++i ) {
+ for ( std::vector<const LauParticlePDG*>::const_iterator iter = allowedDaughters_.begin();
+ iter != allowedDaughters_.end();
+ ++iter ) {
+ Int_t code = ( *iter )->code();
+ if ( codes[i] == code ) {
+ daughters_[i] = ( *iter );
+ std::cout << "INFO in LauDaughters::setDaugType : Setting daughter " << i + 1
+ << " to be " << daughters_[i]->string() << " == " << daughters_[i]->code()
+ << std::endl;
+ break;
+ }
+ }
+ if ( ! daughters_[i] ) {
+ std::cerr << "ERROR in LauDaughters::setDaugType : Couldn't find a valid daughter called \""
+ << names[i] << "\"." << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ }
+
+ // Initialise the various data members concerning particle masses
+ this->sanityCheck();
+
+ // Check whether we have a symmetrical Dalitz plot
+ this->testDPSymmetry();
}
-void LauDaughters::testDPSymmetry()
+void LauDaughters::testDPSymmetry()
{
- // Check to see if we have a symmetrical or flavour-conjugate DP.
-
- symmetricalDP_ = kFALSE;
- fullySymmetricDP_ = kFALSE;
- flavourConjugateDP_ = kFALSE;
-
- if ( daughters_[0]->code() == daughters_[1]->code() && daughters_[0]->code() == daughters_[2]->code() ) {
- std::cout<<"INFO in LauDaughters::testDPSymmetry : We have a fully symmetric DP. "<<std::endl;
- fullySymmetricDP_ = kTRUE;
- } else if ( daughters_[0]->code() == daughters_[1]->code() ) {
- std::cout<<"INFO in LauDaughters::testDPSymmetry : We have a symmetrical DP. "<<std::endl;
- symmetricalDP_ = kTRUE;
- } else if ( daughters_[0]->code() == daughters_[2]->code() ) {
- std::cerr<<"ERROR in LauDaughters::testDPSymmetry : daughter 1 and daughter 3 are both "<<daughters_[0]->string()<<" but DP can only fold on daughters 1 and 2."<<std::endl;
- gSystem->Exit(EXIT_FAILURE);
- } else if ( daughters_[1]->code() == daughters_[2]->code() ) {
- std::cerr<<"ERROR in LauDaughters::testDPSymmetry : daughter 2 and daughter 3 are both "<<daughters_[1]->string()<<" but DP can only fold on daughters 1 and 2."<<std::endl;
- gSystem->Exit(EXIT_FAILURE);
- } else if ( daughters_[0]->type() == daughters_[1]->type() && daughters_[2]->charge() == 0 ) {
- std::cout<<"INFO in LauDaughters::testDPSymmetry : We have a flavour-conjugate DP. "<<std::endl;
- flavourConjugateDP_ = kTRUE;
- } else if ( daughters_[0]->type() == daughters_[2]->type() && daughters_[1]->charge() == 0 ) {
- std::cerr<<"WARNING in LauDaughters::testDPSymmetry : it looks like we have a flavour-conjugate DP but the "<<daughters_[0]->string()<<" and "<<daughters_[2]->string()<<" are not positioned as daughters 1 and 2." << std::endl;
- } else if ( daughters_[1]->type() == daughters_[2]->type() && daughters_[0]->charge() == 0 ) {
- std::cerr<<"WARNING in LauDaughters::testDPSymmetry : it looks like we have a flavour-conjugate DP but the "<<daughters_[1]->string()<<" and "<<daughters_[2]->string()<<" are not positioned as daughters 1 and 2." << std::endl;
- }
+ // Check to see if we have a symmetrical or flavour-conjugate DP.
+
+ symmetricalDP_ = kFALSE;
+ fullySymmetricDP_ = kFALSE;
+ flavourConjugateDP_ = kFALSE;
+
+ if ( daughters_[0]->code() == daughters_[1]->code() &&
+ daughters_[0]->code() == daughters_[2]->code() ) {
+ std::cout << "INFO in LauDaughters::testDPSymmetry : We have a fully symmetric DP. "
+ << std::endl;
+ fullySymmetricDP_ = kTRUE;
+ } else if ( daughters_[0]->code() == daughters_[1]->code() ) {
+ std::cout << "INFO in LauDaughters::testDPSymmetry : We have a symmetrical DP. " << std::endl;
+ symmetricalDP_ = kTRUE;
+ } else if ( daughters_[0]->code() == daughters_[2]->code() ) {
+ std::cerr << "ERROR in LauDaughters::testDPSymmetry : daughter 1 and daughter 3 are both "
+ << daughters_[0]->string() << " but DP can only fold on daughters 1 and 2."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ } else if ( daughters_[1]->code() == daughters_[2]->code() ) {
+ std::cerr << "ERROR in LauDaughters::testDPSymmetry : daughter 2 and daughter 3 are both "
+ << daughters_[1]->string() << " but DP can only fold on daughters 1 and 2."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ } else if ( daughters_[0]->type() == daughters_[1]->type() && daughters_[2]->charge() == 0 ) {
+ std::cout << "INFO in LauDaughters::testDPSymmetry : We have a flavour-conjugate DP. "
+ << std::endl;
+ flavourConjugateDP_ = kTRUE;
+ } else if ( daughters_[0]->type() == daughters_[2]->type() && daughters_[1]->charge() == 0 ) {
+ std::cerr << "WARNING in LauDaughters::testDPSymmetry : it looks like we have a flavour-conjugate DP but the "
+ << daughters_[0]->string() << " and " << daughters_[2]->string()
+ << " are not positioned as daughters 1 and 2." << std::endl;
+ } else if ( daughters_[1]->type() == daughters_[2]->type() && daughters_[0]->charge() == 0 ) {
+ std::cerr << "WARNING in LauDaughters::testDPSymmetry : it looks like we have a flavour-conjugate DP but the "
+ << daughters_[1]->string() << " and " << daughters_[2]->string()
+ << " are not positioned as daughters 1 and 2." << std::endl;
+ }
}
void LauDaughters::sanityCheck()
{
- // Check masses and charges of daughters
-
- Int_t totCharge(0);
- Double_t totMass(0.0);
-
- for ( std::vector<const LauParticlePDG*>::const_iterator iter = daughters_.begin(); iter != daughters_.end(); ++iter ) {
- totCharge += (*iter)->charge();
- totMass += (*iter)->mass();
- }
-
- if (totCharge != parent_->charge()) {
- std::cerr<<"ERROR in LauDaughters::sanityCheck : Total charge of daughters ("<<totCharge<<") not equal to charge of parent ("<<parent_->charge()<<")."<<std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- if (totMass > parent_->mass()) {
- std::cerr<<"ERROR in LauDaughters::sanityCheck : Total mass of daughters ("<<totMass<<") greater than mass of parent ("<<parent_->mass()<<")."<<std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
+ // Check masses and charges of daughters
+
+ Int_t totCharge( 0 );
+ Double_t totMass( 0.0 );
+
+ for ( std::vector<const LauParticlePDG*>::const_iterator iter = daughters_.begin();
+ iter != daughters_.end();
+ ++iter ) {
+ totCharge += ( *iter )->charge();
+ totMass += ( *iter )->mass();
+ }
+
+ if ( totCharge != parent_->charge() ) {
+ std::cerr << "ERROR in LauDaughters::sanityCheck : Total charge of daughters (" << totCharge
+ << ") not equal to charge of parent (" << parent_->charge() << ")." << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ if ( totMass > parent_->mass() ) {
+ std::cerr << "ERROR in LauDaughters::sanityCheck : Total mass of daughters (" << totMass
+ << ") greater than mass of parent (" << parent_->mass() << ")." << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
}
Double_t LauDaughters::getMassDaug1() const
-{
- return daughters_[0]->mass();
+{
+ return daughters_[0]->mass();
}
Double_t LauDaughters::getMassDaug2() const
-{
- return daughters_[1]->mass();
+{
+ return daughters_[1]->mass();
}
Double_t LauDaughters::getMassDaug3() const
-{
- return daughters_[2]->mass();
+{
+ return daughters_[2]->mass();
}
Double_t LauDaughters::getMassParent() const
{
- return parent_->mass();
+ return parent_->mass();
}
TString LauDaughters::getNameDaug1() const
{
- return daughters_[0]->string();
+ return daughters_[0]->string();
}
TString LauDaughters::getNameDaug2() const
{
- return daughters_[1]->string();
+ return daughters_[1]->string();
}
TString LauDaughters::getNameDaug3() const
{
- return daughters_[2]->string();
+ return daughters_[2]->string();
}
TString LauDaughters::getNameParent() const
{
- return parent_->string();
+ return parent_->string();
}
TString LauDaughters::getSanitisedNameDaug1() const
{
- return daughters_[0]->stringAlphaNum();
+ return daughters_[0]->stringAlphaNum();
}
TString LauDaughters::getSanitisedNameDaug2() const
{
- return daughters_[1]->stringAlphaNum();
+ return daughters_[1]->stringAlphaNum();
}
TString LauDaughters::getSanitisedNameDaug3() const
{
- return daughters_[2]->stringAlphaNum();
+ return daughters_[2]->stringAlphaNum();
}
TString LauDaughters::getSanitisedNameParent() const
{
- return parent_->stringAlphaNum();
+ return parent_->stringAlphaNum();
}
Int_t LauDaughters::getTypeDaug1() const
{
- return daughters_[0]->code();
+ return daughters_[0]->code();
}
Int_t LauDaughters::getTypeDaug2() const
{
- return daughters_[1]->code();
+ return daughters_[1]->code();
}
Int_t LauDaughters::getTypeDaug3() const
{
- return daughters_[2]->code();
+ return daughters_[2]->code();
}
Int_t LauDaughters::getTypeParent() const
{
- return parent_->code();
+ return parent_->code();
}
Int_t LauDaughters::getChargeDaug1() const
{
- return daughters_[0]->charge();
+ return daughters_[0]->charge();
}
Int_t LauDaughters::getChargeDaug2() const
{
- return daughters_[1]->charge();
+ return daughters_[1]->charge();
}
Int_t LauDaughters::getChargeDaug3() const
{
- return daughters_[2]->charge();
+ return daughters_[2]->charge();
}
Int_t LauDaughters::getChargeParent() const
{
- return parent_->charge();
+ return parent_->charge();
}
-Int_t LauDaughters::getCharge(Int_t resPairAmpInt) const
+Int_t LauDaughters::getCharge( Int_t resPairAmpInt ) const
{
- Int_t charge = this->getChargeParent();
- if ( resPairAmpInt>0 && resPairAmpInt<4 ) {
- charge -= daughters_[resPairAmpInt-1]->charge();
- }
- return charge;
+ Int_t charge = this->getChargeParent();
+ if ( resPairAmpInt > 0 && resPairAmpInt < 4 ) {
+ charge -= daughters_[resPairAmpInt - 1]->charge();
+ }
+ return charge;
}
-
diff --git a/src/LauEFKLLMRes.cc b/src/LauEFKLLMRes.cc
index 443c310..f582469 100644
--- a/src/LauEFKLLMRes.cc
+++ b/src/LauEFKLLMRes.cc
@@ -1,174 +1,179 @@
/*
Copyright 2015 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauEFKLLMRes.cc
\brief File containing implementation of LauEFKLLMRes class.
*/
-#include <cstdlib>
+#include "LauEFKLLMRes.hh"
#include "Lau1DCubicSpline.hh"
#include "LauKinematics.hh"
-#include "LauEFKLLMRes.hh"
#include "LauResonanceInfo.hh"
#include "LauTextFileParser.hh"
-
-
+#include <cstdlib>
Lau1DCubicSpline* LauEFKLLMRes::magSpline_ = 0;
Lau1DCubicSpline* LauEFKLLMRes::phaseSpline_ = 0;
-
-LauEFKLLMRes::LauEFKLLMRes(LauResonanceInfo* resInfo, const Int_t resPairAmpInt, const LauDaughters* daughters) :
- LauAbsResonance(resInfo, resPairAmpInt, daughters),
- massFactor_(0)
+LauEFKLLMRes::LauEFKLLMRes( LauResonanceInfo* resInfo,
+ const Int_t resPairAmpInt,
+ const LauDaughters* daughters ) :
+ LauAbsResonance( resInfo, resPairAmpInt, daughters ),
+ massFactor_( 0 )
{
- const Double_t massFactorVal = 0.;
-
- const TString& parNameBase = this->getSanitisedName();
-
- TString massFactorName(parNameBase);
- massFactorName += "_massFactor";
- massFactor_ = resInfo->getExtraParameter( massFactorName );
- if ( massFactor_ == 0 ) {
- massFactor_ = new LauParameter( massFactorName, massFactorVal, -10.0, 10.0, kTRUE );
- massFactor_->secondStage(kTRUE);
- resInfo->addExtraParameter( massFactor_ );
- }
+ const Double_t massFactorVal = 0.;
+
+ const TString& parNameBase = this->getSanitisedName();
+
+ TString massFactorName( parNameBase );
+ massFactorName += "_massFactor";
+ massFactor_ = resInfo->getExtraParameter( massFactorName );
+ if ( massFactor_ == 0 ) {
+ massFactor_ = new LauParameter( massFactorName, massFactorVal, -10.0, 10.0, kTRUE );
+ massFactor_->secondStage( kTRUE );
+ resInfo->addExtraParameter( massFactor_ );
+ }
}
LauEFKLLMRes::~LauEFKLLMRes()
{
}
void LauEFKLLMRes::initialise()
{
}
-void LauEFKLLMRes::setResonanceParameter(const TString& name, const Double_t value)
+void LauEFKLLMRes::setResonanceParameter( const TString& name, const Double_t value )
{
- if(name=="massFactor") {
- this->setMassFactor(value);
- std::cout << "INFO in LauEFKLLMRes::setResonanceParameter: Mass factor set to " << value << std::endl;
- } else {
- std::cerr << "WARNING in LauEFKLLMRes::setResonanceParameter: Parameter name not reconised." << std::endl;
- }
+ if ( name == "massFactor" ) {
+ this->setMassFactor( value );
+ std::cout << "INFO in LauEFKLLMRes::setResonanceParameter: Mass factor set to " << value
+ << std::endl;
+ } else {
+ std::cerr << "WARNING in LauEFKLLMRes::setResonanceParameter: Parameter name not reconised."
+ << std::endl;
+ }
}
-void LauEFKLLMRes::floatResonanceParameter(const TString& name)
+void LauEFKLLMRes::floatResonanceParameter( const TString& name )
{
- if(name=="massFactor") {
- if ( massFactor_->fixed() ) {
- massFactor_->fixed( kFALSE );
- this->addFloatingParameter( massFactor_ );
- } else {
- std::cerr << "WARNING in LauEFKLLMRes::floatResonanceParameter: Parameter already floating. No parameter changes made." << std::endl;
- }
- } else {
- std::cerr << "WARNING in LauEFKLLMRes::floatResonanceParameter: Parameter name not reconised." << std::endl;
- }
+ if ( name == "massFactor" ) {
+ if ( massFactor_->fixed() ) {
+ massFactor_->fixed( kFALSE );
+ this->addFloatingParameter( massFactor_ );
+ } else {
+ std::cerr << "WARNING in LauEFKLLMRes::floatResonanceParameter: Parameter already floating. No parameter changes made."
+ << std::endl;
+ }
+ } else {
+ std::cerr << "WARNING in LauEFKLLMRes::floatResonanceParameter: Parameter name not reconised."
+ << std::endl;
+ }
}
-LauParameter* LauEFKLLMRes::getResonanceParameter(const TString& name)
+LauParameter* LauEFKLLMRes::getResonanceParameter( const TString& name )
{
- if(name=="massFactor") {
- return massFactor_;
- } else {
- std::cerr << "WARNING in LauEFKLLMRes::getResonanceParameter: Parameter name not reconised." << std::endl;
- return 0;
- }
+ if ( name == "massFactor" ) {
+ return massFactor_;
+ } else {
+ std::cerr << "WARNING in LauEFKLLMRes::getResonanceParameter: Parameter name not reconised."
+ << std::endl;
+ return 0;
+ }
}
const std::vector<LauParameter*>& LauEFKLLMRes::getFloatingParameters()
{
- this->clearFloatingParameters();
+ this->clearFloatingParameters();
- if ( ! this->fixMassFactor() ) {
- this->addFloatingParameter( massFactor_ );
- }
+ if ( ! this->fixMassFactor() ) {
+ this->addFloatingParameter( massFactor_ );
+ }
- return this->getParameters();
+ return this->getParameters();
}
-LauComplex LauEFKLLMRes::resAmp(Double_t mass, Double_t /*spinTerm*/)
+LauComplex LauEFKLLMRes::resAmp( Double_t mass, Double_t /*spinTerm*/ )
{
- LauComplex amp(0.0, 0.0);
+ LauComplex amp( 0.0, 0.0 );
- if (magSpline_ == 0 || phaseSpline_ == 0) {
- std::cerr << "ERROR in LauEFKLLMRes::resAmp : One of the splines is null." << std::endl;
- return amp;
- }
+ if ( magSpline_ == 0 || phaseSpline_ == 0 ) {
+ std::cerr << "ERROR in LauEFKLLMRes::resAmp : One of the splines is null." << std::endl;
+ return amp;
+ }
- const Double_t massSq = mass*mass;
- const Double_t mag = magSpline_->evaluate(massSq);
- const Double_t phase = TMath::DegToRad()*phaseSpline_->evaluate(massSq);
- LauComplex ff(mag*TMath::Cos(phase), mag*TMath::Sin(phase));
+ const Double_t massSq = mass * mass;
+ const Double_t mag = magSpline_->evaluate( massSq );
+ const Double_t phase = TMath::DegToRad() * phaseSpline_->evaluate( massSq );
+ LauComplex ff( mag * TMath::Cos( phase ), mag * TMath::Sin( phase ) );
- amp = ff.scale(TMath::Power(mass,this->getMassFactor()));
+ amp = ff.scale( TMath::Power( mass, this->getMassFactor() ) );
- return amp;
+ return amp;
}
-void LauEFKLLMRes::setupFormFactor(const TString& inputFile)
+void LauEFKLLMRes::setupFormFactor( const TString& inputFile )
{
- LauTextFileParser readFile(inputFile);
- readFile.processFile();
-
- std::vector<Double_t> mSqVals;
- std::vector<Double_t> magVals;
- std::vector<Double_t> phaseVals;
-
- std::vector<std::string> line;
-
- line=readFile.getNextLine();
- while(!line.empty()) {
- UInt_t length = line.size();
- if(length!=3) {
- std::cerr << "ERROR in LauEFKLLMRes::setupFormFactor : Unexpected number of fields in text file, aborting reading of form-factor information." << std::endl;
- return;
- }
- mSqVals.push_back( atof(line[0].c_str()));
- magVals.push_back( atof(line[1].c_str()));
- phaseVals.push_back(atof(line[2].c_str()));
- line=readFile.getNextLine();
- }
-
- // Destroy any splines we already had defined but issue a warning just in case
- if ( magSpline_ != 0 || phaseSpline_ != 0 ) {
- std::cerr << "WARNING in LauEFKLLMRes::setupFormFactor : Overwriting previous form-factor splines with newly read values." << std::endl;
- delete magSpline_;
- delete phaseSpline_;
- }
- magSpline_ = new Lau1DCubicSpline(mSqVals, magVals, Lau1DCubicSpline::AkimaSpline);
- phaseSpline_ = new Lau1DCubicSpline(mSqVals, phaseVals, Lau1DCubicSpline::AkimaSpline);
+ LauTextFileParser readFile( inputFile );
+ readFile.processFile();
+
+ std::vector<Double_t> mSqVals;
+ std::vector<Double_t> magVals;
+ std::vector<Double_t> phaseVals;
+
+ std::vector<std::string> line;
+
+ line = readFile.getNextLine();
+ while ( ! line.empty() ) {
+ UInt_t length = line.size();
+ if ( length != 3 ) {
+ std::cerr << "ERROR in LauEFKLLMRes::setupFormFactor : Unexpected number of fields in text file, aborting reading of form-factor information."
+ << std::endl;
+ return;
+ }
+ mSqVals.push_back( atof( line[0].c_str() ) );
+ magVals.push_back( atof( line[1].c_str() ) );
+ phaseVals.push_back( atof( line[2].c_str() ) );
+ line = readFile.getNextLine();
+ }
+
+ // Destroy any splines we already had defined but issue a warning just in case
+ if ( magSpline_ != 0 || phaseSpline_ != 0 ) {
+ std::cerr << "WARNING in LauEFKLLMRes::setupFormFactor : Overwriting previous form-factor splines with newly read values."
+ << std::endl;
+ delete magSpline_;
+ delete phaseSpline_;
+ }
+ magSpline_ = new Lau1DCubicSpline( mSqVals, magVals, Lau1DCubicSpline::AkimaSpline );
+ phaseSpline_ = new Lau1DCubicSpline( mSqVals, phaseVals, Lau1DCubicSpline::AkimaSpline );
}
-void LauEFKLLMRes::setMassFactor(const Double_t massFactor)
+void LauEFKLLMRes::setMassFactor( const Double_t massFactor )
{
- massFactor_->value( massFactor );
- massFactor_->genValue( massFactor );
- massFactor_->initValue( massFactor );
+ massFactor_->value( massFactor );
+ massFactor_->genValue( massFactor );
+ massFactor_->initValue( massFactor );
}
-
diff --git a/src/LauEffModel.cc b/src/LauEffModel.cc
index f58bc93..03be1ee 100644
--- a/src/LauEffModel.cc
+++ b/src/LauEffModel.cc
@@ -1,322 +1,427 @@
/*
Copyright 2004 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauEffModel.cc
\brief File containing implementation of LauEffModel class.
*/
-#include <cstdlib>
-#include <iostream>
+#include "LauEffModel.hh"
-#include "TSystem.h"
#include "Lau2DHistDP.hh"
#include "Lau2DSplineDP.hh"
#include "LauDaughters.hh"
-#include "LauEffModel.hh"
#include "LauKinematics.hh"
#include "LauVetoes.hh"
+#include "TSystem.h"
+#include <cstdlib>
+#include <iostream>
-LauEffModel::LauEffModel(const LauDaughters* daughters, const LauVetoes* vetoes) :
- daughters_( daughters ),
- vetoes_( vetoes ),
- effHisto_( 0 ),
- fluctuateEffHisto_( kFALSE ),
- lowBinWarningIssued_( kFALSE ),
- highBinWarningIssued_( kFALSE )
+LauEffModel::LauEffModel( const LauDaughters* daughters, const LauVetoes* vetoes ) :
+ daughters_( daughters ),
+ vetoes_( vetoes ),
+ effHisto_( 0 ),
+ fluctuateEffHisto_( kFALSE ),
+ lowBinWarningIssued_( kFALSE ),
+ highBinWarningIssued_( kFALSE )
{
- if ( daughters_ == 0 ) {
- std::cerr << "ERROR in LauEffModel Constructor : invalid pointer to daughters object supplied." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
+ if ( daughters_ == 0 ) {
+ std::cerr << "ERROR in LauEffModel Constructor : invalid pointer to daughters object supplied."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
}
LauEffModel::~LauEffModel()
{
- std::vector<Lau2DAbsDP*>::iterator it = effHisto_.begin();
- std::vector<Lau2DAbsDP*>::iterator end = effHisto_.end();
- for( ; it!=end; ++it) {
- delete *it;
- *it=0;
- }
- effHisto_.clear();
+ std::vector<Lau2DAbsDP*>::iterator it = effHisto_.begin();
+ std::vector<Lau2DAbsDP*>::iterator end = effHisto_.end();
+ for ( ; it != end; ++it ) {
+ delete *it;
+ *it = 0;
+ }
+ effHisto_.clear();
}
-void LauEffModel::setEffHisto(const TH2* effHisto, Bool_t useInterpolation,
- Bool_t fluctuateBins, Double_t avEff, Double_t absError,
- Bool_t useUpperHalfOnly, Bool_t squareDP)
+void LauEffModel::setEffHisto( const TH2* effHisto,
+ Bool_t useInterpolation,
+ Bool_t fluctuateBins,
+ Double_t avEff,
+ Double_t absError,
+ Bool_t useUpperHalfOnly,
+ Bool_t squareDP )
{
- // Set the efficiency across the Dalitz plot using a predetermined 2D histogram
- // with x = m_13^2, y = m_23^2.
- Bool_t upperHalf( kFALSE );
- if ( daughters_->gotSymmetricalDP() && useUpperHalfOnly == kTRUE) {upperHalf = kTRUE;}
- std::cout<<"INFO in LauEffModel::setEffHisto : Efficiency histogram has upperHalf = "<<static_cast<Int_t>(upperHalf)<<std::endl;
-
- std::vector<Lau2DAbsDP*>::iterator it = effHisto_.begin();
- std::vector<Lau2DAbsDP*>::iterator end = effHisto_.end();
- for( ; it!=end; ++it) {
- delete *it;
- *it=0;
- }
- effHisto_.clear();
-
- // Copy the histogram.
- effHisto_.push_back(new Lau2DHistDP(effHisto, daughters_,
- useInterpolation, fluctuateBins,
- avEff, absError, upperHalf, squareDP));
- fluctuateEffHisto_ = fluctuateBins;
-
- if (avEff > 0.0 && absError > 0.0) {
- fluctuateEffHisto_ = kTRUE;
- }
+ // Set the efficiency across the Dalitz plot using a predetermined 2D histogram
+ // with x = m_13^2, y = m_23^2.
+ Bool_t upperHalf( kFALSE );
+ if ( daughters_->gotSymmetricalDP() && useUpperHalfOnly == kTRUE ) {
+ upperHalf = kTRUE;
+ }
+ std::cout << "INFO in LauEffModel::setEffHisto : Efficiency histogram has upperHalf = "
+ << static_cast<Int_t>( upperHalf ) << std::endl;
+
+ std::vector<Lau2DAbsDP*>::iterator it = effHisto_.begin();
+ std::vector<Lau2DAbsDP*>::iterator end = effHisto_.end();
+ for ( ; it != end; ++it ) {
+ delete *it;
+ *it = 0;
+ }
+ effHisto_.clear();
+
+ // Copy the histogram.
+ effHisto_.push_back( new Lau2DHistDP( effHisto,
+ daughters_,
+ useInterpolation,
+ fluctuateBins,
+ avEff,
+ absError,
+ upperHalf,
+ squareDP ) );
+ fluctuateEffHisto_ = fluctuateBins;
+
+ if ( avEff > 0.0 && absError > 0.0 ) {
+ fluctuateEffHisto_ = kTRUE;
+ }
}
-void LauEffModel::setEffHisto(const TH2* effHisto, const TH2* errorHi, const TH2* errorLo, Bool_t useInterpolation,
- Bool_t fluctuateBins, Double_t avEff, Double_t absError,
- Bool_t useUpperHalfOnly, Bool_t squareDP)
+void LauEffModel::setEffHisto( const TH2* effHisto,
+ const TH2* errorHi,
+ const TH2* errorLo,
+ Bool_t useInterpolation,
+ Bool_t fluctuateBins,
+ Double_t avEff,
+ Double_t absError,
+ Bool_t useUpperHalfOnly,
+ Bool_t squareDP )
{
- // Set the efficiency across the Dalitz plot using a predetermined 2D histogram
- // with x = m_13^2, y = m_23^2.
- Bool_t upperHalf( kFALSE );
- if ( daughters_->gotSymmetricalDP() && useUpperHalfOnly == kTRUE) {upperHalf = kTRUE;}
- std::cout<<"INFO in LauEffModel::setEffHisto : Efficiency histogram has upperHalf = "<<static_cast<Int_t>(upperHalf)<<std::endl;
-
- std::vector<Lau2DAbsDP*>::iterator it = effHisto_.begin();
- std::vector<Lau2DAbsDP*>::iterator end = effHisto_.end();
- for( ; it!=end; ++it) {
- delete *it;
- *it=0;
- }
- effHisto_.clear();
-
- // Copy the histogram.
- effHisto_.push_back(new Lau2DHistDP(effHisto, errorHi, errorLo, daughters_,
- useInterpolation, fluctuateBins,
- avEff, absError, upperHalf, squareDP));
- fluctuateEffHisto_ = fluctuateBins;
-
- if (avEff > 0.0 && absError > 0.0) {
- fluctuateEffHisto_ = kTRUE;
- }
+ // Set the efficiency across the Dalitz plot using a predetermined 2D histogram
+ // with x = m_13^2, y = m_23^2.
+ Bool_t upperHalf( kFALSE );
+ if ( daughters_->gotSymmetricalDP() && useUpperHalfOnly == kTRUE ) {
+ upperHalf = kTRUE;
+ }
+ std::cout << "INFO in LauEffModel::setEffHisto : Efficiency histogram has upperHalf = "
+ << static_cast<Int_t>( upperHalf ) << std::endl;
+
+ std::vector<Lau2DAbsDP*>::iterator it = effHisto_.begin();
+ std::vector<Lau2DAbsDP*>::iterator end = effHisto_.end();
+ for ( ; it != end; ++it ) {
+ delete *it;
+ *it = 0;
+ }
+ effHisto_.clear();
+
+ // Copy the histogram.
+ effHisto_.push_back( new Lau2DHistDP( effHisto,
+ errorHi,
+ errorLo,
+ daughters_,
+ useInterpolation,
+ fluctuateBins,
+ avEff,
+ absError,
+ upperHalf,
+ squareDP ) );
+ fluctuateEffHisto_ = fluctuateBins;
+
+ if ( avEff > 0.0 && absError > 0.0 ) {
+ fluctuateEffHisto_ = kTRUE;
+ }
}
-void LauEffModel::setEffSpline(const TH2* effHisto,
- Bool_t fluctuateBins, Double_t avEff, Double_t absError,
- Bool_t useUpperHalfOnly, Bool_t squareDP)
+void LauEffModel::setEffSpline( const TH2* effHisto,
+ Bool_t fluctuateBins,
+ Double_t avEff,
+ Double_t absError,
+ Bool_t useUpperHalfOnly,
+ Bool_t squareDP )
{
- // Set the efficiency across the Dalitz plot using a predetermined 2D histogram
- // with x = m_13^2, y = m_23^2.
- Bool_t upperHalf( kFALSE );
- if ( daughters_->gotSymmetricalDP() && useUpperHalfOnly == kTRUE) {upperHalf = kTRUE;}
- std::cout<<"INFO in LauEffModel::setEffSpline : Efficiency histogram has upperHalf = "<<static_cast<Int_t>(upperHalf)<<std::endl;
-
- std::vector<Lau2DAbsDP*>::iterator it = effHisto_.begin();
- std::vector<Lau2DAbsDP*>::iterator end = effHisto_.end();
- for( ; it!=end; ++it) {
- delete *it;
- *it=0;
- }
- effHisto_.clear();
-
- // Copy the histogram.
- effHisto_.push_back(new Lau2DSplineDP(effHisto, daughters_,
- fluctuateBins, avEff, absError, upperHalf, squareDP));
- fluctuateEffHisto_ = fluctuateBins;
-
- if (avEff > 0.0 && absError > 0.0) {
- fluctuateEffHisto_ = kTRUE;
- }
+ // Set the efficiency across the Dalitz plot using a predetermined 2D histogram
+ // with x = m_13^2, y = m_23^2.
+ Bool_t upperHalf( kFALSE );
+ if ( daughters_->gotSymmetricalDP() && useUpperHalfOnly == kTRUE ) {
+ upperHalf = kTRUE;
+ }
+ std::cout << "INFO in LauEffModel::setEffSpline : Efficiency histogram has upperHalf = "
+ << static_cast<Int_t>( upperHalf ) << std::endl;
+
+ std::vector<Lau2DAbsDP*>::iterator it = effHisto_.begin();
+ std::vector<Lau2DAbsDP*>::iterator end = effHisto_.end();
+ for ( ; it != end; ++it ) {
+ delete *it;
+ *it = 0;
+ }
+ effHisto_.clear();
+
+ // Copy the histogram.
+ effHisto_.push_back(
+ new Lau2DSplineDP( effHisto, daughters_, fluctuateBins, avEff, absError, upperHalf, squareDP ) );
+ fluctuateEffHisto_ = fluctuateBins;
+
+ if ( avEff > 0.0 && absError > 0.0 ) {
+ fluctuateEffHisto_ = kTRUE;
+ }
}
-void LauEffModel::setEffSpline(const TH2* effHisto, const TH2* errorHi, const TH2* errorLo,
- Bool_t fluctuateBins, Double_t avEff, Double_t absError,
- Bool_t useUpperHalfOnly, Bool_t squareDP)
+void LauEffModel::setEffSpline( const TH2* effHisto,
+ const TH2* errorHi,
+ const TH2* errorLo,
+ Bool_t fluctuateBins,
+ Double_t avEff,
+ Double_t absError,
+ Bool_t useUpperHalfOnly,
+ Bool_t squareDP )
{
- // Set the efficiency across the Dalitz plot using a predetermined 2D histogram
- // with x = m_13^2, y = m_23^2.
- Bool_t upperHalf( kFALSE );
- if ( daughters_->gotSymmetricalDP() && useUpperHalfOnly == kTRUE) {upperHalf = kTRUE;}
- std::cout<<"INFO in LauEffModel::setEffSpline : Efficiency histogram has upperHalf = "<<static_cast<Int_t>(upperHalf)<<std::endl;
-
- std::vector<Lau2DAbsDP*>::iterator it = effHisto_.begin();
- std::vector<Lau2DAbsDP*>::iterator end = effHisto_.end();
- for( ; it!=end; ++it) {
- delete *it;
- *it=0;
- }
- effHisto_.clear();
-
- // Copy the histogram.
- effHisto_.push_back(new Lau2DSplineDP(effHisto, errorHi, errorLo, daughters_,
- fluctuateBins, avEff, absError, upperHalf, squareDP));
- fluctuateEffHisto_ = fluctuateBins;
-
- if (avEff > 0.0 && absError > 0.0) {
- fluctuateEffHisto_ = kTRUE;
- }
+ // Set the efficiency across the Dalitz plot using a predetermined 2D histogram
+ // with x = m_13^2, y = m_23^2.
+ Bool_t upperHalf( kFALSE );
+ if ( daughters_->gotSymmetricalDP() && useUpperHalfOnly == kTRUE ) {
+ upperHalf = kTRUE;
+ }
+ std::cout << "INFO in LauEffModel::setEffSpline : Efficiency histogram has upperHalf = "
+ << static_cast<Int_t>( upperHalf ) << std::endl;
+
+ std::vector<Lau2DAbsDP*>::iterator it = effHisto_.begin();
+ std::vector<Lau2DAbsDP*>::iterator end = effHisto_.end();
+ for ( ; it != end; ++it ) {
+ delete *it;
+ *it = 0;
+ }
+ effHisto_.clear();
+
+ // Copy the histogram.
+ effHisto_.push_back( new Lau2DSplineDP( effHisto,
+ errorHi,
+ errorLo,
+ daughters_,
+ fluctuateBins,
+ avEff,
+ absError,
+ upperHalf,
+ squareDP ) );
+ fluctuateEffHisto_ = fluctuateBins;
+
+ if ( avEff > 0.0 && absError > 0.0 ) {
+ fluctuateEffHisto_ = kTRUE;
+ }
}
-void LauEffModel::addEffHisto(const TH2* effHisto, Bool_t useInterpolation,
- Double_t avEff, Double_t absError,
- Bool_t useUpperHalfOnly, Bool_t squareDP)
+void LauEffModel::addEffHisto( const TH2* effHisto,
+ Bool_t useInterpolation,
+ Double_t avEff,
+ Double_t absError,
+ Bool_t useUpperHalfOnly,
+ Bool_t squareDP )
{
- // Set the efficiency across the Dalitz plot using a predetermined 2D histogram
- // with x = m_13^2, y = m_23^2.
- Bool_t upperHalf( kFALSE );
- if ( daughters_->gotSymmetricalDP() && useUpperHalfOnly == kTRUE) {upperHalf = kTRUE;}
- std::cout<<"INFO in LauEffModel::addEffHisto : Efficiency histogram has upperHalf = "<<static_cast<Int_t>(upperHalf)<<std::endl;
-
- // Copy the histogram.
- effHisto_.push_back(new Lau2DHistDP(effHisto, daughters_,
- useInterpolation, fluctuateEffHisto_,
- avEff, absError, upperHalf, squareDP));
+ // Set the efficiency across the Dalitz plot using a predetermined 2D histogram
+ // with x = m_13^2, y = m_23^2.
+ Bool_t upperHalf( kFALSE );
+ if ( daughters_->gotSymmetricalDP() && useUpperHalfOnly == kTRUE ) {
+ upperHalf = kTRUE;
+ }
+ std::cout << "INFO in LauEffModel::addEffHisto : Efficiency histogram has upperHalf = "
+ << static_cast<Int_t>( upperHalf ) << std::endl;
+
+ // Copy the histogram.
+ effHisto_.push_back( new Lau2DHistDP( effHisto,
+ daughters_,
+ useInterpolation,
+ fluctuateEffHisto_,
+ avEff,
+ absError,
+ upperHalf,
+ squareDP ) );
}
-void LauEffModel::addEffHisto(const TH2* effHisto, const TH2* errorHi, const TH2* errorLo, Bool_t useInterpolation,
- Double_t avEff, Double_t absError,
- Bool_t useUpperHalfOnly, Bool_t squareDP)
+void LauEffModel::addEffHisto( const TH2* effHisto,
+ const TH2* errorHi,
+ const TH2* errorLo,
+ Bool_t useInterpolation,
+ Double_t avEff,
+ Double_t absError,
+ Bool_t useUpperHalfOnly,
+ Bool_t squareDP )
{
- // Set the efficiency across the Dalitz plot using a predetermined 2D histogram
- // with x = m_13^2, y = m_23^2.
- Bool_t upperHalf( kFALSE );
- if ( daughters_->gotSymmetricalDP() && useUpperHalfOnly == kTRUE) {upperHalf = kTRUE;}
- std::cout<<"INFO in LauEffModel::addEffHisto : Efficiency histogram has upperHalf = "<<static_cast<Int_t>(upperHalf)<<std::endl;
-
- // Copy the histogram.
- effHisto_.push_back(new Lau2DHistDP(effHisto, errorHi, errorLo, daughters_,
- useInterpolation, fluctuateEffHisto_,
- avEff, absError, upperHalf, squareDP));
+ // Set the efficiency across the Dalitz plot using a predetermined 2D histogram
+ // with x = m_13^2, y = m_23^2.
+ Bool_t upperHalf( kFALSE );
+ if ( daughters_->gotSymmetricalDP() && useUpperHalfOnly == kTRUE ) {
+ upperHalf = kTRUE;
+ }
+ std::cout << "INFO in LauEffModel::addEffHisto : Efficiency histogram has upperHalf = "
+ << static_cast<Int_t>( upperHalf ) << std::endl;
+
+ // Copy the histogram.
+ effHisto_.push_back( new Lau2DHistDP( effHisto,
+ errorHi,
+ errorLo,
+ daughters_,
+ useInterpolation,
+ fluctuateEffHisto_,
+ avEff,
+ absError,
+ upperHalf,
+ squareDP ) );
}
-void LauEffModel::addEffSpline(const TH2* effHisto,
- Double_t avEff, Double_t absError,
- Bool_t useUpperHalfOnly, Bool_t squareDP)
+void LauEffModel::addEffSpline( const TH2* effHisto,
+ Double_t avEff,
+ Double_t absError,
+ Bool_t useUpperHalfOnly,
+ Bool_t squareDP )
{
- // Set the efficiency across the Dalitz plot using a predetermined 2D histogram
- // with x = m_13^2, y = m_23^2.
- Bool_t upperHalf( kFALSE );
- if ( daughters_->gotSymmetricalDP() && useUpperHalfOnly == kTRUE) {upperHalf = kTRUE;}
- std::cout<<"INFO in LauEffModel::addEffSpline : Efficiency histogram has upperHalf = "<<static_cast<Int_t>(upperHalf)<<std::endl;
-
- // Copy the histogram.
- effHisto_.push_back(new Lau2DSplineDP(effHisto, daughters_,
- fluctuateEffHisto_, avEff, absError, upperHalf, squareDP));
+ // Set the efficiency across the Dalitz plot using a predetermined 2D histogram
+ // with x = m_13^2, y = m_23^2.
+ Bool_t upperHalf( kFALSE );
+ if ( daughters_->gotSymmetricalDP() && useUpperHalfOnly == kTRUE ) {
+ upperHalf = kTRUE;
+ }
+ std::cout << "INFO in LauEffModel::addEffSpline : Efficiency histogram has upperHalf = "
+ << static_cast<Int_t>( upperHalf ) << std::endl;
+
+ // Copy the histogram.
+ effHisto_.push_back( new Lau2DSplineDP( effHisto,
+ daughters_,
+ fluctuateEffHisto_,
+ avEff,
+ absError,
+ upperHalf,
+ squareDP ) );
}
-void LauEffModel::addEffSpline(const TH2* effHisto, const TH2* errorHi, const TH2* errorLo,
- Double_t avEff, Double_t absError,
- Bool_t useUpperHalfOnly, Bool_t squareDP)
+void LauEffModel::addEffSpline( const TH2* effHisto,
+ const TH2* errorHi,
+ const TH2* errorLo,
+ Double_t avEff,
+ Double_t absError,
+ Bool_t useUpperHalfOnly,
+ Bool_t squareDP )
{
- // Set the efficiency across the Dalitz plot using a predetermined 2D histogram
- // with x = m_13^2, y = m_23^2.
- Bool_t upperHalf( kFALSE );
- if ( daughters_->gotSymmetricalDP() && useUpperHalfOnly == kTRUE) {upperHalf = kTRUE;}
- std::cout<<"INFO in LauEffModel::addEffSpline : Efficiency histogram has upperHalf = "<<static_cast<Int_t>(upperHalf)<<std::endl;
-
- // Copy the histogram.
- effHisto_.push_back(new Lau2DSplineDP(effHisto, errorHi, errorLo, daughters_,
- fluctuateEffHisto_, avEff, absError, upperHalf, squareDP));
+ // Set the efficiency across the Dalitz plot using a predetermined 2D histogram
+ // with x = m_13^2, y = m_23^2.
+ Bool_t upperHalf( kFALSE );
+ if ( daughters_->gotSymmetricalDP() && useUpperHalfOnly == kTRUE ) {
+ upperHalf = kTRUE;
+ }
+ std::cout << "INFO in LauEffModel::addEffSpline : Efficiency histogram has upperHalf = "
+ << static_cast<Int_t>( upperHalf ) << std::endl;
+
+ // Copy the histogram.
+ effHisto_.push_back( new Lau2DSplineDP( effHisto,
+ errorHi,
+ errorLo,
+ daughters_,
+ fluctuateEffHisto_,
+ avEff,
+ absError,
+ upperHalf,
+ squareDP ) );
}
-Double_t LauEffModel::getEffHistValue(const LauKinematics* kinematics) const
+Double_t LauEffModel::getEffHistValue( const LauKinematics* kinematics ) const
{
- // Get the efficiency from the 2D histo.
- Double_t eff(1.0);
-
- Double_t xVal(0.0);
- Double_t yVal(0.0);
-
- std::vector<Lau2DAbsDP*>::const_iterator it = effHisto_.begin();
- const std::vector<Lau2DAbsDP*>::const_iterator end = effHisto_.end();
- for( ; it!=end; ++it) {
- if ( (*it)->usingSquareDP() ) {
- xVal = kinematics->getmPrime();
- yVal = kinematics->getThetaPrime();
- } else {
- xVal = kinematics->getm13Sq();
- yVal = kinematics->getm23Sq();
- }
- eff *= (*it)->interpolateXY(xVal, yVal);
- }
-
- return eff;
+ // Get the efficiency from the 2D histo.
+ Double_t eff( 1.0 );
+
+ Double_t xVal( 0.0 );
+ Double_t yVal( 0.0 );
+
+ std::vector<Lau2DAbsDP*>::const_iterator it = effHisto_.begin();
+ const std::vector<Lau2DAbsDP*>::const_iterator end = effHisto_.end();
+ for ( ; it != end; ++it ) {
+ if ( ( *it )->usingSquareDP() ) {
+ xVal = kinematics->getmPrime();
+ yVal = kinematics->getThetaPrime();
+ } else {
+ xVal = kinematics->getm13Sq();
+ yVal = kinematics->getm23Sq();
+ }
+ eff *= ( *it )->interpolateXY( xVal, yVal );
+ }
+
+ return eff;
}
Double_t LauEffModel::calcEfficiency( const LauKinematics* kinematics ) const
{
- // Routine to calculate the efficiency for the given event/point in
- // the Dalitz plot. This routine uses the 2D histogram set by the
- // setEffHisto() function.
- Double_t eff(1.0);
-
- // Check for vetoes
- Bool_t vetoOK(kTRUE);
- if ( vetoes_ != 0 ) {
- vetoOK = vetoes_->passVeto(kinematics);
- }
-
- if (vetoOK == kFALSE) {
- // We failed the veto.
- eff = 0.0;
- } else {
- // We are using a 2D histogram representation of the efficiency across the Dalitz plot.
- eff = this->getEffHistValue( kinematics );
- }
-
- // Check that the efficiency is in the allowed range (0-1)
- // If we're using a spline then out-of-range efficiencies can be caused by adjacent bins that all contain a value of either zero or one.
- // The spline requires the efficiency, its first derivatives and the mixed second derivative to be continuous and to match the input histogram
- // at the bin centres. Derivatives are calculated using a finite difference approximation taking the difference between the neighbouring bins.
- // If two bins are zero but the third is not then the second bin will have a positive first derivative causing the spline to dip below zero
- // between the two zero bins to remain smooth. The analogous case with adjacent maximised bins will cause peaks above one. Such dips are
- // unavoidable but are correctly removed here.
- if ( eff < 0.0 ) {
- if(!lowBinWarningIssued_) {
- std::cerr << "WARNING in LauEffModel::calcEfficiency : Efficiency " << eff << " is less than 0 - setting to 0. You may want to check your histogram!" << std::endl
- << " : If you are using a spline then this could be caused by adjacent empty bins. Further warnings will be suppressed." << std::endl;
- lowBinWarningIssued_=kTRUE;
- }
- eff = 0.0;
- } else if ( eff > 1.0 ) {
- if(!highBinWarningIssued_) {
- std::cerr << "WARNING in LauEffModel::calcEfficiency : Efficiency " << eff << " is greater than 1 - setting to 1. You may want to check your histogram!" << std::endl
- << " : If you are using a spline then this could be caused by adjacent full bins. Further warnings will be suppressed." << std::endl;
- highBinWarningIssued_=kTRUE;
- }
- eff = 1.0;
- }
-
- return eff;
+ // Routine to calculate the efficiency for the given event/point in
+ // the Dalitz plot. This routine uses the 2D histogram set by the
+ // setEffHisto() function.
+ Double_t eff( 1.0 );
+
+ // Check for vetoes
+ Bool_t vetoOK( kTRUE );
+ if ( vetoes_ != 0 ) {
+ vetoOK = vetoes_->passVeto( kinematics );
+ }
+
+ if ( vetoOK == kFALSE ) {
+ // We failed the veto.
+ eff = 0.0;
+ } else {
+ // We are using a 2D histogram representation of the efficiency across the Dalitz plot.
+ eff = this->getEffHistValue( kinematics );
+ }
+
+ // Check that the efficiency is in the allowed range (0-1)
+ // If we're using a spline then out-of-range efficiencies can be caused by adjacent bins that all contain a value of either zero or one.
+ // The spline requires the efficiency, its first derivatives and the mixed second derivative to be continuous and to match the input histogram
+ // at the bin centres. Derivatives are calculated using a finite difference approximation taking the difference between the neighbouring bins.
+ // If two bins are zero but the third is not then the second bin will have a positive first derivative causing the spline to dip below zero
+ // between the two zero bins to remain smooth. The analogous case with adjacent maximised bins will cause peaks above one. Such dips are
+ // unavoidable but are correctly removed here.
+ if ( eff < 0.0 ) {
+ if ( ! lowBinWarningIssued_ ) {
+ std::cerr << "WARNING in LauEffModel::calcEfficiency : Efficiency " << eff
+ << " is less than 0 - setting to 0. You may want to check your histogram!"
+ << std::endl
+ << " : If you are using a spline then this could be caused by adjacent empty bins. Further warnings will be suppressed."
+ << std::endl;
+ lowBinWarningIssued_ = kTRUE;
+ }
+ eff = 0.0;
+ } else if ( eff > 1.0 ) {
+ if ( ! highBinWarningIssued_ ) {
+ std::cerr << "WARNING in LauEffModel::calcEfficiency : Efficiency " << eff
+ << " is greater than 1 - setting to 1. You may want to check your histogram!"
+ << std::endl
+ << " : If you are using a spline then this could be caused by adjacent full bins. Further warnings will be suppressed."
+ << std::endl;
+ highBinWarningIssued_ = kTRUE;
+ }
+ eff = 1.0;
+ }
+
+ return eff;
}
Bool_t LauEffModel::passVeto( const LauKinematics* kinematics ) const
{
- Bool_t pass = kTRUE;
- if ( vetoes_ != 0 ) {
- pass = vetoes_->passVeto( kinematics );
- }
- return pass;
+ Bool_t pass = kTRUE;
+ if ( vetoes_ != 0 ) {
+ pass = vetoes_->passVeto( kinematics );
+ }
+ return pass;
}
-
diff --git a/src/LauEmbeddedData.cc b/src/LauEmbeddedData.cc
index 56659a7..45a2f6e 100644
--- a/src/LauEmbeddedData.cc
+++ b/src/LauEmbeddedData.cc
@@ -1,215 +1,221 @@
/*
Copyright 2007 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauEmbeddedData.cc
\brief File containing implementation of LauEmbeddedData class.
*/
#include <iostream>
#include <vector>
using std::cerr;
using std::endl;
-#include "TRandom.h"
-
-#include "LauIsobarDynamics.hh"
#include "LauEmbeddedData.hh"
+#include "LauIsobarDynamics.hh"
#include "LauKinematics.hh"
#include "LauRandom.hh"
+#include "TRandom.h"
-
-LauEmbeddedData::LauEmbeddedData(const TString& fileName, const TString& treeName, Bool_t allowReuseOfEvents) :
- theDataTree_(new LauFitDataTree(fileName,treeName)),
- reuseEvents_(allowReuseOfEvents)
+LauEmbeddedData::LauEmbeddedData( const TString& fileName,
+ const TString& treeName,
+ Bool_t allowReuseOfEvents ) :
+ theDataTree_( new LauFitDataTree( fileName, treeName ) ),
+ reuseEvents_( allowReuseOfEvents )
{
}
LauEmbeddedData::~LauEmbeddedData()
{
- delete theDataTree_;
+ delete theDataTree_;
}
Bool_t LauEmbeddedData::findBranches()
{
- if ( theDataTree_ == 0 ) {
- cerr<<"ERROR in LauEmbeddedData::findBranches : Invalid pointer to the data tree object."<<endl;
- return kFALSE;
- }
+ if ( theDataTree_ == 0 ) {
+ cerr << "ERROR in LauEmbeddedData::findBranches : Invalid pointer to the data tree object."
+ << endl;
+ return kFALSE;
+ }
- Bool_t branchesReadOK = theDataTree_->findBranches();
- if ( ! branchesReadOK ) {
- cerr<<"ERROR in LauEmbeddedData::findBranches : Problem finding branches."<<endl;
- return kFALSE;
- }
+ Bool_t branchesReadOK = theDataTree_->findBranches();
+ if ( ! branchesReadOK ) {
+ cerr << "ERROR in LauEmbeddedData::findBranches : Problem finding branches." << endl;
+ return kFALSE;
+ }
- theDataTree_->readAllData();
+ theDataTree_->readAllData();
- return kTRUE;
+ return kTRUE;
}
-Bool_t LauEmbeddedData::getReweightedEvent(LauIsobarDynamics* dynamics)
+Bool_t LauEmbeddedData::getReweightedEvent( LauIsobarDynamics* dynamics )
{
- if (!theDataTree_) {
- cerr<<"ERROR in LauEmbeddedData::getReweightedEvent : Invalid pointer to the data tree object."<<endl;
- return kFALSE;
- }
-
- if (!dynamics) {
- cerr<<"ERROR in LauEmbeddedData::getReweightedEvent : Amplitude model is null."<<endl;
- return kFALSE;
- }
-
- UInt_t numEvents = this->nEvents();
- UInt_t iEvt(0);
-
- // First select a random event within the embedded data sample
- if (this->reuseEvents()) {
- iEvt = LauRandom::randomFun()->Integer(numEvents);
- } else {
- if (this->nUsedEvents() == numEvents) {
- cerr<<"ERROR in LauEmbeddedData::getReweightedEvent : Have already used all events in the tree."<<endl;
- return kFALSE;
- }
- Bool_t ok(kFALSE);
- while (!ok) {
- iEvt = LauRandom::randomFun()->Integer(numEvents);
- ok = usedEvents_.insert(iEvt).second;
- }
- }
-
- // Retrieve the data for the selected event
- theData_ = theDataTree_->getData(iEvt);
-
- LauKinematics* kinematics = dynamics->getKinematics();
-
- if (kinematics != 0) {
-
- // Get the true m13Sq, m23Sq variables.
- Double_t m13Sq_MC = this->getValue("m13Sq_MC");
- Double_t m23Sq_MC = this->getValue("m23Sq_MC");
-
- if (kinematics->withinDPLimits(m13Sq_MC,m23Sq_MC)) {
-
- // Update the kinematics with the true m13Sq, m23Sq variables
- kinematics->updateKinematics(m13Sq_MC, m23Sq_MC);
-
- // Use this event or not, according to whether the amplitude model selects it.
- // The LauIsobarDynamics uses an accept/reject method based on the
- // ratio of the current to maximum ASq value. Other models may use alternative methods,
- // but they must provide a yes/no answer if the event is accepted.
- Bool_t gotReweightedEvent = dynamics->gotReweightedEvent();
- if (gotReweightedEvent == kTRUE) {
-
- // Event is accepted.
- // Update the kinematics to use the reco variables.
- Double_t m13Sq = this->getValue("m13Sq");
- Double_t m23Sq = this->getValue("m23Sq");
- kinematics->updateKinematics(m13Sq, m23Sq);
-
- if (LauIsobarDynamics::GenOK != dynamics->checkToyMC(kFALSE,kFALSE)) {
- return kFALSE;
- }
-
- } else {
-
- // Recursively run this function until we get an accepted event
- return this->getReweightedEvent(dynamics);
-
- }
-
- } else {
-
- cerr<<"WARNING in LauEmbeddedData::getReweightedEvent : Skipping event "<<iEvt<<", which isn't within the DP boundary."<<endl;
- return this->getReweightedEvent(dynamics);
-
- }
- }
-
- return kTRUE;
+ if ( ! theDataTree_ ) {
+ cerr << "ERROR in LauEmbeddedData::getReweightedEvent : Invalid pointer to the data tree object."
+ << endl;
+ return kFALSE;
+ }
+
+ if ( ! dynamics ) {
+ cerr << "ERROR in LauEmbeddedData::getReweightedEvent : Amplitude model is null." << endl;
+ return kFALSE;
+ }
+
+ UInt_t numEvents = this->nEvents();
+ UInt_t iEvt( 0 );
+
+ // First select a random event within the embedded data sample
+ if ( this->reuseEvents() ) {
+ iEvt = LauRandom::randomFun()->Integer( numEvents );
+ } else {
+ if ( this->nUsedEvents() == numEvents ) {
+ cerr << "ERROR in LauEmbeddedData::getReweightedEvent : Have already used all events in the tree."
+ << endl;
+ return kFALSE;
+ }
+ Bool_t ok( kFALSE );
+ while ( ! ok ) {
+ iEvt = LauRandom::randomFun()->Integer( numEvents );
+ ok = usedEvents_.insert( iEvt ).second;
+ }
+ }
+
+ // Retrieve the data for the selected event
+ theData_ = theDataTree_->getData( iEvt );
+
+ LauKinematics* kinematics = dynamics->getKinematics();
+
+ if ( kinematics != 0 ) {
+
+ // Get the true m13Sq, m23Sq variables.
+ Double_t m13Sq_MC = this->getValue( "m13Sq_MC" );
+ Double_t m23Sq_MC = this->getValue( "m23Sq_MC" );
+
+ if ( kinematics->withinDPLimits( m13Sq_MC, m23Sq_MC ) ) {
+
+ // Update the kinematics with the true m13Sq, m23Sq variables
+ kinematics->updateKinematics( m13Sq_MC, m23Sq_MC );
+
+ // Use this event or not, according to whether the amplitude model selects it.
+ // The LauIsobarDynamics uses an accept/reject method based on the
+ // ratio of the current to maximum ASq value. Other models may use alternative methods,
+ // but they must provide a yes/no answer if the event is accepted.
+ Bool_t gotReweightedEvent = dynamics->gotReweightedEvent();
+ if ( gotReweightedEvent == kTRUE ) {
+
+ // Event is accepted.
+ // Update the kinematics to use the reco variables.
+ Double_t m13Sq = this->getValue( "m13Sq" );
+ Double_t m23Sq = this->getValue( "m23Sq" );
+ kinematics->updateKinematics( m13Sq, m23Sq );
+
+ if ( LauIsobarDynamics::GenOK != dynamics->checkToyMC( kFALSE, kFALSE ) ) {
+ return kFALSE;
+ }
+
+ } else {
+
+ // Recursively run this function until we get an accepted event
+ return this->getReweightedEvent( dynamics );
+ }
+
+ } else {
+
+ cerr << "WARNING in LauEmbeddedData::getReweightedEvent : Skipping event " << iEvt
+ << ", which isn't within the DP boundary." << endl;
+ return this->getReweightedEvent( dynamics );
+ }
+ }
+
+ return kTRUE;
}
-void LauEmbeddedData::getEmbeddedEvent(LauKinematics* kinematics)
+void LauEmbeddedData::getEmbeddedEvent( LauKinematics* kinematics )
{
- if (!theDataTree_) {
- cerr<<"ERROR in LauEmbeddedData::getEmbeddedEvent : Invalid pointer to the data tree object."<<endl;
- return;
- }
- UInt_t numEvents = this->nEvents();
- UInt_t iEvt(0);
- if (this->reuseEvents()) {
- iEvt = LauRandom::randomFun()->Integer(numEvents);
- } else {
- if (this->nUsedEvents() == numEvents) {
- cerr<<"ERROR in LauEmbeddedData::getEmbeddedEvent : Have already used all events in the tree."<<endl;
- return;
- }
- Bool_t ok(kFALSE);
- while (!ok) {
- iEvt = LauRandom::randomFun()->Integer(numEvents);
- ok = usedEvents_.insert(iEvt).second;
- }
- }
- theData_ = theDataTree_->getData(iEvt);
-
- if (kinematics!=0) {
- Double_t m13Sq = this->getValue("m13Sq");
- Double_t m23Sq = this->getValue("m23Sq");
- if (kinematics->withinDPLimits(m13Sq,m23Sq)) {
- kinematics->updateKinematics(m13Sq,m23Sq);
- } else {
- cerr<<"WARNING in LauEmbeddedData::getEmbeddedEvent : Skipping event that isn't within the DP boundary."<<endl;
- this->getEmbeddedEvent(kinematics);
- }
- }
+ if ( ! theDataTree_ ) {
+ cerr << "ERROR in LauEmbeddedData::getEmbeddedEvent : Invalid pointer to the data tree object."
+ << endl;
+ return;
+ }
+ UInt_t numEvents = this->nEvents();
+ UInt_t iEvt( 0 );
+ if ( this->reuseEvents() ) {
+ iEvt = LauRandom::randomFun()->Integer( numEvents );
+ } else {
+ if ( this->nUsedEvents() == numEvents ) {
+ cerr << "ERROR in LauEmbeddedData::getEmbeddedEvent : Have already used all events in the tree."
+ << endl;
+ return;
+ }
+ Bool_t ok( kFALSE );
+ while ( ! ok ) {
+ iEvt = LauRandom::randomFun()->Integer( numEvents );
+ ok = usedEvents_.insert( iEvt ).second;
+ }
+ }
+ theData_ = theDataTree_->getData( iEvt );
+
+ if ( kinematics != 0 ) {
+ Double_t m13Sq = this->getValue( "m13Sq" );
+ Double_t m23Sq = this->getValue( "m23Sq" );
+ if ( kinematics->withinDPLimits( m13Sq, m23Sq ) ) {
+ kinematics->updateKinematics( m13Sq, m23Sq );
+ } else {
+ cerr << "WARNING in LauEmbeddedData::getEmbeddedEvent : Skipping event that isn't within the DP boundary."
+ << endl;
+ this->getEmbeddedEvent( kinematics );
+ }
+ }
}
-Double_t LauEmbeddedData::getValue(const TString& name) const
+Double_t LauEmbeddedData::getValue( const TString& name ) const
{
- LauFitData::const_iterator iter = theData_.find(name);
- if (iter == theData_.end()) {
- cerr<<"ERROR in LauEmbeddedData::getValue : Could not find branch \""<<name<<"\" in embedded event."<<endl;
- return 0.0;
- } else {
- return iter->second;
- }
+ LauFitData::const_iterator iter = theData_.find( name );
+ if ( iter == theData_.end() ) {
+ cerr << "ERROR in LauEmbeddedData::getValue : Could not find branch \"" << name
+ << "\" in embedded event." << endl;
+ return 0.0;
+ } else {
+ return iter->second;
+ }
}
-LauFitData LauEmbeddedData::getValues(const std::vector<TString>& names) const
+LauFitData LauEmbeddedData::getValues( const std::vector<TString>& names ) const
{
- LauFitData retVal;
-
- for ( std::vector<TString>::const_iterator iter = names.begin(); iter != names.end(); ++iter ) {
- const TString& name = (*iter);
- LauFitData::const_iterator data_iter = theData_.find(name);
- if ( data_iter == theData_.end() ) {
- cerr<<"WARNING in LauEmbeddedData::getValues : Could not find branch \""<<name<<"\" in embedded event."<<endl;
- } else {
- retVal.insert( *data_iter );
- }
- }
-
- return retVal;
+ LauFitData retVal;
+
+ for ( std::vector<TString>::const_iterator iter = names.begin(); iter != names.end(); ++iter ) {
+ const TString& name = ( *iter );
+ LauFitData::const_iterator data_iter = theData_.find( name );
+ if ( data_iter == theData_.end() ) {
+ cerr << "WARNING in LauEmbeddedData::getValues : Could not find branch \"" << name
+ << "\" in embedded event." << endl;
+ } else {
+ retVal.insert( *data_iter );
+ }
+ }
+
+ return retVal;
}
-
diff --git a/src/LauExponentialPdf.cc b/src/LauExponentialPdf.cc
index 414c513..edd63fc 100644
--- a/src/LauExponentialPdf.cc
+++ b/src/LauExponentialPdf.cc
@@ -1,138 +1,139 @@
/*
Copyright 2011 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauExponentialPdf.cc
\brief File containing implementation of LauExponentialPdf class.
*/
#include <iostream>
#include <vector>
-using std::cout;
using std::cerr;
+using std::cout;
using std::endl;
-#include "TMath.h"
-#include "TSystem.h"
-
#include "LauConstants.hh"
#include "LauExponentialPdf.hh"
+#include "TMath.h"
+#include "TSystem.h"
-
-LauExponentialPdf::LauExponentialPdf(const TString& theVarName, const std::vector<LauAbsRValue*>& params, Double_t minAbscissa, Double_t maxAbscissa) :
- LauAbsPdf(theVarName, params, minAbscissa, maxAbscissa),
- slope_(0)
+LauExponentialPdf::LauExponentialPdf( const TString& theVarName,
+ const std::vector<LauAbsRValue*>& params,
+ Double_t minAbscissa,
+ Double_t maxAbscissa ) :
+ LauAbsPdf( theVarName, params, minAbscissa, maxAbscissa ),
+ slope_( 0 )
{
- // Constructor for the Exponential PDF.
- //
- // The parameter in param is the slope of the exponential ie exp(slope*x).
- // The last two arguments specify the range in which the PDF is defined, and the PDF
- // will be normalised w.r.t. these limits.
-
- slope_ = this->findParameter("slope");
-
- if ((this->nParameters() != 1) || (slope_ == 0)) {
- cerr<<"ERROR in LauExponentialPdf constructor: LauExponentialPdf requires 1 parameter: \"slope\"."<<endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // Cache the normalisation factor
- this->calcNorm();
+ // Constructor for the Exponential PDF.
+ //
+ // The parameter in param is the slope of the exponential ie exp(slope*x).
+ // The last two arguments specify the range in which the PDF is defined, and the PDF
+ // will be normalised w.r.t. these limits.
+
+ slope_ = this->findParameter( "slope" );
+
+ if ( ( this->nParameters() != 1 ) || ( slope_ == 0 ) ) {
+ cerr << "ERROR in LauExponentialPdf constructor: LauExponentialPdf requires 1 parameter: \"slope\"."
+ << endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // Cache the normalisation factor
+ this->calcNorm();
}
-LauExponentialPdf::~LauExponentialPdf()
+LauExponentialPdf::~LauExponentialPdf()
{
- // Destructor
+ // Destructor
}
-void LauExponentialPdf::calcLikelihoodInfo(const LauAbscissas& abscissas)
+void LauExponentialPdf::calcLikelihoodInfo( const LauAbscissas& abscissas )
{
- // Check that the given abscissa is within the allowed range
- if (!this->checkRange(abscissas)) {
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // Get our abscissa
- Double_t abscissa = abscissas[0];
+ // Check that the given abscissa is within the allowed range
+ if ( ! this->checkRange( abscissas ) ) {
+ gSystem->Exit( EXIT_FAILURE );
+ }
- // Get the up to date parameter values
- Double_t slope = slope_->unblindValue();
+ // Get our abscissa
+ Double_t abscissa = abscissas[0];
- // Calculate the value of the Exponential for the given value of the abscissa.
+ // Get the up to date parameter values
+ Double_t slope = slope_->unblindValue();
- Double_t exponent(0.0);
- if(slope != 0){
- exponent = slope*abscissa;
- }
+ // Calculate the value of the Exponential for the given value of the abscissa.
- Double_t value = TMath::Exp(exponent);
- this->setUnNormPDFVal(value);
+ Double_t exponent( 0.0 );
+ if ( slope != 0 ) {
+ exponent = slope * abscissa;
+ }
- // if the parameters are floating then we
- // need to recalculate the normalisation
- if (!this->cachePDF() && !this->withinNormCalc() && !this->withinGeneration()) {
- this->calcNorm();
- }
+ Double_t value = TMath::Exp( exponent );
+ this->setUnNormPDFVal( value );
+ // if the parameters are floating then we
+ // need to recalculate the normalisation
+ if ( ! this->cachePDF() && ! this->withinNormCalc() && ! this->withinGeneration() ) {
+ this->calcNorm();
+ }
}
-void LauExponentialPdf::calcNorm()
+void LauExponentialPdf::calcNorm()
{
- // Get the up to date parameter values
- Double_t slope = slope_->unblindValue();
+ // Get the up to date parameter values
+ Double_t slope = slope_->unblindValue();
- // Calculate the normalisation of the exponential and cache it.
- Double_t norm(0.0);
+ // Calculate the normalisation of the exponential and cache it.
+ Double_t norm( 0.0 );
- if(slope != 0){
- norm = (1/slope)*(TMath::Exp(slope*this->getMaxAbscissa()) - TMath::Exp(slope*this->getMinAbscissa())) ;
- }
+ if ( slope != 0 ) {
+ norm = ( 1 / slope ) * ( TMath::Exp( slope * this->getMaxAbscissa() ) -
+ TMath::Exp( slope * this->getMinAbscissa() ) );
+ }
- this->setNorm(norm);
+ this->setNorm( norm );
}
-void LauExponentialPdf::calcPDFHeight(const LauKinematics* /*kinematics*/)
+void LauExponentialPdf::calcPDFHeight( const LauKinematics* /*kinematics*/ )
{
- if (this->heightUpToDate()) {
- return;
- }
-
- // Get the up to date parameter values
- Double_t slope = slope_->unblindValue();
-
- LauAbscissas maxPoint(1);
- maxPoint[0] = 0;
-
- // Calculate the PDF height for the Exponential function.
- if (slope > 0) {
- maxPoint[0] = this->getMaxAbscissa();
- } else if (slope < 0) {
- maxPoint[0] = this->getMinAbscissa();
- }
- this->calcLikelihoodInfo(maxPoint);
-
- Double_t height = this->getUnNormLikelihood();
- this->setMaxHeight(height);
+ if ( this->heightUpToDate() ) {
+ return;
+ }
+
+ // Get the up to date parameter values
+ Double_t slope = slope_->unblindValue();
+
+ LauAbscissas maxPoint( 1 );
+ maxPoint[0] = 0;
+
+ // Calculate the PDF height for the Exponential function.
+ if ( slope > 0 ) {
+ maxPoint[0] = this->getMaxAbscissa();
+ } else if ( slope < 0 ) {
+ maxPoint[0] = this->getMinAbscissa();
+ }
+ this->calcLikelihoodInfo( maxPoint );
+
+ Double_t height = this->getUnNormLikelihood();
+ this->setMaxHeight( height );
}
-
diff --git a/src/LauFitDataTree.cc b/src/LauFitDataTree.cc
index efc01ae..61d9db7 100644
--- a/src/LauFitDataTree.cc
+++ b/src/LauFitDataTree.cc
@@ -1,387 +1,419 @@
/*
Copyright 2004 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauFitDataTree.cc
\brief File containing implementation of LauFitDataTree class.
*/
-#include <cmath>
-#include <cstdlib>
-#include <iostream>
+#include "LauFitDataTree.hh"
#include "TFile.h"
#include "TLeaf.h"
#include "TString.h"
#include "TSystem.h"
-#include "LauFitDataTree.hh"
-
-
+#include <cmath>
+#include <cstdlib>
+#include <iostream>
-LauFitDataTree::LauFitDataTree(const TString& rootFileName, const TString& rootTreeName) :
- rootFileName_(rootFileName),
- rootTreeName_(rootTreeName),
- rootFile_(0),
- rootTree_(0),
- eventList_(0)
+LauFitDataTree::LauFitDataTree( const TString& rootFileName, const TString& rootTreeName ) :
+ rootFileName_( rootFileName ),
+ rootTreeName_( rootTreeName ),
+ rootFile_( 0 ),
+ rootTree_( 0 ),
+ eventList_( 0 )
{
- if (rootFileName_ != "" && rootTreeName_ != "") {
- this->openFileAndTree();
- }
+ if ( rootFileName_ != "" && rootTreeName_ != "" ) {
+ this->openFileAndTree();
+ }
}
LauFitDataTree::~LauFitDataTree()
{
- if (rootFile_ && rootFile_->IsOpen()) {
- delete rootTree_; rootTree_ = 0;
- delete eventList_; eventList_ = 0;
- }
- delete rootFile_; rootFile_ = 0;
+ if ( rootFile_ && rootFile_->IsOpen() ) {
+ delete rootTree_;
+ rootTree_ = 0;
+ delete eventList_;
+ eventList_ = 0;
+ }
+ delete rootFile_;
+ rootFile_ = 0;
}
void LauFitDataTree::openFileAndTree()
{
- // first check whether we've already opened up the file or not
- if (!rootFile_) {
- // if not, first check the filename and if all ok create the file
- if (rootFileName_ == "") {
- std::cerr << "ERROR in LauFitDataTree::openFileAndTree : Bad filename supplied, not creating file or tree." << std::endl;
- return;
- }
- rootFile_ = TFile::Open(rootFileName_, "read");
- if (!rootFile_ || rootFile_->IsZombie() || !rootFile_->IsOpen()) {
- std::cerr << "ERROR in LauFitDataTree::openFileAndTree : Problem opening file \"" << rootFileName_ << "\" for reading." << std::endl;
- return;
- }
- }
- // check whether we've already created the tree
- if (!rootTree_) {
- // if not change to the file's directory and grab the tree
- rootFile_->cd();
- rootTree_ = dynamic_cast<TTree*>(rootFile_->Get(rootTreeName_));
- if (!rootTree_) {
- std::cerr << "ERROR in LauFitDataTree::openFileAndTree : Problem reading tree \"" << rootTreeName_ << "\" from file." << std::endl;
- return;
- }
- rootTree_->SetDirectory(rootFile_);
- }
+ // first check whether we've already opened up the file or not
+ if ( ! rootFile_ ) {
+ // if not, first check the filename and if all ok create the file
+ if ( rootFileName_ == "" ) {
+ std::cerr << "ERROR in LauFitDataTree::openFileAndTree : Bad filename supplied, not creating file or tree."
+ << std::endl;
+ return;
+ }
+ rootFile_ = TFile::Open( rootFileName_, "read" );
+ if ( ! rootFile_ || rootFile_->IsZombie() || ! rootFile_->IsOpen() ) {
+ std::cerr << "ERROR in LauFitDataTree::openFileAndTree : Problem opening file \""
+ << rootFileName_ << "\" for reading." << std::endl;
+ return;
+ }
+ }
+ // check whether we've already created the tree
+ if ( ! rootTree_ ) {
+ // if not change to the file's directory and grab the tree
+ rootFile_->cd();
+ rootTree_ = dynamic_cast<TTree*>( rootFile_->Get( rootTreeName_ ) );
+ if ( ! rootTree_ ) {
+ std::cerr << "ERROR in LauFitDataTree::openFileAndTree : Problem reading tree \""
+ << rootTreeName_ << "\" from file." << std::endl;
+ return;
+ }
+ rootTree_->SetDirectory( rootFile_ );
+ }
}
Bool_t LauFitDataTree::findBranches()
{
- if (!rootTree_) {
- std::cerr << "ERROR in LauFitDataTree::findBranches : Invalid pointer to data tree." << std::endl;
- return kFALSE;
- }
-
- // this method should only be called once
- if ( ! leafNames_.empty() ) {
- std::cerr << "ERROR in LauFitDataTree::findBranches : Branches already found, not running again." << std::endl;
- return kFALSE;
- }
-
- leafNames_.clear();
- eventData_.clear();
- eventDataOut_.clear();
- leaves_.clear();
- treeEvents_.clear();
- fakeEvents_.clear();
-
- const UInt_t numBranches(this->nBranches());
- eventData_.reserve( numBranches );
-
- TObjArray* pLeaves = rootTree_->GetListOfLeaves();
- if (!pLeaves) {
- std::cerr << "ERROR in LauFitDataTree::findBranches : Problem retrieving leaves from the tree." << std::endl;
- return kFALSE;
- }
- TObjArray& leaves = *pLeaves;
-
- const UInt_t numLeaves = static_cast<UInt_t>( leaves.GetEntries() );
- if ( numBranches != numLeaves ) {
- std::cerr << "ERROR in LauFitDataTree::findBranches : List of leaves is not the same size as the number of branches - this is strange!" << std::endl;
- std::cerr << " : There are " << numLeaves << " leaves and " << numBranches << " branches" << std::endl;
- return kFALSE;
- }
-
- for (UInt_t iLeaf = 0; iLeaf < numBranches; ++iLeaf) {
-
- TLeaf * leaf = dynamic_cast<TLeaf*>(leaves[iLeaf]);
-
- // we can't deal with arrays
- Int_t size = leaf->GetNdata();
- if (size != 1) {
- std::cerr << "ERROR in LauFitDataTree::findBranches : Tree has array branches, can't deal with those." << std::endl;
- return kFALSE;
- }
-
- // find the name and type of the leaf
- TString name = leaf->GetName();
-
- // initialise an entry in the maps to hold the value
- leafNames_[ name ] = iLeaf;
- leaves_.push_back( leaf );
- eventData_.push_back( 0.0 );
- eventDataOut_[ name ] = 0.0;
- }
-
- const UInt_t numEvents(this->nTotalEvents());
-
- std::cout << "INFO in LauFitDataTree::findBranches : Finished finding data tree branches." << std::endl;
- std::cout << " : Tree contains " << numBranches << " branches and a total of " << numEvents << " events." << std::endl;
-
- return kTRUE;
+ if ( ! rootTree_ ) {
+ std::cerr << "ERROR in LauFitDataTree::findBranches : Invalid pointer to data tree."
+ << std::endl;
+ return kFALSE;
+ }
+
+ // this method should only be called once
+ if ( ! leafNames_.empty() ) {
+ std::cerr << "ERROR in LauFitDataTree::findBranches : Branches already found, not running again."
+ << std::endl;
+ return kFALSE;
+ }
+
+ leafNames_.clear();
+ eventData_.clear();
+ eventDataOut_.clear();
+ leaves_.clear();
+ treeEvents_.clear();
+ fakeEvents_.clear();
+
+ const UInt_t numBranches( this->nBranches() );
+ eventData_.reserve( numBranches );
+
+ TObjArray* pLeaves = rootTree_->GetListOfLeaves();
+ if ( ! pLeaves ) {
+ std::cerr << "ERROR in LauFitDataTree::findBranches : Problem retrieving leaves from the tree."
+ << std::endl;
+ return kFALSE;
+ }
+ TObjArray& leaves = *pLeaves;
+
+ const UInt_t numLeaves = static_cast<UInt_t>( leaves.GetEntries() );
+ if ( numBranches != numLeaves ) {
+ std::cerr << "ERROR in LauFitDataTree::findBranches : List of leaves is not the same size as the number of branches - this is strange!"
+ << std::endl;
+ std::cerr << " : There are " << numLeaves
+ << " leaves and " << numBranches << " branches" << std::endl;
+ return kFALSE;
+ }
+
+ for ( UInt_t iLeaf = 0; iLeaf < numBranches; ++iLeaf ) {
+
+ TLeaf* leaf = dynamic_cast<TLeaf*>( leaves[iLeaf] );
+
+ // we can't deal with arrays
+ Int_t size = leaf->GetNdata();
+ if ( size != 1 ) {
+ std::cerr << "ERROR in LauFitDataTree::findBranches : Tree has array branches, can't deal with those."
+ << std::endl;
+ return kFALSE;
+ }
+
+ // find the name and type of the leaf
+ TString name = leaf->GetName();
+
+ // initialise an entry in the maps to hold the value
+ leafNames_[name] = iLeaf;
+ leaves_.push_back( leaf );
+ eventData_.push_back( 0.0 );
+ eventDataOut_[name] = 0.0;
+ }
+
+ const UInt_t numEvents( this->nTotalEvents() );
+
+ std::cout << "INFO in LauFitDataTree::findBranches : Finished finding data tree branches."
+ << std::endl;
+ std::cout << " : Tree contains " << numBranches
+ << " branches and a total of " << numEvents << " events." << std::endl;
+
+ return kTRUE;
}
-void LauFitDataTree::readExperimentData(UInt_t iExpt)
+void LauFitDataTree::readExperimentData( UInt_t iExpt )
{
- // Check that we have a valid tree to read from
- if (!rootTree_) {
- std::cerr << "ERROR in LauFitDataTree::readExperimentData : Invalid pointer to data tree." << std::endl;
- return;
- }
-
- rootFile_->cd();
-
- // If the event list doesn't exist, create it
- if (!eventList_) {
- eventList_ = new TEventList("elist","elist");
- eventList_->SetDirectory(rootFile_);
- }
-
- // Reset the event list so it contains no entries
- eventList_->Reset();
-
- // Check that the tree contains the iExpt branch
- if (!this->haveBranch("iExpt")) {
- // If it doesn't, check which experiment we've been asked to read
- if ( iExpt == 0 ) {
- // If it's experiment 0, assume that we should read all events in the tree (but print a warning since this is an assumption)
- std::cerr << "WARNING in LauFitDataTree::readExperimentData : Tree does not contain \"iExpt\" branch, will read all data in the tree" << std::endl;
- this->readAllData();
- return;
- } else {
- // Otherwise we can't really do anything, so print an error and return
- std::cerr << "ERROR in LauFitDataTree::readExperimentData : Tree does not contain \"iExpt\" branch and experiment requested is > 0, will not read anything" << std::endl;
- return;
- }
- }
-
- // Fill the event list with the entries for the requested experiment
- TString listName(eventList_->GetName());
- listName.Prepend(">>");
- TString selection("iExpt==");
- selection += iExpt;
-
- std::cout << "INFO in LauFitDataTree::readExperimentData : Setting tree to experiment number " << iExpt << "." << std::endl;
- rootTree_->Draw(listName,selection);
- std::cout << " : Found " << this->nEvents() << " events." << std::endl;
-
- // Load the data
- this->loadData();
+ // Check that we have a valid tree to read from
+ if ( ! rootTree_ ) {
+ std::cerr << "ERROR in LauFitDataTree::readExperimentData : Invalid pointer to data tree."
+ << std::endl;
+ return;
+ }
+
+ rootFile_->cd();
+
+ // If the event list doesn't exist, create it
+ if ( ! eventList_ ) {
+ eventList_ = new TEventList( "elist", "elist" );
+ eventList_->SetDirectory( rootFile_ );
+ }
+
+ // Reset the event list so it contains no entries
+ eventList_->Reset();
+
+ // Check that the tree contains the iExpt branch
+ if ( ! this->haveBranch( "iExpt" ) ) {
+ // If it doesn't, check which experiment we've been asked to read
+ if ( iExpt == 0 ) {
+ // If it's experiment 0, assume that we should read all events in the tree (but print a warning since this is an assumption)
+ std::cerr << "WARNING in LauFitDataTree::readExperimentData : Tree does not contain \"iExpt\" branch, will read all data in the tree"
+ << std::endl;
+ this->readAllData();
+ return;
+ } else {
+ // Otherwise we can't really do anything, so print an error and return
+ std::cerr << "ERROR in LauFitDataTree::readExperimentData : Tree does not contain \"iExpt\" branch and experiment requested is > 0, will not read anything"
+ << std::endl;
+ return;
+ }
+ }
+
+ // Fill the event list with the entries for the requested experiment
+ TString listName( eventList_->GetName() );
+ listName.Prepend( ">>" );
+ TString selection( "iExpt==" );
+ selection += iExpt;
+
+ std::cout << "INFO in LauFitDataTree::readExperimentData : Setting tree to experiment number "
+ << iExpt << "." << std::endl;
+ rootTree_->Draw( listName, selection );
+ std::cout << " : Found " << this->nEvents()
+ << " events." << std::endl;
+
+ // Load the data
+ this->loadData();
}
UInt_t LauFitDataTree::nBranches() const
{
- if ( rootTree_ ) {
- return static_cast<UInt_t>(rootTree_->GetNbranches());
- } else if ( ! fakeEvents_.empty() ) {
- std::vector<LauEventData>::const_iterator fakeIter = fakeEvents_.begin();
- return (*fakeIter).size();
- } else {
- return 0;
- }
+ if ( rootTree_ ) {
+ return static_cast<UInt_t>( rootTree_->GetNbranches() );
+ } else if ( ! fakeEvents_.empty() ) {
+ std::vector<LauEventData>::const_iterator fakeIter = fakeEvents_.begin();
+ return ( *fakeIter ).size();
+ } else {
+ return 0;
+ }
}
-void LauFitDataTree::appendFakePoints( const std::vector<Double_t>& xCoords, const std::vector<Double_t>& yCoords)
+void LauFitDataTree::appendFakePoints( const std::vector<Double_t>& xCoords,
+ const std::vector<Double_t>& yCoords )
{
- if ( xCoords.size() != yCoords.size() ) {
- std::cerr << "ERROR in LauFitDataTree::appendFakePoints : The co-ordinate vectors are not the same size!" << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // clear the list of fake events and reserve enough space
- fakeEvents_.clear();
- fakeEvents_.reserve(xCoords.size());
-
- // loop over the event data zeroing everything
- for (LauEventData::iterator iter = eventData_.begin(); iter != eventData_.end(); ++iter) {
- *iter = 0.0;
- }
-
- // find the vector indices for the DP co-ordinates
- LauNameIndexMap::const_iterator iter = leafNames_.find( "m13Sq" );
- if ( iter == leafNames_.end() ) {
- std::cerr << "ERROR in LauFitDataTree::appendFakePoints : Can't find entry \"m13Sq\" in event data map." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- UInt_t m13SqIdx = iter->second;
-
- iter = leafNames_.find( "m23Sq" );
- if ( iter == leafNames_.end() ) {
- std::cerr << "ERROR in LauFitDataTree::appendFakePoints : Can't find entry \"m23Sq\" in event data map." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- UInt_t m23SqIdx = iter->second;
-
- // TODO - is this really needed? Comment out for now.
- /*
- // and a fake tagCat which we don't care about, but the program
- // needs a number here for comptibility with conventional events.
- iter = leafNames_.find( "tagCat" );
- if ( iter == leafNames_.end() ) {
- std::cerr << "ERROR in LauFitDataTree::appendFakePoints : Can't find entry \"tagCat\" in event data map." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- UInt_t tagCatIdx = iter->second;
- */
-
- for (UInt_t iEvt = 0; iEvt < xCoords.size() ; ++iEvt) {
-
- // set the values
- eventData_[ m13SqIdx ] = xCoords[iEvt];
- eventData_[ m23SqIdx ] = yCoords[iEvt];
- //eventData_[ tagCatIdx ] = 0.0;
-
- // append to the list of fake events
- fakeEvents_.push_back(eventData_);
- }
+ if ( xCoords.size() != yCoords.size() ) {
+ std::cerr << "ERROR in LauFitDataTree::appendFakePoints : The co-ordinate vectors are not the same size!"
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // clear the list of fake events and reserve enough space
+ fakeEvents_.clear();
+ fakeEvents_.reserve( xCoords.size() );
+
+ // loop over the event data zeroing everything
+ for ( LauEventData::iterator iter = eventData_.begin(); iter != eventData_.end(); ++iter ) {
+ *iter = 0.0;
+ }
+
+ // find the vector indices for the DP co-ordinates
+ LauNameIndexMap::const_iterator iter = leafNames_.find( "m13Sq" );
+ if ( iter == leafNames_.end() ) {
+ std::cerr << "ERROR in LauFitDataTree::appendFakePoints : Can't find entry \"m13Sq\" in event data map."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ UInt_t m13SqIdx = iter->second;
+
+ iter = leafNames_.find( "m23Sq" );
+ if ( iter == leafNames_.end() ) {
+ std::cerr << "ERROR in LauFitDataTree::appendFakePoints : Can't find entry \"m23Sq\" in event data map."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ UInt_t m23SqIdx = iter->second;
+
+ // TODO - is this really needed? Comment out for now.
+ /*
+ // and a fake tagCat which we don't care about, but the program
+ // needs a number here for comptibility with conventional events.
+ iter = leafNames_.find( "tagCat" );
+ if ( iter == leafNames_.end() ) {
+ std::cerr << "ERROR in LauFitDataTree::appendFakePoints : Can't find entry \"tagCat\" in event data map." << std::endl;
+ gSystem->Exit(EXIT_FAILURE);
+ }
+ UInt_t tagCatIdx = iter->second;
+ */
+
+ for ( UInt_t iEvt = 0; iEvt < xCoords.size(); ++iEvt ) {
+
+ // set the values
+ eventData_[m13SqIdx] = xCoords[iEvt];
+ eventData_[m23SqIdx] = yCoords[iEvt];
+ //eventData_[ tagCatIdx ] = 0.0;
+
+ // append to the list of fake events
+ fakeEvents_.push_back( eventData_ );
+ }
}
-Bool_t LauFitDataTree::haveBranch(const TString& name) const
+Bool_t LauFitDataTree::haveBranch( const TString& name ) const
{
- LauNameIndexMap::const_iterator iter = leafNames_.find( name );
- return (iter != leafNames_.end());
+ LauNameIndexMap::const_iterator iter = leafNames_.find( name );
+ return ( iter != leafNames_.end() );
}
void LauFitDataTree::disableAllBranches() const
{
- rootTree_->SetBranchStatus("*", 0);
+ rootTree_->SetBranchStatus( "*", 0 );
}
void LauFitDataTree::enableAllBranches() const
{
- rootTree_->SetBranchStatus("*", 1);
+ rootTree_->SetBranchStatus( "*", 1 );
}
-void LauFitDataTree::enableBranch(const TString& name) const
+void LauFitDataTree::enableBranch( const TString& name ) const
{
- if (this->haveBranch(name)) {rootTree_->SetBranchStatus(name, 1);}
+ if ( this->haveBranch( name ) ) {
+ rootTree_->SetBranchStatus( name, 1 );
+ }
}
-void LauFitDataTree::disableBranch(const TString& name) const
+void LauFitDataTree::disableBranch( const TString& name ) const
{
- if (this->haveBranch(name)) {rootTree_->SetBranchStatus(name, 0);}
+ if ( this->haveBranch( name ) ) {
+ rootTree_->SetBranchStatus( name, 0 );
+ }
}
void LauFitDataTree::loadData()
{
- // Clear any data from previous expts
- treeEvents_.clear();
+ // Clear any data from previous expts
+ treeEvents_.clear();
- // Reserve enough space in the vector
- Long64_t nEvts = this->nEvents();
- treeEvents_.reserve( nEvts );
+ // Reserve enough space in the vector
+ Long64_t nEvts = this->nEvents();
+ treeEvents_.reserve( nEvts );
- const UInt_t nLeaves = this->nBranches();
+ const UInt_t nLeaves = this->nBranches();
- // Loop through the tree and store the data
- for ( Long64_t iEvt(0); iEvt < nEvts; ++iEvt ) {
+ // Loop through the tree and store the data
+ for ( Long64_t iEvt( 0 ); iEvt < nEvts; ++iEvt ) {
- // Find which entry from the full tree contains the requested event
- Long64_t iEntry = eventList_ ? eventList_->GetEntry(iEvt) : iEvt;
- if (iEntry<0) { // this shouldn't happen, but just in case...
- std::cerr << "ERROR in LauFitDataTree::loadData : Requested event not found." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
+ // Find which entry from the full tree contains the requested event
+ Long64_t iEntry = eventList_ ? eventList_->GetEntry( iEvt ) : iEvt;
+ if ( iEntry < 0 ) { // this shouldn't happen, but just in case...
+ std::cerr << "ERROR in LauFitDataTree::loadData : Requested event not found."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
- // Then retrieve that entry from the tree
- rootTree_->GetEntry(iEntry);
+ // Then retrieve that entry from the tree
+ rootTree_->GetEntry( iEntry );
- // Copy the leaf values into eventData_
- for ( UInt_t iLeaf(0); iLeaf < nLeaves; ++iLeaf ) {
+ // Copy the leaf values into eventData_
+ for ( UInt_t iLeaf( 0 ); iLeaf < nLeaves; ++iLeaf ) {
- const TLeaf * leaf = leaves_[ iLeaf ];
+ const TLeaf* leaf = leaves_[iLeaf];
- Double_t value = leaf->GetValue();
- if ( std::isnan( value ) || std::isinf( value ) ) {
- std::cerr << "ERROR in LauFitDataTree::loadData : Event " << iEvt << " has infinite or NaN entry for variable " << leaf->GetName() << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
+ Double_t value = leaf->GetValue();
+ if ( std::isnan( value ) || std::isinf( value ) ) {
+ std::cerr << "ERROR in LauFitDataTree::loadData : Event " << iEvt
+ << " has infinite or NaN entry for variable " << leaf->GetName()
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
- eventData_[ iLeaf ] = value;
- }
+ eventData_[iLeaf] = value;
+ }
- // Store the event in the vector
- treeEvents_.push_back( eventData_ );
- }
+ // Store the event in the vector
+ treeEvents_.push_back( eventData_ );
+ }
}
void LauFitDataTree::readAllData()
{
- delete eventList_; eventList_ = 0;
- this->loadData();
+ delete eventList_;
+ eventList_ = 0;
+ this->loadData();
}
-const LauFitData& LauFitDataTree::getData(UInt_t iEvt) const
+const LauFitData& LauFitDataTree::getData( UInt_t iEvt ) const
{
- // For a given event, within the current experiment,
- // retrieve the input fit variables
-
- const UInt_t numTreeEvents = this->nEvents();
- const UInt_t numFakeEvents = this->nFakeEvents();
-
- // Does the requested event come from the tree or from the fake events list?
- if ( iEvt < numTreeEvents ) {
- if ( iEvt > treeEvents_.size() ) { // this shouldn't happen, but just in case...
- std::cerr << "ERROR in LauFitDataTree::getData : Requested event, " << iEvt << ", not found." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- // Retrieve that event from the vector
- eventData_ = treeEvents_[iEvt];
- } else if ( iEvt < (numTreeEvents + numFakeEvents) ) {
- // Find the entry from the fake events list contains the requested event
- UInt_t iEntry = iEvt - numTreeEvents;
- // Copy the entry into eventData_
- eventData_ = fakeEvents_[iEntry];
- } else {
- std::cerr << "ERROR in LauFitDataTree::getData : Requested event " << iEvt << " not found for " << rootTreeName_ << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- for ( LauNameIndexMap::const_iterator iter = leafNames_.begin(); iter != leafNames_.end(); ++iter ) {
- const TString& name = iter->first;
- UInt_t index = iter->second;
-
- LauFitData::iterator outIter = eventDataOut_.find( name );
- if ( outIter == eventDataOut_.end() ) {
- std::cerr << "ERROR in LauFitDataTree::getData : Something very strange happening." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- outIter->second = eventData_[ index ];
- }
- return eventDataOut_;
+ // For a given event, within the current experiment,
+ // retrieve the input fit variables
+
+ const UInt_t numTreeEvents = this->nEvents();
+ const UInt_t numFakeEvents = this->nFakeEvents();
+
+ // Does the requested event come from the tree or from the fake events list?
+ if ( iEvt < numTreeEvents ) {
+ if ( iEvt > treeEvents_.size() ) { // this shouldn't happen, but just in case...
+ std::cerr << "ERROR in LauFitDataTree::getData : Requested event, " << iEvt
+ << ", not found." << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ // Retrieve that event from the vector
+ eventData_ = treeEvents_[iEvt];
+ } else if ( iEvt < ( numTreeEvents + numFakeEvents ) ) {
+ // Find the entry from the fake events list contains the requested event
+ UInt_t iEntry = iEvt - numTreeEvents;
+ // Copy the entry into eventData_
+ eventData_ = fakeEvents_[iEntry];
+ } else {
+ std::cerr << "ERROR in LauFitDataTree::getData : Requested event " << iEvt
+ << " not found for " << rootTreeName_ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ for ( LauNameIndexMap::const_iterator iter = leafNames_.begin(); iter != leafNames_.end();
+ ++iter ) {
+ const TString& name = iter->first;
+ UInt_t index = iter->second;
+
+ LauFitData::iterator outIter = eventDataOut_.find( name );
+ if ( outIter == eventDataOut_.end() ) {
+ std::cerr << "ERROR in LauFitDataTree::getData : Something very strange happening."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ outIter->second = eventData_[index];
+ }
+ return eventDataOut_;
}
-
diff --git a/src/LauFitNtuple.cc b/src/LauFitNtuple.cc
index 747b9cf..d941292 100644
--- a/src/LauFitNtuple.cc
+++ b/src/LauFitNtuple.cc
@@ -1,349 +1,402 @@
/*
Copyright 2004 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauFitNtuple.cc
\brief File containing implementation of LauFitNtuple class.
*/
-#include <iostream>
+#include "LauFitNtuple.hh"
+
+#include "LauAbsFitter.hh"
+#include "LauFitter.hh"
+#include "LauParamFixed.hh"
+#include "LauParameter.hh"
#include "TFile.h"
#include "TMath.h"
#include "TMatrixD.h"
#include "TSystem.h"
#include "TTree.h"
-#include "LauAbsFitter.hh"
-#include "LauFitNtuple.hh"
-#include "LauFitter.hh"
-#include "LauParameter.hh"
-#include "LauParamFixed.hh"
-
-
+#include <iostream>
-LauFitNtuple::LauFitNtuple(const TString& fileName, Bool_t storeAsymErrors) :
- rootFileName_(fileName),
- rootFile_(0),
- fitResults_(0),
- definedFitTree_(kFALSE),
- storeAsymErrors_(storeAsymErrors),
- fitStatus_({-1,0.0,0.0}),
- nFitPars_(0),
- nFreePars_(0),
- nExtraPars_(0),
- iExpt_(0)
+LauFitNtuple::LauFitNtuple( const TString& fileName, Bool_t storeAsymErrors ) :
+ rootFileName_( fileName ),
+ rootFile_( 0 ),
+ fitResults_( 0 ),
+ definedFitTree_( kFALSE ),
+ storeAsymErrors_( storeAsymErrors ),
+ fitStatus_( { -1, 0.0, 0.0 } ),
+ nFitPars_( 0 ),
+ nFreePars_( 0 ),
+ nExtraPars_( 0 ),
+ iExpt_( 0 )
{
- rootFile_ = TFile::Open(rootFileName_, "recreate");
- rootFile_->cd();
- fitResults_ = new TTree("fitResults", "fitResults");
- fitResults_->SetDirectory(rootFile_);
-
- fitVars_.clear(); constrainedVars_.clear(); extraVars_.clear();
+ rootFile_ = TFile::Open( rootFileName_, "recreate" );
+ rootFile_->cd();
+ fitResults_ = new TTree( "fitResults", "fitResults" );
+ fitResults_->SetDirectory( rootFile_ );
+
+ fitVars_.clear();
+ constrainedVars_.clear();
+ extraVars_.clear();
}
LauFitNtuple::~LauFitNtuple()
{
- if (rootFile_ && rootFile_->IsOpen()) {
- delete fitResults_; fitResults_ = 0;
- }
- delete rootFile_; rootFile_ = 0;
+ if ( rootFile_ && rootFile_->IsOpen() ) {
+ delete fitResults_;
+ fitResults_ = 0;
+ }
+ delete rootFile_;
+ rootFile_ = 0;
}
-void LauFitNtuple::storeCorrMatrix(const UInt_t iExpt, const LauAbsFitter::FitStatus& fitStatus, const TMatrixD& covMatrix)
+void LauFitNtuple::storeCorrMatrix( const UInt_t iExpt,
+ const LauAbsFitter::FitStatus& fitStatus,
+ const TMatrixD& covMatrix )
{
- // store the minimised NLL value, correlation matrix status and experiment number
- iExpt_ = iExpt;
- fitStatus_ = fitStatus;
-
- // make the correlation matrix the correct dimensions
- if (definedFitTree_ == kFALSE) {
- corrMatrix_.clear();
- corrMatrix_.resize(nFitPars_);
- for (UInt_t i = 0; i < nFitPars_; ++i) {corrMatrix_[i].resize(nFitPars_);}
- }
-
- // under certain circumstances, e.g. if the fit has failed in the first
- // stage of a two-stage fit, the covariance matrix might not have the
- // expected dimensions, or it might even be empty
- Bool_t needsPadding = kFALSE;
- const UInt_t nElements = covMatrix.GetNoElements();
- if ( nElements == 0 ) {
-
- // if it's empty we can just make a diagonal matrix
- std::cerr << "WARNING in LauFitNtuple::storeCorrMatrix : received empty covariance matrix - will store diagonal correlation matrix" << std::endl;
- for (UInt_t i = 0; i < nFitPars_; ++i) {
- for (UInt_t j = 0; j < nFitPars_; ++j) {
- if (i == j) {
- corrMatrix_[i][j] = 1.0;
- } else {
- corrMatrix_[i][j] = 0.0;
- }
- }
- }
- return;
-
- } else if ( nElements != nFreePars_*nFreePars_ ) {
-
- UInt_t dimension = covMatrix.GetNrows();
- UInt_t nSecondStage = 0;
- for (UInt_t i = 0; i < nFitPars_; ++i) {
- if ( fitVars_[i]->secondStage() ) {
- ++nSecondStage;
- }
- }
-
- if ( (dimension + nSecondStage) == nFreePars_ ) {
- needsPadding = kTRUE;
- std::cerr << "WARNING in LauFitNtuple::storeCorrMatrix : received smaller covariance matrix than expected, likely due to failure of first stage fit - will pad the correlation matrix" << std::endl;
- std::cerr << " : nFitPars_ = " << nFitPars_ << std::endl;
- std::cerr << " : nFreePars_ = " << nFreePars_ << std::endl;
- std::cerr << " : nSecondStage = " << nSecondStage << std::endl;
- std::cerr << " : covMatrix size = " << dimension << std::endl;
- } else {
- std::cerr << "WARNING in LauFitNtuple::storeCorrMatrix : received smaller covariance matrix than expected, for unknown reasons - will store diagonal correlation matrix" << std::endl;
- std::cerr << " : nFitPars_ = " << nFitPars_ << std::endl;
- std::cerr << " : nFreePars_ = " << nFreePars_ << std::endl;
- std::cerr << " : nSecondStage = " << nSecondStage << std::endl;
- std::cerr << " : covMatrix size = " << dimension << std::endl;
- for (UInt_t i = 0; i < nFitPars_; ++i) {
- for (UInt_t j = 0; j < nFitPars_; ++j) {
- if (i == j) {
- corrMatrix_[i][j] = 1.0;
- } else {
- corrMatrix_[i][j] = 0.0;
- }
- }
- }
- return;
- }
-
- }
-
- // calculate the correlation matrix information from the fitter covariance matrix
- Bool_t iFixed(kFALSE);
- Bool_t jFixed(kFALSE);
- Bool_t iSecondStage(kFALSE);
- Bool_t jSecondStage(kFALSE);
- UInt_t iFree(0);
- UInt_t jFree(0);
-
- for (UInt_t i = 0; i < nFitPars_; ++i) {
-
- iFixed = fitVars_[i]->fixed();
- iSecondStage = fitVars_[i]->secondStage();
-
- // reset the "j" free parameter counter
- jFree = 0;
-
- // NB the supplied covariance matrix is of dimension nFreePars_ x nFreePars_
- for (UInt_t j = 0; j < nFitPars_; ++j) {
-
- jFixed = fitVars_[j]->fixed();
- jSecondStage = fitVars_[j]->secondStage();
-
- if (i == j) {
- corrMatrix_[i][j] = 1.0;
- } else if (iFixed == kTRUE || jFixed == kTRUE) {
- corrMatrix_[i][j] = 0.0;
- } else if ( needsPadding && ( iSecondStage || jSecondStage ) ) {
- corrMatrix_[i][j] = 0.0;
- } else {
- Double_t r_ij = covMatrix(iFree,jFree);
- Double_t r_ii = covMatrix(iFree,iFree);
- Double_t r_jj = covMatrix(jFree,jFree);
- Double_t denom = r_ii * r_jj;
- if (denom < 0.0) {
- r_ij = 0.0;
- denom = 1.0;
- }
- denom = TMath::Sqrt(denom);
- if (denom < 1e-30) {
- r_ij = 0.0;
- denom = 1.0;
- }
- corrMatrix_[i][j] = r_ij / denom;
- }
-
- if ( !jFixed && !(needsPadding && jSecondStage) ) {
- ++jFree;
- }
- }
-
- if ( !iFixed && !(needsPadding && iSecondStage) ) {
- ++iFree;
- }
- }
+ // store the minimised NLL value, correlation matrix status and experiment number
+ iExpt_ = iExpt;
+ fitStatus_ = fitStatus;
+
+ // make the correlation matrix the correct dimensions
+ if ( definedFitTree_ == kFALSE ) {
+ corrMatrix_.clear();
+ corrMatrix_.resize( nFitPars_ );
+ for ( UInt_t i = 0; i < nFitPars_; ++i ) {
+ corrMatrix_[i].resize( nFitPars_ );
+ }
+ }
+
+ // under certain circumstances, e.g. if the fit has failed in the first
+ // stage of a two-stage fit, the covariance matrix might not have the
+ // expected dimensions, or it might even be empty
+ Bool_t needsPadding = kFALSE;
+ const UInt_t nElements = covMatrix.GetNoElements();
+ if ( nElements == 0 ) {
+
+ // if it's empty we can just make a diagonal matrix
+ std::cerr << "WARNING in LauFitNtuple::storeCorrMatrix : received empty covariance matrix - will store diagonal correlation matrix"
+ << std::endl;
+ for ( UInt_t i = 0; i < nFitPars_; ++i ) {
+ for ( UInt_t j = 0; j < nFitPars_; ++j ) {
+ if ( i == j ) {
+ corrMatrix_[i][j] = 1.0;
+ } else {
+ corrMatrix_[i][j] = 0.0;
+ }
+ }
+ }
+ return;
+
+ } else if ( nElements != nFreePars_ * nFreePars_ ) {
+
+ UInt_t dimension = covMatrix.GetNrows();
+ UInt_t nSecondStage = 0;
+ for ( UInt_t i = 0; i < nFitPars_; ++i ) {
+ if ( fitVars_[i]->secondStage() ) {
+ ++nSecondStage;
+ }
+ }
+
+ if ( ( dimension + nSecondStage ) == nFreePars_ ) {
+ needsPadding = kTRUE;
+ std::cerr << "WARNING in LauFitNtuple::storeCorrMatrix : received smaller covariance matrix than expected, likely due to failure of first stage fit - will pad the correlation matrix"
+ << std::endl;
+ std::cerr << " : nFitPars_ = " << nFitPars_
+ << std::endl;
+ std::cerr << " : nFreePars_ = " << nFreePars_
+ << std::endl;
+ std::cerr << " : nSecondStage = "
+ << nSecondStage << std::endl;
+ std::cerr << " : covMatrix size = " << dimension
+ << std::endl;
+ } else {
+ std::cerr << "WARNING in LauFitNtuple::storeCorrMatrix : received smaller covariance matrix than expected, for unknown reasons - will store diagonal correlation matrix"
+ << std::endl;
+ std::cerr << " : nFitPars_ = " << nFitPars_
+ << std::endl;
+ std::cerr << " : nFreePars_ = " << nFreePars_
+ << std::endl;
+ std::cerr << " : nSecondStage = "
+ << nSecondStage << std::endl;
+ std::cerr << " : covMatrix size = " << dimension
+ << std::endl;
+ for ( UInt_t i = 0; i < nFitPars_; ++i ) {
+ for ( UInt_t j = 0; j < nFitPars_; ++j ) {
+ if ( i == j ) {
+ corrMatrix_[i][j] = 1.0;
+ } else {
+ corrMatrix_[i][j] = 0.0;
+ }
+ }
+ }
+ return;
+ }
+ }
+
+ // calculate the correlation matrix information from the fitter covariance matrix
+ Bool_t iFixed( kFALSE );
+ Bool_t jFixed( kFALSE );
+ Bool_t iSecondStage( kFALSE );
+ Bool_t jSecondStage( kFALSE );
+ UInt_t iFree( 0 );
+ UInt_t jFree( 0 );
+
+ for ( UInt_t i = 0; i < nFitPars_; ++i ) {
+
+ iFixed = fitVars_[i]->fixed();
+ iSecondStage = fitVars_[i]->secondStage();
+
+ // reset the "j" free parameter counter
+ jFree = 0;
+
+ // NB the supplied covariance matrix is of dimension nFreePars_ x nFreePars_
+ for ( UInt_t j = 0; j < nFitPars_; ++j ) {
+
+ jFixed = fitVars_[j]->fixed();
+ jSecondStage = fitVars_[j]->secondStage();
+
+ if ( i == j ) {
+ corrMatrix_[i][j] = 1.0;
+ } else if ( iFixed == kTRUE || jFixed == kTRUE ) {
+ corrMatrix_[i][j] = 0.0;
+ } else if ( needsPadding && ( iSecondStage || jSecondStage ) ) {
+ corrMatrix_[i][j] = 0.0;
+ } else {
+ Double_t r_ij = covMatrix( iFree, jFree );
+ Double_t r_ii = covMatrix( iFree, iFree );
+ Double_t r_jj = covMatrix( jFree, jFree );
+ Double_t denom = r_ii * r_jj;
+ if ( denom < 0.0 ) {
+ r_ij = 0.0;
+ denom = 1.0;
+ }
+ denom = TMath::Sqrt( denom );
+ if ( denom < 1e-30 ) {
+ r_ij = 0.0;
+ denom = 1.0;
+ }
+ corrMatrix_[i][j] = r_ij / denom;
+ }
+
+ if ( ! jFixed && ! ( needsPadding && jSecondStage ) ) {
+ ++jFree;
+ }
+ }
+
+ if ( ! iFixed && ! ( needsPadding && iSecondStage ) ) {
+ ++iFree;
+ }
+ }
}
-void LauFitNtuple::storeParsAndErrors(const std::vector<LauParameter*>& fitVars, const std::set<TString>& constrainedVars, const std::vector<LauParameter>& extraVars)
+void LauFitNtuple::storeParsAndErrors( const std::vector<LauParameter*>& fitVars,
+ const std::set<TString>& constrainedVars,
+ const std::vector<LauParameter>& extraVars )
{
- fitVars_ = fitVars;
- UInt_t nFitPars = fitVars_.size();
-
- // the number of parameters being given to us should be the same as the number from the last fit
- // OR it's the first time so the "last" number is zero
- if (nFitPars_ != 0 && nFitPars_ != nFitPars) {
- std::cerr << "ERROR in LauFitNtuple::storeParsAndErrors : expected total number of parameters (" << nFitPars_
- << ") not the same as the number provided (" << nFitPars << ")." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- LauParamFixed pred;
- UInt_t nFreePars = nFitPars - std::count_if(fitVars_.begin(),fitVars_.end(),pred);
-
- // the number of free parameters being given to us should be the same as the number from the last fit
- // OR it's the first time so the "last" number is zero
- // (NB we check whether nFitPars_ is zero for this since it is possible to have zero free parameters, albeit rather daft)
- if (nFitPars_ != 0 && nFreePars_ != nFreePars) {
- std::cerr << "ERROR in LauFitNtuple::storeParsAndErrors : expected number of free parameters (" << nFreePars_
- << ") not the same as the number provided (" << nFreePars << ")." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- nFitPars_ = nFitPars;
- nFreePars_ = nFreePars;
-
- constrainedVars_ = constrainedVars;
-
- extraVars_ = extraVars;
- nExtraPars_ = extraVars_.size();
+ fitVars_ = fitVars;
+ UInt_t nFitPars = fitVars_.size();
+
+ // the number of parameters being given to us should be the same as the number from the last fit
+ // OR it's the first time so the "last" number is zero
+ if ( nFitPars_ != 0 && nFitPars_ != nFitPars ) {
+ std::cerr << "ERROR in LauFitNtuple::storeParsAndErrors : expected total number of parameters ("
+ << nFitPars_ << ") not the same as the number provided (" << nFitPars << ")."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ LauParamFixed pred;
+ UInt_t nFreePars = nFitPars - std::count_if( fitVars_.begin(), fitVars_.end(), pred );
+
+ // the number of free parameters being given to us should be the same as the number from the last fit
+ // OR it's the first time so the "last" number is zero
+ // (NB we check whether nFitPars_ is zero for this since it is possible to have zero free parameters, albeit rather daft)
+ if ( nFitPars_ != 0 && nFreePars_ != nFreePars ) {
+ std::cerr << "ERROR in LauFitNtuple::storeParsAndErrors : expected number of free parameters ("
+ << nFreePars_ << ") not the same as the number provided (" << nFreePars << ")."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ nFitPars_ = nFitPars;
+ nFreePars_ = nFreePars;
+
+ constrainedVars_ = constrainedVars;
+
+ extraVars_ = extraVars;
+ nExtraPars_ = extraVars_.size();
}
void LauFitNtuple::updateFitNtuple()
{
- // Now create and fill the stored fit results into an ntuple (TTree)
- if (definedFitTree_ == kFALSE) {
-
- std::cout << "INFO in LauFitNtuple::updateFitNtuple : totNoPars = " << nFitPars_ << std::endl;
-
- // Add experiment number as a branch
- fitResults_->Branch("iExpt", &iExpt_, "iExpt/I");
- fitResults_->Branch("fitStatus", &fitStatus_.status, "fitStatus/I");
-
- // Add NLL (negative log-likelihood) and EDM values from fit
- fitResults_->Branch("NLL", &fitStatus_.NLL, "NLL/D");
- fitResults_->Branch("EDM", &fitStatus_.EDM, "EDM/D");
-
- for (UInt_t i = 0; i < nFitPars_; i++) {
-
- TString parName = fitVars_[i]->name();
- TString parNameD(parName); parNameD += "/D";
- fitResults_->Branch(parName.Data(), &fitVars_[i]->value_, parNameD.Data());
-
- TString parInitName(parName); parInitName += "_True";
- TString parInitNameD(parInitName); parInitNameD += "/D";
- fitResults_->Branch(parInitName.Data(), &fitVars_[i]->genValue_, parInitNameD.Data());
-
- if (!fitVars_[i]->fixed()) {
- TString parErrName(parName); parErrName += "_Error";
- TString parErrNameD(parErrName); parErrNameD += "/D";
- fitResults_->Branch(parErrName.Data(), &fitVars_[i]->error_, parErrNameD.Data());
-
- if ( storeAsymErrors_ ) {
- TString parNegErrName(parName); parNegErrName += "_NegError";
- TString parNegErrNameD(parNegErrName); parNegErrNameD += "/D";
- fitResults_->Branch(parNegErrName.Data(), &fitVars_[i]->negError_, parNegErrNameD.Data());
-
- TString parPosErrName(parName); parPosErrName += "_PosError";
- TString parPosErrNameD(parPosErrName); parPosErrNameD += "/D";
- fitResults_->Branch(parPosErrName.Data(), &fitVars_[i]->posError_, parPosErrNameD.Data());
- }
-
- TString parPullName(parName); parPullName += "_Pull";
- TString parPullNameD(parPullName); parPullNameD += "/D";
- fitResults_->Branch(parPullName.Data(), &fitVars_[i]->pull_, parPullNameD.Data());
-
- if ( fitVars_[i]->gaussConstraint() || constrainedVars_.find( parName ) != constrainedVars_.end() ) {
- TString parConstMeanName(parName); parConstMeanName += "_ConstraintMean";
- TString parConstMeanNameD(parConstMeanName); parConstMeanNameD += "/D";
- fitResults_->Branch(parConstMeanName.Data(), &fitVars_[i]->constraintMean_, parConstMeanNameD.Data());
- }
- }
-
- // Now add in the correlation matrix values (only for floating parameters)
- if (!fitVars_[i]->fixed()) {
- // First the global correlation coeffs
- TString parGCCName(parName); parGCCName += "_GCC";
- TString parGCCNameD(parGCCName); parGCCNameD += "/D";
- fitResults_->Branch(parGCCName.Data(), &fitVars_[i]->gcc_, parGCCNameD.Data());
-
- if ( ! corrMatrix_.empty() ) {
- // Then the rest
- for (UInt_t j = 0; j < nFitPars_; j++) {
- if (!fitVars_[j]->fixed() && i!=j) {
- TString parName2 = fitVars_[j]->name();
- TString corrName("corr__");
- corrName += parName; corrName += "__"; corrName += parName2;
-
- TString corrNameD(corrName); corrNameD += "/D";
- fitResults_->Branch(corrName.Data(), &corrMatrix_[i][j], corrNameD.Data());
- }
- }
- }
- }
- }
-
- // Update extra parameter values...
- for (UInt_t i = 0; i < nExtraPars_; i++) {
-
- TString parName = extraVars_[i].name();
- TString parNameD(parName); parNameD += "/D";
- fitResults_->Branch(parName.Data(), &extraVars_[i].value_, parNameD.Data());
-
- TString parInitName(parName); parInitName += "_True";
- TString parInitNameD(parInitName); parInitNameD += "/D";
- fitResults_->Branch(parInitName.Data(), &extraVars_[i].genValue_, parInitNameD.Data());
-
- //TString parErrName(parName); parErrName += "_Error";
- //TString parErrNameD(parErrName); parErrNameD += "/D";
- //fitResults_->Branch(parErrName.Data(), &extraVars_[i].error_, parErrNameD.Data());
-
- // Also find the fit fraction pull and store it
- //TString pullName(parName); pullName += "_Pull";
- //TString pullNameD(pullName); pullNameD += "/D";
- //fitResults_->Branch(pullName.Data(), &extraVars_[i].pull_, pullNameD.Data());
-
- }
-
- definedFitTree_ = kTRUE;
-
- }
-
- std::cout << "INFO in LauFitNtuple::updateFitNtuple : Stored fit values for experiment " << iExpt_ << "\n";
- std::cout << " : fitStatus = " << fitStatus_.status << std::endl;
- std::cout << " : NLL = " << fitStatus_.NLL << std::endl;
- std::cout << " : EDM = " << fitStatus_.EDM << std::endl;
-
- fitResults_->Fill();
-}
+ // Now create and fill the stored fit results into an ntuple (TTree)
+ if ( definedFitTree_ == kFALSE ) {
+
+ std::cout << "INFO in LauFitNtuple::updateFitNtuple : totNoPars = " << nFitPars_ << std::endl;
+
+ // Add experiment number as a branch
+ fitResults_->Branch( "iExpt", &iExpt_, "iExpt/I" );
+ fitResults_->Branch( "fitStatus", &fitStatus_.status, "fitStatus/I" );
+
+ // Add NLL (negative log-likelihood) and EDM values from fit
+ fitResults_->Branch( "NLL", &fitStatus_.NLL, "NLL/D" );
+ fitResults_->Branch( "EDM", &fitStatus_.EDM, "EDM/D" );
+
+ for ( UInt_t i = 0; i < nFitPars_; i++ ) {
+
+ TString parName = fitVars_[i]->name();
+ TString parNameD( parName );
+ parNameD += "/D";
+ fitResults_->Branch( parName.Data(), &fitVars_[i]->value_, parNameD.Data() );
+
+ TString parInitName( parName );
+ parInitName += "_True";
+ TString parInitNameD( parInitName );
+ parInitNameD += "/D";
+ fitResults_->Branch( parInitName.Data(), &fitVars_[i]->genValue_, parInitNameD.Data() );
+
+ if ( ! fitVars_[i]->fixed() ) {
+ TString parErrName( parName );
+ parErrName += "_Error";
+ TString parErrNameD( parErrName );
+ parErrNameD += "/D";
+ fitResults_->Branch( parErrName.Data(), &fitVars_[i]->error_, parErrNameD.Data() );
+
+ if ( storeAsymErrors_ ) {
+ TString parNegErrName( parName );
+ parNegErrName += "_NegError";
+ TString parNegErrNameD( parNegErrName );
+ parNegErrNameD += "/D";
+ fitResults_->Branch( parNegErrName.Data(),
+ &fitVars_[i]->negError_,
+ parNegErrNameD.Data() );
+
+ TString parPosErrName( parName );
+ parPosErrName += "_PosError";
+ TString parPosErrNameD( parPosErrName );
+ parPosErrNameD += "/D";
+ fitResults_->Branch( parPosErrName.Data(),
+ &fitVars_[i]->posError_,
+ parPosErrNameD.Data() );
+ }
+
+ TString parPullName( parName );
+ parPullName += "_Pull";
+ TString parPullNameD( parPullName );
+ parPullNameD += "/D";
+ fitResults_->Branch( parPullName.Data(), &fitVars_[i]->pull_, parPullNameD.Data() );
+
+ if ( fitVars_[i]->gaussConstraint() ||
+ constrainedVars_.find( parName ) != constrainedVars_.end() ) {
+ TString parConstMeanName( parName );
+ parConstMeanName += "_ConstraintMean";
+ TString parConstMeanNameD( parConstMeanName );
+ parConstMeanNameD += "/D";
+ fitResults_->Branch( parConstMeanName.Data(),
+ &fitVars_[i]->constraintMean_,
+ parConstMeanNameD.Data() );
+ }
+ }
+
+ // Now add in the correlation matrix values (only for floating parameters)
+ if ( ! fitVars_[i]->fixed() ) {
+ // First the global correlation coeffs
+ TString parGCCName( parName );
+ parGCCName += "_GCC";
+ TString parGCCNameD( parGCCName );
+ parGCCNameD += "/D";
+ fitResults_->Branch( parGCCName.Data(), &fitVars_[i]->gcc_, parGCCNameD.Data() );
+
+ if ( ! corrMatrix_.empty() ) {
+ // Then the rest
+ for ( UInt_t j = 0; j < nFitPars_; j++ ) {
+ if ( ! fitVars_[j]->fixed() && i != j ) {
+ TString parName2 = fitVars_[j]->name();
+ TString corrName( "corr__" );
+ corrName += parName;
+ corrName += "__";
+ corrName += parName2;
+
+ TString corrNameD( corrName );
+ corrNameD += "/D";
+ fitResults_->Branch( corrName.Data(),
+ &corrMatrix_[i][j],
+ corrNameD.Data() );
+ }
+ }
+ }
+ }
+ }
+
+ // Update extra parameter values...
+ for ( UInt_t i = 0; i < nExtraPars_; i++ ) {
+
+ TString parName = extraVars_[i].name();
+ TString parNameD( parName );
+ parNameD += "/D";
+ fitResults_->Branch( parName.Data(), &extraVars_[i].value_, parNameD.Data() );
+
+ TString parInitName( parName );
+ parInitName += "_True";
+ TString parInitNameD( parInitName );
+ parInitNameD += "/D";
+ fitResults_->Branch( parInitName.Data(), &extraVars_[i].genValue_, parInitNameD.Data() );
+
+ //TString parErrName(parName); parErrName += "_Error";
+ //TString parErrNameD(parErrName); parErrNameD += "/D";
+ //fitResults_->Branch(parErrName.Data(), &extraVars_[i].error_, parErrNameD.Data());
+
+ // Also find the fit fraction pull and store it
+ //TString pullName(parName); pullName += "_Pull";
+ //TString pullNameD(pullName); pullNameD += "/D";
+ //fitResults_->Branch(pullName.Data(), &extraVars_[i].pull_, pullNameD.Data());
+ }
+
+ definedFitTree_ = kTRUE;
+ }
+
+ std::cout << "INFO in LauFitNtuple::updateFitNtuple : Stored fit values for experiment "
+ << iExpt_ << "\n";
+ std::cout << " : fitStatus = " << fitStatus_.status
+ << std::endl;
+ std::cout << " : NLL = " << fitStatus_.NLL
+ << std::endl;
+ std::cout << " : EDM = " << fitStatus_.EDM
+ << std::endl;
+
+ fitResults_->Fill();
+}
void LauFitNtuple::writeOutFitResults()
{
- // Write out the fit ntuple to the appropriate root file
- rootFile_->cd();
- fitResults_->Write("",TObject::kOverwrite);
- rootFile_->Close();
- delete rootFile_; rootFile_ = 0;
+ // Write out the fit ntuple to the appropriate root file
+ rootFile_->cd();
+ fitResults_->Write( "", TObject::kOverwrite );
+ rootFile_->Close();
+ delete rootFile_;
+ rootFile_ = 0;
}
-
diff --git a/src/LauFitObject.cc b/src/LauFitObject.cc
index 3834617..e2595e5 100644
--- a/src/LauFitObject.cc
+++ b/src/LauFitObject.cc
@@ -1,255 +1,281 @@
/*
Copyright 2017 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauFitObject.cc
\brief File containing implementation of LauFitObject class.
*/
-#include <iostream>
+#include "LauFitObject.hh"
+
+#include "LauRandom.hh"
#include "TDecompChol.h"
#include "TMatrixD.h"
#include "TRandom.h"
#include "TSystem.h"
#include "TVectorD.h"
-#include "LauFitObject.hh"
-#include "LauRandom.hh"
-
+#include <iostream>
-LauFitObject::LauFitObject() : TObject(),
- twoStageFit_(kFALSE),
- useAsymmFitErrors_(kFALSE),
- nParams_(0),
- nFreeParams_(0),
- withinAsymErrorCalc_(kFALSE),
- toyExpts_(kFALSE),
- firstExpt_(0),
- nExpt_(1),
- iExpt_(0),
- evtsPerExpt_(0),
- fitStatus_({-1,0.0,0.0}),
- worstLogLike_(std::numeric_limits<Double_t>::max()),
- covMatrix_(),
- numberOKFits_(0),
- numberBadFits_(0)
+LauFitObject::LauFitObject() :
+ TObject(),
+ twoStageFit_( kFALSE ),
+ useAsymmFitErrors_( kFALSE ),
+ nParams_( 0 ),
+ nFreeParams_( 0 ),
+ withinAsymErrorCalc_( kFALSE ),
+ toyExpts_( kFALSE ),
+ firstExpt_( 0 ),
+ nExpt_( 1 ),
+ iExpt_( 0 ),
+ evtsPerExpt_( 0 ),
+ fitStatus_( { -1, 0.0, 0.0 } ),
+ worstLogLike_( std::numeric_limits<Double_t>::max() ),
+ covMatrix_(),
+ numberOKFits_( 0 ),
+ numberBadFits_( 0 )
{
}
-void LauFitObject::setNExpts(UInt_t nExperiments, UInt_t firstExperiment, Bool_t toyExpts)
+void LauFitObject::setNExpts( UInt_t nExperiments, UInt_t firstExperiment, Bool_t toyExpts )
{
- nExpt_ = nExperiments;
- firstExpt_ = firstExperiment;
- toyExpts_ = toyExpts;
-
- if ( ! toyExpts && ( nExperiments > 1 || firstExperiment > 0 ) ) {
- std::cerr << "WARNING in LauFitObject::setNExpts : toyExpts is set to kFALSE but the values of nExperiments and firstExperiment indicate otherwise, please check" << std::endl;
- } else if ( toyExpts && nExperiments == 1 && firstExperiment == 0 ) {
- std::cerr << "WARNING in LauFitObject::setNExpts : toyExpts is set to kTRUE but the values of nExperiments and firstExperiment perhaps indicate otherwise, please check" << std::endl;
- }
+ nExpt_ = nExperiments;
+ firstExpt_ = firstExperiment;
+ toyExpts_ = toyExpts;
+
+ if ( ! toyExpts && ( nExperiments > 1 || firstExperiment > 0 ) ) {
+ std::cerr << "WARNING in LauFitObject::setNExpts : toyExpts is set to kFALSE but the values of nExperiments and firstExperiment indicate otherwise, please check"
+ << std::endl;
+ } else if ( toyExpts && nExperiments == 1 && firstExperiment == 0 ) {
+ std::cerr << "WARNING in LauFitObject::setNExpts : toyExpts is set to kTRUE but the values of nExperiments and firstExperiment perhaps indicate otherwise, please check"
+ << std::endl;
+ }
}
void LauFitObject::resetFitCounters()
{
- numberOKFits_ = 0;
- numberBadFits_ = 0;
- fitStatus_ = { -1, 0.0, 0.0 };
+ numberOKFits_ = 0;
+ numberBadFits_ = 0;
+ fitStatus_ = { -1, 0.0, 0.0 };
}
void LauFitObject::startNewFit( const UInt_t nPars, const UInt_t nFreePars )
{
- // Reset the worst likelihood found to its catch-all value
- worstLogLike_ = std::numeric_limits<Double_t>::max();
+ // Reset the worst likelihood found to its catch-all value
+ worstLogLike_ = std::numeric_limits<Double_t>::max();
- // Store the number of fit parameters (total and floating)
- nParams_ = nPars;
- nFreeParams_ = nFreePars;
+ // Store the number of fit parameters (total and floating)
+ nParams_ = nPars;
+ nFreeParams_ = nFreePars;
}
void LauFitObject::storeFitStatus( const LauAbsFitter::FitStatus& status, const TMatrixD& covMatrix )
{
- fitStatus_ = status;
-
- covMatrix_.Clear();
- covMatrix_.ResizeTo( covMatrix.GetNrows(), covMatrix.GetNcols() );
- covMatrix_.SetMatrixArray( covMatrix.GetMatrixArray() );
-
- // Keep track of how many fits worked or failed
- // NB values of fitStatus_ indicate the status of the error matrix:
- // 0= not calculated at all
- // 1= approximation only, not accurate
- // 2= full matrix, but forced positive-definite
- // 3= full accurate covariance matrix
- if (fitStatus_.status == 3) {
- ++numberOKFits_;
- } else {
- ++numberBadFits_;
- }
+ fitStatus_ = status;
+
+ covMatrix_.Clear();
+ covMatrix_.ResizeTo( covMatrix.GetNrows(), covMatrix.GetNcols() );
+ covMatrix_.SetMatrixArray( covMatrix.GetMatrixArray() );
+
+ // Keep track of how many fits worked or failed
+ // NB values of fitStatus_ indicate the status of the error matrix:
+ // 0= not calculated at all
+ // 1= approximation only, not accurate
+ // 2= full matrix, but forced positive-definite
+ // 3= full accurate covariance matrix
+ if ( fitStatus_.status == 3 ) {
+ ++numberOKFits_;
+ } else {
+ ++numberBadFits_;
+ }
}
-void LauFitObject::addConstraint(const TString& formula, const std::vector<TString>& pars, const Double_t mean, const Double_t width)
+void LauFitObject::addConstraint( const TString& formula,
+ const std::vector<TString>& pars,
+ const Double_t mean,
+ const Double_t width )
{
- std::cerr << "WARNING in LauFitObject::addConstraint : This function is deprecated, please switch to addFormulaConstraint!" << std::endl;
- this->addFormulaConstraint( formula, pars, mean, width );
+ std::cerr << "WARNING in LauFitObject::addConstraint : This function is deprecated, please switch to addFormulaConstraint!"
+ << std::endl;
+ this->addFormulaConstraint( formula, pars, mean, width );
}
-void LauFitObject::addFormulaConstraint(const TString& formula, const std::vector<TString>& pars, const Double_t mean, const Double_t width)
+void LauFitObject::addFormulaConstraint( const TString& formula,
+ const std::vector<TString>& pars,
+ const Double_t mean,
+ const Double_t width )
{
- if ( ! this->checkRepetition(pars, ConstraintType::Formula) ){
- std::cerr << "WARNING in LauFitObject::addFormulaConstraint : Parameter(s) added to multiple constraints!" << std::endl;
- }
+ if ( ! this->checkRepetition( pars, ConstraintType::Formula ) ) {
+ std::cerr << "WARNING in LauFitObject::addFormulaConstraint : Parameter(s) added to multiple constraints!"
+ << std::endl;
+ }
+
+ formulaConstraints_.emplace_back( FormulaConstraint { formula, pars, mean, width, nullptr } );
- formulaConstraints_.emplace_back( FormulaConstraint{formula, pars, mean, width, nullptr} );
-
- std::cout << "INFO in LauFitObject::addFormulaConstraint : Added formula constraint" << std::endl;
+ std::cout << "INFO in LauFitObject::addFormulaConstraint : Added formula constraint" << std::endl;
}
-void LauFitObject::addMultiDimConstraint( const std::vector<TString>& pars, const TVectorD& means, const TMatrixD& covMat)
+void LauFitObject::addMultiDimConstraint( const std::vector<TString>& pars,
+ const TVectorD& means,
+ const TMatrixD& covMat )
{
- if ( ! this->checkRepetition(pars, ConstraintType::MultDim) ){
- std::cerr << "WARNING in LauFitObject::addMultiDimConstraint : Parameter(s) added to multiple constraints!" << std::endl;
- }
+ if ( ! this->checkRepetition( pars, ConstraintType::MultDim ) ) {
+ std::cerr << "WARNING in LauFitObject::addMultiDimConstraint : Parameter(s) added to multiple constraints!"
+ << std::endl;
+ }
- multiDimConstraints_.emplace_back( pars, means, covMat );
+ multiDimConstraints_.emplace_back( pars, means, covMat );
- std::cout << "INFO in LauFitObject::addMultiDimConstraint : Added multi-dimensional constraint" << std::endl;
+ std::cout << "INFO in LauFitObject::addMultiDimConstraint : Added multi-dimensional constraint"
+ << std::endl;
}
void LauFitObject::generateConstraintMeans( std::vector<LauAbsRValue*>& conVars )
{
- if ( ! this->toyExpts() ) {
- return;
- }
+ if ( ! this->toyExpts() ) {
+ return;
+ }
- // For reproducibility, set a seed based on the experiment number
- // First, store the current seed, so that it can be restored afterwards
- const UInt_t oldSeed { LauRandom::randomFun()->GetSeed() };
- LauRandom::randomFun()->SetSeed( 827375 + this->iExpt() );
+ // For reproducibility, set a seed based on the experiment number
+ // First, store the current seed, so that it can be restored afterwards
+ const UInt_t oldSeed { LauRandom::randomFun()->GetSeed() };
+ LauRandom::randomFun()->SetSeed( 827375 + this->iExpt() );
- for ( LauAbsRValue* par : conVars ) {
- par->generateConstraintMean();
- }
+ for ( LauAbsRValue* par : conVars ) {
+ par->generateConstraintMean();
+ }
- for ( auto& constraint : multiDimConstraints_ ) {
- constraint.generateConstraintMeans();
- }
+ for ( auto& constraint : multiDimConstraints_ ) {
+ constraint.generateConstraintMeans();
+ }
- // Restore the old random seed
- LauRandom::randomFun()->SetSeed( oldSeed );
+ // Restore the old random seed
+ LauRandom::randomFun()->SetSeed( oldSeed );
}
Bool_t LauFitObject::checkRepetition( const std::vector<TString>& names, const ConstraintType conType )
{
- Bool_t allOK{kTRUE};
-
- for ( auto& newname : names ){
- // Check in formula constraints
- if ( formulaConstrainedPars_.find(newname) != formulaConstrainedPars_.end() ){
- std::cerr << "WARNING in LauFitObject::checkRepetition: named parameter " << newname << " already used in a formula constraint" << std::endl;
- allOK = kFALSE;
- }
-
- // Check in ND constraints
- if ( multiDimConstrainedPars_.find(newname) != multiDimConstrainedPars_.end() ){
- std::cerr << "WARNING in LauFitObject::checkRepetition: named parameter " << newname << " already used in a multi-dimensional constraint" << std::endl;
- allOK = kFALSE;
- }
-
- // Add the new names to the appropriate set
- switch ( conType ) {
- case ConstraintType::Formula :
- formulaConstrainedPars_.insert(newname);
- break;
- case ConstraintType::MultDim :
- multiDimConstrainedPars_.insert(newname);
- break;
- }
+ Bool_t allOK { kTRUE };
+
+ for ( auto& newname : names ) {
+ // Check in formula constraints
+ if ( formulaConstrainedPars_.find( newname ) != formulaConstrainedPars_.end() ) {
+ std::cerr << "WARNING in LauFitObject::checkRepetition: named parameter " << newname
+ << " already used in a formula constraint" << std::endl;
+ allOK = kFALSE;
}
- return allOK;
+ // Check in ND constraints
+ if ( multiDimConstrainedPars_.find( newname ) != multiDimConstrainedPars_.end() ) {
+ std::cerr << "WARNING in LauFitObject::checkRepetition: named parameter " << newname
+ << " already used in a multi-dimensional constraint" << std::endl;
+ allOK = kFALSE;
+ }
+
+ // Add the new names to the appropriate set
+ switch ( conType ) {
+ case ConstraintType::Formula :
+ formulaConstrainedPars_.insert( newname );
+ break;
+ case ConstraintType::MultDim :
+ multiDimConstrainedPars_.insert( newname );
+ break;
+ }
+ }
+
+ return allOK;
}
-LauFitObject::MultiDimConstraint::MultiDimConstraint( const std::vector<TString>& parNames, const TVectorD& means, const TMatrixD& covMat ) :
- conPars_{parNames},
- trueMeans_{means},
- means_{means},
- invCovMat_{covMat.GetNrows(),covMat.GetNcols()},
- sqrtCovMat_{covMat.GetNrows(),covMat.GetNcols()}
+LauFitObject::MultiDimConstraint::MultiDimConstraint( const std::vector<TString>& parNames,
+ const TVectorD& means,
+ const TMatrixD& covMat ) :
+ conPars_ { parNames },
+ trueMeans_ { means },
+ means_ { means },
+ invCovMat_ { covMat.GetNrows(), covMat.GetNcols() },
+ sqrtCovMat_ { covMat.GetNrows(), covMat.GetNcols() }
{
- if ( covMat.GetNcols() != covMat.GetNrows() ){
- std::cerr << "ERROR in LauFitObject::MultiDimConstraint : Covariance matrix is not square!" << std::endl;
- gSystem->Exit( EXIT_FAILURE );
- }
-
- if ( ( parNames.size() != static_cast<std::size_t>(means.GetNrows()) ) || ( parNames.size() != static_cast<std::size_t>(covMat.GetNrows()) ) ){
- std::cerr << "ERROR in LauFitObject::MultiDimConstraint : Different number of elements in vectors/covariance matrix!" << std::endl;
- gSystem->Exit( EXIT_FAILURE );
- }
-
- // Check invertion of the covariance matrix was successful
- TMatrixD invCovMat {TMatrixD::kInverted, covMat};
- if ( invCovMat == covMat ){
- std::cerr << "ERROR in LauFitObject::MultiDimConstraint : covariance matrix inversion failed, check your input!" << std::endl;
- gSystem->Exit( EXIT_FAILURE );
- }
- invCovMat_ = invCovMat;
-
- // Check invertion of the covariance matrix was successful
- TDecompChol cholDecomp {covMat};
- if ( ! cholDecomp.Decompose() ) {
- std::cerr << "ERROR in LauFitObject::MultiDimConstraint : covariance matrix decomposition failed, check your input!" << std::endl;
- gSystem->Exit( EXIT_FAILURE );
- }
- sqrtCovMat_ = TMatrixD{TMatrixD::kTransposed, cholDecomp.GetU()};
+ if ( covMat.GetNcols() != covMat.GetNrows() ) {
+ std::cerr << "ERROR in LauFitObject::MultiDimConstraint : Covariance matrix is not square!"
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ if ( ( parNames.size() != static_cast<std::size_t>( means.GetNrows() ) ) ||
+ ( parNames.size() != static_cast<std::size_t>( covMat.GetNrows() ) ) ) {
+ std::cerr << "ERROR in LauFitObject::MultiDimConstraint : Different number of elements in vectors/covariance matrix!"
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // Check invertion of the covariance matrix was successful
+ TMatrixD invCovMat { TMatrixD::kInverted, covMat };
+ if ( invCovMat == covMat ) {
+ std::cerr << "ERROR in LauFitObject::MultiDimConstraint : covariance matrix inversion failed, check your input!"
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ invCovMat_ = invCovMat;
+
+ // Check invertion of the covariance matrix was successful
+ TDecompChol cholDecomp { covMat };
+ if ( ! cholDecomp.Decompose() ) {
+ std::cerr << "ERROR in LauFitObject::MultiDimConstraint : covariance matrix decomposition failed, check your input!"
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ sqrtCovMat_ = TMatrixD { TMatrixD::kTransposed, cholDecomp.GetU() };
}
Double_t LauFitObject::MultiDimConstraint::constraintPenalty() const
{
- TVectorD diff{ means_.GetNrows() };
- for ( ULong_t j {0}; j < conLauPars_.size(); ++j ) {
- LauParameter* param = conLauPars_[j];
- diff[j] = param->unblindValue();
- }
- diff -= means_;
- return 0.5 * invCovMat_.Similarity( diff );
+ TVectorD diff { means_.GetNrows() };
+ for ( ULong_t j { 0 }; j < conLauPars_.size(); ++j ) {
+ LauParameter* param = conLauPars_[j];
+ diff[j] = param->unblindValue();
+ }
+ diff -= means_;
+ return 0.5 * invCovMat_.Similarity( diff );
}
void LauFitObject::MultiDimConstraint::generateConstraintMeans()
{
- TRandom* random = LauRandom::randomFun();
-
- for ( Int_t j {0}; j < trueMeans_.GetNrows(); ++j ) {
- means_[j] = random->Gaus(0.0, 1.0);
- }
-
- means_ *= sqrtCovMat_;
- means_ += trueMeans_;
-
- // Store the new mean in the parameter itself to enable writing it out to the results ntuple
- // (this is safe because a parameter cannot have both a 1D constraint and an ND constraint on it at the same time)
- for ( Int_t j {0}; j < trueMeans_.GetNrows(); ++j ) {
- conLauPars_[j]->constraintMean_ = means_[j];
- std::cout << "INFO in LauFitObject::MultiDimConstraint::generateConstraintMeans : set constraint mean for parameter \"" << conLauPars_[j]->name() << "\" to " << conLauPars_[j]->constraintMean_ << std::endl;
- }
+ TRandom* random = LauRandom::randomFun();
+
+ for ( Int_t j { 0 }; j < trueMeans_.GetNrows(); ++j ) {
+ means_[j] = random->Gaus( 0.0, 1.0 );
+ }
+
+ means_ *= sqrtCovMat_;
+ means_ += trueMeans_;
+
+ // Store the new mean in the parameter itself to enable writing it out to the results ntuple
+ // (this is safe because a parameter cannot have both a 1D constraint and an ND constraint on it at the same time)
+ for ( Int_t j { 0 }; j < trueMeans_.GetNrows(); ++j ) {
+ conLauPars_[j]->constraintMean_ = means_[j];
+ std::cout << "INFO in LauFitObject::MultiDimConstraint::generateConstraintMeans : set constraint mean for parameter \""
+ << conLauPars_[j]->name() << "\" to " << conLauPars_[j]->constraintMean_
+ << std::endl;
+ }
}
diff --git a/src/LauFitter.cc b/src/LauFitter.cc
index 2c62d33..94ed336 100644
--- a/src/LauFitter.cc
+++ b/src/LauFitter.cc
@@ -1,98 +1,99 @@
/*
Copyright 2005 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauFitter.cc
\brief File containing implementation of LauFitter methods.
*/
#include "LauFitter.hh"
#include "LauMinuit.hh"
#include <array>
#include <iostream>
#include <memory>
-
std::unique_ptr<LauAbsFitter> LauFitter::theInstance_ = nullptr;
-LauFitter::Type LauFitter::fitterType_ = LauFitter::Type::Minuit;
-LauOutputLevel LauFitter::fitterVerbosity_ = LauOutputLevel::Standard;
-UInt_t LauFitter::fitterMaxPars_ = 100;
-
+LauFitter::Type LauFitter::fitterType_ = LauFitter::Type::Minuit;
+LauOutputLevel LauFitter::fitterVerbosity_ = LauOutputLevel::Standard;
+UInt_t LauFitter::fitterMaxPars_ = 100;
void LauFitter::setFitterType( const Type type )
{
- if ( theInstance_ != nullptr ) {
- std::cerr << "ERROR in LauFitter::setFitterType : The fitter has already been created, cannot change the type now." << std::endl;
- return;
- }
+ if ( theInstance_ != nullptr ) {
+ std::cerr << "ERROR in LauFitter::setFitterType : The fitter has already been created, cannot change the type now."
+ << std::endl;
+ return;
+ }
- fitterType_ = type;
+ fitterType_ = type;
}
void LauFitter::setFitterVerbosity( const LauOutputLevel level )
{
- if ( theInstance_ != nullptr ) {
- std::cerr << "ERROR in LauFitter::setFitterVerbosity : The fitter has already been created, cannot change the verbosity now." << std::endl;
- return;
- }
+ if ( theInstance_ != nullptr ) {
+ std::cerr << "ERROR in LauFitter::setFitterVerbosity : The fitter has already been created, cannot change the verbosity now."
+ << std::endl;
+ return;
+ }
- fitterVerbosity_ = level;
+ fitterVerbosity_ = level;
}
void LauFitter::setFitterMaxPars( const UInt_t maxPars )
{
- if ( theInstance_ != nullptr ) {
- std::cerr << "ERROR in LauFitter::setFitterMaxPars : The fitter has already been created, cannot change the maximum number of parameters now." << std::endl;
- return;
- }
+ if ( theInstance_ != nullptr ) {
+ std::cerr << "ERROR in LauFitter::setFitterMaxPars : The fitter has already been created, cannot change the maximum number of parameters now."
+ << std::endl;
+ return;
+ }
- fitterMaxPars_ = maxPars;
+ fitterMaxPars_ = maxPars;
}
LauAbsFitter& LauFitter::fitter()
{
- // Returns a reference to a singleton LauAbsFitter object.
- // Creates the object the first time it is called.
+ // Returns a reference to a singleton LauAbsFitter object.
+ // Creates the object the first time it is called.
- if ( theInstance_ == nullptr ) {
- if ( fitterType_ == Type::Minuit ) {
- // NB cannot use std::make_unique here since the LauMinuit constructor is private
- theInstance_.reset( new LauMinuit( fitterMaxPars_, fitterVerbosity_ ) );
- }
- }
+ if ( theInstance_ == nullptr ) {
+ if ( fitterType_ == Type::Minuit ) {
+ // NB cannot use std::make_unique here since the LauMinuit constructor is private
+ theInstance_.reset( new LauMinuit( fitterMaxPars_, fitterVerbosity_ ) );
+ }
+ }
- return *theInstance_;
+ return *theInstance_;
}
void LauFitter::destroyFitter()
{
- // destroy the current fitter
- theInstance_.reset();
+ // destroy the current fitter
+ theInstance_.reset();
- // restore the default settings
- fitterType_ = LauFitter::Type::Minuit;
- fitterVerbosity_ = LauOutputLevel::Standard;
- fitterMaxPars_ = 100;
+ // restore the default settings
+ fitterType_ = LauFitter::Type::Minuit;
+ fitterVerbosity_ = LauOutputLevel::Standard;
+ fitterMaxPars_ = 100;
}
diff --git a/src/LauFlatNR.cc b/src/LauFlatNR.cc
index 24d6e33..a8b841e 100644
--- a/src/LauFlatNR.cc
+++ b/src/LauFlatNR.cc
@@ -1,60 +1,62 @@
/*
Copyright 2014 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauFlatNR.cc
\brief File containing implementation of LauFlatNR class.
*/
-#include <iostream>
+#include "LauFlatNR.hh"
#include "LauKinematics.hh"
-#include "LauFlatNR.hh"
+#include <iostream>
-LauFlatNR::LauFlatNR(LauResonanceInfo* resInfo, const Int_t resPairAmpInt, const LauDaughters* daughters) :
- LauAbsResonance(resInfo, resPairAmpInt, daughters)
+LauFlatNR::LauFlatNR( LauResonanceInfo* resInfo,
+ const Int_t resPairAmpInt,
+ const LauDaughters* daughters ) :
+ LauAbsResonance( resInfo, resPairAmpInt, daughters )
{
}
LauFlatNR::~LauFlatNR()
{
}
void LauFlatNR::initialise()
{
}
-LauComplex LauFlatNR::amplitude(const LauKinematics* /*kinematics*/)
+LauComplex LauFlatNR::amplitude( const LauKinematics* /*kinematics*/ )
{
- // return the uniform amplitude
- return LauComplex(1.0, 0.0);
+ // return the uniform amplitude
+ return LauComplex( 1.0, 0.0 );
}
-LauComplex LauFlatNR::resAmp(Double_t mass, Double_t spinTerm)
+LauComplex LauFlatNR::resAmp( Double_t mass, Double_t spinTerm )
{
- std::cerr << "ERROR in LauFlatNR::resAmp : This method shouldn't get called." << std::endl;
- std::cerr << " Returning zero amplitude for mass = " << mass << " and spinTerm = " << spinTerm << "." << std::endl;
- return LauComplex(0.0, 0.0);
+ std::cerr << "ERROR in LauFlatNR::resAmp : This method shouldn't get called." << std::endl;
+ std::cerr << " Returning zero amplitude for mass = " << mass
+ << " and spinTerm = " << spinTerm << "." << std::endl;
+ return LauComplex( 0.0, 0.0 );
}
-
diff --git a/src/LauFlatteRes.cc b/src/LauFlatteRes.cc
index 0feed54..9207eb7 100644
--- a/src/LauFlatteRes.cc
+++ b/src/LauFlatteRes.cc
@@ -1,368 +1,408 @@
/*
Copyright 2004 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauFlatteRes.cc
\brief File containing implementation of LauFlatteRes class.
*/
-#include <iostream>
+#include "LauFlatteRes.hh"
#include "LauConstants.hh"
-#include "LauFlatteRes.hh"
#include "LauResonanceInfo.hh"
#include "TSystem.h"
+#include <iostream>
-
-LauFlatteRes::LauFlatteRes(LauResonanceInfo* resInfo, const Int_t resPairAmpInt, const LauDaughters* daughters) :
- LauAbsResonance(resInfo, resPairAmpInt, daughters),
- g1_(0),
- g2_(0),
- mSumSq0_(0.0),
- mSumSq1_(0.0),
- mSumSq2_(0.0),
- mSumSq3_(0.0),
- useAdlerTerm_(kFALSE),
- sA_(0.0),
- absorbM0_(kFALSE)
+LauFlatteRes::LauFlatteRes( LauResonanceInfo* resInfo,
+ const Int_t resPairAmpInt,
+ const LauDaughters* daughters ) :
+ LauAbsResonance( resInfo, resPairAmpInt, daughters ),
+ g1_( 0 ),
+ g2_( 0 ),
+ mSumSq0_( 0.0 ),
+ mSumSq1_( 0.0 ),
+ mSumSq2_( 0.0 ),
+ mSumSq3_( 0.0 ),
+ useAdlerTerm_( kFALSE ),
+ sA_( 0.0 ),
+ absorbM0_( kFALSE )
{
- Double_t resMass(0.0);
- Double_t g1Val(0.0);
- Double_t g2Val(0.0);
-
- const TString& resName = this->getResonanceName();
-
- if ( resName == "f_0(980)" ) {
-
- // Set the mass threshold values
- mSumSq0_ = (LauConstants::mPi0 + LauConstants::mPi0) * (LauConstants::mPi0 + LauConstants::mPi0);
- mSumSq1_ = (LauConstants::mPi + LauConstants::mPi) * (LauConstants::mPi + LauConstants::mPi);
- mSumSq2_ = (LauConstants::mK + LauConstants::mK) * (LauConstants::mK + LauConstants::mK);
- mSumSq3_ = (LauConstants::mK0 + LauConstants::mK0) * (LauConstants::mK0 + LauConstants::mK0);
-
- // Set values of mass and coupling constants from:
- // Phys. Lett. B 607, 243 (2005)
- resMass = 0.965; // 0.965 +/- 0.008 +/- 0.006 GeV/c^2
- g1Val = 0.165; // 0.165 +/- 0.010 +/- 0.015 GeV^2
- g2Val = 4.21*g1Val; // 4.21 +/- 0.25 +/- 0.21
-
- useAdlerTerm_ = kFALSE;
- sA_ = 0.0;
-
- absorbM0_ = kTRUE;
-
- } else if ( resName == "K*0_0(1430)" ) {
-
- // Set the mass threshold values
- mSumSq0_ = (LauConstants::mK0 + LauConstants::mPi0) * (LauConstants::mK0 + LauConstants::mPi0);
- mSumSq1_ = (LauConstants::mK + LauConstants::mPi) * (LauConstants::mK + LauConstants::mPi);
- mSumSq2_ = (LauConstants::mK0 + LauConstants::mEtaPrime) * (LauConstants::mK0 + LauConstants::mEtaPrime);
- mSumSq3_ = (LauConstants::mK0 + LauConstants::mEtaPrime) * (LauConstants::mK0 + LauConstants::mEtaPrime);
-
- // Set values of mass and coupling constants from:
- // Phys. Lett. B 572, 1 (2003)
- resMass = 1.513; // GeV/c^2
- g1Val = 0.304; // GeV
- g2Val = 0.380; // GeV
-
- useAdlerTerm_ = kTRUE;
- sA_ = 0.234;
-
- absorbM0_ = kFALSE;
-
- } else if ( resName == "K*+_0(1430)" || resName == "K*-_0(1430)" ) {
-
- // Set the mass threshold values
- mSumSq0_ = (LauConstants::mK + LauConstants::mPi0) * (LauConstants::mK + LauConstants::mPi0);
- mSumSq1_ = (LauConstants::mK0 + LauConstants::mPi) * (LauConstants::mK0 + LauConstants::mPi);
- mSumSq2_ = (LauConstants::mK + LauConstants::mEtaPrime) * (LauConstants::mK + LauConstants::mEtaPrime);
- mSumSq3_ = (LauConstants::mK + LauConstants::mEtaPrime) * (LauConstants::mK + LauConstants::mEtaPrime);
-
- // Set values of mass and coupling constants from:
- // Phys. Lett. B 572, 1 (2003)
- resMass = 1.513; // GeV/c^2
- g1Val = 0.304; // GeV
- g2Val = 0.380; // GeV
-
- useAdlerTerm_ = kTRUE;
- sA_ = 0.234;
-
- absorbM0_ = kFALSE;
-
- } else if ( resName == "a0_0(980)" ) {
-
- // Set the mass threshold values
- mSumSq0_ = (LauConstants::mEta + LauConstants::mPi0) * (LauConstants::mEta + LauConstants::mPi0);
- mSumSq1_ = (LauConstants::mEta + LauConstants::mPi0) * (LauConstants::mEta + LauConstants::mPi0);
- mSumSq2_ = (LauConstants::mK + LauConstants::mK) * (LauConstants::mK + LauConstants::mK);
- mSumSq3_ = (LauConstants::mK0 + LauConstants::mK0) * (LauConstants::mK0 + LauConstants::mK0);
-
- // Set values of mass and coupling constants from:
- // Phys. Rev. D 57, 3860 (1998)
- resMass = 0.982; // 0.982 +/- 0.003 GeV/c^2
- g1Val = 0.324*0.324; // 0.324 +/- 0.015 GeV (NB this value needs to be squared since the paper uses g_1^2 and g_2^2)
- g2Val = 1.03*g1Val; // 1.03 +/- 0.14 (NB this is indeed the ratio of what the paper refers to as g_2^2 and g_1^2, so can be used unchanged here)
-
- useAdlerTerm_ = kFALSE;
- sA_ = 0.0;
-
- absorbM0_ = kTRUE;
-
- } else if ( resName == "a+_0(980)" || resName == "a-_0(980)" ) {
-
- // Set the mass threshold values
- mSumSq0_ = (LauConstants::mEta + LauConstants::mPi) * (LauConstants::mEta + LauConstants::mPi);
- mSumSq1_ = (LauConstants::mEta + LauConstants::mPi) * (LauConstants::mEta + LauConstants::mPi);
- mSumSq2_ = (LauConstants::mK + LauConstants::mK0) * (LauConstants::mK + LauConstants::mK0);
- mSumSq3_ = (LauConstants::mK + LauConstants::mK0) * (LauConstants::mK + LauConstants::mK0);
-
- // Set values of mass and coupling constants from:
- // Phys. Rev. D 57, 3860 (1998)
- resMass = 0.982; // 0.982 +/- 0.003 GeV/c^2
- g1Val = 0.324*0.324; // 0.324 +/- 0.015 GeV (NB this value needs to be squared since the paper uses g_1^2 and g_2^2)
- g2Val = 1.03*g1Val; // 1.03 +/- 0.14 (NB this is indeed the ratio of what the paper refers to as g_2^2 and g_1^2, so can be used unchanged here)
-
- useAdlerTerm_ = kFALSE;
- sA_ = 0.0;
-
- absorbM0_ = kTRUE;
-
- }
-
- const TString couplingUnits = (absorbM0_) ? "GeV^2" : "GeV";
- std::cout << "INFO in LauFlatteRes::LauFlatteRes : Setting default parameters for " << resName << ":\n";
- std::cout << " : mass = " << resMass << " GeV/c^2\n";
- std::cout << " : g1 = " << g1Val << " " << couplingUnits << "\n";
- std::cout << " : g2 = " << g2Val << " " << couplingUnits << "\n";
- if ( absorbM0_ ) {
- std::cout << " : Will absorb m0 into couplings\n";
- } else {
- std::cout << " : Will not absorb m0 into couplings\n";
- }
- if ( useAdlerTerm_ ) {
- std::cout << " : Will use Adler zero term\n";
- std::cout << " : sA = " << sA_ << " GeV^2/c^4\n";
- } else {
- std::cout << " : Will not use Adler zero term\n";
- }
-
- // Set the mass value
- LauParameter* massPar = this->getMassPar();
- if ( massPar ) {
- massPar->valueAndRange(resMass,0.0,3.0*resMass);
- massPar->initValue(resMass);
- massPar->genValue(resMass);
- } else {
- std::cerr << "ERROR in LauFlatteRes::LauFlatteRes : Unable to retrieve mass parameter" << std::endl;
- }
-
- // Create the parameters for the coupling constants
- const TString& parNameBase = this->getSanitisedName();
-
- TString g1Name(parNameBase);
- g1Name += "_g1";
- g1_ = resInfo->getExtraParameter( g1Name );
- if ( g1_ == 0 ) {
- g1_ = new LauParameter( g1Name, g1Val, 0.0, 10.0, kTRUE );
- g1_->secondStage(kTRUE);
- resInfo->addExtraParameter( g1_ );
- }
-
- TString g2Name(parNameBase);
- g2Name += "_g2";
- g2_ = resInfo->getExtraParameter( g2Name );
- if ( g2_ == 0 ) {
- g2_ = new LauParameter( g2Name, g2Val, 0.0, 10.0, kTRUE );
- g2_->secondStage(kTRUE);
- resInfo->addExtraParameter( g2_ );
- }
+ Double_t resMass( 0.0 );
+ Double_t g1Val( 0.0 );
+ Double_t g2Val( 0.0 );
+
+ const TString& resName = this->getResonanceName();
+
+ if ( resName == "f_0(980)" ) {
+
+ // Set the mass threshold values
+ mSumSq0_ = ( LauConstants::mPi0 + LauConstants::mPi0 ) *
+ ( LauConstants::mPi0 + LauConstants::mPi0 );
+ mSumSq1_ = ( LauConstants::mPi + LauConstants::mPi ) *
+ ( LauConstants::mPi + LauConstants::mPi );
+ mSumSq2_ = ( LauConstants::mK + LauConstants::mK ) * ( LauConstants::mK + LauConstants::mK );
+ mSumSq3_ = ( LauConstants::mK0 + LauConstants::mK0 ) *
+ ( LauConstants::mK0 + LauConstants::mK0 );
+
+ // Set values of mass and coupling constants from:
+ // Phys. Lett. B 607, 243 (2005)
+ resMass = 0.965; // 0.965 +/- 0.008 +/- 0.006 GeV/c^2
+ g1Val = 0.165; // 0.165 +/- 0.010 +/- 0.015 GeV^2
+ g2Val = 4.21 * g1Val; // 4.21 +/- 0.25 +/- 0.21
+
+ useAdlerTerm_ = kFALSE;
+ sA_ = 0.0;
+
+ absorbM0_ = kTRUE;
+
+ } else if ( resName == "K*0_0(1430)" ) {
+
+ // Set the mass threshold values
+ mSumSq0_ = ( LauConstants::mK0 + LauConstants::mPi0 ) *
+ ( LauConstants::mK0 + LauConstants::mPi0 );
+ mSumSq1_ = ( LauConstants::mK + LauConstants::mPi ) *
+ ( LauConstants::mK + LauConstants::mPi );
+ mSumSq2_ = ( LauConstants::mK0 + LauConstants::mEtaPrime ) *
+ ( LauConstants::mK0 + LauConstants::mEtaPrime );
+ mSumSq3_ = ( LauConstants::mK0 + LauConstants::mEtaPrime ) *
+ ( LauConstants::mK0 + LauConstants::mEtaPrime );
+
+ // Set values of mass and coupling constants from:
+ // Phys. Lett. B 572, 1 (2003)
+ resMass = 1.513; // GeV/c^2
+ g1Val = 0.304; // GeV
+ g2Val = 0.380; // GeV
+
+ useAdlerTerm_ = kTRUE;
+ sA_ = 0.234;
+
+ absorbM0_ = kFALSE;
+
+ } else if ( resName == "K*+_0(1430)" || resName == "K*-_0(1430)" ) {
+
+ // Set the mass threshold values
+ mSumSq0_ = ( LauConstants::mK + LauConstants::mPi0 ) *
+ ( LauConstants::mK + LauConstants::mPi0 );
+ mSumSq1_ = ( LauConstants::mK0 + LauConstants::mPi ) *
+ ( LauConstants::mK0 + LauConstants::mPi );
+ mSumSq2_ = ( LauConstants::mK + LauConstants::mEtaPrime ) *
+ ( LauConstants::mK + LauConstants::mEtaPrime );
+ mSumSq3_ = ( LauConstants::mK + LauConstants::mEtaPrime ) *
+ ( LauConstants::mK + LauConstants::mEtaPrime );
+
+ // Set values of mass and coupling constants from:
+ // Phys. Lett. B 572, 1 (2003)
+ resMass = 1.513; // GeV/c^2
+ g1Val = 0.304; // GeV
+ g2Val = 0.380; // GeV
+
+ useAdlerTerm_ = kTRUE;
+ sA_ = 0.234;
+
+ absorbM0_ = kFALSE;
+
+ } else if ( resName == "a0_0(980)" ) {
+
+ // Set the mass threshold values
+ mSumSq0_ = ( LauConstants::mEta + LauConstants::mPi0 ) *
+ ( LauConstants::mEta + LauConstants::mPi0 );
+ mSumSq1_ = ( LauConstants::mEta + LauConstants::mPi0 ) *
+ ( LauConstants::mEta + LauConstants::mPi0 );
+ mSumSq2_ = ( LauConstants::mK + LauConstants::mK ) * ( LauConstants::mK + LauConstants::mK );
+ mSumSq3_ = ( LauConstants::mK0 + LauConstants::mK0 ) *
+ ( LauConstants::mK0 + LauConstants::mK0 );
+
+ // Set values of mass and coupling constants from:
+ // Phys. Rev. D 57, 3860 (1998)
+ resMass = 0.982; // 0.982 +/- 0.003 GeV/c^2
+ g1Val = 0.324 *
+ 0.324; // 0.324 +/- 0.015 GeV (NB this value needs to be squared since the paper uses g_1^2 and g_2^2)
+ g2Val = 1.03 *
+ g1Val; // 1.03 +/- 0.14 (NB this is indeed the ratio of what the paper refers to as g_2^2 and g_1^2, so can be used unchanged here)
+
+ useAdlerTerm_ = kFALSE;
+ sA_ = 0.0;
+
+ absorbM0_ = kTRUE;
+
+ } else if ( resName == "a+_0(980)" || resName == "a-_0(980)" ) {
+
+ // Set the mass threshold values
+ mSumSq0_ = ( LauConstants::mEta + LauConstants::mPi ) *
+ ( LauConstants::mEta + LauConstants::mPi );
+ mSumSq1_ = ( LauConstants::mEta + LauConstants::mPi ) *
+ ( LauConstants::mEta + LauConstants::mPi );
+ mSumSq2_ = ( LauConstants::mK + LauConstants::mK0 ) *
+ ( LauConstants::mK + LauConstants::mK0 );
+ mSumSq3_ = ( LauConstants::mK + LauConstants::mK0 ) *
+ ( LauConstants::mK + LauConstants::mK0 );
+
+ // Set values of mass and coupling constants from:
+ // Phys. Rev. D 57, 3860 (1998)
+ resMass = 0.982; // 0.982 +/- 0.003 GeV/c^2
+ g1Val = 0.324 *
+ 0.324; // 0.324 +/- 0.015 GeV (NB this value needs to be squared since the paper uses g_1^2 and g_2^2)
+ g2Val = 1.03 *
+ g1Val; // 1.03 +/- 0.14 (NB this is indeed the ratio of what the paper refers to as g_2^2 and g_1^2, so can be used unchanged here)
+
+ useAdlerTerm_ = kFALSE;
+ sA_ = 0.0;
+
+ absorbM0_ = kTRUE;
+ }
+
+ const TString couplingUnits = ( absorbM0_ ) ? "GeV^2" : "GeV";
+ std::cout << "INFO in LauFlatteRes::LauFlatteRes : Setting default parameters for " << resName
+ << ":\n";
+ std::cout << " : mass = " << resMass << " GeV/c^2\n";
+ std::cout << " : g1 = " << g1Val << " " << couplingUnits
+ << "\n";
+ std::cout << " : g2 = " << g2Val << " " << couplingUnits
+ << "\n";
+ if ( absorbM0_ ) {
+ std::cout << " : Will absorb m0 into couplings\n";
+ } else {
+ std::cout << " : Will not absorb m0 into couplings\n";
+ }
+ if ( useAdlerTerm_ ) {
+ std::cout << " : Will use Adler zero term\n";
+ std::cout << " : sA = " << sA_ << " GeV^2/c^4\n";
+ } else {
+ std::cout << " : Will not use Adler zero term\n";
+ }
+
+ // Set the mass value
+ LauParameter* massPar = this->getMassPar();
+ if ( massPar ) {
+ massPar->valueAndRange( resMass, 0.0, 3.0 * resMass );
+ massPar->initValue( resMass );
+ massPar->genValue( resMass );
+ } else {
+ std::cerr << "ERROR in LauFlatteRes::LauFlatteRes : Unable to retrieve mass parameter"
+ << std::endl;
+ }
+
+ // Create the parameters for the coupling constants
+ const TString& parNameBase = this->getSanitisedName();
+
+ TString g1Name( parNameBase );
+ g1Name += "_g1";
+ g1_ = resInfo->getExtraParameter( g1Name );
+ if ( g1_ == 0 ) {
+ g1_ = new LauParameter( g1Name, g1Val, 0.0, 10.0, kTRUE );
+ g1_->secondStage( kTRUE );
+ resInfo->addExtraParameter( g1_ );
+ }
+
+ TString g2Name( parNameBase );
+ g2Name += "_g2";
+ g2_ = resInfo->getExtraParameter( g2Name );
+ if ( g2_ == 0 ) {
+ g2_ = new LauParameter( g2Name, g2Val, 0.0, 10.0, kTRUE );
+ g2_->secondStage( kTRUE );
+ resInfo->addExtraParameter( g2_ );
+ }
}
LauFlatteRes::~LauFlatteRes()
{
}
void LauFlatteRes::initialise()
{
- const TString& resName = this->getResonanceName();
- if ( resName != "f_0(980)" && resName != "K*0_0(1430)" && resName != "K*+_0(1430)" && resName != "K*-_0(1430)" &&
- resName != "a0_0(980)" && resName != "a+_0(980)" && resName != "a-_0(980)" ) {
- std::cerr << "ERROR in LauFlatteRes::initialise : Unexpected resonance name \"" << resName << "\" for Flatte shape." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- Int_t resSpin = this->getSpin();
- if (resSpin != 0) {
- std::cerr << "WARNING in LauFlatteRes::amplitude : Resonance spin is " << resSpin << "." << std::endl;
- std::cerr << " : Flatte amplitude is only defined for scalers, resetting spin to 0." << std::endl;
- this->changeResonance( -1.0, -1.0, 0 );
- }
+ const TString& resName = this->getResonanceName();
+ if ( resName != "f_0(980)" && resName != "K*0_0(1430)" && resName != "K*+_0(1430)" &&
+ resName != "K*-_0(1430)" && resName != "a0_0(980)" && resName != "a+_0(980)" &&
+ resName != "a-_0(980)" ) {
+ std::cerr << "ERROR in LauFlatteRes::initialise : Unexpected resonance name \"" << resName
+ << "\" for Flatte shape." << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ Int_t resSpin = this->getSpin();
+ if ( resSpin != 0 ) {
+ std::cerr << "WARNING in LauFlatteRes::amplitude : Resonance spin is " << resSpin << "."
+ << std::endl;
+ std::cerr << " : Flatte amplitude is only defined for scalers, resetting spin to 0."
+ << std::endl;
+ this->changeResonance( -1.0, -1.0, 0 );
+ }
}
-LauComplex LauFlatteRes::resAmp(Double_t mass, Double_t spinTerm)
+LauComplex LauFlatteRes::resAmp( Double_t mass, Double_t spinTerm )
{
- // This function returns the complex dynamical amplitude for a Flatte distribution
- // given the invariant mass and cos(helicity) values.
-
- const Double_t resMass = this->getMass();
- const Double_t resMassSq = resMass*resMass;
- const Double_t s = mass*mass; // Invariant mass squared combination for the system
-
- const Double_t g1Val = this->getg1Parameter();
- const Double_t g2Val = this->getg2Parameter();
-
- Double_t dMSq = resMassSq - s;
- Double_t rho1(0.0), rho2(0.0);
- if (s > mSumSq0_) {
- rho1 = TMath::Sqrt(1.0 - mSumSq0_/s)/3.0;
- if (s > mSumSq1_) {
- rho1 += 2.0*TMath::Sqrt(1.0 - mSumSq1_/s)/3.0;
- if (s > mSumSq2_) {
- rho2 = 0.5*TMath::Sqrt(1.0 - mSumSq2_/s);
- if (s > mSumSq3_) {
- rho2 += 0.5*TMath::Sqrt(1.0 - mSumSq3_/s);
- } else {
- // Continue analytically below higher channel thresholds
- // This contributes to the real part of the amplitude denominator
- dMSq += g2Val*resMass*0.5*TMath::Sqrt(mSumSq3_/s - 1.0);
- }
- } else {
- // Continue analytically below higher channel thresholds
- // This contributes to the real part of the amplitude denominator
- rho2 = 0.0;
- dMSq += g2Val*resMass*(0.5*TMath::Sqrt(mSumSq2_/s - 1.0) + 0.5*TMath::Sqrt(mSumSq3_/s - 1.0));
- }
- } else {
- // Continue analytically below higher channel thresholds
- // This contributes to the real part of the amplitude denominator
- dMSq += g1Val*resMass*2.0*TMath::Sqrt(mSumSq1_/s - 1.0)/3.0;
- }
- }
-
- Double_t massFactor = 1.0;
- if ( ! absorbM0_ ) {
- massFactor = resMass;
- }
- if (useAdlerTerm_) {
- massFactor *= ( s - sA_ ) / ( resMassSq - sA_ );
- }
- const Double_t width1 = g1Val*rho1*massFactor;
- const Double_t width2 = g2Val*rho2*massFactor;
- const Double_t widthTerm = width1 + width2;
-
- LauComplex resAmplitude(dMSq, widthTerm);
-
- const Double_t denomFactor = dMSq*dMSq + widthTerm*widthTerm;
-
- Double_t invDenomFactor = 0.0;
- if (denomFactor > 1e-10) {invDenomFactor = 1.0/denomFactor;}
-
- resAmplitude.rescale(spinTerm*invDenomFactor);
-
- return resAmplitude;
+ // This function returns the complex dynamical amplitude for a Flatte distribution
+ // given the invariant mass and cos(helicity) values.
+
+ const Double_t resMass = this->getMass();
+ const Double_t resMassSq = resMass * resMass;
+ const Double_t s = mass * mass; // Invariant mass squared combination for the system
+
+ const Double_t g1Val = this->getg1Parameter();
+ const Double_t g2Val = this->getg2Parameter();
+
+ Double_t dMSq = resMassSq - s;
+ Double_t rho1( 0.0 ), rho2( 0.0 );
+ if ( s > mSumSq0_ ) {
+ rho1 = TMath::Sqrt( 1.0 - mSumSq0_ / s ) / 3.0;
+ if ( s > mSumSq1_ ) {
+ rho1 += 2.0 * TMath::Sqrt( 1.0 - mSumSq1_ / s ) / 3.0;
+ if ( s > mSumSq2_ ) {
+ rho2 = 0.5 * TMath::Sqrt( 1.0 - mSumSq2_ / s );
+ if ( s > mSumSq3_ ) {
+ rho2 += 0.5 * TMath::Sqrt( 1.0 - mSumSq3_ / s );
+ } else {
+ // Continue analytically below higher channel thresholds
+ // This contributes to the real part of the amplitude denominator
+ dMSq += g2Val * resMass * 0.5 * TMath::Sqrt( mSumSq3_ / s - 1.0 );
+ }
+ } else {
+ // Continue analytically below higher channel thresholds
+ // This contributes to the real part of the amplitude denominator
+ rho2 = 0.0;
+ dMSq += g2Val * resMass *
+ ( 0.5 * TMath::Sqrt( mSumSq2_ / s - 1.0 ) +
+ 0.5 * TMath::Sqrt( mSumSq3_ / s - 1.0 ) );
+ }
+ } else {
+ // Continue analytically below higher channel thresholds
+ // This contributes to the real part of the amplitude denominator
+ dMSq += g1Val * resMass * 2.0 * TMath::Sqrt( mSumSq1_ / s - 1.0 ) / 3.0;
+ }
+ }
+
+ Double_t massFactor = 1.0;
+ if ( ! absorbM0_ ) {
+ massFactor = resMass;
+ }
+ if ( useAdlerTerm_ ) {
+ massFactor *= ( s - sA_ ) / ( resMassSq - sA_ );
+ }
+ const Double_t width1 = g1Val * rho1 * massFactor;
+ const Double_t width2 = g2Val * rho2 * massFactor;
+ const Double_t widthTerm = width1 + width2;
+
+ LauComplex resAmplitude( dMSq, widthTerm );
+
+ const Double_t denomFactor = dMSq * dMSq + widthTerm * widthTerm;
+
+ Double_t invDenomFactor = 0.0;
+ if ( denomFactor > 1e-10 ) {
+ invDenomFactor = 1.0 / denomFactor;
+ }
+
+ resAmplitude.rescale( spinTerm * invDenomFactor );
+
+ return resAmplitude;
}
const std::vector<LauParameter*>& LauFlatteRes::getFloatingParameters()
{
- this->clearFloatingParameters();
+ this->clearFloatingParameters();
- if ( ! this->fixMass() ) {
- this->addFloatingParameter( this->getMassPar() );
- }
+ if ( ! this->fixMass() ) {
+ this->addFloatingParameter( this->getMassPar() );
+ }
- // NB the width is given in terms of g1 and g2 so the normal width
- // parameter should be ignored, hence it is not added to the list
+ // NB the width is given in terms of g1 and g2 so the normal width
+ // parameter should be ignored, hence it is not added to the list
- if ( ! this->fixg1Parameter() ) {
- this->addFloatingParameter( g1_ );
- }
+ if ( ! this->fixg1Parameter() ) {
+ this->addFloatingParameter( g1_ );
+ }
- if ( ! this->fixg2Parameter() ) {
- this->addFloatingParameter( g2_ );
- }
+ if ( ! this->fixg2Parameter() ) {
+ this->addFloatingParameter( g2_ );
+ }
- return this->getParameters();
+ return this->getParameters();
}
-void LauFlatteRes::setResonanceParameter(const TString& name, const Double_t value)
+void LauFlatteRes::setResonanceParameter( const TString& name, const Double_t value )
{
- if (name == "g1") {
- this->setg1Parameter(value);
- std::cout << "INFO in LauFlatteRes::setResonanceParameter : Setting g1 parameter to " << this->getg1Parameter() << std::endl;
- } else if (name == "g2") {
- this->setg2Parameter(value);
- std::cout << "INFO in LauFlatteRes::setResonanceParameter : Setting g2 parameter to " << this->getg2Parameter() << std::endl;
- } else {
- std::cerr << "WARNING in LauFlatteRes::setResonanceParameter : Parameter name \"" << name << "\" not recognised." << std::endl;
- }
-}
-
-void LauFlatteRes::floatResonanceParameter(const TString& name)
-{
- if (name == "g1") {
- if ( g1_->fixed() ) {
- g1_->fixed( kFALSE );
- this->addFloatingParameter( g1_ );
- } else {
- std::cerr << "WARNING in LauFlatteRes::floatResonanceParameter: Parameter already floating. No parameter changes made." << std::endl;
- }
- } else if (name == "g2") {
- if ( g2_->fixed() ) {
- g2_->fixed( kFALSE );
- this->addFloatingParameter( g2_ );
- } else {
- std::cerr << "WARNING in LauFlatteRes::floatResonanceParameter: Parameter already floating. No parameter changes made." << std::endl;
- }
- } else {
- std::cerr << "WARNING in LauFlatteRes::fixResonanceParameter: Parameter name not reconised. No parameter changes made." << std::endl;
- }
+ if ( name == "g1" ) {
+ this->setg1Parameter( value );
+ std::cout << "INFO in LauFlatteRes::setResonanceParameter : Setting g1 parameter to "
+ << this->getg1Parameter() << std::endl;
+ } else if ( name == "g2" ) {
+ this->setg2Parameter( value );
+ std::cout << "INFO in LauFlatteRes::setResonanceParameter : Setting g2 parameter to "
+ << this->getg2Parameter() << std::endl;
+ } else {
+ std::cerr << "WARNING in LauFlatteRes::setResonanceParameter : Parameter name \"" << name
+ << "\" not recognised." << std::endl;
+ }
}
-LauParameter* LauFlatteRes::getResonanceParameter(const TString& name)
+void LauFlatteRes::floatResonanceParameter( const TString& name )
{
- if (name == "g1") {
- return g1_;
- } else if (name == "g2") {
- return g2_;
- } else {
- std::cerr << "WARNING in LauFlatteRes::getResonanceParameter: Parameter name not reconised." << std::endl;
- return 0;
- }
+ if ( name == "g1" ) {
+ if ( g1_->fixed() ) {
+ g1_->fixed( kFALSE );
+ this->addFloatingParameter( g1_ );
+ } else {
+ std::cerr << "WARNING in LauFlatteRes::floatResonanceParameter: Parameter already floating. No parameter changes made."
+ << std::endl;
+ }
+ } else if ( name == "g2" ) {
+ if ( g2_->fixed() ) {
+ g2_->fixed( kFALSE );
+ this->addFloatingParameter( g2_ );
+ } else {
+ std::cerr << "WARNING in LauFlatteRes::floatResonanceParameter: Parameter already floating. No parameter changes made."
+ << std::endl;
+ }
+ } else {
+ std::cerr << "WARNING in LauFlatteRes::fixResonanceParameter: Parameter name not reconised. No parameter changes made."
+ << std::endl;
+ }
}
-void LauFlatteRes::setg1Parameter(const Double_t g1)
+LauParameter* LauFlatteRes::getResonanceParameter( const TString& name )
{
- g1_->value( g1 );
- g1_->genValue( g1 );
- g1_->initValue( g1 );
+ if ( name == "g1" ) {
+ return g1_;
+ } else if ( name == "g2" ) {
+ return g2_;
+ } else {
+ std::cerr << "WARNING in LauFlatteRes::getResonanceParameter: Parameter name not reconised."
+ << std::endl;
+ return 0;
+ }
}
-void LauFlatteRes::setg2Parameter(const Double_t g2)
+void LauFlatteRes::setg1Parameter( const Double_t g1 )
{
- g2_->value( g2 );
- g2_->genValue( g2 );
- g2_->initValue( g2 );
+ g1_->value( g1 );
+ g1_->genValue( g1 );
+ g1_->initValue( g1 );
}
+void LauFlatteRes::setg2Parameter( const Double_t g2 )
+{
+ g2_->value( g2 );
+ g2_->genValue( g2 );
+ g2_->initValue( g2 );
+}
diff --git a/src/LauFormulaPar.cc b/src/LauFormulaPar.cc
index b0b9b25..e2d66d3 100644
--- a/src/LauFormulaPar.cc
+++ b/src/LauFormulaPar.cc
@@ -1,214 +1,229 @@
/*
Copyright 2014 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauFormulaPar.cc
- \brief File containing implementation of LauFormulaPar class.
+ \brief File containing implementation of LauFormulaPar class.
*/
-#include <iostream>
-#include <iomanip>
-#include <vector>
-#include <cstdlib>
-
-#include "TRandom.h"
-#include "TMessage.h"
-#include "TSystem.h"
-
#include "LauFormulaPar.hh"
+
#include "LauParameter.hh"
#include "LauRandom.hh"
+#include "TMessage.h"
+#include "TRandom.h"
+#include "TSystem.h"
+#include <cstdlib>
+#include <iomanip>
+#include <iostream>
+#include <vector>
-LauFormulaPar::LauFormulaPar(const TString& forName, const TString& formula, const std::vector<LauParameter*>& params) :
- name_(forName),
- formula_(forName,formula),
- paramVec_(params),
- paramArray_(nullptr),
- gaussConstraint_(kFALSE),
- constraintTrueMean_(0.0),
- constraintMean_(0.0),
- constraintWidth_(0.0)
+LauFormulaPar::LauFormulaPar( const TString& forName,
+ const TString& formula,
+ const std::vector<LauParameter*>& params ) :
+ name_( forName ),
+ formula_( forName, formula ),
+ paramVec_( params ),
+ paramArray_( nullptr ),
+ gaussConstraint_( kFALSE ),
+ constraintTrueMean_( 0.0 ),
+ constraintMean_( 0.0 ),
+ constraintWidth_( 0.0 )
{
- // Check length of vector matches number of parameter in the formula
- Int_t nPars = paramVec_.size();
- if (formula_.GetNpar() != nPars){
- std::cerr<<"ERROR in LauFormulaPar::evaluate : Number of parameters in the formula is : "<<formula_.GetNpar()<< " and the number of LauParameters is : "<<nPars<<std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- if (formula_.GetNdim() != 0){
- std::cerr<<"ERROR in LauFormulaPar::evaluate : Given formula of dimension: "<<formula_.GetNdim()<<" and not 0"<<std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // Array of input parameters
- paramArray_ = new Double_t[nPars];
+ // Check length of vector matches number of parameter in the formula
+ Int_t nPars = paramVec_.size();
+ if ( formula_.GetNpar() != nPars ) {
+ std::cerr << "ERROR in LauFormulaPar::evaluate : Number of parameters in the formula is : "
+ << formula_.GetNpar() << " and the number of LauParameters is : " << nPars
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ if ( formula_.GetNdim() != 0 ) {
+ std::cerr << "ERROR in LauFormulaPar::evaluate : Given formula of dimension: "
+ << formula_.GetNdim() << " and not 0" << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // Array of input parameters
+ paramArray_ = new Double_t[nPars];
}
LauFormulaPar::~LauFormulaPar()
{
- delete[] paramArray_;
+ delete[] paramArray_;
}
-LauFormulaPar::LauFormulaPar(const LauFormulaPar& rhs) : LauAbsRValue(rhs),
- name_(rhs.name_),
- formula_(rhs.formula_),
- paramVec_(rhs.paramVec_),
- paramArray_(nullptr),
- gaussConstraint_(rhs.gaussConstraint_),
- constraintTrueMean_(rhs.constraintTrueMean_),
- constraintMean_(rhs.constraintMean_),
- constraintWidth_(rhs.constraintWidth_)
+LauFormulaPar::LauFormulaPar( const LauFormulaPar& rhs ) :
+ LauAbsRValue( rhs ),
+ name_( rhs.name_ ),
+ formula_( rhs.formula_ ),
+ paramVec_( rhs.paramVec_ ),
+ paramArray_( nullptr ),
+ gaussConstraint_( rhs.gaussConstraint_ ),
+ constraintTrueMean_( rhs.constraintTrueMean_ ),
+ constraintMean_( rhs.constraintMean_ ),
+ constraintWidth_( rhs.constraintWidth_ )
{
- // Check length of vector matches number of parameter in the formula
- Int_t nPars = paramVec_.size();
- if (formula_.GetNpar() != nPars){
- std::cerr<<"ERROR in LauFormulaPar::evaluate : Number of parameters in the formula is : "<<formula_.GetNpar()<< " and the number of LauParameters is : "<<nPars<<std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- if (formula_.GetNdim() != 0){
- std::cerr<<"ERROR in LauFormulaPar::evaluate : Given formula of dimension: "<<formula_.GetNdim()<<" and not 0"<<std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // Array of input parameters
- paramArray_ = new Double_t[nPars];
+ // Check length of vector matches number of parameter in the formula
+ Int_t nPars = paramVec_.size();
+ if ( formula_.GetNpar() != nPars ) {
+ std::cerr << "ERROR in LauFormulaPar::evaluate : Number of parameters in the formula is : "
+ << formula_.GetNpar() << " and the number of LauParameters is : " << nPars
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ if ( formula_.GetNdim() != 0 ) {
+ std::cerr << "ERROR in LauFormulaPar::evaluate : Given formula of dimension: "
+ << formula_.GetNdim() << " and not 0" << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // Array of input parameters
+ paramArray_ = new Double_t[nPars];
}
-LauFormulaPar& LauFormulaPar::operator=(const LauFormulaPar& rhs)
+LauFormulaPar& LauFormulaPar::operator=( const LauFormulaPar& rhs )
{
- if ( &rhs != this ) {
- name_ = rhs.name_;
- formula_ = rhs.formula_;
-
- Int_t nOldPars = paramVec_.size();
- Int_t nNewPars = rhs.paramVec_.size();
-
- paramVec_ = rhs.paramVec_;
- if ( nOldPars != nNewPars ) {
- delete [] paramArray_;
- paramArray_ = new Double_t[nNewPars];
- }
-
- gaussConstraint_ = rhs.gaussConstraint_;
- constraintTrueMean_ = rhs.constraintTrueMean_;
- constraintMean_ = rhs.constraintMean_;
- constraintWidth_ = rhs.constraintWidth_;
- }
- return *this;
+ if ( &rhs != this ) {
+ name_ = rhs.name_;
+ formula_ = rhs.formula_;
+
+ Int_t nOldPars = paramVec_.size();
+ Int_t nNewPars = rhs.paramVec_.size();
+
+ paramVec_ = rhs.paramVec_;
+ if ( nOldPars != nNewPars ) {
+ delete[] paramArray_;
+ paramArray_ = new Double_t[nNewPars];
+ }
+
+ gaussConstraint_ = rhs.gaussConstraint_;
+ constraintTrueMean_ = rhs.constraintTrueMean_;
+ constraintMean_ = rhs.constraintMean_;
+ constraintWidth_ = rhs.constraintWidth_;
+ }
+ return *this;
}
Double_t LauFormulaPar::value() const
{
- //Assign vector values to array
- Int_t nPars = paramVec_.size();
+ //Assign vector values to array
+ Int_t nPars = paramVec_.size();
- for(Int_t i=0; i<nPars; ++i){
- paramArray_[i] = paramVec_[i]->value();
- }
+ for ( Int_t i = 0; i < nPars; ++i ) {
+ paramArray_[i] = paramVec_[i]->value();
+ }
- return formula_.EvalPar(nullptr,paramArray_);
+ return formula_.EvalPar( nullptr, paramArray_ );
}
Double_t LauFormulaPar::unblindValue() const
{
- //Assign vector values to array
- Int_t nPars = paramVec_.size();
+ //Assign vector values to array
+ Int_t nPars = paramVec_.size();
- for(Int_t i=0; i<nPars; ++i){
- paramArray_[i] = paramVec_[i]->unblindValue();
- }
+ for ( Int_t i = 0; i < nPars; ++i ) {
+ paramArray_[i] = paramVec_[i]->unblindValue();
+ }
- return formula_.EvalPar(nullptr,paramArray_);
+ return formula_.EvalPar( nullptr, paramArray_ );
}
Double_t LauFormulaPar::genValue() const
{
- //Assign vector values to array
- Int_t nPars = paramVec_.size();
+ //Assign vector values to array
+ Int_t nPars = paramVec_.size();
- for(Int_t i=0; i<nPars; ++i){
- paramArray_[i] = paramVec_[i]->genValue();
- }
+ for ( Int_t i = 0; i < nPars; ++i ) {
+ paramArray_[i] = paramVec_[i]->genValue();
+ }
- return formula_.EvalPar(nullptr,paramArray_);
+ return formula_.EvalPar( nullptr, paramArray_ );
}
Double_t LauFormulaPar::initValue() const
{
- //Assign vector values to array
- Int_t nPars = paramVec_.size();
+ //Assign vector values to array
+ Int_t nPars = paramVec_.size();
- for(Int_t i=0; i<nPars; ++i){
- paramArray_[i] = paramVec_[i]->initValue();
- }
+ for ( Int_t i = 0; i < nPars; ++i ) {
+ paramArray_[i] = paramVec_[i]->initValue();
+ }
- return formula_.EvalPar(nullptr,paramArray_);
+ return formula_.EvalPar( nullptr, paramArray_ );
}
Bool_t LauFormulaPar::fixed() const
{
- for ( std::vector<LauParameter*>::const_iterator iter = paramVec_.begin(); iter != paramVec_.end(); ++iter ) {
- if ( !(*iter)->fixed() ) { return kFALSE; }
- }
- return kTRUE;
+ for ( std::vector<LauParameter*>::const_iterator iter = paramVec_.begin();
+ iter != paramVec_.end();
+ ++iter ) {
+ if ( ! ( *iter )->fixed() ) {
+ return kFALSE;
+ }
+ }
+ return kTRUE;
}
Bool_t LauFormulaPar::blind() const
{
- for ( std::vector<LauParameter*>::const_iterator iter = paramVec_.begin(); iter != paramVec_.end(); ++iter ) {
- if ( (*iter)->blind() ) { return kTRUE; }
- }
- return kFALSE;
+ for ( std::vector<LauParameter*>::const_iterator iter = paramVec_.begin();
+ iter != paramVec_.end();
+ ++iter ) {
+ if ( ( *iter )->blind() ) {
+ return kTRUE;
+ }
+ }
+ return kFALSE;
}
-void LauFormulaPar::addGaussianConstraint(Double_t newGaussMean, Double_t newGaussWidth)
+void LauFormulaPar::addGaussianConstraint( Double_t newGaussMean, Double_t newGaussWidth )
{
- gaussConstraint_ = kTRUE;
- constraintTrueMean_ = newGaussMean;
- constraintMean_ = newGaussMean;
- constraintWidth_ = newGaussWidth;
+ gaussConstraint_ = kTRUE;
+ constraintTrueMean_ = newGaussMean;
+ constraintMean_ = newGaussMean;
+ constraintWidth_ = newGaussWidth;
}
void LauFormulaPar::removeGaussianConstraint()
{
- gaussConstraint_ = kFALSE;
+ gaussConstraint_ = kFALSE;
}
void LauFormulaPar::generateConstraintMean()
{
- constraintMean_ = LauRandom::randomFun()->Gaus( constraintTrueMean_, constraintWidth_ );
+ constraintMean_ = LauRandom::randomFun()->Gaus( constraintTrueMean_, constraintWidth_ );
}
Double_t LauFormulaPar::constraintPenalty() const
{
- const Double_t val { this->unblindValue() };
- const Double_t diff { val - constraintMean_ };
- const Double_t term { diff * diff };
+ const Double_t val { this->unblindValue() };
+ const Double_t diff { val - constraintMean_ };
+ const Double_t term { diff * diff };
- return term / ( 2.0 * constraintWidth_ * constraintWidth_ );
+ return term / ( 2.0 * constraintWidth_ * constraintWidth_ );
}
-
diff --git a/src/LauGaussIncohRes.cc b/src/LauGaussIncohRes.cc
index 3a2a682..a1260d0 100644
--- a/src/LauGaussIncohRes.cc
+++ b/src/LauGaussIncohRes.cc
@@ -1,98 +1,101 @@
/*
Copyright 2014 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauGaussIncohRes.cc
\brief File containing implementation of LauGaussIncohRes class.
*/
-#include <iostream>
+#include "LauGaussIncohRes.hh"
#include "LauConstants.hh"
-#include "LauGaussIncohRes.hh"
#include "LauKinematics.hh"
+#include <iostream>
-LauGaussIncohRes::LauGaussIncohRes(LauResonanceInfo* resInfo, const Int_t resPairAmpInt, const LauDaughters* daughters) :
- LauAbsIncohRes(resInfo, resPairAmpInt, daughters)
+LauGaussIncohRes::LauGaussIncohRes( LauResonanceInfo* resInfo,
+ const Int_t resPairAmpInt,
+ const LauDaughters* daughters ) :
+ LauAbsIncohRes( resInfo, resPairAmpInt, daughters )
{
}
LauGaussIncohRes::~LauGaussIncohRes()
{
}
void LauGaussIncohRes::initialise()
{
}
-Double_t LauGaussIncohRes::intensityFactor(const LauKinematics* kinematics)
+Double_t LauGaussIncohRes::intensityFactor( const LauKinematics* kinematics )
{
- Int_t pair = this->getPairInt();
- Double_t mass(0.);
-
- switch(pair) {
- case 1:
- mass = kinematics->getm23();
- break;
- case 2:
- mass = kinematics->getm13();
- break;
- case 3:
- mass = kinematics->getm12();
- break;
- default:
- std::cerr << "ERROR in LauGaussIncohRes::intensityFactor : Incorrect daughter pair defined." << std::endl;
- std::cerr << " Returning zero intensity." << std::endl;
- return 0.;
- }
-
- Double_t m0 = this->getMass();
- Double_t G0 = this->getWidth();
-
- if(G0==0) {
- std::cerr << "ERROR in LauGaussIncohRes::intensityFactor : Gaussian width cannot be zero." << std::endl;
- std::cerr << " Returning zero intensity." << std::endl;
- return 0.;
- }
-
- Double_t exponent = -0.5 * ( mass - m0 ) * (mass - m0 ) / (G0*G0);
- Double_t intensity = TMath::Exp(exponent);
-
- return intensity;
+ Int_t pair = this->getPairInt();
+ Double_t mass( 0. );
+
+ switch ( pair ) {
+ case 1 :
+ mass = kinematics->getm23();
+ break;
+ case 2 :
+ mass = kinematics->getm13();
+ break;
+ case 3 :
+ mass = kinematics->getm12();
+ break;
+ default :
+ std::cerr << "ERROR in LauGaussIncohRes::intensityFactor : Incorrect daughter pair defined."
+ << std::endl;
+ std::cerr << " Returning zero intensity." << std::endl;
+ return 0.;
+ }
+
+ Double_t m0 = this->getMass();
+ Double_t G0 = this->getWidth();
+
+ if ( G0 == 0 ) {
+ std::cerr << "ERROR in LauGaussIncohRes::intensityFactor : Gaussian width cannot be zero."
+ << std::endl;
+ std::cerr << " Returning zero intensity." << std::endl;
+ return 0.;
+ }
+
+ Double_t exponent = -0.5 * ( mass - m0 ) * ( mass - m0 ) / ( G0 * G0 );
+ Double_t intensity = TMath::Exp( exponent );
+
+ return intensity;
}
const std::vector<LauParameter*>& LauGaussIncohRes::getFloatingParameters()
{
- this->clearFloatingParameters();
+ this->clearFloatingParameters();
- if ( ! this->fixMass() ) {
- this->addFloatingParameter( this->getMassPar() );
- }
- if ( ! this->fixWidth() ) {
- this->addFloatingParameter( this->getWidthPar() );
- }
+ if ( ! this->fixMass() ) {
+ this->addFloatingParameter( this->getMassPar() );
+ }
+ if ( ! this->fixWidth() ) {
+ this->addFloatingParameter( this->getWidthPar() );
+ }
- return this->getParameters();
+ return this->getParameters();
}
-
diff --git a/src/LauGaussPdf.cc b/src/LauGaussPdf.cc
index 81351ca..2329c8c 100644
--- a/src/LauGaussPdf.cc
+++ b/src/LauGaussPdf.cc
@@ -1,144 +1,146 @@
/*
Copyright 2006 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauGaussPdf.cc
\brief File containing implementation of LauGaussPdf class.
*/
#include <iostream>
#include <vector>
-using std::cout;
using std::cerr;
+using std::cout;
using std::endl;
-#include "TMath.h"
-#include "TSystem.h"
-
#include "LauConstants.hh"
#include "LauGaussPdf.hh"
+#include "TMath.h"
+#include "TSystem.h"
-
-LauGaussPdf::LauGaussPdf(const TString& theVarName, const std::vector<LauAbsRValue*>& params, Double_t minAbscissa, Double_t maxAbscissa) :
- LauAbsPdf(theVarName, params, minAbscissa, maxAbscissa),
- mean_(0),
- sigma_(0)
+LauGaussPdf::LauGaussPdf( const TString& theVarName,
+ const std::vector<LauAbsRValue*>& params,
+ Double_t minAbscissa,
+ Double_t maxAbscissa ) :
+ LauAbsPdf( theVarName, params, minAbscissa, maxAbscissa ),
+ mean_( 0 ),
+ sigma_( 0 )
{
- // Constructor for the Gaussian PDF.
- //
- // The parameters in params are the mean and the sigma (half the width) of the gaussian.
- // The last two arguments specify the range in which the PDF is defined, and the PDF
- // will be normalised w.r.t. these limits.
-
- mean_ = this->findParameter("mean");
- sigma_ = this->findParameter("sigma");
-
- if ((this->nParameters() != 2) || (mean_ == 0) || (sigma_ == 0)) {
- cerr<<"ERROR in LauGaussPdf constructor: LauGaussPdf requires 2 parameters: \"mean\" and \"sigma\"."<<endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // Cache the normalisation factor
- this->calcNorm();
+ // Constructor for the Gaussian PDF.
+ //
+ // The parameters in params are the mean and the sigma (half the width) of the gaussian.
+ // The last two arguments specify the range in which the PDF is defined, and the PDF
+ // will be normalised w.r.t. these limits.
+
+ mean_ = this->findParameter( "mean" );
+ sigma_ = this->findParameter( "sigma" );
+
+ if ( ( this->nParameters() != 2 ) || ( mean_ == 0 ) || ( sigma_ == 0 ) ) {
+ cerr << "ERROR in LauGaussPdf constructor: LauGaussPdf requires 2 parameters: \"mean\" and \"sigma\"."
+ << endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // Cache the normalisation factor
+ this->calcNorm();
}
-LauGaussPdf::~LauGaussPdf()
+LauGaussPdf::~LauGaussPdf()
{
- // Destructor
+ // Destructor
}
-void LauGaussPdf::calcLikelihoodInfo(const LauAbscissas& abscissas)
+void LauGaussPdf::calcLikelihoodInfo( const LauAbscissas& abscissas )
{
- // Check that the given abscissa is within the allowed range
- if (!this->checkRange(abscissas)) {
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // Get our abscissa
- Double_t abscissa = abscissas[0];
-
- // Get the up to date parameter values
- Double_t mean = mean_->unblindValue();
- Double_t sigma = sigma_->unblindValue();
-
- // Calculate the value of the Gaussian for the given value of the abscissa.
- Double_t arg = abscissa - mean;
-
- Double_t exponent(0.0);
- if (TMath::Abs(sigma) > 1e-10) {
- exponent = -0.5*arg*arg/(sigma*sigma);
- }
-
- Double_t value = TMath::Exp(exponent);
- this->setUnNormPDFVal(value);
-
- // if the parameters are floating then we
- // need to recalculate the normalisation
- if (!this->cachePDF() && !this->withinNormCalc() && !this->withinGeneration()) {
- this->calcNorm();
- }
-
+ // Check that the given abscissa is within the allowed range
+ if ( ! this->checkRange( abscissas ) ) {
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // Get our abscissa
+ Double_t abscissa = abscissas[0];
+
+ // Get the up to date parameter values
+ Double_t mean = mean_->unblindValue();
+ Double_t sigma = sigma_->unblindValue();
+
+ // Calculate the value of the Gaussian for the given value of the abscissa.
+ Double_t arg = abscissa - mean;
+
+ Double_t exponent( 0.0 );
+ if ( TMath::Abs( sigma ) > 1e-10 ) {
+ exponent = -0.5 * arg * arg / ( sigma * sigma );
+ }
+
+ Double_t value = TMath::Exp( exponent );
+ this->setUnNormPDFVal( value );
+
+ // if the parameters are floating then we
+ // need to recalculate the normalisation
+ if ( ! this->cachePDF() && ! this->withinNormCalc() && ! this->withinGeneration() ) {
+ this->calcNorm();
+ }
}
-void LauGaussPdf::calcNorm()
+void LauGaussPdf::calcNorm()
{
- // Get the up to date parameter values
- Double_t mean = mean_->unblindValue();
- Double_t sigma = sigma_->unblindValue();
+ // Get the up to date parameter values
+ Double_t mean = mean_->unblindValue();
+ Double_t sigma = sigma_->unblindValue();
- // Calculate the normalisation of the gaussian and cache it.
- Double_t scale = LauConstants::root2*sigma;
- Double_t norm(0.0);
+ // Calculate the normalisation of the gaussian and cache it.
+ Double_t scale = LauConstants::root2 * sigma;
+ Double_t norm( 0.0 );
- if (TMath::Abs(sigma) > 1e-10) {
- norm = LauConstants::rootPiBy2*sigma*(TMath::Erf((this->getMaxAbscissa() - mean)/scale) - TMath::Erf((this->getMinAbscissa() - mean)/scale));
- }
+ if ( TMath::Abs( sigma ) > 1e-10 ) {
+ norm = LauConstants::rootPiBy2 * sigma *
+ ( TMath::Erf( ( this->getMaxAbscissa() - mean ) / scale ) -
+ TMath::Erf( ( this->getMinAbscissa() - mean ) / scale ) );
+ }
- this->setNorm(norm);
+ this->setNorm( norm );
}
-void LauGaussPdf::calcPDFHeight(const LauKinematics* /*kinematics*/)
+void LauGaussPdf::calcPDFHeight( const LauKinematics* /*kinematics*/ )
{
- if (this->heightUpToDate()) {
- return;
- }
-
- // Get the up to date parameter values
- Double_t mean = mean_->unblindValue();
-
- LauAbscissas maxPoint(1);
- maxPoint[0] = mean;
-
- // Calculate the PDF height for the Gaussian function.
- if (mean>this->getMaxAbscissa()) {
- maxPoint[0] = this->getMaxAbscissa();
- } else if (mean<this->getMinAbscissa()) {
- maxPoint[0] = this->getMinAbscissa();
- }
- this->calcLikelihoodInfo(maxPoint);
-
- Double_t height = this->getUnNormLikelihood();
- this->setMaxHeight(height);
+ if ( this->heightUpToDate() ) {
+ return;
+ }
+
+ // Get the up to date parameter values
+ Double_t mean = mean_->unblindValue();
+
+ LauAbscissas maxPoint( 1 );
+ maxPoint[0] = mean;
+
+ // Calculate the PDF height for the Gaussian function.
+ if ( mean > this->getMaxAbscissa() ) {
+ maxPoint[0] = this->getMaxAbscissa();
+ } else if ( mean < this->getMinAbscissa() ) {
+ maxPoint[0] = this->getMinAbscissa();
+ }
+ this->calcLikelihoodInfo( maxPoint );
+
+ Double_t height = this->getUnNormLikelihood();
+ this->setMaxHeight( height );
}
-
diff --git a/src/LauGenNtuple.cc b/src/LauGenNtuple.cc
index 8686e05..432fe09 100644
--- a/src/LauGenNtuple.cc
+++ b/src/LauGenNtuple.cc
@@ -1,216 +1,227 @@
/*
Copyright 2006 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauGenNtuple.cc
\brief File containing implementation of LauGenNtuple class.
*/
#include <iostream>
-using std::cout;
using std::cerr;
+using std::cout;
using std::endl;
-#include "TFile.h"
-#include "TTree.h"
-
#include "LauGenNtuple.hh"
+#include "TFile.h"
+#include "TTree.h"
-
-LauGenNtuple::LauGenNtuple(const TString& rootFileName, const TString& rootTreeName) :
- rootFileName_(rootFileName),
- rootTreeName_(rootTreeName),
- rootFile_(0),
- rootTree_(0),
- definedBranches_(kFALSE)
+LauGenNtuple::LauGenNtuple( const TString& rootFileName, const TString& rootTreeName ) :
+ rootFileName_( rootFileName ),
+ rootTreeName_( rootTreeName ),
+ rootFile_( 0 ),
+ rootTree_( 0 ),
+ definedBranches_( kFALSE )
{
- this->createFileAndTree();
+ this->createFileAndTree();
}
LauGenNtuple::~LauGenNtuple()
{
- // seems that closing the file deletes the tree
- // so only delete if the file is still open for some reason
- if (rootFile_ && rootFile_->IsOpen()) {
- delete rootTree_; rootTree_ = 0;
- }
- delete rootFile_; rootFile_ = 0;
+ // seems that closing the file deletes the tree
+ // so only delete if the file is still open for some reason
+ if ( rootFile_ && rootFile_->IsOpen() ) {
+ delete rootTree_;
+ rootTree_ = 0;
+ }
+ delete rootFile_;
+ rootFile_ = 0;
}
void LauGenNtuple::createFileAndTree()
{
- // first check whether we've already opened up the file or not
- if (!rootFile_) {
- // if not, first check the filename and if all ok create the file
- if (rootFileName_ == "") {
- cerr<<"ERROR in LauGenNtuple::createFileAndTree : Bad filename supplied, not creating file or tree."<<endl;
- return;
- }
- rootFile_ = TFile::Open(rootFileName_, "recreate");
- if (!rootFile_ || rootFile_->IsZombie() || !rootFile_->IsWritable()) {
- cerr<<"ERROR in LauGenNtuple::createFileAndTree : Problem opening file \""<<rootFileName_<<"\" for writing, not creating tree."<<endl;
- return;
- }
- }
- // check whether we've already created the tree
- if (!rootTree_) {
- // if not change to the file's directory and create the tree
- rootFile_->cd();
- rootTree_ = new TTree(rootTreeName_, rootTreeName_);
- rootTree_->SetDirectory(rootFile_);
- this->definedBranches(kFALSE);
- }
+ // first check whether we've already opened up the file or not
+ if ( ! rootFile_ ) {
+ // if not, first check the filename and if all ok create the file
+ if ( rootFileName_ == "" ) {
+ cerr << "ERROR in LauGenNtuple::createFileAndTree : Bad filename supplied, not creating file or tree."
+ << endl;
+ return;
+ }
+ rootFile_ = TFile::Open( rootFileName_, "recreate" );
+ if ( ! rootFile_ || rootFile_->IsZombie() || ! rootFile_->IsWritable() ) {
+ cerr << "ERROR in LauGenNtuple::createFileAndTree : Problem opening file \""
+ << rootFileName_ << "\" for writing, not creating tree." << endl;
+ return;
+ }
+ }
+ // check whether we've already created the tree
+ if ( ! rootTree_ ) {
+ // if not change to the file's directory and create the tree
+ rootFile_->cd();
+ rootTree_ = new TTree( rootTreeName_, rootTreeName_ );
+ rootTree_->SetDirectory( rootFile_ );
+ this->definedBranches( kFALSE );
+ }
}
-void LauGenNtuple::addIntegerBranch(const TString& name)
+void LauGenNtuple::addIntegerBranch( const TString& name )
{
- if (this->definedBranches()) {
- cerr<<"ERROR in LauGenNtuple::addIntegerBranch : Already defined branches, can't add further ones."<<endl;
- return;
- }
- this->setIntegerBranchValue(name, 0);
+ if ( this->definedBranches() ) {
+ cerr << "ERROR in LauGenNtuple::addIntegerBranch : Already defined branches, can't add further ones."
+ << endl;
+ return;
+ }
+ this->setIntegerBranchValue( name, 0 );
}
-void LauGenNtuple::addDoubleBranch(const TString& name)
+void LauGenNtuple::addDoubleBranch( const TString& name )
{
- if (this->definedBranches()) {
- cerr<<"ERROR in LauGenNtuple::addDoubleBranch : Already defined branches, can't add further ones."<<endl;
- return;
- }
- this->setDoubleBranchValue(name, 0.0);
+ if ( this->definedBranches() ) {
+ cerr << "ERROR in LauGenNtuple::addDoubleBranch : Already defined branches, can't add further ones."
+ << endl;
+ return;
+ }
+ this->setDoubleBranchValue( name, 0.0 );
}
-void LauGenNtuple::setIntegerBranchValue(const TString& name, Int_t value)
+void LauGenNtuple::setIntegerBranchValue( const TString& name, Int_t value )
{
- intVars_[name] = value;
+ intVars_[name] = value;
}
-void LauGenNtuple::setDoubleBranchValue(const TString& name, Double_t value)
+void LauGenNtuple::setDoubleBranchValue( const TString& name, Double_t value )
{
- doubleVars_[name] = value;
+ doubleVars_[name] = value;
}
-Int_t LauGenNtuple::getIntegerBranchValue(const TString& name) const
+Int_t LauGenNtuple::getIntegerBranchValue( const TString& name ) const
{
- IntVarMap::const_iterator iter = intVars_.find( name );
- if ( iter == intVars_.end() ) {
- cerr<<"ERROR in LauGenNtuple::getIntegerBranchValue : no such branch \""<<name<<"\"."<<endl;
- return -99;
- } else {
- return iter->second;
- }
+ IntVarMap::const_iterator iter = intVars_.find( name );
+ if ( iter == intVars_.end() ) {
+ cerr << "ERROR in LauGenNtuple::getIntegerBranchValue : no such branch \"" << name << "\"."
+ << endl;
+ return -99;
+ } else {
+ return iter->second;
+ }
}
-Double_t LauGenNtuple::getDoubleBranchValue(const TString& name) const
+Double_t LauGenNtuple::getDoubleBranchValue( const TString& name ) const
{
- DoubleVarMap::const_iterator iter = doubleVars_.find( name );
- if ( iter == doubleVars_.end() ) {
- cerr<<"ERROR in LauGenNtuple::getDoubleBranchValue : no such branch \""<<name<<"\"."<<endl;
- return -99.0;
- } else {
- return iter->second;
- }
+ DoubleVarMap::const_iterator iter = doubleVars_.find( name );
+ if ( iter == doubleVars_.end() ) {
+ cerr << "ERROR in LauGenNtuple::getDoubleBranchValue : no such branch \"" << name << "\"."
+ << endl;
+ return -99.0;
+ } else {
+ return iter->second;
+ }
}
void LauGenNtuple::defineBranches()
{
- if (this->definedBranches()) {
- cerr<<"ERROR in LauGenNtuple::defineBranches : Already defined branches, not doing it again."<<endl;
- return;
- }
- for (IntVarMap::iterator iter = intVars_.begin(); iter != intVars_.end(); ++iter) {
- TString name = iter->first;
- Int_t * pointer = &(iter->second);
- TString thirdPart(name); thirdPart += "/I";
- rootTree_->Branch(name, pointer, thirdPart);
- }
- for (DoubleVarMap::iterator iter = doubleVars_.begin(); iter != doubleVars_.end(); ++iter) {
- TString name = iter->first;
- Double_t * pointer = &(iter->second);
- TString thirdPart(name); thirdPart += "/D";
- rootTree_->Branch(name, pointer, thirdPart);
- }
- this->definedBranches(kTRUE);
+ if ( this->definedBranches() ) {
+ cerr << "ERROR in LauGenNtuple::defineBranches : Already defined branches, not doing it again."
+ << endl;
+ return;
+ }
+ for ( IntVarMap::iterator iter = intVars_.begin(); iter != intVars_.end(); ++iter ) {
+ TString name = iter->first;
+ Int_t* pointer = &( iter->second );
+ TString thirdPart( name );
+ thirdPart += "/I";
+ rootTree_->Branch( name, pointer, thirdPart );
+ }
+ for ( DoubleVarMap::iterator iter = doubleVars_.begin(); iter != doubleVars_.end(); ++iter ) {
+ TString name = iter->first;
+ Double_t* pointer = &( iter->second );
+ TString thirdPart( name );
+ thirdPart += "/D";
+ rootTree_->Branch( name, pointer, thirdPart );
+ }
+ this->definedBranches( kTRUE );
}
void LauGenNtuple::fillBranches()
{
- if (!rootTree_) {
- cerr<<"ERROR in LauGenNtuple::fillBranches : Tree not created, cannot fill branches."<<endl;
- return;
- } else if (!this->definedBranches()) {
- this->defineBranches();
- }
- rootTree_->Fill();
+ if ( ! rootTree_ ) {
+ cerr << "ERROR in LauGenNtuple::fillBranches : Tree not created, cannot fill branches."
+ << endl;
+ return;
+ } else if ( ! this->definedBranches() ) {
+ this->defineBranches();
+ }
+ rootTree_->Fill();
}
void LauGenNtuple::deleteAndRecreateTree()
{
- if (rootTree_) {
- delete rootTree_;
- rootTree_ = 0;
- }
- this->createFileAndTree();
+ if ( rootTree_ ) {
+ delete rootTree_;
+ rootTree_ = 0;
+ }
+ this->createFileAndTree();
}
-Int_t LauGenNtuple::buildIndex(const TString& majorName, const TString& minorName)
+Int_t LauGenNtuple::buildIndex( const TString& majorName, const TString& minorName )
{
- if (!rootTree_) {
- cerr<<"ERROR in LauGenNtuple::buildIndex : Tree not created, cannot build index."<<endl;
- return -1;
- }
- return rootTree_->BuildIndex(majorName, minorName);
+ if ( ! rootTree_ ) {
+ cerr << "ERROR in LauGenNtuple::buildIndex : Tree not created, cannot build index." << endl;
+ return -1;
+ }
+ return rootTree_->BuildIndex( majorName, minorName );
}
void LauGenNtuple::writeOutGenResults()
{
- // Write out the generated ntuple
-
- // Check that the file is open
- if ( rootFile_ == 0 ) {
- cerr<<"ERROR in LauGenNtuple::writeOutGenResults : File not opened, can't write anything."<<endl;
- return;
- }
-
- // Check that the tree exists and if so then make sure we have the
- // up to date pointer to the file since if it splits via the
- // TTree::ChangeFile mechanism we're left with a dangling pointer
- if ( rootTree_ != 0 ) {
- rootFile_ = rootTree_->GetCurrentFile();
- }
- rootFile_->cd();
- rootTree_->Write("",TObject::kOverwrite);
- rootFile_->Close();
- delete rootFile_; rootFile_ = 0;
+ // Write out the generated ntuple
+
+ // Check that the file is open
+ if ( rootFile_ == 0 ) {
+ cerr << "ERROR in LauGenNtuple::writeOutGenResults : File not opened, can't write anything."
+ << endl;
+ return;
+ }
+
+ // Check that the tree exists and if so then make sure we have the
+ // up to date pointer to the file since if it splits via the
+ // TTree::ChangeFile mechanism we're left with a dangling pointer
+ if ( rootTree_ != 0 ) {
+ rootFile_ = rootTree_->GetCurrentFile();
+ }
+ rootFile_->cd();
+ rootTree_->Write( "", TObject::kOverwrite );
+ rootFile_->Close();
+ delete rootFile_;
+ rootFile_ = 0;
}
-void LauGenNtuple::addFriendTree(const TString& rootFileName, const TString& rootTreeName)
+void LauGenNtuple::addFriendTree( const TString& rootFileName, const TString& rootTreeName )
{
- if (!rootTree_) {
- cerr<<"ERROR in LauGenNtuple::addFriendTree : Tree not created, cannot add friend."<<endl;
- return;
- }
- rootTree_->AddFriend(rootTreeName,rootFileName);
+ if ( ! rootTree_ ) {
+ cerr << "ERROR in LauGenNtuple::addFriendTree : Tree not created, cannot add friend." << endl;
+ return;
+ }
+ rootTree_->AddFriend( rootTreeName, rootFileName );
}
-
diff --git a/src/LauGounarisSakuraiRes.cc b/src/LauGounarisSakuraiRes.cc
index 5be8bf0..e20ab3d 100644
--- a/src/LauGounarisSakuraiRes.cc
+++ b/src/LauGounarisSakuraiRes.cc
@@ -1,252 +1,258 @@
/*
Copyright 2006 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauGounarisSakuraiRes.cc
\brief File containing implementation of LauGounarisSakuraiRes class.
*/
-#include <iostream>
-
-#include "LauConstants.hh"
#include "LauGounarisSakuraiRes.hh"
+#include "LauConstants.hh"
+#include <iostream>
-LauGounarisSakuraiRes::LauGounarisSakuraiRes(LauResonanceInfo* resInfo, const Int_t resPairAmpInt, const LauDaughters* daughters) :
- LauAbsResonance(resInfo, resPairAmpInt, daughters),
- q0_(0.0),
- resMass_(0.0),
- resMassSq_(0.0),
- resWidth_(0.0),
- resRadius_(0.0),
- parRadius_(0.0),
- mDaugSum_(0.0),
- mDaugSumSq_(0.0),
- mDaugDiff_(0.0),
- mDaugDiffSq_(0.0),
- mParentSq_(0.0),
- mBachSq_(0.0),
- h0_(0.0),
- dhdm0_(0.0),
- d_(0.0),
- FR0_(1.0)
+LauGounarisSakuraiRes::LauGounarisSakuraiRes( LauResonanceInfo* resInfo,
+ const Int_t resPairAmpInt,
+ const LauDaughters* daughters ) :
+ LauAbsResonance( resInfo, resPairAmpInt, daughters ),
+ q0_( 0.0 ),
+ resMass_( 0.0 ),
+ resMassSq_( 0.0 ),
+ resWidth_( 0.0 ),
+ resRadius_( 0.0 ),
+ parRadius_( 0.0 ),
+ mDaugSum_( 0.0 ),
+ mDaugSumSq_( 0.0 ),
+ mDaugDiff_( 0.0 ),
+ mDaugDiffSq_( 0.0 ),
+ mParentSq_( 0.0 ),
+ mBachSq_( 0.0 ),
+ h0_( 0.0 ),
+ dhdm0_( 0.0 ),
+ d_( 0.0 ),
+ FR0_( 1.0 )
{
}
LauGounarisSakuraiRes::~LauGounarisSakuraiRes()
{
}
void LauGounarisSakuraiRes::initialise()
{
- // Set-up various constants. This must be called again if the mass/width/spin
- // of a resonance changes...
-
- resMass_ = this->getMass();
- resWidth_ = this->getWidth();
- resRadius_ = this->getResRadius();
- parRadius_ = this->getParRadius();
-
- Double_t massDaug1 = this->getMassDaug1();
- Double_t massDaug2 = this->getMassDaug2();
- Double_t massBachelor = this->getMassBachelor();
- Double_t massParent = this->getMassParent();
-
- // Check that the spin is 1
- Int_t resSpin = this->getSpin();
- if (resSpin != 1) {
- std::cerr << "WARNING in LauGounarisSakuraiRes::initialise : Resonance spin is != 1. This lineshape is for the rho(770), setting the spin to 1." << std::endl;
- this->changeResonance( -1.0, -1.0, 1 );
- resSpin = this->getSpin();
- }
-
- // Create the mass squares, sums, differences etc.
- resMassSq_ = resMass_*resMass_;
- mDaugSum_ = massDaug1 + massDaug2;
- mDaugSumSq_ = mDaugSum_*mDaugSum_;
- mDaugDiff_ = massDaug1 - massDaug2;
- mDaugDiffSq_ = mDaugDiff_*mDaugDiff_;
- mParentSq_ = massParent*massParent;
- mBachSq_ = massBachelor*massBachelor;
-
- // Create an effective resonance pole mass to protect against resonances
- // that are below threshold
- Double_t effResMass = resMass_;
- Double_t effResMassSq = resMassSq_;
- if ( resMassSq_ - mDaugSumSq_ < 0.0 ) {
- Double_t minMass = mDaugSum_;
- Double_t maxMass = massParent - massBachelor;
- Double_t tanhTerm = std::tanh( (resMass_ - ((minMass + maxMass)/2))/(maxMass-minMass));
- effResMass = minMass + (maxMass-minMass)*(1+tanhTerm)/2;
- effResMassSq = effResMass*effResMass;
- }
-
- // Decay momentum of either daughter in the resonance rest frame
- // when resonance mass = rest-mass value, m_0 (PDG value)
- Double_t term1 = effResMassSq - mDaugSumSq_;
- Double_t term2 = effResMassSq - mDaugDiffSq_;
- Double_t term12 = term1*term2;
- if (term12 > 0.0) {
- q0_ = TMath::Sqrt(term12)/(2.0*effResMass);
- } else {
- q0_ = 0.0;
- }
-
- // Calculate the Blatt-Weisskopf form factor for the case when m = m_0
- FR0_ = 1.0;
- if ( this->getSpin() > 0 ) {
- const LauBlattWeisskopfFactor* resBWFactor = this->getResBWFactor();
- if ( resBWFactor != nullptr ) {
- FR0_ = resBWFactor->calcFormFactor(q0_);
- }
- }
-
- // Calculate the extra things needed by the G-S shape
- h0_ = 2.0*LauConstants::invPi * q0_/effResMass * TMath::Log((effResMass + 2.0*q0_)/(2.0*LauConstants::mPi));
- dhdm0_ = h0_ * (1.0/(8.0*q0_*q0_) - 1.0/(2.0*effResMassSq)) + 1.0/(LauConstants::twoPi*effResMassSq);
- d_ = 3.0*LauConstants::invPi * LauConstants::mPi*LauConstants::mPi/(q0_*q0_)
- * TMath::Log((effResMass + 2.0*q0_)/(2.0*LauConstants::mPi))
- + effResMass/(LauConstants::twoPi*q0_)
- - LauConstants::mPi*LauConstants::mPi*effResMass/(LauConstants::pi*q0_*q0_*q0_);
+ // Set-up various constants. This must be called again if the mass/width/spin
+ // of a resonance changes...
+
+ resMass_ = this->getMass();
+ resWidth_ = this->getWidth();
+ resRadius_ = this->getResRadius();
+ parRadius_ = this->getParRadius();
+
+ Double_t massDaug1 = this->getMassDaug1();
+ Double_t massDaug2 = this->getMassDaug2();
+ Double_t massBachelor = this->getMassBachelor();
+ Double_t massParent = this->getMassParent();
+
+ // Check that the spin is 1
+ Int_t resSpin = this->getSpin();
+ if ( resSpin != 1 ) {
+ std::cerr << "WARNING in LauGounarisSakuraiRes::initialise : Resonance spin is != 1. This lineshape is for the rho(770), setting the spin to 1."
+ << std::endl;
+ this->changeResonance( -1.0, -1.0, 1 );
+ resSpin = this->getSpin();
+ }
+
+ // Create the mass squares, sums, differences etc.
+ resMassSq_ = resMass_ * resMass_;
+ mDaugSum_ = massDaug1 + massDaug2;
+ mDaugSumSq_ = mDaugSum_ * mDaugSum_;
+ mDaugDiff_ = massDaug1 - massDaug2;
+ mDaugDiffSq_ = mDaugDiff_ * mDaugDiff_;
+ mParentSq_ = massParent * massParent;
+ mBachSq_ = massBachelor * massBachelor;
+
+ // Create an effective resonance pole mass to protect against resonances
+ // that are below threshold
+ Double_t effResMass = resMass_;
+ Double_t effResMassSq = resMassSq_;
+ if ( resMassSq_ - mDaugSumSq_ < 0.0 ) {
+ Double_t minMass = mDaugSum_;
+ Double_t maxMass = massParent - massBachelor;
+ Double_t tanhTerm = std::tanh( ( resMass_ - ( ( minMass + maxMass ) / 2 ) ) /
+ ( maxMass - minMass ) );
+ effResMass = minMass + ( maxMass - minMass ) * ( 1 + tanhTerm ) / 2;
+ effResMassSq = effResMass * effResMass;
+ }
+
+ // Decay momentum of either daughter in the resonance rest frame
+ // when resonance mass = rest-mass value, m_0 (PDG value)
+ Double_t term1 = effResMassSq - mDaugSumSq_;
+ Double_t term2 = effResMassSq - mDaugDiffSq_;
+ Double_t term12 = term1 * term2;
+ if ( term12 > 0.0 ) {
+ q0_ = TMath::Sqrt( term12 ) / ( 2.0 * effResMass );
+ } else {
+ q0_ = 0.0;
+ }
+
+ // Calculate the Blatt-Weisskopf form factor for the case when m = m_0
+ FR0_ = 1.0;
+ if ( this->getSpin() > 0 ) {
+ const LauBlattWeisskopfFactor* resBWFactor = this->getResBWFactor();
+ if ( resBWFactor != nullptr ) {
+ FR0_ = resBWFactor->calcFormFactor( q0_ );
+ }
+ }
+
+ // Calculate the extra things needed by the G-S shape
+ h0_ = 2.0 * LauConstants::invPi * q0_ / effResMass *
+ TMath::Log( ( effResMass + 2.0 * q0_ ) / ( 2.0 * LauConstants::mPi ) );
+ dhdm0_ = h0_ * ( 1.0 / ( 8.0 * q0_ * q0_ ) - 1.0 / ( 2.0 * effResMassSq ) ) +
+ 1.0 / ( LauConstants::twoPi * effResMassSq );
+ d_ = 3.0 * LauConstants::invPi * LauConstants::mPi * LauConstants::mPi / ( q0_ * q0_ ) *
+ TMath::Log( ( effResMass + 2.0 * q0_ ) / ( 2.0 * LauConstants::mPi ) ) +
+ effResMass / ( LauConstants::twoPi * q0_ ) -
+ LauConstants::mPi * LauConstants::mPi * effResMass / ( LauConstants::pi * q0_ * q0_ * q0_ );
}
-LauComplex LauGounarisSakuraiRes::resAmp(Double_t mass, Double_t spinTerm)
+LauComplex LauGounarisSakuraiRes::resAmp( Double_t mass, Double_t spinTerm )
{
- // This function returns the complex dynamical amplitude for a Breit-Wigner resonance,
- // given the invariant mass and cos(helicity) values.
-
- LauComplex resAmplitude(0.0, 0.0);
-
- if (mass < 1e-10) {
- std::cerr << "WARNING in LauGounarisSakuraiRes::amplitude : mass < 1e-10." << std::endl;
- return LauComplex(0.0, 0.0);
- } else if (q0_ < 1e-30) {
- return LauComplex(0.0, 0.0);
- }
-
- // Calculate the width of the resonance (as a function of mass)
- // First, calculate the various form factors.
- // NB
- // q is the momentum of either daughter in the resonance rest-frame,
- // p is the momentum of the bachelor in the resonance rest-frame,
- // pstar is the momentum of the bachelor in the parent rest-frame.
- // These quantities have been calculate in LauAbsResonance::amplitude(...)
-
- const Double_t resMass = this->getMass();
- const Double_t resWidth = this->getWidth();
- const Double_t resRadius = this->getResRadius();
- const Double_t parRadius = this->getParRadius();
-
- // If the mass is floating and its value has changed we need to
- // recalculate everything that assumes that value
- // Similarly for the BW radii
- if ( ( (!this->fixMass()) && resMass != resMass_ ) ||
- ( (!this->fixResRadius()) && resRadius != resRadius_ ) ||
- ( (!this->fixParRadius()) && parRadius != parRadius_ ) ) {
- this->initialise();
- }
-
- const Int_t resSpin = this->getSpin();
- const Double_t q = this->getQ();
- const Double_t p = this->getP();
- const Double_t pstar = this->getPstar();
-
- Double_t fFactorR(1.0);
- Double_t fFactorB(1.0);
- if ( resSpin > 0 ) {
- const LauBlattWeisskopfFactor* resBWFactor = this->getResBWFactor();
- if ( resBWFactor != nullptr ) {
- fFactorR = resBWFactor->calcFormFactor(q);
- }
-
- const LauBlattWeisskopfFactor* parBWFactor = this->getParBWFactor();
- if ( parBWFactor != nullptr ) {
- switch ( parBWFactor->getRestFrame() ) {
- case LauBlattWeisskopfFactor::ResonanceFrame:
- fFactorB = parBWFactor->calcFormFactor(p);
- break;
- case LauBlattWeisskopfFactor::ParentFrame:
- fFactorB = parBWFactor->calcFormFactor(pstar);
- break;
- case LauBlattWeisskopfFactor::Covariant:
- {
- Double_t covFactor = this->getCovFactor();
- if ( resSpin > 2 ) {
- covFactor = TMath::Power( covFactor, 1.0/resSpin );
- } else if ( resSpin == 2 ) {
- covFactor = TMath::Sqrt( covFactor );
- }
- fFactorB = parBWFactor->calcFormFactor(pstar*covFactor);
- break;
- }
- }
- }
- }
- const Double_t fFactorRRatio = fFactorR/FR0_;
-
- const Double_t qRatio = q/q0_;
- const Double_t qTerm = qRatio*qRatio*qRatio;
-
- const Double_t totWidth = resWidth*qTerm*(resMass/mass)*fFactorRRatio*fFactorRRatio;
-
- const Double_t massSq = mass*mass;
- const Double_t massSqTerm = resMassSq_ - massSq;
-
- const Double_t h = 2.0*LauConstants::invPi * q/mass * TMath::Log((mass + 2.0*q)/(2.0*LauConstants::mPi));
- const Double_t f = resWidth * resMassSq_/(q0_*q0_*q0_) * (q*q * (h - h0_) + massSqTerm * q0_*q0_ * dhdm0_);
-
- // Compute the complex amplitude
- resAmplitude = LauComplex(massSqTerm + f, resMass*totWidth);
-
- // Scale by the denominator factor, as well as the spin term and Blatt-Weisskopf factors
- Double_t numerFactor = spinTerm*(1.0 + d_ * resWidth/resMass);
- if (!this->ignoreBarrierScaling()) {
- numerFactor *= fFactorR * fFactorB;
- }
- const Double_t denomFactor = (massSqTerm + f)*(massSqTerm + f) + resMassSq_*totWidth*totWidth;
- resAmplitude.rescale(numerFactor/denomFactor);
-
- return resAmplitude;
+ // This function returns the complex dynamical amplitude for a Breit-Wigner resonance,
+ // given the invariant mass and cos(helicity) values.
+
+ LauComplex resAmplitude( 0.0, 0.0 );
+
+ if ( mass < 1e-10 ) {
+ std::cerr << "WARNING in LauGounarisSakuraiRes::amplitude : mass < 1e-10." << std::endl;
+ return LauComplex( 0.0, 0.0 );
+ } else if ( q0_ < 1e-30 ) {
+ return LauComplex( 0.0, 0.0 );
+ }
+
+ // Calculate the width of the resonance (as a function of mass)
+ // First, calculate the various form factors.
+ // NB
+ // q is the momentum of either daughter in the resonance rest-frame,
+ // p is the momentum of the bachelor in the resonance rest-frame,
+ // pstar is the momentum of the bachelor in the parent rest-frame.
+ // These quantities have been calculate in LauAbsResonance::amplitude(...)
+
+ const Double_t resMass = this->getMass();
+ const Double_t resWidth = this->getWidth();
+ const Double_t resRadius = this->getResRadius();
+ const Double_t parRadius = this->getParRadius();
+
+ // If the mass is floating and its value has changed we need to
+ // recalculate everything that assumes that value
+ // Similarly for the BW radii
+ if ( ( ( ! this->fixMass() ) && resMass != resMass_ ) ||
+ ( ( ! this->fixResRadius() ) && resRadius != resRadius_ ) ||
+ ( ( ! this->fixParRadius() ) && parRadius != parRadius_ ) ) {
+ this->initialise();
+ }
+
+ const Int_t resSpin = this->getSpin();
+ const Double_t q = this->getQ();
+ const Double_t p = this->getP();
+ const Double_t pstar = this->getPstar();
+
+ Double_t fFactorR( 1.0 );
+ Double_t fFactorB( 1.0 );
+ if ( resSpin > 0 ) {
+ const LauBlattWeisskopfFactor* resBWFactor = this->getResBWFactor();
+ if ( resBWFactor != nullptr ) {
+ fFactorR = resBWFactor->calcFormFactor( q );
+ }
+
+ const LauBlattWeisskopfFactor* parBWFactor = this->getParBWFactor();
+ if ( parBWFactor != nullptr ) {
+ switch ( parBWFactor->getRestFrame() ) {
+ case LauBlattWeisskopfFactor::ResonanceFrame :
+ fFactorB = parBWFactor->calcFormFactor( p );
+ break;
+ case LauBlattWeisskopfFactor::ParentFrame :
+ fFactorB = parBWFactor->calcFormFactor( pstar );
+ break;
+ case LauBlattWeisskopfFactor::Covariant : {
+ Double_t covFactor = this->getCovFactor();
+ if ( resSpin > 2 ) {
+ covFactor = TMath::Power( covFactor, 1.0 / resSpin );
+ } else if ( resSpin == 2 ) {
+ covFactor = TMath::Sqrt( covFactor );
+ }
+ fFactorB = parBWFactor->calcFormFactor( pstar * covFactor );
+ break;
+ }
+ }
+ }
+ }
+ const Double_t fFactorRRatio = fFactorR / FR0_;
+
+ const Double_t qRatio = q / q0_;
+ const Double_t qTerm = qRatio * qRatio * qRatio;
+
+ const Double_t totWidth = resWidth * qTerm * ( resMass / mass ) * fFactorRRatio * fFactorRRatio;
+
+ const Double_t massSq = mass * mass;
+ const Double_t massSqTerm = resMassSq_ - massSq;
+
+ const Double_t h = 2.0 * LauConstants::invPi * q / mass *
+ TMath::Log( ( mass + 2.0 * q ) / ( 2.0 * LauConstants::mPi ) );
+ const Double_t f = resWidth * resMassSq_ / ( q0_ * q0_ * q0_ ) *
+ ( q * q * ( h - h0_ ) + massSqTerm * q0_ * q0_ * dhdm0_ );
+
+ // Compute the complex amplitude
+ resAmplitude = LauComplex( massSqTerm + f, resMass * totWidth );
+
+ // Scale by the denominator factor, as well as the spin term and Blatt-Weisskopf factors
+ Double_t numerFactor = spinTerm * ( 1.0 + d_ * resWidth / resMass );
+ if ( ! this->ignoreBarrierScaling() ) {
+ numerFactor *= fFactorR * fFactorB;
+ }
+ const Double_t denomFactor = ( massSqTerm + f ) * ( massSqTerm + f ) +
+ resMassSq_ * totWidth * totWidth;
+ resAmplitude.rescale( numerFactor / denomFactor );
+
+ return resAmplitude;
}
const std::vector<LauParameter*>& LauGounarisSakuraiRes::getFloatingParameters()
{
- this->clearFloatingParameters();
-
- if ( ! this->fixMass() ) {
- this->addFloatingParameter( this->getMassPar() );
- }
- if ( ! this->fixWidth() ) {
- this->addFloatingParameter( this->getWidthPar() );
- }
- if ( ! this->fixResRadius() ) {
- this->addFloatingParameter( this->getResBWFactor()->getRadiusParameter() );
- }
- if ( ! this->fixParRadius() ) {
- this->addFloatingParameter( this->getParBWFactor()->getRadiusParameter() );
- }
-
- return this->getParameters();
+ this->clearFloatingParameters();
+
+ if ( ! this->fixMass() ) {
+ this->addFloatingParameter( this->getMassPar() );
+ }
+ if ( ! this->fixWidth() ) {
+ this->addFloatingParameter( this->getWidthPar() );
+ }
+ if ( ! this->fixResRadius() ) {
+ this->addFloatingParameter( this->getResBWFactor()->getRadiusParameter() );
+ }
+ if ( ! this->fixParRadius() ) {
+ this->addFloatingParameter( this->getParBWFactor()->getRadiusParameter() );
+ }
+
+ return this->getParameters();
}
-
diff --git a/src/LauIntegrals.cc b/src/LauIntegrals.cc
index 05aa3f7..6e7bc79 100644
--- a/src/LauIntegrals.cc
+++ b/src/LauIntegrals.cc
@@ -1,177 +1,180 @@
/*
Copyright 2004 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauIntegrals.cc
\brief File containing implementation of LauIntegrals class.
*/
#include <iostream>
using std::cout;
using std::endl;
-#include "TMath.h"
-
#include "LauConstants.hh"
#include "LauIntegrals.hh"
+#include "TMath.h"
-
-
-LauIntegrals::LauIntegrals(Double_t weightsPrecision) :
- weightsPrecision_( weightsPrecision )
+LauIntegrals::LauIntegrals( Double_t weightsPrecision ) :
+ weightsPrecision_( weightsPrecision )
{
}
LauIntegrals::~LauIntegrals()
{
}
-LauIntegrals::LauIntegrals(const LauIntegrals& rhs) :
- weightsPrecision_( rhs.weightsPrecision_ )
+LauIntegrals::LauIntegrals( const LauIntegrals& rhs ) :
+ weightsPrecision_( rhs.weightsPrecision_ )
{
}
-LauIntegrals& LauIntegrals::operator=(const LauIntegrals& rhs)
+LauIntegrals& LauIntegrals::operator=( const LauIntegrals& rhs )
{
- if ( &rhs != this ) {
- weightsPrecision_ = rhs.weightsPrecision_;
- }
- return *this;
+ if ( &rhs != this ) {
+ weightsPrecision_ = rhs.weightsPrecision_;
+ }
+ return *this;
}
-void LauIntegrals::calcGaussLegendreWeights(const Int_t numPoints, std::vector<Double_t>& abscissas, std::vector<Double_t>& weights)
+void LauIntegrals::calcGaussLegendreWeights( const Int_t numPoints,
+ std::vector<Double_t>& abscissas,
+ std::vector<Double_t>& weights )
{
- // Calculate the Gauss-Legendre weights that will be used for the
- // simple Gaussian integration method given the number of points
-
- abscissas.clear();
- weights.clear();
- abscissas.resize(numPoints);
- weights.resize(numPoints);
-
- Int_t m = (numPoints+1)/2;
- Double_t dnumPoints(numPoints);
- Double_t dnumPointsPlusHalf = static_cast<Double_t>(numPoints + 0.5);
- Int_t i(0), j(0);
- Double_t p1(0.0), p2(0.0), p3(0.0), pp(0.0), z(0.0), zSq(0.0), z1(0.0), di(0.0);
-
- for (i = 1; i <= m; i++){
-
- di = static_cast<Double_t>(i);
- z = TMath::Cos(LauConstants::pi*(di - 0.25)/dnumPointsPlusHalf);
- zSq = z*z;
-
- // Starting with the above approximation for the ith root, we enter the
- // main loop of refinement by Newton's method
- do{
- p1 = 1.0;
- p2 = 0.0;
-
- // Calculate the Legendre polynomial at z - recurrence relation
- for (j = 1; j <= numPoints; j++){
- p3 = p2;
- p2 = p1;
- p1 = (( 2.0*j - 1.0) * z * p2 - (j - 1.0)*p3)/static_cast<Double_t>(j);
- }
- // p1 = Legendre polynomial. Compute its derivative, pp.
-
- pp = dnumPoints * (z*p1 - p2)/(zSq - 1.0);
- z1 = z;
- z = z1 - p1/pp; // Newton's method
- } while (TMath::Abs(z-z1) > weightsPrecision_);
-
- // Scale the root to the desired interval
- // Remember that the vector entries start with 0, hence i-1 (where first i value is 1)
- abscissas[i-1] = z;
- abscissas[numPoints-i] = abscissas[i-1]; // Symmetric abscissa
- weights[i-1] = 2.0/((1.0 - zSq)*pp*pp);
- weights[numPoints-i] = weights[i-1]; // Symmetric weight
-
- }
+ // Calculate the Gauss-Legendre weights that will be used for the
+ // simple Gaussian integration method given the number of points
+
+ abscissas.clear();
+ weights.clear();
+ abscissas.resize( numPoints );
+ weights.resize( numPoints );
+
+ Int_t m = ( numPoints + 1 ) / 2;
+ Double_t dnumPoints( numPoints );
+ Double_t dnumPointsPlusHalf = static_cast<Double_t>( numPoints + 0.5 );
+ Int_t i( 0 ), j( 0 );
+ Double_t p1( 0.0 ), p2( 0.0 ), p3( 0.0 ), pp( 0.0 ), z( 0.0 ), zSq( 0.0 ), z1( 0.0 ), di( 0.0 );
+
+ for ( i = 1; i <= m; i++ ) {
+
+ di = static_cast<Double_t>( i );
+ z = TMath::Cos( LauConstants::pi * ( di - 0.25 ) / dnumPointsPlusHalf );
+ zSq = z * z;
+
+ // Starting with the above approximation for the ith root, we enter the
+ // main loop of refinement by Newton's method
+ do {
+ p1 = 1.0;
+ p2 = 0.0;
+
+ // Calculate the Legendre polynomial at z - recurrence relation
+ for ( j = 1; j <= numPoints; j++ ) {
+ p3 = p2;
+ p2 = p1;
+ p1 = ( ( 2.0 * j - 1.0 ) * z * p2 - ( j - 1.0 ) * p3 ) / static_cast<Double_t>( j );
+ }
+ // p1 = Legendre polynomial. Compute its derivative, pp.
+
+ pp = dnumPoints * ( z * p1 - p2 ) / ( zSq - 1.0 );
+ z1 = z;
+ z = z1 - p1 / pp; // Newton's method
+ } while ( TMath::Abs( z - z1 ) > weightsPrecision_ );
+
+ // Scale the root to the desired interval
+ // Remember that the vector entries start with 0, hence i-1 (where first i value is 1)
+ abscissas[i - 1] = z;
+ abscissas[numPoints - i] = abscissas[i - 1]; // Symmetric abscissa
+ weights[i - 1] = 2.0 / ( ( 1.0 - zSq ) * pp * pp );
+ weights[numPoints - i] = weights[i - 1]; // Symmetric weight
+ }
}
-void LauIntegrals::calcGaussHermiteWeights(const Int_t numPoints, std::vector<Double_t>& abscissas, std::vector<Double_t>& weights)
+void LauIntegrals::calcGaussHermiteWeights( const Int_t numPoints,
+ std::vector<Double_t>& abscissas,
+ std::vector<Double_t>& weights )
{
- // Calculate the Gauss-Hermite weights that will be used for the
- // simple Gaussian integration method for a function weighted by an exp(-x**2) term
- // These weights are common to all integration intervals - therefore they
- // should only be calculated once - when the constructor is called, for example.
-
- abscissas.clear();
- weights.clear();
- abscissas.resize(numPoints); weights.resize(numPoints);
-
- Int_t m = (numPoints+1)/2;
- Double_t dnumPoints(numPoints);
- Int_t i(0), j(0), its(0);
- Double_t p1(0.0), p2(0.0), p3(0.0), pp(0.0), z(0.0), z1(0.0);
- Double_t numPointsTerm(2*numPoints+1);
-
- // The roots are symmetric about the origin. Therefore, we only need to find half of them
- // Loop over the desired roots.
- for (i = 1; i <= m; i++) {
-
- if (i == 1) {
- // Initial guess for largest root
- z = TMath::Sqrt(numPointsTerm) - 1.85575*TMath::Power(numPointsTerm, -0.16667);
- } else if (i == 2) {
- // Initial guess for second largest root
- z -= 1.14*TMath::Power(dnumPoints, 0.426)/z;
- } else if (i == 3) {
- // Initial guess for third largest root
- z = 1.86*z - 0.86*abscissas[0];
- } else if (i == 4) {
- // Initial guess for fourth largest root
- z = 1.91*z - 0.91*abscissas[1];
- } else {
- // Initial guess for other roots
- z = 2.0*z - abscissas[i-3];
- }
-
- for (its = 1; its <= 10; its++) {
- p1 = LauConstants::pim4;
- p2 = 0.0;
-
- for (j = 1; j <= numPoints; j++) {
- Double_t dj(j);
- p3 = p2;
- p2 = p1;
- p1 = z*TMath::Sqrt(2.0/dj)*p2 - TMath::Sqrt((dj-1.0)/dj)*p3;
- }
- // p1 is now the desired Hermite polynomial. Compute its derivative, pp
- pp = TMath::Sqrt(2.0*dnumPoints)*p2;
- z1 = z;
- if (pp > 1e-10) {z = z1 - p1/pp;}
- if (TMath::Abs(z - z1) < weightsPrecision_) break;
- }
-
- // Scale the root to the desired interval
- // Remember that the vector entries start with 0, hence i-1 (where first i value is 1)
- abscissas[i-1] = z;
- abscissas[numPoints-i] = -z; // Symmetric abscissa
- weights[i-1] = 2.0/(pp*pp);
- weights[numPoints-i] = weights[i-1]; // Symmetric weight
-
- }
+ // Calculate the Gauss-Hermite weights that will be used for the
+ // simple Gaussian integration method for a function weighted by an exp(-x**2) term
+ // These weights are common to all integration intervals - therefore they
+ // should only be calculated once - when the constructor is called, for example.
+
+ abscissas.clear();
+ weights.clear();
+ abscissas.resize( numPoints );
+ weights.resize( numPoints );
+
+ Int_t m = ( numPoints + 1 ) / 2;
+ Double_t dnumPoints( numPoints );
+ Int_t i( 0 ), j( 0 ), its( 0 );
+ Double_t p1( 0.0 ), p2( 0.0 ), p3( 0.0 ), pp( 0.0 ), z( 0.0 ), z1( 0.0 );
+ Double_t numPointsTerm( 2 * numPoints + 1 );
+
+ // The roots are symmetric about the origin. Therefore, we only need to find half of them
+ // Loop over the desired roots.
+ for ( i = 1; i <= m; i++ ) {
+
+ if ( i == 1 ) {
+ // Initial guess for largest root
+ z = TMath::Sqrt( numPointsTerm ) - 1.85575 * TMath::Power( numPointsTerm, -0.16667 );
+ } else if ( i == 2 ) {
+ // Initial guess for second largest root
+ z -= 1.14 * TMath::Power( dnumPoints, 0.426 ) / z;
+ } else if ( i == 3 ) {
+ // Initial guess for third largest root
+ z = 1.86 * z - 0.86 * abscissas[0];
+ } else if ( i == 4 ) {
+ // Initial guess for fourth largest root
+ z = 1.91 * z - 0.91 * abscissas[1];
+ } else {
+ // Initial guess for other roots
+ z = 2.0 * z - abscissas[i - 3];
+ }
+
+ for ( its = 1; its <= 10; its++ ) {
+ p1 = LauConstants::pim4;
+ p2 = 0.0;
+
+ for ( j = 1; j <= numPoints; j++ ) {
+ Double_t dj( j );
+ p3 = p2;
+ p2 = p1;
+ p1 = z * TMath::Sqrt( 2.0 / dj ) * p2 - TMath::Sqrt( ( dj - 1.0 ) / dj ) * p3;
+ }
+ // p1 is now the desired Hermite polynomial. Compute its derivative, pp
+ pp = TMath::Sqrt( 2.0 * dnumPoints ) * p2;
+ z1 = z;
+ if ( pp > 1e-10 ) {
+ z = z1 - p1 / pp;
+ }
+ if ( TMath::Abs( z - z1 ) < weightsPrecision_ )
+ break;
+ }
+
+ // Scale the root to the desired interval
+ // Remember that the vector entries start with 0, hence i-1 (where first i value is 1)
+ abscissas[i - 1] = z;
+ abscissas[numPoints - i] = -z; // Symmetric abscissa
+ weights[i - 1] = 2.0 / ( pp * pp );
+ weights[numPoints - i] = weights[i - 1]; // Symmetric weight
+ }
}
diff --git a/src/LauIsobarDynamics.cc b/src/LauIsobarDynamics.cc
index df75822..8e907c8 100644
--- a/src/LauIsobarDynamics.cc
+++ b/src/LauIsobarDynamics.cc
@@ -1,2699 +1,3014 @@
/*
Copyright 2005 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauIsobarDynamics.cc
\brief File containing implementation of LauIsobarDynamics class.
*/
-#include <iostream>
-#include <iomanip>
-#include <fstream>
-#include <set>
-#include <vector>
-
-#include "TFile.h"
-#include "TRandom.h"
-#include "TSystem.h"
+#include "LauIsobarDynamics.hh"
+#include "LauASqMaxFinder.hh"
#include "LauAbsEffModel.hh"
-#include "LauAbsResonance.hh"
#include "LauAbsIncohRes.hh"
+#include "LauAbsResonance.hh"
#include "LauBelleNR.hh"
#include "LauBelleSymNR.hh"
#include "LauCacheData.hh"
#include "LauConstants.hh"
-#include "LauDaughters.hh"
#include "LauDPPartialIntegralInfo.hh"
+#include "LauDaughters.hh"
#include "LauFitDataTree.hh"
-#include "LauIsobarDynamics.hh"
-#include "LauKinematics.hh"
#include "LauKMatrixProdPole.hh"
#include "LauKMatrixProdSVP.hh"
-#include "LauKMatrixPropagator.hh"
#include "LauKMatrixPropFactory.hh"
+#include "LauKMatrixPropagator.hh"
+#include "LauKinematics.hh"
#include "LauNRAmplitude.hh"
#include "LauPrint.hh"
#include "LauRandom.hh"
#include "LauResonanceInfo.hh"
#include "LauResonanceMaker.hh"
#include "LauRhoOmegaMix.hh"
-#include "LauASqMaxFinder.hh"
+#include "TFile.h"
+#include "TRandom.h"
+#include "TSystem.h"
+
+#include <fstream>
+#include <iomanip>
+#include <iostream>
+#include <set>
+#include <vector>
// for Kpipi: only one scfFraction 2D histogram is needed
-LauIsobarDynamics::LauIsobarDynamics(LauDaughters* daughters, LauAbsEffModel* effModel, LauAbsEffModel* scfFractionModel) :
- daughters_(daughters),
- kinematics_(daughters_ ? daughters_->getKinematics() : 0),
- effModel_(effModel),
- nAmp_(0),
- nIncohAmp_(0),
- DPNorm_(0.0),
- DPRate_("DPRate", 0.0, 0.0, 1000.0),
- meanDPEff_("meanDPEff", 0.0, 0.0, 1.0),
- currentEvent_(0),
- symmetricalDP_(kFALSE),
- fullySymmetricDP_(kFALSE),
- flavConjDP_(kFALSE),
- integralsDone_(kFALSE),
- normalizationSchemeDone_(kFALSE),
- forceSymmetriseIntegration_(kFALSE),
- intFileName_("integ.dat"),
- m13BinWidth_(0.005),
- m23BinWidth_(0.005),
- mPrimeBinWidth_(0.001),
- thPrimeBinWidth_(0.001),
- narrowWidth_(0.020),
- binningFactor_(100.0),
- m13Sq_(0.0),
- m23Sq_(0.0),
- mPrime_(0.0),
- thPrime_(0.0),
- tagCat_(-1),
- eff_(1.0),
- scfFraction_(0.0),
- jacobian_(0.0),
- ASq_(0.0),
- evtLike_(0.0),
- iterationsMax_(100000),
- nSigGenLoop_(0),
- aSqMaxSet_(1.25),
- aSqMaxVar_(0.0),
- flipHelicity_(kTRUE),
- recalcNormalisation_(kFALSE),
- calculateRhoOmegaFitFractions_(kFALSE)
+LauIsobarDynamics::LauIsobarDynamics( LauDaughters* daughters,
+ LauAbsEffModel* effModel,
+ LauAbsEffModel* scfFractionModel ) :
+ daughters_( daughters ),
+ kinematics_( daughters_ ? daughters_->getKinematics() : 0 ),
+ effModel_( effModel ),
+ nAmp_( 0 ),
+ nIncohAmp_( 0 ),
+ DPNorm_( 0.0 ),
+ DPRate_( "DPRate", 0.0, 0.0, 1000.0 ),
+ meanDPEff_( "meanDPEff", 0.0, 0.0, 1.0 ),
+ currentEvent_( 0 ),
+ symmetricalDP_( kFALSE ),
+ fullySymmetricDP_( kFALSE ),
+ flavConjDP_( kFALSE ),
+ integralsDone_( kFALSE ),
+ normalizationSchemeDone_( kFALSE ),
+ forceSymmetriseIntegration_( kFALSE ),
+ intFileName_( "integ.dat" ),
+ m13BinWidth_( 0.005 ),
+ m23BinWidth_( 0.005 ),
+ mPrimeBinWidth_( 0.001 ),
+ thPrimeBinWidth_( 0.001 ),
+ narrowWidth_( 0.020 ),
+ binningFactor_( 100.0 ),
+ m13Sq_( 0.0 ),
+ m23Sq_( 0.0 ),
+ mPrime_( 0.0 ),
+ thPrime_( 0.0 ),
+ tagCat_( -1 ),
+ eff_( 1.0 ),
+ scfFraction_( 0.0 ),
+ jacobian_( 0.0 ),
+ ASq_( 0.0 ),
+ evtLike_( 0.0 ),
+ iterationsMax_( 100000 ),
+ nSigGenLoop_( 0 ),
+ aSqMaxSet_( 1.25 ),
+ aSqMaxVar_( 0.0 ),
+ flipHelicity_( kTRUE ),
+ recalcNormalisation_( kFALSE ),
+ calculateRhoOmegaFitFractions_( kFALSE )
{
- if (daughters != 0) {
- symmetricalDP_ = daughters->gotSymmetricalDP();
- fullySymmetricDP_ = daughters->gotFullySymmetricDP();
- flavConjDP_ = daughters->gotFlavourConjugateDP();
- typDaug_.push_back(daughters->getTypeDaug1());
- typDaug_.push_back(daughters->getTypeDaug2());
- typDaug_.push_back(daughters->getTypeDaug3());
- }
-
- if (scfFractionModel != 0) {
- scfFractionModel_[0] = scfFractionModel;
- }
-
- sigResonances_.clear();
- sigIncohResonances_.clear();
- kMatrixPropagators_.clear();
- kMatrixPropSet_.clear();
- extraParameters_.clear();
+ if ( daughters != 0 ) {
+ symmetricalDP_ = daughters->gotSymmetricalDP();
+ fullySymmetricDP_ = daughters->gotFullySymmetricDP();
+ flavConjDP_ = daughters->gotFlavourConjugateDP();
+ typDaug_.push_back( daughters->getTypeDaug1() );
+ typDaug_.push_back( daughters->getTypeDaug2() );
+ typDaug_.push_back( daughters->getTypeDaug3() );
+ }
+
+ if ( scfFractionModel != 0 ) {
+ scfFractionModel_[0] = scfFractionModel;
+ }
+
+ sigResonances_.clear();
+ sigIncohResonances_.clear();
+ kMatrixPropagators_.clear();
+ kMatrixPropSet_.clear();
+ extraParameters_.clear();
}
// for Kspipi, we need a scfFraction 2D histogram for each tagging category. They are provided by the map.
// Also, we need to know the place that the tagging category of the current event occupies in the data structure inputFitTree
-LauIsobarDynamics::LauIsobarDynamics(LauDaughters* daughters, LauAbsEffModel* effModel, LauTagCatScfFractionModelMap scfFractionModel) :
- daughters_(daughters),
- kinematics_(daughters_ ? daughters_->getKinematics() : 0),
- effModel_(effModel),
- scfFractionModel_(scfFractionModel),
- nAmp_(0),
- nIncohAmp_(0),
- DPNorm_(0.0),
- DPRate_("DPRate", 0.0, 0.0, 1000.0),
- meanDPEff_("meanDPEff", 0.0, 0.0, 1.0),
- currentEvent_(0),
- symmetricalDP_(kFALSE),
- fullySymmetricDP_(kFALSE),
- flavConjDP_(kFALSE),
- integralsDone_(kFALSE),
- normalizationSchemeDone_(kFALSE),
- forceSymmetriseIntegration_(kFALSE),
- intFileName_("integ.dat"),
- m13BinWidth_(0.005),
- m23BinWidth_(0.005),
- mPrimeBinWidth_(0.001),
- thPrimeBinWidth_(0.001),
- narrowWidth_(0.020),
- binningFactor_(100.0),
- m13Sq_(0.0),
- m23Sq_(0.0),
- mPrime_(0.0),
- thPrime_(0.0),
- tagCat_(-1),
- eff_(1.0),
- scfFraction_(0.0),
- jacobian_(0.0),
- ASq_(0.0),
- evtLike_(0.0),
- iterationsMax_(100000),
- nSigGenLoop_(0),
- aSqMaxSet_(1.25),
- aSqMaxVar_(0.0),
- flipHelicity_(kTRUE),
- recalcNormalisation_(kFALSE),
- calculateRhoOmegaFitFractions_(kFALSE)
+LauIsobarDynamics::LauIsobarDynamics( LauDaughters* daughters,
+ LauAbsEffModel* effModel,
+ LauTagCatScfFractionModelMap scfFractionModel ) :
+ daughters_( daughters ),
+ kinematics_( daughters_ ? daughters_->getKinematics() : 0 ),
+ effModel_( effModel ),
+ scfFractionModel_( scfFractionModel ),
+ nAmp_( 0 ),
+ nIncohAmp_( 0 ),
+ DPNorm_( 0.0 ),
+ DPRate_( "DPRate", 0.0, 0.0, 1000.0 ),
+ meanDPEff_( "meanDPEff", 0.0, 0.0, 1.0 ),
+ currentEvent_( 0 ),
+ symmetricalDP_( kFALSE ),
+ fullySymmetricDP_( kFALSE ),
+ flavConjDP_( kFALSE ),
+ integralsDone_( kFALSE ),
+ normalizationSchemeDone_( kFALSE ),
+ forceSymmetriseIntegration_( kFALSE ),
+ intFileName_( "integ.dat" ),
+ m13BinWidth_( 0.005 ),
+ m23BinWidth_( 0.005 ),
+ mPrimeBinWidth_( 0.001 ),
+ thPrimeBinWidth_( 0.001 ),
+ narrowWidth_( 0.020 ),
+ binningFactor_( 100.0 ),
+ m13Sq_( 0.0 ),
+ m23Sq_( 0.0 ),
+ mPrime_( 0.0 ),
+ thPrime_( 0.0 ),
+ tagCat_( -1 ),
+ eff_( 1.0 ),
+ scfFraction_( 0.0 ),
+ jacobian_( 0.0 ),
+ ASq_( 0.0 ),
+ evtLike_( 0.0 ),
+ iterationsMax_( 100000 ),
+ nSigGenLoop_( 0 ),
+ aSqMaxSet_( 1.25 ),
+ aSqMaxVar_( 0.0 ),
+ flipHelicity_( kTRUE ),
+ recalcNormalisation_( kFALSE ),
+ calculateRhoOmegaFitFractions_( kFALSE )
{
- // Constructor for the isobar signal model
- if (daughters != 0) {
- symmetricalDP_ = daughters->gotSymmetricalDP();
- fullySymmetricDP_ = daughters->gotFullySymmetricDP();
- flavConjDP_ = daughters->gotFlavourConjugateDP();
- typDaug_.push_back(daughters->getTypeDaug1());
- typDaug_.push_back(daughters->getTypeDaug2());
- typDaug_.push_back(daughters->getTypeDaug3());
- }
-
- sigResonances_.clear();
- sigIncohResonances_.clear();
- kMatrixPropagators_.clear();
- kMatrixPropSet_.clear();
- extraParameters_.clear();
+ // Constructor for the isobar signal model
+ if ( daughters != 0 ) {
+ symmetricalDP_ = daughters->gotSymmetricalDP();
+ fullySymmetricDP_ = daughters->gotFullySymmetricDP();
+ flavConjDP_ = daughters->gotFlavourConjugateDP();
+ typDaug_.push_back( daughters->getTypeDaug1() );
+ typDaug_.push_back( daughters->getTypeDaug2() );
+ typDaug_.push_back( daughters->getTypeDaug3() );
+ }
+
+ sigResonances_.clear();
+ sigIncohResonances_.clear();
+ kMatrixPropagators_.clear();
+ kMatrixPropSet_.clear();
+ extraParameters_.clear();
}
LauIsobarDynamics::~LauIsobarDynamics()
{
- extraParameters_.clear();
-
- for ( std::vector<LauCacheData*>::iterator iter = data_.begin(); iter != data_.end(); ++iter ) {
- delete (*iter);
- }
- data_.clear();
-
- for (std::vector<LauDPPartialIntegralInfo*>::iterator it = dpPartialIntegralInfo_.begin(); it != dpPartialIntegralInfo_.end(); ++it)
- {
- delete (*it);
- }
- dpPartialIntegralInfo_.clear();
+ extraParameters_.clear();
+
+ for ( std::vector<LauCacheData*>::iterator iter = data_.begin(); iter != data_.end(); ++iter ) {
+ delete ( *iter );
+ }
+ data_.clear();
+
+ for ( std::vector<LauDPPartialIntegralInfo*>::iterator it = dpPartialIntegralInfo_.begin();
+ it != dpPartialIntegralInfo_.end();
+ ++it ) {
+ delete ( *it );
+ }
+ dpPartialIntegralInfo_.clear();
}
void LauIsobarDynamics::resetNormVectors()
{
- for (UInt_t i = 0; i < nAmp_; i++) {
-
- fSqSum_[i] = 0.0;
- fSqEffSum_[i] = 0.0;
- fNorm_[i] = 0.0;
- ff_[i].zero();
-
- for (UInt_t j = 0; j < nAmp_; j++) {
-
- fifjEffSum_[i][j].zero();
- fifjSum_[i][j].zero();
-
- }
- }
-
- for (UInt_t i = 0; i < nIncohAmp_; i++) {
- fSqSum_[i+nAmp_] = 0.0;
- fSqEffSum_[i+nAmp_] = 0.0;
- fNorm_[i+nAmp_] = 0.0;
- incohInten_[i] = 0.0;
- }
+ for ( UInt_t i = 0; i < nAmp_; i++ ) {
+
+ fSqSum_[i] = 0.0;
+ fSqEffSum_[i] = 0.0;
+ fNorm_[i] = 0.0;
+ ff_[i].zero();
+
+ for ( UInt_t j = 0; j < nAmp_; j++ ) {
+
+ fifjEffSum_[i][j].zero();
+ fifjSum_[i][j].zero();
+ }
+ }
+
+ for ( UInt_t i = 0; i < nIncohAmp_; i++ ) {
+ fSqSum_[i + nAmp_] = 0.0;
+ fSqEffSum_[i + nAmp_] = 0.0;
+ fNorm_[i + nAmp_] = 0.0;
+ incohInten_[i] = 0.0;
+ }
}
void LauIsobarDynamics::recalculateNormalisation()
{
- if ( recalcNormalisation_ == kFALSE ) {
- return;
- }
+ if ( recalcNormalisation_ == kFALSE ) {
+ return;
+ }
- // We need to calculate the normalisation constants for the
- // Dalitz plot generation/fitting.
+ // We need to calculate the normalisation constants for the
+ // Dalitz plot generation/fitting.
- integralsDone_ = kFALSE;
+ integralsDone_ = kFALSE;
- this->resetNormVectors();
- this->findIntegralsToBeRecalculated();
- this->calcDPNormalisation();
+ this->resetNormVectors();
+ this->findIntegralsToBeRecalculated();
+ this->calcDPNormalisation();
- integralsDone_ = kTRUE;
+ integralsDone_ = kTRUE;
}
void LauIsobarDynamics::findIntegralsToBeRecalculated()
{
- // Loop through the resonance parameters and see which ones have changed
- // For those that have changed mark the corresponding resonance(s) as needing to be re-evaluated
-
- integralsToBeCalculated_.clear();
-
- const UInt_t nResPars = resonancePars_.size();
- for ( UInt_t iPar(0); iPar < nResPars; ++iPar ) {
- const Double_t newValue = resonancePars_[iPar]->value();
- if ( newValue != resonanceParValues_[iPar] ) {
- resonanceParValues_[iPar] = newValue;
-
- const std::vector<UInt_t>& indices = resonanceParResIndex_[iPar];
- std::vector<UInt_t>::const_iterator indexIter = indices.begin();
- const std::vector<UInt_t>::const_iterator indexEnd = indices.end();
- for( ; indexIter != indexEnd; ++indexIter) {
- integralsToBeCalculated_.insert(*indexIter);
- }
- }
- }
+ // Loop through the resonance parameters and see which ones have changed
+ // For those that have changed mark the corresponding resonance(s) as needing to be re-evaluated
+
+ integralsToBeCalculated_.clear();
+
+ const UInt_t nResPars = resonancePars_.size();
+ for ( UInt_t iPar( 0 ); iPar < nResPars; ++iPar ) {
+ const Double_t newValue = resonancePars_[iPar]->value();
+ if ( newValue != resonanceParValues_[iPar] ) {
+ resonanceParValues_[iPar] = newValue;
+
+ const std::vector<UInt_t>& indices = resonanceParResIndex_[iPar];
+ std::vector<UInt_t>::const_iterator indexIter = indices.begin();
+ const std::vector<UInt_t>::const_iterator indexEnd = indices.end();
+ for ( ; indexIter != indexEnd; ++indexIter ) {
+ integralsToBeCalculated_.insert( *indexIter );
+ }
+ }
+ }
}
void LauIsobarDynamics::collateResonanceParameters()
{
- // Initialise all resonance models
- resonancePars_.clear();
- resonanceParValues_.clear();
- resonanceParResIndex_.clear();
-
- std::set<LauParameter*> uniqueResPars;
- UInt_t resIndex(0);
- for ( std::vector<LauAbsResonance*>::iterator resIter = sigResonances_.begin(); resIter != sigResonances_.end(); ++resIter ) {
- (*resIter)->initialise();
-
- // Check if this resonance has floating parameters
- // Append all unique parameters to our list
- const std::vector<LauParameter*>& resPars = (*resIter)->getFloatingParameters();
-
- for ( std::vector<LauParameter*>::const_iterator parIter = resPars.begin(); parIter != resPars.end(); ++parIter ) {
- if ( uniqueResPars.insert( *parIter ).second ) {
- // This parameter has not already been added to
- // the list of unique ones. Add it, its value
- // and its associated resonance ID to the
- // appropriate lists.
- resonancePars_.push_back( *parIter );
- resonanceParValues_.push_back( (*parIter)->value() );
- std::vector<UInt_t> resIndices( 1, resIndex );
- resonanceParResIndex_.push_back( resIndices );
- } else {
- // This parameter has already been added to the
- // list of unique ones. However, we still need
- // to indicate that this resonance should be
- // associated with it.
- std::vector<LauParameter*>::const_iterator uniqueParIter = resonancePars_.begin();
- std::vector<std::vector<UInt_t> >::iterator indicesIter = resonanceParResIndex_.begin();
- while( (*uniqueParIter) != (*parIter) ) {
- ++uniqueParIter;
- ++indicesIter;
- }
- ( *indicesIter ).push_back( resIndex );
- }
- }
-
- ++resIndex;
- }
-
- for ( std::vector<LauAbsIncohRes*>::iterator resIter = sigIncohResonances_.begin(); resIter != sigIncohResonances_.end(); ++resIter ) {
- (*resIter)->initialise();
-
- // Check if this resonance has floating parameters
- // Append all unique parameters to our list
- const std::vector<LauParameter*>& resPars = (*resIter)->getFloatingParameters();
-
- for ( std::vector<LauParameter*>::const_iterator parIter = resPars.begin(); parIter != resPars.end(); ++parIter ) {
- if ( uniqueResPars.insert( *parIter ).second ) {
- // This parameter has not already been added to
- // the list of unique ones. Add it, its value
- // and its associated resonance ID to the
- // appropriate lists.
- resonancePars_.push_back( *parIter );
- resonanceParValues_.push_back( (*parIter)->value() );
- std::vector<UInt_t> resIndices( 1, resIndex );
- resonanceParResIndex_.push_back( resIndices );
- } else {
- // This parameter has already been added to the
- // list of unique ones. However, we still need
- // to indicate that this resonance should be
- // associated with it.
- std::vector<LauParameter*>::const_iterator uniqueParIter = resonancePars_.begin();
- std::vector<std::vector<UInt_t> >::iterator indicesIter = resonanceParResIndex_.begin();
- while( (*uniqueParIter) != (*parIter) ) {
- ++uniqueParIter;
- ++indicesIter;
- }
- ( *indicesIter ).push_back( resIndex );
- }
- }
-
- ++resIndex;
- }
+ // Initialise all resonance models
+ resonancePars_.clear();
+ resonanceParValues_.clear();
+ resonanceParResIndex_.clear();
+
+ std::set<LauParameter*> uniqueResPars;
+ UInt_t resIndex( 0 );
+ for ( std::vector<LauAbsResonance*>::iterator resIter = sigResonances_.begin();
+ resIter != sigResonances_.end();
+ ++resIter ) {
+ ( *resIter )->initialise();
+
+ // Check if this resonance has floating parameters
+ // Append all unique parameters to our list
+ const std::vector<LauParameter*>& resPars = ( *resIter )->getFloatingParameters();
+
+ for ( std::vector<LauParameter*>::const_iterator parIter = resPars.begin();
+ parIter != resPars.end();
+ ++parIter ) {
+ if ( uniqueResPars.insert( *parIter ).second ) {
+ // This parameter has not already been added to
+ // the list of unique ones. Add it, its value
+ // and its associated resonance ID to the
+ // appropriate lists.
+ resonancePars_.push_back( *parIter );
+ resonanceParValues_.push_back( ( *parIter )->value() );
+ std::vector<UInt_t> resIndices( 1, resIndex );
+ resonanceParResIndex_.push_back( resIndices );
+ } else {
+ // This parameter has already been added to the
+ // list of unique ones. However, we still need
+ // to indicate that this resonance should be
+ // associated with it.
+ std::vector<LauParameter*>::const_iterator uniqueParIter = resonancePars_.begin();
+ std::vector<std::vector<UInt_t>>::iterator indicesIter = resonanceParResIndex_.begin();
+ while ( ( *uniqueParIter ) != ( *parIter ) ) {
+ ++uniqueParIter;
+ ++indicesIter;
+ }
+ ( *indicesIter ).push_back( resIndex );
+ }
+ }
+
+ ++resIndex;
+ }
+
+ for ( std::vector<LauAbsIncohRes*>::iterator resIter = sigIncohResonances_.begin();
+ resIter != sigIncohResonances_.end();
+ ++resIter ) {
+ ( *resIter )->initialise();
+
+ // Check if this resonance has floating parameters
+ // Append all unique parameters to our list
+ const std::vector<LauParameter*>& resPars = ( *resIter )->getFloatingParameters();
+
+ for ( std::vector<LauParameter*>::const_iterator parIter = resPars.begin();
+ parIter != resPars.end();
+ ++parIter ) {
+ if ( uniqueResPars.insert( *parIter ).second ) {
+ // This parameter has not already been added to
+ // the list of unique ones. Add it, its value
+ // and its associated resonance ID to the
+ // appropriate lists.
+ resonancePars_.push_back( *parIter );
+ resonanceParValues_.push_back( ( *parIter )->value() );
+ std::vector<UInt_t> resIndices( 1, resIndex );
+ resonanceParResIndex_.push_back( resIndices );
+ } else {
+ // This parameter has already been added to the
+ // list of unique ones. However, we still need
+ // to indicate that this resonance should be
+ // associated with it.
+ std::vector<LauParameter*>::const_iterator uniqueParIter = resonancePars_.begin();
+ std::vector<std::vector<UInt_t>>::iterator indicesIter = resonanceParResIndex_.begin();
+ while ( ( *uniqueParIter ) != ( *parIter ) ) {
+ ++uniqueParIter;
+ ++indicesIter;
+ }
+ ( *indicesIter ).push_back( resIndex );
+ }
+ }
+
+ ++resIndex;
+ }
}
-void LauIsobarDynamics::initialise(const std::vector<LauComplex>& coeffs)
+void LauIsobarDynamics::initialise( const std::vector<LauComplex>& coeffs )
{
- // Check whether we have a valid set of integration constants for
- // the normalisation of the signal likelihood function.
- this->initialiseVectors();
-
- // Mark the DP integrals as undetermined
- integralsDone_ = kFALSE;
-
- this->collateResonanceParameters();
-
- if ( resonancePars_.empty() ) {
- recalcNormalisation_ = kFALSE;
- } else {
- recalcNormalisation_ = kTRUE;
- }
-
- // Print summary of what we have so far to screen
- this->initSummary();
-
- if ( nAmp_+nIncohAmp_ == 0 ) {
- std::cout << "INFO in LauIsobarDynamics::initialise : No contributions to DP model, not performing normalisation integrals." << std::endl;
- } else {
-
- // We need to calculate the normalisation constants for the Dalitz plot generation/fitting.
-
- std::cout<<"INFO in LauIsobarDynamics::initialise : Starting special run to generate the integrals for normalising the PDF..."<<std::endl;
-
- // Since this is the initialisation, we need to calculate everything for every resonance
- integralsToBeCalculated_.clear();
- for ( UInt_t i(0); i < nAmp_+nIncohAmp_; ++i ) {
- integralsToBeCalculated_.insert(i);
- }
-
- // Calculate and cache the normalisations of each resonance _dynamic_ amplitude
- // (e.g. Breit-Wigner contribution, not from the complex coefficients).
- // These are stored in fNorm_[i].
- // fSqSum[i] is the total of the dynamical amplitude squared for a given resonance, i.
- // We require that:
- // |fNorm_[i]|^2 * |fSqSum[i]|^2 = 1,
- // i.e. fNorm_[i] normalises each resonance contribution to give the same number of
- // events in the DP, accounting for the total DP area and the dynamics of the resonance.
- this->calcDPNormalisation();
-
- // Write the integrals to a file (mainly for debugging purposes)
- this->writeIntegralsFile();
- }
-
-
- integralsDone_ = kTRUE;
-
- std::cout << std::setprecision(10);
-
- std::cout<<"INFO in LauIsobarDynamics::initialise : Summary of the integrals:"<<std::endl;
-
- for (UInt_t i = 0; i < nAmp_+nIncohAmp_; i++) {
- std::cout<<" fNorm["<<i<<"] = "<<fNorm_[i]<<std::endl;
- std::cout<<" fSqSum["<<i<<"] = "<<fSqSum_[i]<<std::endl;
- std::cout<<" fSqEffSum["<<i<<"] = "<<fSqEffSum_[i]<<std::endl;
- }
-
- for (UInt_t i = 0; i < nAmp_; i++) {
- for (UInt_t j = 0; j < nAmp_; j++) {
- std::cout<<" fifjEffSum["<<i<<"]["<<j<<"] = "<<fifjEffSum_[i][j];
- }
- std::cout<<std::endl;
- }
-
- for (UInt_t i = 0; i < nAmp_; i++) {
- for (UInt_t j = 0; j < nAmp_; j++) {
- std::cout<<" fifjSum["<<i<<"]["<<j<<"] = "<<fifjSum_[i][j];
- }
- std::cout<<std::endl;
- }
-
- // Calculate the initial fit fractions (for later comparison with Toy MC, if required)
- this->updateCoeffs(coeffs);
- this->calcExtraInfo(kTRUE);
-
- for (UInt_t i = 0; i < nAmp_; i++) {
- for (UInt_t j = i; j < nAmp_; j++) {
- std::cout<<"INFO in LauIsobarDynamics::initialise : Initial fit fraction for amplitude ("<<i<<","<<j<<") = "<<fitFrac_[i][j].genValue()<<std::endl;
- }
- }
-
- for (UInt_t i = 0; i < nIncohAmp_; i++) {
- std::cout<<"INFO in LauIsobarDynamics::initialise : Initial fit fraction for incoherent amplitude ("<<i<<","<<i<<") = "<<fitFrac_[i+nAmp_][i+nAmp_].genValue()<<std::endl;
- }
-
- std::cout<<"INFO in LauIsobarDynamics::initialise : Initial efficiency = "<<meanDPEff_.initValue()<<std::endl;
-
- std::cout<<"INFO in LauIsobarDynamics::initialise : Initial DPRate = "<<DPRate_.initValue()<<std::endl;
+ // Check whether we have a valid set of integration constants for
+ // the normalisation of the signal likelihood function.
+ this->initialiseVectors();
+
+ // Mark the DP integrals as undetermined
+ integralsDone_ = kFALSE;
+
+ this->collateResonanceParameters();
+
+ if ( resonancePars_.empty() ) {
+ recalcNormalisation_ = kFALSE;
+ } else {
+ recalcNormalisation_ = kTRUE;
+ }
+
+ // Print summary of what we have so far to screen
+ this->initSummary();
+
+ if ( nAmp_ + nIncohAmp_ == 0 ) {
+ std::cout << "INFO in LauIsobarDynamics::initialise : No contributions to DP model, not performing normalisation integrals."
+ << std::endl;
+ } else {
+
+ // We need to calculate the normalisation constants for the Dalitz plot generation/fitting.
+
+ std::cout << "INFO in LauIsobarDynamics::initialise : Starting special run to generate the integrals for normalising the PDF..."
+ << std::endl;
+
+ // Since this is the initialisation, we need to calculate everything for every resonance
+ integralsToBeCalculated_.clear();
+ for ( UInt_t i( 0 ); i < nAmp_ + nIncohAmp_; ++i ) {
+ integralsToBeCalculated_.insert( i );
+ }
+
+ // Calculate and cache the normalisations of each resonance _dynamic_ amplitude
+ // (e.g. Breit-Wigner contribution, not from the complex coefficients).
+ // These are stored in fNorm_[i].
+ // fSqSum[i] is the total of the dynamical amplitude squared for a given resonance, i.
+ // We require that:
+ // |fNorm_[i]|^2 * |fSqSum[i]|^2 = 1,
+ // i.e. fNorm_[i] normalises each resonance contribution to give the same number of
+ // events in the DP, accounting for the total DP area and the dynamics of the resonance.
+ this->calcDPNormalisation();
+
+ // Write the integrals to a file (mainly for debugging purposes)
+ this->writeIntegralsFile();
+ }
+
+ integralsDone_ = kTRUE;
+
+ std::cout << std::setprecision( 10 );
+
+ std::cout << "INFO in LauIsobarDynamics::initialise : Summary of the integrals:" << std::endl;
+
+ for ( UInt_t i = 0; i < nAmp_ + nIncohAmp_; i++ ) {
+ std::cout << " fNorm[" << i << "] = " << fNorm_[i] << std::endl;
+ std::cout << " fSqSum[" << i << "] = " << fSqSum_[i] << std::endl;
+ std::cout << " fSqEffSum[" << i << "] = " << fSqEffSum_[i] << std::endl;
+ }
+
+ for ( UInt_t i = 0; i < nAmp_; i++ ) {
+ for ( UInt_t j = 0; j < nAmp_; j++ ) {
+ std::cout << " fifjEffSum[" << i << "][" << j << "] = " << fifjEffSum_[i][j];
+ }
+ std::cout << std::endl;
+ }
+
+ for ( UInt_t i = 0; i < nAmp_; i++ ) {
+ for ( UInt_t j = 0; j < nAmp_; j++ ) {
+ std::cout << " fifjSum[" << i << "][" << j << "] = " << fifjSum_[i][j];
+ }
+ std::cout << std::endl;
+ }
+
+ // Calculate the initial fit fractions (for later comparison with Toy MC, if required)
+ this->updateCoeffs( coeffs );
+ this->calcExtraInfo( kTRUE );
+
+ for ( UInt_t i = 0; i < nAmp_; i++ ) {
+ for ( UInt_t j = i; j < nAmp_; j++ ) {
+ std::cout << "INFO in LauIsobarDynamics::initialise : Initial fit fraction for amplitude ("
+ << i << "," << j << ") = " << fitFrac_[i][j].genValue() << std::endl;
+ }
+ }
+
+ for ( UInt_t i = 0; i < nIncohAmp_; i++ ) {
+ std::cout << "INFO in LauIsobarDynamics::initialise : Initial fit fraction for incoherent amplitude ("
+ << i << "," << i << ") = " << fitFrac_[i + nAmp_][i + nAmp_].genValue()
+ << std::endl;
+ }
+
+ std::cout << "INFO in LauIsobarDynamics::initialise : Initial efficiency = "
+ << meanDPEff_.initValue() << std::endl;
+
+ std::cout << "INFO in LauIsobarDynamics::initialise : Initial DPRate = " << DPRate_.initValue()
+ << std::endl;
}
void LauIsobarDynamics::initSummary()
{
- UInt_t i(0);
- TString nameP = daughters_->getNameParent();
- TString name1 = daughters_->getNameDaug1();
- TString name2 = daughters_->getNameDaug2();
- TString name3 = daughters_->getNameDaug3();
-
- std::cout<<"INFO in LauIsobarDynamics::initSummary : We are going to do a DP with "<<nameP<<" going to "<<name1<<" "<<name2<<" "<<name3<<std::endl;
-
- std::cout<<" : For the following resonance combinations:"<<std::endl;
-
- std::cout<<" : In tracks 2 and 3:"<<std::endl;
- for (i = 0; i < nAmp_; i++) {
- if (resPairAmp_[i] == 1) {
- std::cout<<" : A"<<i<<": "<<resTypAmp_[i]<<" to "<<name2<<", "<< name3<<std::endl;
- }
- }
-
- for (i = 0; i < nIncohAmp_; i++) {
- if (incohResPairAmp_[i] == 1) {
- std::cout<<" : A"<<nAmp_+i<<": "<<incohResTypAmp_[i]<<" (incoherent) to "<<name2<<", "<< name3<<std::endl;
- }
- }
-
- std::cout<<" : In tracks 1 and 3:"<<std::endl;
- for (i = 0; i < nAmp_; i++) {
- if (resPairAmp_[i] == 2) {
- std::cout<<" : A"<<i<<": "<<resTypAmp_[i]<<" to "<<name1<<", "<< name3<<std::endl;
- }
- }
-
- for (i = 0; i < nIncohAmp_; i++) {
- if (incohResPairAmp_[i] == 2) {
- std::cout<<" : A"<<nAmp_+i<<": "<<incohResTypAmp_[i]<<" (incoherent) to "<<name1<<", "<< name3<<std::endl;
- }
- }
-
- std::cout<<" : In tracks 1 and 2:"<<std::endl;
- for (i = 0; i < nAmp_; i++) {
- if (resPairAmp_[i] == 3) {
- std::cout<<" : A"<<i<<": "<<resTypAmp_[i]<<" to "<<name1<<", "<< name2<<std::endl;
- }
- }
-
- for (i = 0; i < nIncohAmp_; i++) {
- if (incohResPairAmp_[i] == 3) {
- std::cout<<" : A"<<nAmp_+i<<": "<<incohResTypAmp_[i]<<" (incoherent) to "<<name1<<", "<< name2<<std::endl;
- }
- }
-
- for (i = 0; i < nAmp_; i++) {
- if (resPairAmp_[i] == 0) {
- std::cout<<" : and a non-resonant amplitude:"<<std::endl;
- std::cout<<" : A"<<i<<std::endl;
- }
- }
-
- std::cout<<std::endl;
+ UInt_t i( 0 );
+ TString nameP = daughters_->getNameParent();
+ TString name1 = daughters_->getNameDaug1();
+ TString name2 = daughters_->getNameDaug2();
+ TString name3 = daughters_->getNameDaug3();
+
+ std::cout << "INFO in LauIsobarDynamics::initSummary : We are going to do a DP with " << nameP
+ << " going to " << name1 << " " << name2 << " " << name3 << std::endl;
+
+ std::cout << " : For the following resonance combinations:"
+ << std::endl;
+
+ std::cout << " : In tracks 2 and 3:" << std::endl;
+ for ( i = 0; i < nAmp_; i++ ) {
+ if ( resPairAmp_[i] == 1 ) {
+ std::cout << " : A" << i << ": "
+ << resTypAmp_[i] << " to " << name2 << ", " << name3 << std::endl;
+ }
+ }
+
+ for ( i = 0; i < nIncohAmp_; i++ ) {
+ if ( incohResPairAmp_[i] == 1 ) {
+ std::cout << " : A" << nAmp_ + i << ": "
+ << incohResTypAmp_[i] << " (incoherent) to " << name2 << ", " << name3
+ << std::endl;
+ }
+ }
+
+ std::cout << " : In tracks 1 and 3:" << std::endl;
+ for ( i = 0; i < nAmp_; i++ ) {
+ if ( resPairAmp_[i] == 2 ) {
+ std::cout << " : A" << i << ": "
+ << resTypAmp_[i] << " to " << name1 << ", " << name3 << std::endl;
+ }
+ }
+
+ for ( i = 0; i < nIncohAmp_; i++ ) {
+ if ( incohResPairAmp_[i] == 2 ) {
+ std::cout << " : A" << nAmp_ + i << ": "
+ << incohResTypAmp_[i] << " (incoherent) to " << name1 << ", " << name3
+ << std::endl;
+ }
+ }
+
+ std::cout << " : In tracks 1 and 2:" << std::endl;
+ for ( i = 0; i < nAmp_; i++ ) {
+ if ( resPairAmp_[i] == 3 ) {
+ std::cout << " : A" << i << ": "
+ << resTypAmp_[i] << " to " << name1 << ", " << name2 << std::endl;
+ }
+ }
+
+ for ( i = 0; i < nIncohAmp_; i++ ) {
+ if ( incohResPairAmp_[i] == 3 ) {
+ std::cout << " : A" << nAmp_ + i << ": "
+ << incohResTypAmp_[i] << " (incoherent) to " << name1 << ", " << name2
+ << std::endl;
+ }
+ }
+
+ for ( i = 0; i < nAmp_; i++ ) {
+ if ( resPairAmp_[i] == 0 ) {
+ std::cout << " : and a non-resonant amplitude:"
+ << std::endl;
+ std::cout << " : A" << i << std::endl;
+ }
+ }
+
+ std::cout << std::endl;
}
void LauIsobarDynamics::initialiseVectors()
{
- fSqSum_.clear(); fSqSum_.resize(nAmp_+nIncohAmp_);
- fSqEffSum_.clear(); fSqEffSum_.resize(nAmp_+nIncohAmp_);
- fifjEffSum_.clear(); fifjEffSum_.resize(nAmp_);
- fifjSum_.clear(); fifjSum_.resize(nAmp_);
- ff_.clear(); ff_.resize(nAmp_);
- incohInten_.clear(); incohInten_.resize(nIncohAmp_);
- fNorm_.clear(); fNorm_.resize(nAmp_+nIncohAmp_);
- fitFrac_.clear(); fitFrac_.resize(nAmp_+nIncohAmp_);
- fitFracEffUnCorr_.clear(); fitFracEffUnCorr_.resize(nAmp_+nIncohAmp_);
-
- LauComplex null(0.0, 0.0);
-
- for (UInt_t i = 0; i < nAmp_; i++) {
-
- fSqSum_[i] = 0.0; fNorm_[i] = 0.0;
- ff_[i] = null;
- fifjEffSum_[i].resize(nAmp_);
- fifjSum_[i].resize(nAmp_);
- fitFrac_[i].resize(nAmp_+nIncohAmp_);
- fitFracEffUnCorr_[i].resize(nAmp_+nIncohAmp_);
-
- for (UInt_t j = 0; j < nAmp_; j++) {
- fifjEffSum_[i][j] = null;
- fifjSum_[i][j] = null;
- fitFrac_[i][j].valueAndRange(0.0, -100.0, 100.0);
- fitFracEffUnCorr_[i][j].valueAndRange(0.0, -100.0, 100.0);
- }
- for (UInt_t j = nAmp_; j < nAmp_+nIncohAmp_; j++) {
- fitFrac_[i][j].valueAndRange(0.0, -100.0, 100.0);
- fitFracEffUnCorr_[i][j].valueAndRange(0.0, -100.0, 100.0);
- }
- }
- for (UInt_t i = nAmp_; i < nAmp_+nIncohAmp_; i++) {
- fSqSum_[i] = 0.0; fNorm_[i] = 0.0;
- incohInten_[i-nAmp_] = 0.0;
- fitFrac_[i].resize(nAmp_+nIncohAmp_);
- fitFracEffUnCorr_[i].resize(nAmp_+nIncohAmp_);
-
- for (UInt_t j = 0; j < nAmp_+nIncohAmp_; j++) {
- fitFrac_[i][j].valueAndRange(0.0, -100.0, 100.0);
- fitFracEffUnCorr_[i][j].valueAndRange(0.0, -100.0, 100.0);
- }
- }
-
- UInt_t nKMatrixProps = kMatrixPropagators_.size();
- extraParameters_.clear();
- extraParameters_.resize( nKMatrixProps );
-
- for ( UInt_t i = 0; i < nKMatrixProps; ++i ) {
- extraParameters_[i].valueAndRange(0.0, -100.0, 100.0);
- }
+ fSqSum_.clear();
+ fSqSum_.resize( nAmp_ + nIncohAmp_ );
+ fSqEffSum_.clear();
+ fSqEffSum_.resize( nAmp_ + nIncohAmp_ );
+ fifjEffSum_.clear();
+ fifjEffSum_.resize( nAmp_ );
+ fifjSum_.clear();
+ fifjSum_.resize( nAmp_ );
+ ff_.clear();
+ ff_.resize( nAmp_ );
+ incohInten_.clear();
+ incohInten_.resize( nIncohAmp_ );
+ fNorm_.clear();
+ fNorm_.resize( nAmp_ + nIncohAmp_ );
+ fitFrac_.clear();
+ fitFrac_.resize( nAmp_ + nIncohAmp_ );
+ fitFracEffUnCorr_.clear();
+ fitFracEffUnCorr_.resize( nAmp_ + nIncohAmp_ );
+
+ LauComplex null( 0.0, 0.0 );
+
+ for ( UInt_t i = 0; i < nAmp_; i++ ) {
+
+ fSqSum_[i] = 0.0;
+ fNorm_[i] = 0.0;
+ ff_[i] = null;
+ fifjEffSum_[i].resize( nAmp_ );
+ fifjSum_[i].resize( nAmp_ );
+ fitFrac_[i].resize( nAmp_ + nIncohAmp_ );
+ fitFracEffUnCorr_[i].resize( nAmp_ + nIncohAmp_ );
+
+ for ( UInt_t j = 0; j < nAmp_; j++ ) {
+ fifjEffSum_[i][j] = null;
+ fifjSum_[i][j] = null;
+ fitFrac_[i][j].valueAndRange( 0.0, -100.0, 100.0 );
+ fitFracEffUnCorr_[i][j].valueAndRange( 0.0, -100.0, 100.0 );
+ }
+ for ( UInt_t j = nAmp_; j < nAmp_ + nIncohAmp_; j++ ) {
+ fitFrac_[i][j].valueAndRange( 0.0, -100.0, 100.0 );
+ fitFracEffUnCorr_[i][j].valueAndRange( 0.0, -100.0, 100.0 );
+ }
+ }
+ for ( UInt_t i = nAmp_; i < nAmp_ + nIncohAmp_; i++ ) {
+ fSqSum_[i] = 0.0;
+ fNorm_[i] = 0.0;
+ incohInten_[i - nAmp_] = 0.0;
+ fitFrac_[i].resize( nAmp_ + nIncohAmp_ );
+ fitFracEffUnCorr_[i].resize( nAmp_ + nIncohAmp_ );
+
+ for ( UInt_t j = 0; j < nAmp_ + nIncohAmp_; j++ ) {
+ fitFrac_[i][j].valueAndRange( 0.0, -100.0, 100.0 );
+ fitFracEffUnCorr_[i][j].valueAndRange( 0.0, -100.0, 100.0 );
+ }
+ }
+
+ UInt_t nKMatrixProps = kMatrixPropagators_.size();
+ extraParameters_.clear();
+ extraParameters_.resize( nKMatrixProps );
+
+ for ( UInt_t i = 0; i < nKMatrixProps; ++i ) {
+ extraParameters_[i].valueAndRange( 0.0, -100.0, 100.0 );
+ }
}
-
void LauIsobarDynamics::writeIntegralsFile()
{
- // Routine to end integration calculation for loglike normalisation.
- // This writes out the normalisation integral output into the file named
- // outputFileName.
- std::cout<<"INFO in LauIsobarDynamics::writeIntegralsFile : Writing integral output to integrals file "<<intFileName_.Data()<<std::endl;
-
- UInt_t i(0), j(0);
- std::ofstream getChar(intFileName_.Data());
+ // Routine to end integration calculation for loglike normalisation.
+ // This writes out the normalisation integral output into the file named
+ // outputFileName.
+ std::cout << "INFO in LauIsobarDynamics::writeIntegralsFile : Writing integral output to integrals file "
+ << intFileName_.Data() << std::endl;
- getChar << std::setprecision(10);
+ UInt_t i( 0 ), j( 0 );
+ std::ofstream getChar( intFileName_.Data() );
- // Write out daughter types (pi, pi0, K, K0s?)
- for (i = 0; i < 3; i++) {
- getChar << typDaug_[i] << " ";
- }
+ getChar << std::setprecision( 10 );
- // Write out number of resonances in the Dalitz plot model
- getChar << nAmp_ << std::endl;
+ // Write out daughter types (pi, pi0, K, K0s?)
+ for ( i = 0; i < 3; i++ ) {
+ getChar << typDaug_[i] << " ";
+ }
- // Write out the resonances
- for (i = 0; i < nAmp_; i++) {
- getChar << resTypAmp_[i] << " ";
- }
+ // Write out number of resonances in the Dalitz plot model
+ getChar << nAmp_ << std::endl;
- getChar << std::endl;
+ // Write out the resonances
+ for ( i = 0; i < nAmp_; i++ ) {
+ getChar << resTypAmp_[i] << " ";
+ }
- // Write out the resonance model types (BW, RelBW etc...)
- for (i = 0; i < nAmp_; i++) {
- LauAbsResonance* theResonance = sigResonances_[i];
- Int_t resModelInt = theResonance->getResonanceModel();
- getChar << resModelInt << " ";
- }
+ getChar << std::endl;
- getChar << std::endl;
+ // Write out the resonance model types (BW, RelBW etc...)
+ for ( i = 0; i < nAmp_; i++ ) {
+ LauAbsResonance* theResonance = sigResonances_[i];
+ Int_t resModelInt = theResonance->getResonanceModel();
+ getChar << resModelInt << " ";
+ }
- // Write out the track pairings for each resonance. This is specified
- // by the resPairAmpInt integer in the addResonance function.
- for (i = 0; i < nAmp_; i++) {
- getChar << resPairAmp_[i] << " ";
- }
+ getChar << std::endl;
- getChar << std::endl;
+ // Write out the track pairings for each resonance. This is specified
+ // by the resPairAmpInt integer in the addResonance function.
+ for ( i = 0; i < nAmp_; i++ ) {
+ getChar << resPairAmp_[i] << " ";
+ }
- // Write out the fSqSum = |ff|^2, where ff = resAmp()
- for (i = 0; i < nAmp_; i++) {
- getChar << fSqSum_[i] << " ";
- }
+ getChar << std::endl;
- getChar << std::endl;
+ // Write out the fSqSum = |ff|^2, where ff = resAmp()
+ for ( i = 0; i < nAmp_; i++ ) {
+ getChar << fSqSum_[i] << " ";
+ }
- // Similar to fSqSum, but with the efficiency term included.
- for (i = 0; i < nAmp_; i++) {
- getChar << fSqEffSum_[i] << " ";
- }
+ getChar << std::endl;
- getChar << std::endl;
+ // Similar to fSqSum, but with the efficiency term included.
+ for ( i = 0; i < nAmp_; i++ ) {
+ getChar << fSqEffSum_[i] << " ";
+ }
- // Write out the f_i*f_j_conj*eff values = resAmp_i*resAmp_j_conj*eff.
- // Note that only the top half of the i*j "matrix" is required, as it
- // is symmetric w.r.t i, j.
- for (i = 0; i < nAmp_; i++) {
- for (j = i; j < nAmp_; j++) {
- getChar << fifjEffSum_[i][j] << " ";
- }
- }
+ getChar << std::endl;
- getChar << std::endl;
+ // Write out the f_i*f_j_conj*eff values = resAmp_i*resAmp_j_conj*eff.
+ // Note that only the top half of the i*j "matrix" is required, as it
+ // is symmetric w.r.t i, j.
+ for ( i = 0; i < nAmp_; i++ ) {
+ for ( j = i; j < nAmp_; j++ ) {
+ getChar << fifjEffSum_[i][j] << " ";
+ }
+ }
- // Similar to fifjEffSum, but without the efficiency term included.
- for (i = 0; i < nAmp_; i++) {
- for (j = i; j < nAmp_; j++) {
- getChar << fifjSum_[i][j] << " ";
- }
- }
+ getChar << std::endl;
- getChar << std::endl;
+ // Similar to fifjEffSum, but without the efficiency term included.
+ for ( i = 0; i < nAmp_; i++ ) {
+ for ( j = i; j < nAmp_; j++ ) {
+ getChar << fifjSum_[i][j] << " ";
+ }
+ }
- // Write out number of incoherent resonances in the Dalitz plot model
- getChar << nIncohAmp_ << std::endl;
+ getChar << std::endl;
- // Write out the incoherent resonances
- for (i = 0; i < nIncohAmp_; i++) {
- getChar << incohResTypAmp_[i] << " ";
- }
+ // Write out number of incoherent resonances in the Dalitz plot model
+ getChar << nIncohAmp_ << std::endl;
- getChar << std::endl;
+ // Write out the incoherent resonances
+ for ( i = 0; i < nIncohAmp_; i++ ) {
+ getChar << incohResTypAmp_[i] << " ";
+ }
- // Write out the incoherent resonance model types (BW, RelBW etc...)
- for (i = 0; i < nIncohAmp_; i++) {
- LauAbsResonance* theResonance = sigIncohResonances_[i];
- Int_t resModelInt = theResonance->getResonanceModel();
- getChar << resModelInt << " ";
- }
+ getChar << std::endl;
- getChar << std::endl;
+ // Write out the incoherent resonance model types (BW, RelBW etc...)
+ for ( i = 0; i < nIncohAmp_; i++ ) {
+ LauAbsResonance* theResonance = sigIncohResonances_[i];
+ Int_t resModelInt = theResonance->getResonanceModel();
+ getChar << resModelInt << " ";
+ }
- // Write out the track pairings for each incoherent resonance. This is specified
- // by the resPairAmpInt integer in the addIncohResonance function.
- for (i = 0; i < nIncohAmp_; i++) {
- getChar << incohResPairAmp_[i] << " ";
- }
+ getChar << std::endl;
- getChar << std::endl;
+ // Write out the track pairings for each incoherent resonance. This is specified
+ // by the resPairAmpInt integer in the addIncohResonance function.
+ for ( i = 0; i < nIncohAmp_; i++ ) {
+ getChar << incohResPairAmp_[i] << " ";
+ }
- // Write out the fSqSum = |ff|^2, where |ff|^2 = incohResAmp()
- for (i = nAmp_; i < nAmp_+nIncohAmp_; i++) {
- getChar << fSqSum_[i] << " ";
- }
+ getChar << std::endl;
- getChar << std::endl;
+ // Write out the fSqSum = |ff|^2, where |ff|^2 = incohResAmp()
+ for ( i = nAmp_; i < nAmp_ + nIncohAmp_; i++ ) {
+ getChar << fSqSum_[i] << " ";
+ }
- // Similar to fSqSum, but with the efficiency term included.
- for (i = nAmp_; i < nAmp_+nIncohAmp_; i++) {
- getChar << fSqEffSum_[i] << " ";
- }
+ getChar << std::endl;
- getChar << std::endl;
+ // Similar to fSqSum, but with the efficiency term included.
+ for ( i = nAmp_; i < nAmp_ + nIncohAmp_; i++ ) {
+ getChar << fSqEffSum_[i] << " ";
+ }
+ getChar << std::endl;
}
-LauAbsResonance* LauIsobarDynamics::addResonance(const TString& resName, const Int_t resPairAmpInt, const LauAbsResonance::LauResonanceModel resType, const LauBlattWeisskopfFactor::BlattWeisskopfCategory bwCategory)
+LauAbsResonance* LauIsobarDynamics::addResonance(
+ const TString& resName,
+ const Int_t resPairAmpInt,
+ const LauAbsResonance::LauResonanceModel resType,
+ const LauBlattWeisskopfFactor::BlattWeisskopfCategory bwCategory )
{
- // Function to add a resonance in a Dalitz plot.
- // No check is made w.r.t flavour and charge conservation rules, and so
- // the user is responsible for checking the internal consistency of
- // their function statements with these laws. For example, the program
- // will not prevent the user from asking for a rho resonance in a K-pi
- // pair or a K* resonance in a pi-pi pair.
- // However, to assist the user, a summary of the resonant structure requested
- // by the user is printed before the program runs. It is important to check this
- // information when you first define your Dalitz plot model before doing
- // any fitting/generating.
- // Arguments are: resonance name, integer to specify the resonance track pairing
- // (1 => m_23, 2 => m_13, 3 => m_12), i.e. the bachelor track number.
- // The third argument resType specifies whether the resonance is a Breit-Wigner (BW)
- // Relativistic Breit-Wigner (RelBW) or Flatte distribution (Flatte), for example.
-
- if( LauAbsResonance::isIncoherentModel(resType) == true ) {
- std::cerr<<"ERROR in LauIsobarDynamics::addResonance : Resonance type \""<<resType<<"\" not allowed for a coherent resonance"<<std::endl;
- return 0;
- }
-
- LauResonanceMaker& resonanceMaker = LauResonanceMaker::get();
- LauAbsResonance *theResonance = resonanceMaker.getResonance(daughters_, resName, resPairAmpInt, resType, bwCategory);
-
- if (theResonance == 0) {
- std::cerr<<"ERROR in LauIsobarDynamics::addResonance : Couldn't create the resonance \""<<resName<<"\""<<std::endl;
- return 0;
- }
-
- // implement the helicity flip here
- if (flipHelicity_ && daughters_->getCharge(resPairAmpInt) == 0 && daughters_->getChargeParent() == 0 && daughters_->getTypeParent() > 0 ) {
- if ( ( resPairAmpInt == 1 && TMath::Abs(daughters_->getTypeDaug2()) == TMath::Abs(daughters_->getTypeDaug3()) ) ||
- ( resPairAmpInt == 2 && TMath::Abs(daughters_->getTypeDaug1()) == TMath::Abs(daughters_->getTypeDaug3()) ) ||
- ( resPairAmpInt == 3 && TMath::Abs(daughters_->getTypeDaug1()) == TMath::Abs(daughters_->getTypeDaug2()) ) ) {
- theResonance->flipHelicity(kTRUE);
- }
- }
-
- // Set the resonance name and what track is the bachelor
- TString resonanceName = theResonance->getResonanceName();
- resTypAmp_.push_back(resonanceName);
-
- // Always force the non-resonant amplitude pair to have resPairAmp = 0
- // in case the user chooses the wrong number.
- if ( resType == LauAbsResonance::FlatNR ||
- resType == LauAbsResonance::NRModel ) {
- std::cout<<"INFO in LauIsobarDynamics::addResonance : Setting resPairAmp to 0 for "<<resonanceName<<" contribution."<<std::endl;
- resPairAmp_.push_back(0);
- } else {
- resPairAmp_.push_back(resPairAmpInt);
- }
-
- // Increment the number of resonance amplitudes we have so far
- ++nAmp_;
-
- // Finally, add the resonance object to the internal array
- sigResonances_.push_back(theResonance);
-
- std::cout<<"INFO in LauIsobarDynamics::addResonance : Successfully added resonance. Total number of resonances so far = "<<nAmp_<<std::endl;
-
- return theResonance;
+ // Function to add a resonance in a Dalitz plot.
+ // No check is made w.r.t flavour and charge conservation rules, and so
+ // the user is responsible for checking the internal consistency of
+ // their function statements with these laws. For example, the program
+ // will not prevent the user from asking for a rho resonance in a K-pi
+ // pair or a K* resonance in a pi-pi pair.
+ // However, to assist the user, a summary of the resonant structure requested
+ // by the user is printed before the program runs. It is important to check this
+ // information when you first define your Dalitz plot model before doing
+ // any fitting/generating.
+ // Arguments are: resonance name, integer to specify the resonance track pairing
+ // (1 => m_23, 2 => m_13, 3 => m_12), i.e. the bachelor track number.
+ // The third argument resType specifies whether the resonance is a Breit-Wigner (BW)
+ // Relativistic Breit-Wigner (RelBW) or Flatte distribution (Flatte), for example.
+
+ if ( LauAbsResonance::isIncoherentModel( resType ) == true ) {
+ std::cerr << "ERROR in LauIsobarDynamics::addResonance : Resonance type \"" << resType
+ << "\" not allowed for a coherent resonance" << std::endl;
+ return 0;
+ }
+
+ LauResonanceMaker& resonanceMaker = LauResonanceMaker::get();
+ LauAbsResonance* theResonance =
+ resonanceMaker.getResonance( daughters_, resName, resPairAmpInt, resType, bwCategory );
+
+ if ( theResonance == 0 ) {
+ std::cerr << "ERROR in LauIsobarDynamics::addResonance : Couldn't create the resonance \""
+ << resName << "\"" << std::endl;
+ return 0;
+ }
+
+ // implement the helicity flip here
+ if ( flipHelicity_ && daughters_->getCharge( resPairAmpInt ) == 0 &&
+ daughters_->getChargeParent() == 0 && daughters_->getTypeParent() > 0 ) {
+ if ( ( resPairAmpInt == 1 && TMath::Abs( daughters_->getTypeDaug2() ) ==
+ TMath::Abs( daughters_->getTypeDaug3() ) ) ||
+ ( resPairAmpInt == 2 && TMath::Abs( daughters_->getTypeDaug1() ) ==
+ TMath::Abs( daughters_->getTypeDaug3() ) ) ||
+ ( resPairAmpInt == 3 && TMath::Abs( daughters_->getTypeDaug1() ) ==
+ TMath::Abs( daughters_->getTypeDaug2() ) ) ) {
+ theResonance->flipHelicity( kTRUE );
+ }
+ }
+
+ // Set the resonance name and what track is the bachelor
+ TString resonanceName = theResonance->getResonanceName();
+ resTypAmp_.push_back( resonanceName );
+
+ // Always force the non-resonant amplitude pair to have resPairAmp = 0
+ // in case the user chooses the wrong number.
+ if ( resType == LauAbsResonance::FlatNR || resType == LauAbsResonance::NRModel ) {
+ std::cout << "INFO in LauIsobarDynamics::addResonance : Setting resPairAmp to 0 for "
+ << resonanceName << " contribution." << std::endl;
+ resPairAmp_.push_back( 0 );
+ } else {
+ resPairAmp_.push_back( resPairAmpInt );
+ }
+
+ // Increment the number of resonance amplitudes we have so far
+ ++nAmp_;
+
+ // Finally, add the resonance object to the internal array
+ sigResonances_.push_back( theResonance );
+
+ std::cout << "INFO in LauIsobarDynamics::addResonance : Successfully added resonance. Total number of resonances so far = "
+ << nAmp_ << std::endl;
+
+ return theResonance;
}
-LauAbsResonance* LauIsobarDynamics::addIncoherentResonance(const TString& resName, const Int_t resPairAmpInt, const LauAbsResonance::LauResonanceModel resType)
+LauAbsResonance* LauIsobarDynamics::addIncoherentResonance(
+ const TString& resName,
+ const Int_t resPairAmpInt,
+ const LauAbsResonance::LauResonanceModel resType )
{
- // Function to add an incoherent resonance in a Dalitz plot.
- // No check is made w.r.t flavour and charge conservation rules, and so
- // the user is responsible for checking the internal consistency of
- // their function statements with these laws. For example, the program
- // will not prevent the user from asking for a rho resonance in a K-pi
- // pair or a K* resonance in a pi-pi pair.
- // However, to assist the user, a summary of the resonant structure requested
- // by the user is printed before the program runs. It is important to check this
- // information when you first define your Dalitz plot model before doing
- // any fitting/generating.
- // Arguments are: resonance name, integer to specify the resonance track pairing
- // (1 => m_23, 2 => m_13, 3 => m_12), i.e. the bachelor track number.
- // The third argument resType specifies the shape of the resonance
- // Gaussian (GaussIncoh), for example.
-
- if( LauAbsResonance::isIncoherentModel(resType) == false ) {
- std::cerr<<"ERROR in LauIsobarDynamics::addIncohResonance : Resonance type \""<<resType<<"\" not allowed for an incoherent resonance"<<std::endl;
- return 0;
- }
-
- LauResonanceMaker& resonanceMaker = LauResonanceMaker::get();
- LauAbsIncohRes *theResonance = dynamic_cast<LauAbsIncohRes*>( resonanceMaker.getResonance(daughters_, resName, resPairAmpInt, resType) );
-
- if (theResonance == 0) {
- std::cerr<<"ERROR in LauIsobarDynamics::addIncohResonance : Couldn't create the resonance \""<<resName<<"\""<<std::endl;
- return 0;
- }
-
- // Set the resonance name and what track is the bachelor
- TString resonanceName = theResonance->getResonanceName();
- incohResTypAmp_.push_back(resonanceName);
- incohResPairAmp_.push_back(resPairAmpInt);
-
- // Increment the number of resonance amplitudes we have so far
- ++nIncohAmp_;
-
- // Finally, add the resonance object to the internal array
- sigIncohResonances_.push_back(theResonance);
-
- std::cout<<"INFO in LauIsobarDynamics::addIncohResonance : Successfully added incoherent resonance. Total number of incoherent resonances so far = "<<nIncohAmp_<<std::endl;
-
- return theResonance;
+ // Function to add an incoherent resonance in a Dalitz plot.
+ // No check is made w.r.t flavour and charge conservation rules, and so
+ // the user is responsible for checking the internal consistency of
+ // their function statements with these laws. For example, the program
+ // will not prevent the user from asking for a rho resonance in a K-pi
+ // pair or a K* resonance in a pi-pi pair.
+ // However, to assist the user, a summary of the resonant structure requested
+ // by the user is printed before the program runs. It is important to check this
+ // information when you first define your Dalitz plot model before doing
+ // any fitting/generating.
+ // Arguments are: resonance name, integer to specify the resonance track pairing
+ // (1 => m_23, 2 => m_13, 3 => m_12), i.e. the bachelor track number.
+ // The third argument resType specifies the shape of the resonance
+ // Gaussian (GaussIncoh), for example.
+
+ if ( LauAbsResonance::isIncoherentModel( resType ) == false ) {
+ std::cerr << "ERROR in LauIsobarDynamics::addIncohResonance : Resonance type \"" << resType
+ << "\" not allowed for an incoherent resonance" << std::endl;
+ return 0;
+ }
+
+ LauResonanceMaker& resonanceMaker = LauResonanceMaker::get();
+ LauAbsIncohRes* theResonance = dynamic_cast<LauAbsIncohRes*>(
+ resonanceMaker.getResonance( daughters_, resName, resPairAmpInt, resType ) );
+
+ if ( theResonance == 0 ) {
+ std::cerr << "ERROR in LauIsobarDynamics::addIncohResonance : Couldn't create the resonance \""
+ << resName << "\"" << std::endl;
+ return 0;
+ }
+
+ // Set the resonance name and what track is the bachelor
+ TString resonanceName = theResonance->getResonanceName();
+ incohResTypAmp_.push_back( resonanceName );
+ incohResPairAmp_.push_back( resPairAmpInt );
+
+ // Increment the number of resonance amplitudes we have so far
+ ++nIncohAmp_;
+
+ // Finally, add the resonance object to the internal array
+ sigIncohResonances_.push_back( theResonance );
+
+ std::cout << "INFO in LauIsobarDynamics::addIncohResonance : Successfully added incoherent resonance. Total number of incoherent resonances so far = "
+ << nIncohAmp_ << std::endl;
+
+ return theResonance;
}
-LauKMatrixPropagator* LauIsobarDynamics::defineKMatrixPropagator( const TString& propName, const TString& paramFileName, Int_t resPairAmpInt,
- Int_t nChannels, Int_t nPoles, Int_t rowIndex)
+LauKMatrixPropagator* LauIsobarDynamics::defineKMatrixPropagator( const TString& propName,
+ const TString& paramFileName,
+ Int_t resPairAmpInt,
+ Int_t nChannels,
+ Int_t nPoles,
+ Int_t rowIndex )
{
- // Define the K-matrix propagator. The resPairAmpInt integer specifies which mass combination should be used
- // for the invariant mass-squared variable "s". The pole masses and coupling constants are defined in the
- // paramFileName parameter file.
- // The number of channels and poles are defined by the nChannels and nPoles integers, respectively.
- // The integer rowIndex specifies which row of the propagator should be used when
- // summing over all amplitude channels: S-wave will be the first row, so rowIndex = 1.
-
- // Check that the rowIndex is valid
- if (rowIndex < 1 || rowIndex > nChannels) {
- std::cerr << "ERROR in LauIsobarDynamics::defineKMatrixPropagator. The rowIndex, which is set to "
- << rowIndex << ", must be between 1 and the number of channels "
- << nChannels << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- TString propagatorName(propName), parameterFile(paramFileName);
-
- LauKMatrixPropagator* thePropagator = LauKMatrixPropFactory::getInstance()->getPropagator(propagatorName, parameterFile,
- resPairAmpInt, nChannels,
- nPoles, rowIndex);
- kMatrixPropagators_[propagatorName] = thePropagator;
-
- return thePropagator;
+ // Define the K-matrix propagator. The resPairAmpInt integer specifies which mass combination should be used
+ // for the invariant mass-squared variable "s". The pole masses and coupling constants are defined in the
+ // paramFileName parameter file.
+ // The number of channels and poles are defined by the nChannels and nPoles integers, respectively.
+ // The integer rowIndex specifies which row of the propagator should be used when
+ // summing over all amplitude channels: S-wave will be the first row, so rowIndex = 1.
+
+ // Check that the rowIndex is valid
+ if ( rowIndex < 1 || rowIndex > nChannels ) {
+ std::cerr << "ERROR in LauIsobarDynamics::defineKMatrixPropagator. The rowIndex, which is set to "
+ << rowIndex << ", must be between 1 and the number of channels " << nChannels
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ TString propagatorName( propName ), parameterFile( paramFileName );
+
+ LauKMatrixPropagator* thePropagator =
+ LauKMatrixPropFactory::getInstance()->getPropagator( propagatorName,
+ parameterFile,
+ resPairAmpInt,
+ nChannels,
+ nPoles,
+ rowIndex );
+ kMatrixPropagators_[propagatorName] = thePropagator;
+
+ return thePropagator;
}
-void LauIsobarDynamics::addKMatrixProdPole(const TString& poleName, const TString& propName, Int_t poleIndex, Bool_t useProdAdler)
+void LauIsobarDynamics::addKMatrixProdPole( const TString& poleName,
+ const TString& propName,
+ Int_t poleIndex,
+ Bool_t useProdAdler )
{
- // Add a K-matrix production pole term, using the K-matrix propagator given by the propName.
- // Here, poleIndex is the integer specifying the pole number.
-
- // First, find the K-matrix propagator.
- KMPropMap::iterator mapIter = kMatrixPropagators_.find(propName);
- if (mapIter != kMatrixPropagators_.end()) {
-
- LauKMatrixPropagator* thePropagator = mapIter->second;
-
- // Make sure the pole index is valid
- Int_t nPoles = thePropagator->getNPoles();
- if (poleIndex < 1 || poleIndex > nPoles) {
- std::cerr<<"ERROR in LauIsobarDynamics::addKMatrixProdPole : The pole index "<<poleIndex
- <<" is not between 1 and "<<nPoles<<". Not adding production pole "<<poleName
- <<" for K-matrix propagator "<<propName<<std::endl;
- return;
- }
-
- // Now add the K-matrix production pole amplitude to the vector of LauAbsResonance pointers.
- Int_t resPairAmpInt = thePropagator->getResPairAmpInt();
- LauAbsResonance* prodPole = new LauKMatrixProdPole(poleName, poleIndex, resPairAmpInt,
- thePropagator, daughters_, useProdAdler);
- prodPole->setSpinType( LauAbsResonance::Legendre );
-
- resTypAmp_.push_back(poleName);
- resPairAmp_.push_back(resPairAmpInt);
-
- ++nAmp_;
- sigResonances_.push_back(prodPole);
-
- // Also store the propName-poleName pair for calculating total fit fractions later on
- // (avoiding the need to use dynamic casts to check which resonances are of the K-matrix type)
- kMatrixPropSet_[poleName] = propName;
-
- std::cout<<"INFO in LauIsobarDynamics::addKMatrixProdPole : Successfully added K-matrix production pole term. Total number of resonances so far = "<<nAmp_<<std::endl;
-
- } else {
-
- std::cerr<<"ERROR in LauIsobarDynamics::addKMatrixProdPole : The propagator of the name "<<propName
- <<" could not be found for the production pole "<<poleName<<std::endl;
-
- }
-
+ // Add a K-matrix production pole term, using the K-matrix propagator given by the propName.
+ // Here, poleIndex is the integer specifying the pole number.
+
+ // First, find the K-matrix propagator.
+ KMPropMap::iterator mapIter = kMatrixPropagators_.find( propName );
+ if ( mapIter != kMatrixPropagators_.end() ) {
+
+ LauKMatrixPropagator* thePropagator = mapIter->second;
+
+ // Make sure the pole index is valid
+ Int_t nPoles = thePropagator->getNPoles();
+ if ( poleIndex < 1 || poleIndex > nPoles ) {
+ std::cerr << "ERROR in LauIsobarDynamics::addKMatrixProdPole : The pole index "
+ << poleIndex << " is not between 1 and " << nPoles
+ << ". Not adding production pole " << poleName << " for K-matrix propagator "
+ << propName << std::endl;
+ return;
+ }
+
+ // Now add the K-matrix production pole amplitude to the vector of LauAbsResonance pointers.
+ Int_t resPairAmpInt = thePropagator->getResPairAmpInt();
+ LauAbsResonance* prodPole = new LauKMatrixProdPole( poleName,
+ poleIndex,
+ resPairAmpInt,
+ thePropagator,
+ daughters_,
+ useProdAdler );
+ prodPole->setSpinType( LauAbsResonance::Legendre );
+
+ resTypAmp_.push_back( poleName );
+ resPairAmp_.push_back( resPairAmpInt );
+
+ ++nAmp_;
+ sigResonances_.push_back( prodPole );
+
+ // Also store the propName-poleName pair for calculating total fit fractions later on
+ // (avoiding the need to use dynamic casts to check which resonances are of the K-matrix type)
+ kMatrixPropSet_[poleName] = propName;
+
+ std::cout << "INFO in LauIsobarDynamics::addKMatrixProdPole : Successfully added K-matrix production pole term. Total number of resonances so far = "
+ << nAmp_ << std::endl;
+
+ } else {
+
+ std::cerr << "ERROR in LauIsobarDynamics::addKMatrixProdPole : The propagator of the name "
+ << propName << " could not be found for the production pole " << poleName
+ << std::endl;
+ }
}
-
-void LauIsobarDynamics::addKMatrixProdSVP(const TString& SVPName, const TString& propName, Int_t channelIndex, Bool_t useProdAdler)
+void LauIsobarDynamics::addKMatrixProdSVP( const TString& SVPName,
+ const TString& propName,
+ Int_t channelIndex,
+ Bool_t useProdAdler )
{
- // Add a K-matrix production "slowly-varying part" (SVP) term, using the K-matrix propagator
- // given by the propName. Here, channelIndex is the integer specifying the channel number.
-
- // First, find the K-matrix propagator.
- KMPropMap::iterator mapIter = kMatrixPropagators_.find(propName);
- if (mapIter != kMatrixPropagators_.end()) {
-
- LauKMatrixPropagator* thePropagator = mapIter->second;
-
- // Make sure the channel index is valid
- Int_t nChannels = thePropagator->getNChannels();
- if (channelIndex < 1 || channelIndex > nChannels) {
- std::cerr<<"ERROR in LauIsobarDynamics::addKMatrixProdSVP : The channel index "<<channelIndex
- <<" is not between 1 and "<<nChannels<<". Not adding production slowly-varying part "<<SVPName
- <<" for K-matrix propagator "<<propName<<std::endl;
- return;
- }
-
- // Now add the K-matrix production SVP amplitude to the vector of LauAbsResonance pointers.
- Int_t resPairAmpInt = thePropagator->getResPairAmpInt();
- LauAbsResonance* prodSVP = new LauKMatrixProdSVP(SVPName, channelIndex, resPairAmpInt,
- thePropagator, daughters_, useProdAdler);
- prodSVP->setSpinType( LauAbsResonance::Legendre );
-
- resTypAmp_.push_back(SVPName);
- resPairAmp_.push_back(resPairAmpInt);
-
- ++nAmp_;
- sigResonances_.push_back(prodSVP);
-
- // Also store the SVPName-propName pair for calculating total fit fractions later on
- // (avoiding the need to use dynamic casts to check which resonances are of the K-matrix type)
- kMatrixPropSet_[SVPName] = propName;
-
- std::cout<<"INFO in LauIsobarDynamics::addKMatrixProdSVP : Successfully added K-matrix production slowly-varying (SVP) term. Total number of resonances so far = "<<nAmp_<<std::endl;
-
- } else {
-
- std::cerr<<"ERROR in LauIsobarDynamics::addKMatrixProdSVP : The propagator of the name "<<propName
- <<" could not be found for the production slowly-varying part "<<SVPName<<std::endl;
-
- }
+ // Add a K-matrix production "slowly-varying part" (SVP) term, using the K-matrix propagator
+ // given by the propName. Here, channelIndex is the integer specifying the channel number.
+
+ // First, find the K-matrix propagator.
+ KMPropMap::iterator mapIter = kMatrixPropagators_.find( propName );
+ if ( mapIter != kMatrixPropagators_.end() ) {
+
+ LauKMatrixPropagator* thePropagator = mapIter->second;
+
+ // Make sure the channel index is valid
+ Int_t nChannels = thePropagator->getNChannels();
+ if ( channelIndex < 1 || channelIndex > nChannels ) {
+ std::cerr << "ERROR in LauIsobarDynamics::addKMatrixProdSVP : The channel index "
+ << channelIndex << " is not between 1 and " << nChannels
+ << ". Not adding production slowly-varying part " << SVPName
+ << " for K-matrix propagator " << propName << std::endl;
+ return;
+ }
+
+ // Now add the K-matrix production SVP amplitude to the vector of LauAbsResonance pointers.
+ Int_t resPairAmpInt = thePropagator->getResPairAmpInt();
+ LauAbsResonance* prodSVP = new LauKMatrixProdSVP( SVPName,
+ channelIndex,
+ resPairAmpInt,
+ thePropagator,
+ daughters_,
+ useProdAdler );
+ prodSVP->setSpinType( LauAbsResonance::Legendre );
+
+ resTypAmp_.push_back( SVPName );
+ resPairAmp_.push_back( resPairAmpInt );
+
+ ++nAmp_;
+ sigResonances_.push_back( prodSVP );
+
+ // Also store the SVPName-propName pair for calculating total fit fractions later on
+ // (avoiding the need to use dynamic casts to check which resonances are of the K-matrix type)
+ kMatrixPropSet_[SVPName] = propName;
+
+ std::cout << "INFO in LauIsobarDynamics::addKMatrixProdSVP : Successfully added K-matrix production slowly-varying (SVP) term. Total number of resonances so far = "
+ << nAmp_ << std::endl;
+
+ } else {
+
+ std::cerr << "ERROR in LauIsobarDynamics::addKMatrixProdSVP : The propagator of the name "
+ << propName << " could not be found for the production slowly-varying part "
+ << SVPName << std::endl;
+ }
}
-Int_t LauIsobarDynamics::resonanceIndex(const TString& resName) const
+Int_t LauIsobarDynamics::resonanceIndex( const TString& resName ) const
{
- Int_t index(0);
- const LauAbsResonance* theResonance(0);
-
- for (std::vector<LauAbsResonance*>::const_iterator iter=sigResonances_.begin(); iter!=sigResonances_.end(); ++iter) {
- theResonance = (*iter);
- if (theResonance != 0) {
- const TString& resString = theResonance->getResonanceName();
- if (resString == resName) {
- return index;
- }
- }
- ++index;
- }
-
- for (std::vector<LauAbsIncohRes*>::const_iterator iter=sigIncohResonances_.begin(); iter!=sigIncohResonances_.end(); ++iter) {
- theResonance = (*iter);
- if (theResonance != 0) {
- const TString& resString = theResonance->getResonanceName();
- if (resString == resName) {
- return index;
- }
- }
- ++index;
- }
-
- return -1;
+ Int_t index( 0 );
+ const LauAbsResonance* theResonance( 0 );
+
+ for ( std::vector<LauAbsResonance*>::const_iterator iter = sigResonances_.begin();
+ iter != sigResonances_.end();
+ ++iter ) {
+ theResonance = ( *iter );
+ if ( theResonance != 0 ) {
+ const TString& resString = theResonance->getResonanceName();
+ if ( resString == resName ) {
+ return index;
+ }
+ }
+ ++index;
+ }
+
+ for ( std::vector<LauAbsIncohRes*>::const_iterator iter = sigIncohResonances_.begin();
+ iter != sigIncohResonances_.end();
+ ++iter ) {
+ theResonance = ( *iter );
+ if ( theResonance != 0 ) {
+ const TString& resString = theResonance->getResonanceName();
+ if ( resString == resName ) {
+ return index;
+ }
+ }
+ ++index;
+ }
+
+ return -1;
}
-Bool_t LauIsobarDynamics::hasResonance(const TString& resName) const
+Bool_t LauIsobarDynamics::hasResonance( const TString& resName ) const
{
- const Int_t index = this->resonanceIndex(resName);
- if (index < 0) {
- return kFALSE;
- } else {
- return kTRUE;
- }
+ const Int_t index = this->resonanceIndex( resName );
+ if ( index < 0 ) {
+ return kFALSE;
+ } else {
+ return kTRUE;
+ }
}
-const LauAbsResonance* LauIsobarDynamics::getResonance(const UInt_t resIndex) const
+const LauAbsResonance* LauIsobarDynamics::getResonance( const UInt_t resIndex ) const
{
- if ( resIndex < this->getnCohAmp() ) {
- return sigResonances_[resIndex];
- } else if ( resIndex < this->getnTotAmp() ) {
- return sigIncohResonances_[ resIndex - nAmp_ ];
- } else {
- std::cerr<<"ERROR in LauIsobarDynamics::getResonance : Couldn't find resonance with index \""<<resIndex<<"\" in the model."<<std::endl;
- return 0;
- }
+ if ( resIndex < this->getnCohAmp() ) {
+ return sigResonances_[resIndex];
+ } else if ( resIndex < this->getnTotAmp() ) {
+ return sigIncohResonances_[resIndex - nAmp_];
+ } else {
+ std::cerr << "ERROR in LauIsobarDynamics::getResonance : Couldn't find resonance with index \""
+ << resIndex << "\" in the model." << std::endl;
+ return 0;
+ }
}
-LauAbsResonance* LauIsobarDynamics::getResonance(const UInt_t resIndex)
+LauAbsResonance* LauIsobarDynamics::getResonance( const UInt_t resIndex )
{
- if ( resIndex < this->getnCohAmp() ) {
- return sigResonances_[resIndex];
- } else if ( resIndex < this->getnTotAmp() ) {
- return sigIncohResonances_[ resIndex - nAmp_ ];
- } else {
- std::cerr<<"ERROR in LauIsobarDynamics::getResonance : Couldn't find resonance with index \""<<resIndex<<"\" in the model."<<std::endl;
- return 0;
- }
+ if ( resIndex < this->getnCohAmp() ) {
+ return sigResonances_[resIndex];
+ } else if ( resIndex < this->getnTotAmp() ) {
+ return sigIncohResonances_[resIndex - nAmp_];
+ } else {
+ std::cerr << "ERROR in LauIsobarDynamics::getResonance : Couldn't find resonance with index \""
+ << resIndex << "\" in the model." << std::endl;
+ return 0;
+ }
}
-LauAbsResonance* LauIsobarDynamics::findResonance(const TString& resName)
+LauAbsResonance* LauIsobarDynamics::findResonance( const TString& resName )
{
- const Int_t index = this->resonanceIndex( resName );
- if ( index < 0 ) {
- std::cerr<<"ERROR in LauIsobarDynamics::findResonance : Couldn't find resonance with name \""<<resName<<"\" in the model."<<std::endl;
- return 0;
- } else {
- return this->getResonance( index );
- }
+ const Int_t index = this->resonanceIndex( resName );
+ if ( index < 0 ) {
+ std::cerr << "ERROR in LauIsobarDynamics::findResonance : Couldn't find resonance with name \""
+ << resName << "\" in the model." << std::endl;
+ return 0;
+ } else {
+ return this->getResonance( index );
+ }
}
-const LauAbsResonance* LauIsobarDynamics::findResonance(const TString& resName) const
+const LauAbsResonance* LauIsobarDynamics::findResonance( const TString& resName ) const
{
- const Int_t index = this->resonanceIndex( resName );
- if ( index < 0 ) {
- std::cerr<<"ERROR in LauIsobarDynamics::findResonance : Couldn't find resonance with name \""<<resName<<"\" in the model."<<std::endl;
- return 0;
- } else {
- return this->getResonance( index );
- }
+ const Int_t index = this->resonanceIndex( resName );
+ if ( index < 0 ) {
+ std::cerr << "ERROR in LauIsobarDynamics::findResonance : Couldn't find resonance with name \""
+ << resName << "\" in the model." << std::endl;
+ return 0;
+ } else {
+ return this->getResonance( index );
+ }
}
-void LauIsobarDynamics::removeCharge(TString& string) const
+void LauIsobarDynamics::removeCharge( TString& string ) const
{
- Ssiz_t index = string.Index("+");
- if (index != -1) {
- string.Remove(index,1);
- }
- index = string.Index("-");
- if (index != -1) {
- string.Remove(index,1);
- }
+ Ssiz_t index = string.Index( "+" );
+ if ( index != -1 ) {
+ string.Remove( index, 1 );
+ }
+ index = string.Index( "-" );
+ if ( index != -1 ) {
+ string.Remove( index, 1 );
+ }
}
void LauIsobarDynamics::calcDPNormalisation()
{
- if (!normalizationSchemeDone_) {
- this->calcDPNormalisationScheme();
- }
-
- for (std::vector<LauDPPartialIntegralInfo*>::iterator it = dpPartialIntegralInfo_.begin(); it != dpPartialIntegralInfo_.end(); ++it)
- {
- this->calcDPPartialIntegral( *it );
- }
-
- for (UInt_t i = 0; i < nAmp_+nIncohAmp_; ++i) {
- fNorm_[i] = 0.0;
- if (fSqSum_[i] > 0.0) {fNorm_[i] = TMath::Sqrt(1.0/(fSqSum_[i]));}
- }
+ if ( ! normalizationSchemeDone_ ) {
+ this->calcDPNormalisationScheme();
+ }
+
+ for ( std::vector<LauDPPartialIntegralInfo*>::iterator it = dpPartialIntegralInfo_.begin();
+ it != dpPartialIntegralInfo_.end();
+ ++it ) {
+ this->calcDPPartialIntegral( *it );
+ }
+
+ for ( UInt_t i = 0; i < nAmp_ + nIncohAmp_; ++i ) {
+ fNorm_[i] = 0.0;
+ if ( fSqSum_[i] > 0.0 ) {
+ fNorm_[i] = TMath::Sqrt( 1.0 / ( fSqSum_[i] ) );
+ }
+ }
}
-std::vector< std::pair<Double_t, Double_t> > LauIsobarDynamics::formGapsFromRegions( const std::vector< std::pair<Double_t, Double_t> >& regions, const Double_t min, const Double_t max ) const
+std::vector<std::pair<Double_t, Double_t>> LauIsobarDynamics::formGapsFromRegions(
+ const std::vector<std::pair<Double_t, Double_t>>& regions,
+ const Double_t min,
+ const Double_t max ) const
{
- std::vector< std::pair<Double_t, Double_t> > gaps(regions.size() + 1, std::make_pair(0., 0.));
+ std::vector<std::pair<Double_t, Double_t>> gaps( regions.size() + 1, std::make_pair( 0., 0. ) );
- // Given some narrow resonance regions, find the regions that correspond to the gaps between them
+ // Given some narrow resonance regions, find the regions that correspond to the gaps between them
- gaps[0].first = min;
+ gaps[0].first = min;
- for (UInt_t i = 0; i < regions.size(); ++i) {
- gaps[i].second = regions[i].first;
- gaps[i + 1].first = regions[i].second;
- }
+ for ( UInt_t i = 0; i < regions.size(); ++i ) {
+ gaps[i].second = regions[i].first;
+ gaps[i + 1].first = regions[i].second;
+ }
- gaps[gaps.size() - 1].second = max;
+ gaps[gaps.size() - 1].second = max;
- return gaps;
+ return gaps;
}
void LauIsobarDynamics::cullNullRegions( std::vector<LauDPPartialIntegralInfo*>& regions ) const
{
- LauDPPartialIntegralInfo* tmp(0);
- regions.erase( std::remove(regions.begin(), regions.end(), tmp), regions.end() );
+ LauDPPartialIntegralInfo* tmp( 0 );
+ regions.erase( std::remove( regions.begin(), regions.end(), tmp ), regions.end() );
}
-void LauIsobarDynamics::correctDPOverlap( std::vector< std::pair<Double_t, Double_t> >& regions, const std::vector<Double_t>& binnings ) const
+void LauIsobarDynamics::correctDPOverlap( std::vector<std::pair<Double_t, Double_t>>& regions,
+ const std::vector<Double_t>& binnings ) const
{
- if (regions.empty()) {
- return;
- }
-
- // If the regions overlap, ensure that the one with the finest binning takes precedence (i.e., extends its full width)
-
- for (UInt_t i = 0; i < regions.size() - 1; ++i) {
- if ( regions[i + 1].first <= regions[i].second ) {
- if ((binnings[i] < binnings[i + 1])) {
- regions[i + 1] = std::make_pair(regions[i].second, regions[i + 1].second);
- } else {
- regions[i] = std::make_pair(regions[i].first, regions[i + 1].first);
- }
- }
- }
-
+ if ( regions.empty() ) {
+ return;
+ }
+
+ // If the regions overlap, ensure that the one with the finest binning takes precedence (i.e., extends its full width)
+
+ for ( UInt_t i = 0; i < regions.size() - 1; ++i ) {
+ if ( regions[i + 1].first <= regions[i].second ) {
+ if ( ( binnings[i] < binnings[i + 1] ) ) {
+ regions[i + 1] = std::make_pair( regions[i].second, regions[i + 1].second );
+ } else {
+ regions[i] = std::make_pair( regions[i].first, regions[i + 1].first );
+ }
+ }
+ }
}
-
-std::vector<LauDPPartialIntegralInfo*> LauIsobarDynamics::m13IntegrationRegions( const std::vector< std::pair<Double_t,Double_t> >& m13Regions,
- const std::vector< std::pair<Double_t,Double_t> >& m23Regions,
- const std::vector<Double_t>& m13Binnings,
- const Double_t precision,
- const Double_t defaultBinning ) const
+std::vector<LauDPPartialIntegralInfo*> LauIsobarDynamics::m13IntegrationRegions(
+ const std::vector<std::pair<Double_t, Double_t>>& m13Regions,
+ const std::vector<std::pair<Double_t, Double_t>>& m23Regions,
+ const std::vector<Double_t>& m13Binnings,
+ const Double_t precision,
+ const Double_t defaultBinning ) const
{
- // Create integration regions for all narrow resonances in m13 except for the overlaps with narrow resonances in m23
- std::vector<LauDPPartialIntegralInfo*> integrationRegions;
-
- const Double_t m23Min = kinematics_->getm23Min();
- const Double_t m23Max = kinematics_->getm23Max();
-
- // Loop over narrow resonances in m13
- for (UInt_t m13i = 0; m13i < m13Regions.size(); ++m13i) {
-
- const Double_t m13Binning = m13Binnings[m13i];
-
- const Double_t resMin13 = m13Regions[m13i].first;
- const Double_t resMax13 = m13Regions[m13i].second;
-
- // Initialise to the full height of the DP in case there are no narrow resonances in m23
- Double_t lastResMax23 = m23Min;
-
- // Loop over narrow resonances in m23
- for (UInt_t m23i = 0; m23i < m23Regions.size(); m23i++) {
-
- const Double_t resMin23 = m23Regions[m23i].first;
- const Double_t resMax23 = m23Regions[m23i].second;
-
- // For the first entry, add the area between m23 threshold and this first entry
- if (m23i == 0) {
- integrationRegions.push_back(this->newDPIntegrationRegion(resMin13, resMax13, m23Min, resMin23, m13Binning, defaultBinning, precision, nAmp_, nIncohAmp_));
- }
-
- // For all entries except the last one, add the area between this and the next entry
- if (m23i != (m23Regions.size() - 1)) {
- const Double_t nextResMin23 = m23Regions[m23i + 1].first;
- integrationRegions.push_back(this->newDPIntegrationRegion(resMin13, resMax13, resMax23, nextResMin23, m13Binning, defaultBinning, precision, nAmp_, nIncohAmp_));
- } else {
- lastResMax23 = resMax23;
- }
- }
-
- // Add the area between the last entry and the maximum m23 (which could be the whole strip if there are no entries in m23Regions)
- integrationRegions.push_back(this->newDPIntegrationRegion(resMin13, resMax13, lastResMax23, m23Max, m13Binning, defaultBinning, precision, nAmp_, nIncohAmp_));
- }
-
- return integrationRegions;
+ // Create integration regions for all narrow resonances in m13 except for the overlaps with narrow resonances in m23
+ std::vector<LauDPPartialIntegralInfo*> integrationRegions;
+
+ const Double_t m23Min = kinematics_->getm23Min();
+ const Double_t m23Max = kinematics_->getm23Max();
+
+ // Loop over narrow resonances in m13
+ for ( UInt_t m13i = 0; m13i < m13Regions.size(); ++m13i ) {
+
+ const Double_t m13Binning = m13Binnings[m13i];
+
+ const Double_t resMin13 = m13Regions[m13i].first;
+ const Double_t resMax13 = m13Regions[m13i].second;
+
+ // Initialise to the full height of the DP in case there are no narrow resonances in m23
+ Double_t lastResMax23 = m23Min;
+
+ // Loop over narrow resonances in m23
+ for ( UInt_t m23i = 0; m23i < m23Regions.size(); m23i++ ) {
+
+ const Double_t resMin23 = m23Regions[m23i].first;
+ const Double_t resMax23 = m23Regions[m23i].second;
+
+ // For the first entry, add the area between m23 threshold and this first entry
+ if ( m23i == 0 ) {
+ integrationRegions.push_back( this->newDPIntegrationRegion( resMin13,
+ resMax13,
+ m23Min,
+ resMin23,
+ m13Binning,
+ defaultBinning,
+ precision,
+ nAmp_,
+ nIncohAmp_ ) );
+ }
+
+ // For all entries except the last one, add the area between this and the next entry
+ if ( m23i != ( m23Regions.size() - 1 ) ) {
+ const Double_t nextResMin23 = m23Regions[m23i + 1].first;
+ integrationRegions.push_back( this->newDPIntegrationRegion( resMin13,
+ resMax13,
+ resMax23,
+ nextResMin23,
+ m13Binning,
+ defaultBinning,
+ precision,
+ nAmp_,
+ nIncohAmp_ ) );
+ } else {
+ lastResMax23 = resMax23;
+ }
+ }
+
+ // Add the area between the last entry and the maximum m23 (which could be the whole strip if there are no entries in m23Regions)
+ integrationRegions.push_back( this->newDPIntegrationRegion( resMin13,
+ resMax13,
+ lastResMax23,
+ m23Max,
+ m13Binning,
+ defaultBinning,
+ precision,
+ nAmp_,
+ nIncohAmp_ ) );
+ }
+
+ return integrationRegions;
}
-std::vector<LauDPPartialIntegralInfo*> LauIsobarDynamics::m23IntegrationRegions( const std::vector<std::pair<Double_t,Double_t> >& m13Regions,
- const std::vector<std::pair<Double_t,Double_t> >& m23Regions,
- const std::vector<Double_t>& m13Binnings,
- const std::vector<Double_t>& m23Binnings,
- const Double_t precision,
- const Double_t defaultBinning ) const
+std::vector<LauDPPartialIntegralInfo*> LauIsobarDynamics::m23IntegrationRegions(
+ const std::vector<std::pair<Double_t, Double_t>>& m13Regions,
+ const std::vector<std::pair<Double_t, Double_t>>& m23Regions,
+ const std::vector<Double_t>& m13Binnings,
+ const std::vector<Double_t>& m23Binnings,
+ const Double_t precision,
+ const Double_t defaultBinning ) const
{
- // Create integration regions for all narrow resonances in m23 (including the overlap regions with m13 narrow resonances)
- std::vector<LauDPPartialIntegralInfo *> integrationRegions;
-
- const Double_t m13Min = kinematics_->getm13Min();
- const Double_t m13Max = kinematics_->getm13Max();
-
- // Loop over narrow resonances in m23
- for (UInt_t m23i = 0; m23i < m23Regions.size(); m23i++) {
-
- const Double_t m23Binning = m23Binnings[m23i];
-
- const Double_t resMin23 = m23Regions[m23i].first;
- const Double_t resMax23 = m23Regions[m23i].second;
-
- // Initialise to the full width of the DP in case there are no narrow resonances in m13
- Double_t lastResMax13 = m13Min;
-
- // Loop over narrow resonances in m13
- for (UInt_t m13i = 0; m13i < m13Regions.size(); m13i++){
-
- const Double_t m13Binning = m13Binnings[m23i];
-
- const Double_t resMin13 = m13Regions[m13i].first;
- const Double_t resMax13 = m13Regions[m13i].second;
-
- // Overlap region (only needed in m23)
- integrationRegions.push_back(this->newDPIntegrationRegion(resMin13, resMax13, resMin23, resMax23, m13Binning, m23Binning, precision, nAmp_, nIncohAmp_));
-
- // For the first entry, add the area between m13 threshold and this first entry
- if (m13i == 0) {
- integrationRegions.push_back(this->newDPIntegrationRegion(m13Min, resMin13, resMin23, resMax23, defaultBinning, m23Binning, precision, nAmp_, nIncohAmp_));
- }
-
- // For all entries except the last one, add the area between this and the next entry
- if (m13i != m13Regions.size() - 1) {
- const Double_t nextResMin13 = m23Regions[m13i + 1].first;
- integrationRegions.push_back(this->newDPIntegrationRegion(resMax13, nextResMin13, resMin23, resMax23, defaultBinning, m23Binning, precision, nAmp_, nIncohAmp_));
- } else {
- lastResMax13 = resMax13;
- }
- }
-
- // Add the area between the last entry and the maximum m13 (which could be the whole strip if there are no entries in m13Regions)
- integrationRegions.push_back(this->newDPIntegrationRegion(lastResMax13, m13Max, resMin23, resMax23, defaultBinning, m23Binning, precision, nAmp_, nIncohAmp_));
- }
-
- return integrationRegions;
+ // Create integration regions for all narrow resonances in m23 (including the overlap regions with m13 narrow resonances)
+ std::vector<LauDPPartialIntegralInfo*> integrationRegions;
+
+ const Double_t m13Min = kinematics_->getm13Min();
+ const Double_t m13Max = kinematics_->getm13Max();
+
+ // Loop over narrow resonances in m23
+ for ( UInt_t m23i = 0; m23i < m23Regions.size(); m23i++ ) {
+
+ const Double_t m23Binning = m23Binnings[m23i];
+
+ const Double_t resMin23 = m23Regions[m23i].first;
+ const Double_t resMax23 = m23Regions[m23i].second;
+
+ // Initialise to the full width of the DP in case there are no narrow resonances in m13
+ Double_t lastResMax13 = m13Min;
+
+ // Loop over narrow resonances in m13
+ for ( UInt_t m13i = 0; m13i < m13Regions.size(); m13i++ ) {
+
+ const Double_t m13Binning = m13Binnings[m23i];
+
+ const Double_t resMin13 = m13Regions[m13i].first;
+ const Double_t resMax13 = m13Regions[m13i].second;
+
+ // Overlap region (only needed in m23)
+ integrationRegions.push_back( this->newDPIntegrationRegion( resMin13,
+ resMax13,
+ resMin23,
+ resMax23,
+ m13Binning,
+ m23Binning,
+ precision,
+ nAmp_,
+ nIncohAmp_ ) );
+
+ // For the first entry, add the area between m13 threshold and this first entry
+ if ( m13i == 0 ) {
+ integrationRegions.push_back( this->newDPIntegrationRegion( m13Min,
+ resMin13,
+ resMin23,
+ resMax23,
+ defaultBinning,
+ m23Binning,
+ precision,
+ nAmp_,
+ nIncohAmp_ ) );
+ }
+
+ // For all entries except the last one, add the area between this and the next entry
+ if ( m13i != m13Regions.size() - 1 ) {
+ const Double_t nextResMin13 = m23Regions[m13i + 1].first;
+ integrationRegions.push_back( this->newDPIntegrationRegion( resMax13,
+ nextResMin13,
+ resMin23,
+ resMax23,
+ defaultBinning,
+ m23Binning,
+ precision,
+ nAmp_,
+ nIncohAmp_ ) );
+ } else {
+ lastResMax13 = resMax13;
+ }
+ }
+
+ // Add the area between the last entry and the maximum m13 (which could be the whole strip if there are no entries in m13Regions)
+ integrationRegions.push_back( this->newDPIntegrationRegion( lastResMax13,
+ m13Max,
+ resMin23,
+ resMax23,
+ defaultBinning,
+ m23Binning,
+ precision,
+ nAmp_,
+ nIncohAmp_ ) );
+ }
+
+ return integrationRegions;
}
-LauDPPartialIntegralInfo* LauIsobarDynamics::newDPIntegrationRegion( const Double_t minm13, const Double_t maxm13,
- const Double_t minm23, const Double_t maxm23,
- const Double_t m13BinWidth, const Double_t m23BinWidth,
+LauDPPartialIntegralInfo* LauIsobarDynamics::newDPIntegrationRegion( const Double_t minm13,
+ const Double_t maxm13,
+ const Double_t minm23,
+ const Double_t maxm23,
+ const Double_t m13BinWidth,
+ const Double_t m23BinWidth,
const Double_t precision,
const UInt_t nAmp,
const UInt_t nIncohAmp ) const
{
- const UInt_t nm13Points = static_cast<UInt_t>((maxm13-minm13)/m13BinWidth);
- const UInt_t nm23Points = static_cast<UInt_t>((maxm23-minm23)/m23BinWidth);
-
- // If we would create a region with no interior points, just return a null pointer
- if (nm13Points == 0 || nm23Points == 0) {
- return 0;
- }
-
- return new LauDPPartialIntegralInfo(minm13, maxm13, minm23, maxm23, m13BinWidth, m23BinWidth, precision, nAmp, nIncohAmp);
+ const UInt_t nm13Points = static_cast<UInt_t>( ( maxm13 - minm13 ) / m13BinWidth );
+ const UInt_t nm23Points = static_cast<UInt_t>( ( maxm23 - minm23 ) / m23BinWidth );
+
+ // If we would create a region with no interior points, just return a null pointer
+ if ( nm13Points == 0 || nm23Points == 0 ) {
+ return 0;
+ }
+
+ return new LauDPPartialIntegralInfo( minm13,
+ maxm13,
+ minm23,
+ maxm23,
+ m13BinWidth,
+ m23BinWidth,
+ precision,
+ nAmp,
+ nIncohAmp );
}
void LauIsobarDynamics::calcDPNormalisationScheme()
{
- if ( ! dpPartialIntegralInfo_.empty() ) {
- std::cerr << "ERROR in LauIsobarDynamics::calcDPNormalisationScheme : Scheme already stored!" << std::endl;
- return;
- }
-
- // The precision for the Gauss-Legendre weights
- const Double_t precision(1e-6);
-
- // Get the rectangle that encloses the DP
- const Double_t minm13 = kinematics_->getm13Min();
- const Double_t maxm13 = kinematics_->getm13Max();
- const Double_t minm23 = kinematics_->getm23Min();
- const Double_t maxm23 = kinematics_->getm23Max();
- const Double_t minm12 = kinematics_->getm12Min();
- const Double_t maxm12 = kinematics_->getm12Max();
-
- // Find out whether we have narrow resonances in the DP (defined here as width < 20 MeV).
- std::vector< std::pair<Double_t,Double_t> > m13NarrowRes;
- std::vector< std::pair<Double_t,Double_t> > m23NarrowRes;
- std::vector< std::pair<Double_t,Double_t> > m12NarrowRes;
-
- // Rho-omega mixing models implicitly contains omega(782) model, but width is of rho(770) - handle as a special case
- LauResonanceMaker& resonanceMaker = LauResonanceMaker::get();
- LauResonanceInfo* omega_info = resonanceMaker.getResInfo("omega(782)");
- const Double_t omegaMass = (omega_info!=0) ? omega_info->getMass()->unblindValue() : 0.78265;
- const Double_t omegaWidth = (omega_info!=0) ? omega_info->getWidth()->unblindValue() : 0.00849;
-
- for ( std::vector<LauAbsResonance*>::const_iterator iter = sigResonances_.begin(); iter != sigResonances_.end(); ++iter ) {
-
- LauAbsResonance::LauResonanceModel model = (*iter)->getResonanceModel();
- const TString& name = (*iter)->getResonanceName();
- Int_t pair = (*iter)->getPairInt();
- Double_t mass = (*iter)->getMass();
- Double_t width = (*iter)->getWidth();
-
- if ( model == LauAbsResonance::RhoOmegaMix_GS ||
- model == LauAbsResonance::RhoOmegaMix_GS_1 ||
- model == LauAbsResonance::RhoOmegaMix_RBW ||
- model == LauAbsResonance::RhoOmegaMix_RBW_1 ) {
- mass = omegaMass;
- width = omegaWidth;
- }
-
- if ( width > narrowWidth_ || width <= 0.0 ) {
- continue;
- }
-
- std::cout << "INFO in LauIsobarDynamics::calcDPNormalisationScheme : Found narrow resonance: " << name << ", mass = " << mass << ", width = " << width << ", pair int = " << pair << std::endl;
- if ( pair == 1 ) {
- if ( mass < minm23 || mass > maxm23 ){
- std::cout << std::string(53, ' ') << ": But its pole is outside the kinematically allowed range, so will not consider it narrow for the purposes of integration" << std::endl;
- } else {
- m23NarrowRes.push_back( std::make_pair(mass,width) );
- if ( fullySymmetricDP_ ) {
- m13NarrowRes.push_back( std::make_pair(mass,width) );
- m12NarrowRes.push_back( std::make_pair(mass,width) );
- } else if ( symmetricalDP_ || ( flavConjDP_ && forceSymmetriseIntegration_ ) ) {
- m13NarrowRes.push_back( std::make_pair(mass,width) );
- }
- }
- } else if ( pair == 2 ) {
- if ( mass < minm13 || mass > maxm13 ){
- std::cout << std::string(53, ' ') << ": But its pole is outside the kinematically allowed range, so will not consider it narrow for the purposes of integration" << std::endl;
- } else {
- m13NarrowRes.push_back( std::make_pair(mass,width) );
- if ( fullySymmetricDP_ ) {
- m23NarrowRes.push_back( std::make_pair(mass,width) );
- m12NarrowRes.push_back( std::make_pair(mass,width) );
- } else if ( symmetricalDP_ || ( flavConjDP_ && forceSymmetriseIntegration_ ) ) {
- m23NarrowRes.push_back( std::make_pair(mass,width) );
- }
- }
- } else if ( pair == 3 ) {
- if ( mass < minm12 || mass > maxm12 ){
- std::cout << std::string(53, ' ') << ": But its pole is outside the kinematically allowed range, so will not consider it narrow for the purposes of integration" << std::endl;
- } else {
- m12NarrowRes.push_back( std::make_pair(mass,width) );
- if ( fullySymmetricDP_ ) {
- m13NarrowRes.push_back( std::make_pair(mass,width) );
- m12NarrowRes.push_back( std::make_pair(mass,width) );
- }
- }
- } else {
- std::cerr << "WARNING in LauIsobarDynamics::calcDPNormalisationScheme : strange pair integer, " << pair << ", for resonance \"" << (*iter)->getResonanceName() << std::endl;
- }
- }
-
- for ( std::vector<LauAbsIncohRes*>::const_iterator iter = sigIncohResonances_.begin(); iter != sigIncohResonances_.end(); ++iter ) {
-
- const TString& name = (*iter)->getResonanceName();
- Int_t pair = (*iter)->getPairInt();
- Double_t mass = (*iter)->getMass();
- Double_t width = (*iter)->getWidth();
-
- if ( width > narrowWidth_ || width == 0.0 ) {
- continue;
- }
-
- std::cout<<"INFO in LauIsobarDynamics::calcDPNormalisationScheme : Found narrow resonance: " << name << ", mass = " << mass << ", width = " << width << ", pair int = " << pair << std::endl;
-
- if ( pair == 1 ) {
- if ( mass < minm23 || mass > maxm23 ){
- std::cout << std::string(53, ' ') << ": But its pole is outside the kinematically allowed range, so will not consider it narrow for the purposes of integration" << std::endl;
- } else {
- m23NarrowRes.push_back( std::make_pair(mass,width) );
- if ( fullySymmetricDP_ ) {
- m13NarrowRes.push_back( std::make_pair(mass,width) );
- m12NarrowRes.push_back( std::make_pair(mass,width) );
- } else if ( symmetricalDP_ || ( flavConjDP_ && forceSymmetriseIntegration_ ) ) {
- m13NarrowRes.push_back( std::make_pair(mass,width) );
- }
- }
- } else if ( pair == 2 ) {
- if ( mass < minm13 || mass > maxm13 ){
- std::cout << std::string(53, ' ') << ": But its pole is outside the kinematically allowed range, so will not consider it narrow for the purposes of integration" << std::endl;
- } else {
- m13NarrowRes.push_back( std::make_pair(mass,width) );
- if ( fullySymmetricDP_ ) {
- m23NarrowRes.push_back( std::make_pair(mass,width) );
- m12NarrowRes.push_back( std::make_pair(mass,width) );
- } else if ( symmetricalDP_ || ( flavConjDP_ && forceSymmetriseIntegration_ ) ) {
- m23NarrowRes.push_back( std::make_pair(mass,width) );
- }
- }
- } else if ( pair == 3 ) {
- if ( mass < minm12 || mass > maxm12 ){
- std::cout << std::string(53, ' ') << ": But its pole is outside the kinematically allowed range, so will not consider it narrow for the purposes of integration" << std::endl;
- } else {
- m12NarrowRes.push_back( std::make_pair(mass,width) );
- if ( fullySymmetricDP_ ) {
- m13NarrowRes.push_back( std::make_pair(mass,width) );
- m12NarrowRes.push_back( std::make_pair(mass,width) );
- }
- }
- } else {
- std::cerr << "WARNING in LauIsobarDynamics::calcDPNormalisationScheme : strange pair integer, " << pair << ", for resonance \"" << (*iter)->getResonanceName() << std::endl;
- }
- }
-
- // Depending on how many narrow resonances we have and where they are
- // we adopt different approaches
- if ( ! m12NarrowRes.empty() ) {
-
- // We have at least one narrow resonance in m12
- // Switch to using the square DP for the integration
- // TODO - for the time being just use a single, reasonably fine by default and tunable, grid
- // - can later consider whether there's a need to split up the mPrime axis into regions around particularly narrow resonances in m12
- // - but it seems that this isn't really needed since even the default tune gives a good resolution for most narrow resonances such as phi / chi_c0
- std::cout<<"INFO in LauIsobarDynamics::calcDPNormalisationScheme : One or more narrow resonances found in m12, integrating over whole square Dalitz plot with bin widths of "<<mPrimeBinWidth_<<" in mPrime and "<<thPrimeBinWidth_<<" in thetaPrime..."<<std::endl;
-
- // Make sure that the kinematics will calculate the square DP co-ordinates
- if ( ! kinematics_->squareDP() ) {
- std::cerr << "WARNING in LauIsobarDynamics::calcDPNormalisationScheme : forcing kinematics to calculate the required square DP co-ordinates" << std::endl;
- kinematics_->squareDP(kTRUE);
- }
-
- dpPartialIntegralInfo_.push_back(new LauDPPartialIntegralInfo(0.0, 1.0, 0.0, 1.0, mPrimeBinWidth_, thPrimeBinWidth_, precision, nAmp_, nIncohAmp_, kTRUE, kinematics_));
-
- } else if (m13NarrowRes.empty() && m23NarrowRes.empty()) {
-
- // There are no narrow resonances, so we just do a single grid over the whole DP
- std::cout << "INFO in LauIsobarDynamics::calcDPNormalisationScheme : No narrow resonances found, integrating over whole Dalitz plot..." << std::endl;
- dpPartialIntegralInfo_.push_back(new LauDPPartialIntegralInfo(minm13, maxm13, minm23, maxm23, m13BinWidth_, m23BinWidth_, precision, nAmp_, nIncohAmp_));
-
- } else {
-
- // Get regions in that correspond to narrow resonances in m13 and m23, and correct for overlaps in each dimension (to use the finest binning)
-
- // Sort resonances by ascending mass to calculate regions properly
- std::sort(m13NarrowRes.begin(), m13NarrowRes.end());
- std::sort(m23NarrowRes.begin(), m23NarrowRes.end());
-
- // For each narrow resonance in m13, determine the corresponding window and its binning
- std::vector<std::pair<Double_t, Double_t> > m13Regions;
- std::vector<Double_t> m13Binnings;
-
- for ( std::vector<std::pair<Double_t, Double_t> >::const_iterator iter = m13NarrowRes.begin(); iter != m13NarrowRes.end(); ++iter ) {
- Double_t mass = iter->first;
- Double_t width = iter->second;
-
- Double_t regionBegin = mass - 5.0 * width;
- Double_t regionEnd = mass + 5.0 * width;
- Double_t binning = width / binningFactor_;
-
- // check if we ought to extend the region to the edge of the phase space (in either direction)
- if ( regionBegin < (minm13+50.0*m13BinWidth_) ) {
- std::cout << "INFO in LauIsobarDynamics::calcDPNormalisationScheme : Resonance at m13 = " << mass << " is close to threshold, extending integration region" << std::endl;
- regionBegin = minm13;
- }
- if ( regionEnd > (maxm13-50.0*m13BinWidth_) ) {
- std::cout << "INFO in LauIsobarDynamics::calcDPNormalisationScheme : Resonance at m13 = " << mass << " is close to upper edge of phase space, extending integration region" << std::endl;
- regionEnd = maxm13;
- }
-
- m13Regions.push_back(std::make_pair(regionBegin, regionEnd));
- m13Binnings.push_back(binning);
- }
-
- // For each narrow resonance in m23, determine the corresponding window and its binning
- std::vector<std::pair<Double_t, Double_t> > m23Regions;
- std::vector<Double_t> m23Binnings;
-
- for ( std::vector<std::pair<Double_t, Double_t> >::const_iterator iter = m23NarrowRes.begin(); iter != m23NarrowRes.end(); ++iter ) {
- Double_t mass = iter->first;
- Double_t width = iter->second;
-
- Double_t regionBegin = mass - 5.0 * width;
- Double_t regionEnd = mass + 5.0 * width;
- Double_t binning = width / binningFactor_;
-
- // check if we ought to extend the region to the edge of the phase space (in either direction)
- if ( regionBegin < (minm23+50.0*m23BinWidth_) ) {
- std::cout << "INFO in LauIsobarDynamics::calcDPNormalisationScheme : Resonance at m23 = " << mass << " is close to threshold, extending integration region" << std::endl;
- regionBegin = minm23;
- }
- if ( regionEnd > (maxm23-50.0*m23BinWidth_) ) {
- std::cout << "INFO in LauIsobarDynamics::calcDPNormalisationScheme : Resonance at m23 = " << mass << " is close to upper edge of phase space, extending integration region" << std::endl;
- regionEnd = maxm23;
- }
-
- m23Regions.push_back(std::make_pair(regionBegin, regionEnd));
- m23Binnings.push_back(binning);
- }
-
- // Sort out overlaps between regions in the same mass pairing
- this->correctDPOverlap(m13Regions, m13Binnings);
- this->correctDPOverlap(m23Regions, m23Binnings);
-
- // Get the narrow resonance regions plus any overlap region
- std::vector<LauDPPartialIntegralInfo*> fineScheme13 = this->m13IntegrationRegions(m13Regions, m23Regions, m13Binnings, precision, m13BinWidth_);
- std::vector<LauDPPartialIntegralInfo*> fineScheme23 = this->m23IntegrationRegions(m13Regions, m23Regions, m13Binnings, m23Binnings, precision, m23BinWidth_);
-
- // Get coarse regions by calculating the gaps between the
- // narrow resonances and using the same functions to create
- // the integration grid object for each
- std::vector< std::pair<Double_t,Double_t> > coarseRegions = this->formGapsFromRegions(m13Regions, minm13, maxm13);
- std::vector<Double_t> coarseBinning( fineScheme13.size()+1, m13BinWidth_ );
- std::vector<LauDPPartialIntegralInfo*> coarseScheme = this->m13IntegrationRegions(coarseRegions, m23Regions, coarseBinning, precision, m13BinWidth_);
-
- dpPartialIntegralInfo_.insert(dpPartialIntegralInfo_.end(), fineScheme13.begin(), fineScheme13.end());
- dpPartialIntegralInfo_.insert(dpPartialIntegralInfo_.end(), fineScheme23.begin(), fineScheme23.end());
- dpPartialIntegralInfo_.insert(dpPartialIntegralInfo_.end(), coarseScheme.begin(), coarseScheme.end());
-
- // Remove any null pointer entries in the integral list
- // (that are produced when an integration region with no
- // interior points is defined)
- this->cullNullRegions(dpPartialIntegralInfo_);
- }
-
- normalizationSchemeDone_ = kTRUE;
+ if ( ! dpPartialIntegralInfo_.empty() ) {
+ std::cerr << "ERROR in LauIsobarDynamics::calcDPNormalisationScheme : Scheme already stored!"
+ << std::endl;
+ return;
+ }
+
+ // The precision for the Gauss-Legendre weights
+ const Double_t precision( 1e-6 );
+
+ // Get the rectangle that encloses the DP
+ const Double_t minm13 = kinematics_->getm13Min();
+ const Double_t maxm13 = kinematics_->getm13Max();
+ const Double_t minm23 = kinematics_->getm23Min();
+ const Double_t maxm23 = kinematics_->getm23Max();
+ const Double_t minm12 = kinematics_->getm12Min();
+ const Double_t maxm12 = kinematics_->getm12Max();
+
+ // Find out whether we have narrow resonances in the DP (defined here as width < 20 MeV).
+ std::vector<std::pair<Double_t, Double_t>> m13NarrowRes;
+ std::vector<std::pair<Double_t, Double_t>> m23NarrowRes;
+ std::vector<std::pair<Double_t, Double_t>> m12NarrowRes;
+
+ // Rho-omega mixing models implicitly contains omega(782) model, but width is of rho(770) - handle as a special case
+ LauResonanceMaker& resonanceMaker = LauResonanceMaker::get();
+ LauResonanceInfo* omega_info = resonanceMaker.getResInfo( "omega(782)" );
+ const Double_t omegaMass = ( omega_info != 0 ) ? omega_info->getMass()->unblindValue() : 0.78265;
+ const Double_t omegaWidth = ( omega_info != 0 ) ? omega_info->getWidth()->unblindValue()
+ : 0.00849;
+
+ for ( std::vector<LauAbsResonance*>::const_iterator iter = sigResonances_.begin();
+ iter != sigResonances_.end();
+ ++iter ) {
+
+ LauAbsResonance::LauResonanceModel model = ( *iter )->getResonanceModel();
+ const TString& name = ( *iter )->getResonanceName();
+ Int_t pair = ( *iter )->getPairInt();
+ Double_t mass = ( *iter )->getMass();
+ Double_t width = ( *iter )->getWidth();
+
+ if ( model == LauAbsResonance::RhoOmegaMix_GS || model == LauAbsResonance::RhoOmegaMix_GS_1 ||
+ model == LauAbsResonance::RhoOmegaMix_RBW ||
+ model == LauAbsResonance::RhoOmegaMix_RBW_1 ) {
+ mass = omegaMass;
+ width = omegaWidth;
+ }
+
+ if ( width > narrowWidth_ || width <= 0.0 ) {
+ continue;
+ }
+
+ std::cout << "INFO in LauIsobarDynamics::calcDPNormalisationScheme : Found narrow resonance: "
+ << name << ", mass = " << mass << ", width = " << width << ", pair int = " << pair
+ << std::endl;
+ if ( pair == 1 ) {
+ if ( mass < minm23 || mass > maxm23 ) {
+ std::cout << std::string( 53, ' ' )
+ << ": But its pole is outside the kinematically allowed range, so will not consider it narrow for the purposes of integration"
+ << std::endl;
+ } else {
+ m23NarrowRes.push_back( std::make_pair( mass, width ) );
+ if ( fullySymmetricDP_ ) {
+ m13NarrowRes.push_back( std::make_pair( mass, width ) );
+ m12NarrowRes.push_back( std::make_pair( mass, width ) );
+ } else if ( symmetricalDP_ || ( flavConjDP_ && forceSymmetriseIntegration_ ) ) {
+ m13NarrowRes.push_back( std::make_pair( mass, width ) );
+ }
+ }
+ } else if ( pair == 2 ) {
+ if ( mass < minm13 || mass > maxm13 ) {
+ std::cout << std::string( 53, ' ' )
+ << ": But its pole is outside the kinematically allowed range, so will not consider it narrow for the purposes of integration"
+ << std::endl;
+ } else {
+ m13NarrowRes.push_back( std::make_pair( mass, width ) );
+ if ( fullySymmetricDP_ ) {
+ m23NarrowRes.push_back( std::make_pair( mass, width ) );
+ m12NarrowRes.push_back( std::make_pair( mass, width ) );
+ } else if ( symmetricalDP_ || ( flavConjDP_ && forceSymmetriseIntegration_ ) ) {
+ m23NarrowRes.push_back( std::make_pair( mass, width ) );
+ }
+ }
+ } else if ( pair == 3 ) {
+ if ( mass < minm12 || mass > maxm12 ) {
+ std::cout << std::string( 53, ' ' )
+ << ": But its pole is outside the kinematically allowed range, so will not consider it narrow for the purposes of integration"
+ << std::endl;
+ } else {
+ m12NarrowRes.push_back( std::make_pair( mass, width ) );
+ if ( fullySymmetricDP_ ) {
+ m13NarrowRes.push_back( std::make_pair( mass, width ) );
+ m12NarrowRes.push_back( std::make_pair( mass, width ) );
+ }
+ }
+ } else {
+ std::cerr << "WARNING in LauIsobarDynamics::calcDPNormalisationScheme : strange pair integer, "
+ << pair << ", for resonance \"" << ( *iter )->getResonanceName() << std::endl;
+ }
+ }
+
+ for ( std::vector<LauAbsIncohRes*>::const_iterator iter = sigIncohResonances_.begin();
+ iter != sigIncohResonances_.end();
+ ++iter ) {
+
+ const TString& name = ( *iter )->getResonanceName();
+ Int_t pair = ( *iter )->getPairInt();
+ Double_t mass = ( *iter )->getMass();
+ Double_t width = ( *iter )->getWidth();
+
+ if ( width > narrowWidth_ || width == 0.0 ) {
+ continue;
+ }
+
+ std::cout << "INFO in LauIsobarDynamics::calcDPNormalisationScheme : Found narrow resonance: "
+ << name << ", mass = " << mass << ", width = " << width << ", pair int = " << pair
+ << std::endl;
+
+ if ( pair == 1 ) {
+ if ( mass < minm23 || mass > maxm23 ) {
+ std::cout << std::string( 53, ' ' )
+ << ": But its pole is outside the kinematically allowed range, so will not consider it narrow for the purposes of integration"
+ << std::endl;
+ } else {
+ m23NarrowRes.push_back( std::make_pair( mass, width ) );
+ if ( fullySymmetricDP_ ) {
+ m13NarrowRes.push_back( std::make_pair( mass, width ) );
+ m12NarrowRes.push_back( std::make_pair( mass, width ) );
+ } else if ( symmetricalDP_ || ( flavConjDP_ && forceSymmetriseIntegration_ ) ) {
+ m13NarrowRes.push_back( std::make_pair( mass, width ) );
+ }
+ }
+ } else if ( pair == 2 ) {
+ if ( mass < minm13 || mass > maxm13 ) {
+ std::cout << std::string( 53, ' ' )
+ << ": But its pole is outside the kinematically allowed range, so will not consider it narrow for the purposes of integration"
+ << std::endl;
+ } else {
+ m13NarrowRes.push_back( std::make_pair( mass, width ) );
+ if ( fullySymmetricDP_ ) {
+ m23NarrowRes.push_back( std::make_pair( mass, width ) );
+ m12NarrowRes.push_back( std::make_pair( mass, width ) );
+ } else if ( symmetricalDP_ || ( flavConjDP_ && forceSymmetriseIntegration_ ) ) {
+ m23NarrowRes.push_back( std::make_pair( mass, width ) );
+ }
+ }
+ } else if ( pair == 3 ) {
+ if ( mass < minm12 || mass > maxm12 ) {
+ std::cout << std::string( 53, ' ' )
+ << ": But its pole is outside the kinematically allowed range, so will not consider it narrow for the purposes of integration"
+ << std::endl;
+ } else {
+ m12NarrowRes.push_back( std::make_pair( mass, width ) );
+ if ( fullySymmetricDP_ ) {
+ m13NarrowRes.push_back( std::make_pair( mass, width ) );
+ m12NarrowRes.push_back( std::make_pair( mass, width ) );
+ }
+ }
+ } else {
+ std::cerr << "WARNING in LauIsobarDynamics::calcDPNormalisationScheme : strange pair integer, "
+ << pair << ", for resonance \"" << ( *iter )->getResonanceName() << std::endl;
+ }
+ }
+
+ // Depending on how many narrow resonances we have and where they are
+ // we adopt different approaches
+ if ( ! m12NarrowRes.empty() ) {
+
+ // We have at least one narrow resonance in m12
+ // Switch to using the square DP for the integration
+ // TODO - for the time being just use a single, reasonably fine by default and tunable, grid
+ // - can later consider whether there's a need to split up the mPrime axis into regions around particularly narrow resonances in m12
+ // - but it seems that this isn't really needed since even the default tune gives a good resolution for most narrow resonances such as phi / chi_c0
+ std::cout << "INFO in LauIsobarDynamics::calcDPNormalisationScheme : One or more narrow resonances found in m12, integrating over whole square Dalitz plot with bin widths of "
+ << mPrimeBinWidth_ << " in mPrime and " << thPrimeBinWidth_ << " in thetaPrime..."
+ << std::endl;
+
+ // Make sure that the kinematics will calculate the square DP co-ordinates
+ if ( ! kinematics_->squareDP() ) {
+ std::cerr << "WARNING in LauIsobarDynamics::calcDPNormalisationScheme : forcing kinematics to calculate the required square DP co-ordinates"
+ << std::endl;
+ kinematics_->squareDP( kTRUE );
+ }
+
+ dpPartialIntegralInfo_.push_back( new LauDPPartialIntegralInfo( 0.0,
+ 1.0,
+ 0.0,
+ 1.0,
+ mPrimeBinWidth_,
+ thPrimeBinWidth_,
+ precision,
+ nAmp_,
+ nIncohAmp_,
+ kTRUE,
+ kinematics_ ) );
+
+ } else if ( m13NarrowRes.empty() && m23NarrowRes.empty() ) {
+
+ // There are no narrow resonances, so we just do a single grid over the whole DP
+ std::cout << "INFO in LauIsobarDynamics::calcDPNormalisationScheme : No narrow resonances found, integrating over whole Dalitz plot..."
+ << std::endl;
+ dpPartialIntegralInfo_.push_back( new LauDPPartialIntegralInfo( minm13,
+ maxm13,
+ minm23,
+ maxm23,
+ m13BinWidth_,
+ m23BinWidth_,
+ precision,
+ nAmp_,
+ nIncohAmp_ ) );
+
+ } else {
+
+ // Get regions in that correspond to narrow resonances in m13 and m23, and correct for overlaps in each dimension (to use the finest binning)
+
+ // Sort resonances by ascending mass to calculate regions properly
+ std::sort( m13NarrowRes.begin(), m13NarrowRes.end() );
+ std::sort( m23NarrowRes.begin(), m23NarrowRes.end() );
+
+ // For each narrow resonance in m13, determine the corresponding window and its binning
+ std::vector<std::pair<Double_t, Double_t>> m13Regions;
+ std::vector<Double_t> m13Binnings;
+
+ for ( std::vector<std::pair<Double_t, Double_t>>::const_iterator iter = m13NarrowRes.begin();
+ iter != m13NarrowRes.end();
+ ++iter ) {
+ Double_t mass = iter->first;
+ Double_t width = iter->second;
+
+ Double_t regionBegin = mass - 5.0 * width;
+ Double_t regionEnd = mass + 5.0 * width;
+ Double_t binning = width / binningFactor_;
+
+ // check if we ought to extend the region to the edge of the phase space (in either direction)
+ if ( regionBegin < ( minm13 + 50.0 * m13BinWidth_ ) ) {
+ std::cout << "INFO in LauIsobarDynamics::calcDPNormalisationScheme : Resonance at m13 = "
+ << mass << " is close to threshold, extending integration region"
+ << std::endl;
+ regionBegin = minm13;
+ }
+ if ( regionEnd > ( maxm13 - 50.0 * m13BinWidth_ ) ) {
+ std::cout << "INFO in LauIsobarDynamics::calcDPNormalisationScheme : Resonance at m13 = "
+ << mass
+ << " is close to upper edge of phase space, extending integration region"
+ << std::endl;
+ regionEnd = maxm13;
+ }
+
+ m13Regions.push_back( std::make_pair( regionBegin, regionEnd ) );
+ m13Binnings.push_back( binning );
+ }
+
+ // For each narrow resonance in m23, determine the corresponding window and its binning
+ std::vector<std::pair<Double_t, Double_t>> m23Regions;
+ std::vector<Double_t> m23Binnings;
+
+ for ( std::vector<std::pair<Double_t, Double_t>>::const_iterator iter = m23NarrowRes.begin();
+ iter != m23NarrowRes.end();
+ ++iter ) {
+ Double_t mass = iter->first;
+ Double_t width = iter->second;
+
+ Double_t regionBegin = mass - 5.0 * width;
+ Double_t regionEnd = mass + 5.0 * width;
+ Double_t binning = width / binningFactor_;
+
+ // check if we ought to extend the region to the edge of the phase space (in either direction)
+ if ( regionBegin < ( minm23 + 50.0 * m23BinWidth_ ) ) {
+ std::cout << "INFO in LauIsobarDynamics::calcDPNormalisationScheme : Resonance at m23 = "
+ << mass << " is close to threshold, extending integration region"
+ << std::endl;
+ regionBegin = minm23;
+ }
+ if ( regionEnd > ( maxm23 - 50.0 * m23BinWidth_ ) ) {
+ std::cout << "INFO in LauIsobarDynamics::calcDPNormalisationScheme : Resonance at m23 = "
+ << mass
+ << " is close to upper edge of phase space, extending integration region"
+ << std::endl;
+ regionEnd = maxm23;
+ }
+
+ m23Regions.push_back( std::make_pair( regionBegin, regionEnd ) );
+ m23Binnings.push_back( binning );
+ }
+
+ // Sort out overlaps between regions in the same mass pairing
+ this->correctDPOverlap( m13Regions, m13Binnings );
+ this->correctDPOverlap( m23Regions, m23Binnings );
+
+ // Get the narrow resonance regions plus any overlap region
+ std::vector<LauDPPartialIntegralInfo*> fineScheme13 =
+ this->m13IntegrationRegions( m13Regions, m23Regions, m13Binnings, precision, m13BinWidth_ );
+ std::vector<LauDPPartialIntegralInfo*> fineScheme23 =
+ this->m23IntegrationRegions( m13Regions,
+ m23Regions,
+ m13Binnings,
+ m23Binnings,
+ precision,
+ m23BinWidth_ );
+
+ // Get coarse regions by calculating the gaps between the
+ // narrow resonances and using the same functions to create
+ // the integration grid object for each
+ std::vector<std::pair<Double_t, Double_t>> coarseRegions =
+ this->formGapsFromRegions( m13Regions, minm13, maxm13 );
+ std::vector<Double_t> coarseBinning( fineScheme13.size() + 1, m13BinWidth_ );
+ std::vector<LauDPPartialIntegralInfo*> coarseScheme =
+ this->m13IntegrationRegions( coarseRegions,
+ m23Regions,
+ coarseBinning,
+ precision,
+ m13BinWidth_ );
+
+ dpPartialIntegralInfo_.insert( dpPartialIntegralInfo_.end(),
+ fineScheme13.begin(),
+ fineScheme13.end() );
+ dpPartialIntegralInfo_.insert( dpPartialIntegralInfo_.end(),
+ fineScheme23.begin(),
+ fineScheme23.end() );
+ dpPartialIntegralInfo_.insert( dpPartialIntegralInfo_.end(),
+ coarseScheme.begin(),
+ coarseScheme.end() );
+
+ // Remove any null pointer entries in the integral list
+ // (that are produced when an integration region with no
+ // interior points is defined)
+ this->cullNullRegions( dpPartialIntegralInfo_ );
+ }
+
+ normalizationSchemeDone_ = kTRUE;
}
-void LauIsobarDynamics::setIntegralBinWidths(const Double_t m13BinWidth, const Double_t m23BinWidth,
- const Double_t mPrimeBinWidth, const Double_t thPrimeBinWidth)
+void LauIsobarDynamics::setIntegralBinWidths( const Double_t m13BinWidth,
+ const Double_t m23BinWidth,
+ const Double_t mPrimeBinWidth,
+ const Double_t thPrimeBinWidth )
{
- // Set the bin widths for the m13 vs m23 integration grid
- m13BinWidth_ = m13BinWidth;
- m23BinWidth_ = m23BinWidth;
+ // Set the bin widths for the m13 vs m23 integration grid
+ m13BinWidth_ = m13BinWidth;
+ m23BinWidth_ = m23BinWidth;
- // Set the bin widths for the m' vs theta' integration grid
- mPrimeBinWidth_ = mPrimeBinWidth;
- thPrimeBinWidth_ = thPrimeBinWidth;
+ // Set the bin widths for the m' vs theta' integration grid
+ mPrimeBinWidth_ = mPrimeBinWidth;
+ thPrimeBinWidth_ = thPrimeBinWidth;
}
-void LauIsobarDynamics::calcDPPartialIntegral(LauDPPartialIntegralInfo* intInfo)
+void LauIsobarDynamics::calcDPPartialIntegral( LauDPPartialIntegralInfo* intInfo )
{
- // Calculate the integrals for all parts of the amplitude in the given region of the DP
+ // Calculate the integrals for all parts of the amplitude in the given region of the DP
- const Bool_t squareDP = intInfo->getSquareDP();
- const UInt_t nm13Points = intInfo->getnm13Points();
- const UInt_t nm23Points = intInfo->getnm23Points();
+ const Bool_t squareDP = intInfo->getSquareDP();
+ const UInt_t nm13Points = intInfo->getnm13Points();
+ const UInt_t nm23Points = intInfo->getnm23Points();
- //Double_t dpArea(0.0);
- for (UInt_t i = 0; i < nm13Points; ++i) {
+ //Double_t dpArea(0.0);
+ for ( UInt_t i = 0; i < nm13Points; ++i ) {
- const Double_t m13 = intInfo->getM13Value(i);
- const Double_t m13Sq = m13*m13;
+ const Double_t m13 = intInfo->getM13Value( i );
+ const Double_t m13Sq = m13 * m13;
- for (UInt_t j = 0; j < nm23Points; ++j) {
+ for ( UInt_t j = 0; j < nm23Points; ++j ) {
- const Double_t m23 = intInfo->getM23Value(j);
- const Double_t m23Sq = m23*m23;
- const Double_t weight = intInfo->getWeight(i,j);
+ const Double_t m23 = intInfo->getM23Value( j );
+ const Double_t m23Sq = m23 * m23;
+ const Double_t weight = intInfo->getWeight( i, j );
- // Calculate the integral contributions for each resonance.
- // Only points within the DP area contribute.
- // This also calculates the total DP area as a check.
- // NB if squareDP is true, m13 and m23 are actually mPrime and thetaPrime
- Bool_t withinDP = squareDP ? kinematics_->withinSqDPLimits(m13, m23) : kinematics_->withinDPLimits(m13Sq, m23Sq);
- if (withinDP == kTRUE) {
+ // Calculate the integral contributions for each resonance.
+ // Only points within the DP area contribute.
+ // This also calculates the total DP area as a check.
+ // NB if squareDP is true, m13 and m23 are actually mPrime and thetaPrime
+ Bool_t withinDP = squareDP ? kinematics_->withinSqDPLimits( m13, m23 )
+ : kinematics_->withinDPLimits( m13Sq, m23Sq );
+ if ( withinDP == kTRUE ) {
- if ( squareDP ) {
- // NB m13 and m23 are actually mPrime and thetaPrime
- kinematics_->updateSqDPKinematics(m13, m23);
- } else {
- kinematics_->updateKinematics(m13Sq, m23Sq);
- }
+ if ( squareDP ) {
+ // NB m13 and m23 are actually mPrime and thetaPrime
+ kinematics_->updateSqDPKinematics( m13, m23 );
+ } else {
+ kinematics_->updateKinematics( m13Sq, m23Sq );
+ }
- this->calculateAmplitudes(intInfo, i, j);
+ this->calculateAmplitudes( intInfo, i, j );
- this->addGridPointToIntegrals(weight);
+ this->addGridPointToIntegrals( weight );
- // Increment total DP area
- //dpArea += weight;
- }
+ // Increment total DP area
+ //dpArea += weight;
+ }
- } // j weights loop
- } // i weights loop
+ } // j weights loop
+ } // i weights loop
- // Print out DP area to check whether we have a sensible output
- //std::cout<<" : dpArea = "<<dpArea<<std::endl;
+ // Print out DP area to check whether we have a sensible output
+ //std::cout<<" : dpArea = "<<dpArea<<std::endl;
}
-void LauIsobarDynamics::calculateAmplitudes( LauDPPartialIntegralInfo* intInfo, const UInt_t m13Point, const UInt_t m23Point )
+void LauIsobarDynamics::calculateAmplitudes( LauDPPartialIntegralInfo* intInfo,
+ const UInt_t m13Point,
+ const UInt_t m23Point )
{
- const std::set<UInt_t>::const_iterator intEnd = integralsToBeCalculated_.end();
-
- for (UInt_t iAmp = 0; iAmp < nAmp_; ++iAmp) {
-
- if ( integralsToBeCalculated_.find(iAmp) != intEnd ) {
- // Calculate the dynamics for this resonance
- ff_[iAmp] = this->resAmp(iAmp);
-
- // Store the new value in the integration info object
- intInfo->storeAmplitude( m13Point, m23Point, iAmp, ff_[iAmp] );
- } else {
- // Retrieve the cached value of the amplitude
- ff_[iAmp] = intInfo->getAmplitude( m13Point, m23Point, iAmp );
- }
- }
-
- for (UInt_t iAmp = 0; iAmp < nIncohAmp_; ++iAmp) {
-
- if ( integralsToBeCalculated_.find(iAmp+nAmp_) != intEnd ) {
- // Calculate the dynamics for this resonance
- incohInten_[iAmp] = this->incohResAmp(iAmp);
-
- // Store the new value in the integration info object
- intInfo->storeIntensity( m13Point, m23Point, iAmp, incohInten_[iAmp] );
- } else {
- // Retrieve the cached value of the amplitude
- incohInten_[iAmp] = intInfo->getIntensity( m13Point, m23Point, iAmp );
- }
- }
-
- // If symmetric, do as above with flipped kinematics and add to amplitude
- // (No need to retrive the cache if this was done in the first case)
-
- if ( symmetricalDP_ == kTRUE ) {
- kinematics_->flipAndUpdateKinematics();
-
- for (UInt_t iAmp = 0; iAmp < nAmp_; ++iAmp) {
-
- if ( (integralsToBeCalculated_.find(iAmp) != intEnd) && !sigResonances_[iAmp]->preSymmetrised() ) {
- // Calculate the dynamics for this resonance
- ff_[iAmp] += this->resAmp(iAmp);
-
- // Store the new value in the integration info object
- intInfo->storeAmplitude( m13Point, m23Point, iAmp, ff_[iAmp] );
-
- }
- }
-
- for (UInt_t iAmp = 0; iAmp < nIncohAmp_; ++iAmp) {
-
- if ( (integralsToBeCalculated_.find(iAmp+nAmp_) != intEnd) && !sigResonances_[iAmp]->preSymmetrised() ) {
- // Calculate the dynamics for this resonance
- incohInten_[iAmp] += this->incohResAmp(iAmp);
-
- // Store the new value in the integration info object
- intInfo->storeIntensity( m13Point, m23Point, iAmp, incohInten_[iAmp] );
-
- }
- }
-
- kinematics_->flipAndUpdateKinematics();
- }
-
-
- if (fullySymmetricDP_ == kTRUE) {
- // rotate and evaluate
- kinematics_->rotateAndUpdateKinematics();
- for (UInt_t iAmp = 0; iAmp < nAmp_; ++iAmp) {
- if ( (integralsToBeCalculated_.find(iAmp) != intEnd) && !sigResonances_[iAmp]->preSymmetrised() ) {
- // Calculate the dynamics for this resonance
- ff_[iAmp] += this->resAmp(iAmp);
- // Store the new value in the integration info object
- intInfo->storeAmplitude( m13Point, m23Point, iAmp, ff_[iAmp] );
- }
- }
- for (UInt_t iAmp = 0; iAmp < nIncohAmp_; ++iAmp) {
- if ( (integralsToBeCalculated_.find(iAmp+nAmp_) != intEnd) && !sigResonances_[iAmp]->preSymmetrised() ) {
- // Calculate the dynamics for this resonance
- incohInten_[iAmp] += this->incohResAmp(iAmp);
- // Store the new value in the integration info object
- intInfo->storeIntensity( m13Point, m23Point, iAmp, incohInten_[iAmp] );
- }
- }
-
- // rotate and evaluate
- kinematics_->rotateAndUpdateKinematics();
- for (UInt_t iAmp = 0; iAmp < nAmp_; ++iAmp) {
- if ( (integralsToBeCalculated_.find(iAmp) != intEnd) && !sigResonances_[iAmp]->preSymmetrised() ) {
- // Calculate the dynamics for this resonance
- ff_[iAmp] += this->resAmp(iAmp);
- // Store the new value in the integration info object
- intInfo->storeAmplitude( m13Point, m23Point, iAmp, ff_[iAmp] );
- }
- }
- for (UInt_t iAmp = 0; iAmp < nIncohAmp_; ++iAmp) {
- if ( (integralsToBeCalculated_.find(iAmp+nAmp_) != intEnd) && !sigResonances_[iAmp]->preSymmetrised() ) {
- // Calculate the dynamics for this resonance
- incohInten_[iAmp] += this->incohResAmp(iAmp);
- // Store the new value in the integration info object
- intInfo->storeIntensity( m13Point, m23Point, iAmp, incohInten_[iAmp] );
- }
- }
-
- // rotate, flip and evaluate
- kinematics_->rotateAndUpdateKinematics();
- kinematics_->flipAndUpdateKinematics();
- for (UInt_t iAmp = 0; iAmp < nAmp_; ++iAmp) {
- if ( (integralsToBeCalculated_.find(iAmp) != intEnd) && !sigResonances_[iAmp]->preSymmetrised() ) {
- // Calculate the dynamics for this resonance
- ff_[iAmp] += this->resAmp(iAmp);
- // Store the new value in the integration info object
- intInfo->storeAmplitude( m13Point, m23Point, iAmp, ff_[iAmp] );
- }
- }
- for (UInt_t iAmp = 0; iAmp < nIncohAmp_; ++iAmp) {
- if ( (integralsToBeCalculated_.find(iAmp+nAmp_) != intEnd) && !sigResonances_[iAmp]->preSymmetrised() ) {
- // Calculate the dynamics for this resonance
- incohInten_[iAmp] += this->incohResAmp(iAmp);
- // Store the new value in the integration info object
- intInfo->storeIntensity( m13Point, m23Point, iAmp, incohInten_[iAmp] );
- }
- }
-
- // rotate and evaluate
- kinematics_->rotateAndUpdateKinematics();
- for (UInt_t iAmp = 0; iAmp < nAmp_; ++iAmp) {
- if ( (integralsToBeCalculated_.find(iAmp) != intEnd) && !sigResonances_[iAmp]->preSymmetrised() ) {
- // Calculate the dynamics for this resonance
- ff_[iAmp] += this->resAmp(iAmp);
- // Store the new value in the integration info object
- intInfo->storeAmplitude( m13Point, m23Point, iAmp, ff_[iAmp] );
- }
- }
- for (UInt_t iAmp = 0; iAmp < nIncohAmp_; ++iAmp) {
- if ( (integralsToBeCalculated_.find(iAmp+nAmp_) != intEnd) && !sigResonances_[iAmp]->preSymmetrised() ) {
- // Calculate the dynamics for this resonance
- incohInten_[iAmp] += this->incohResAmp(iAmp);
- // Store the new value in the integration info object
- intInfo->storeIntensity( m13Point, m23Point, iAmp, incohInten_[iAmp] );
- }
- }
-
- // rotate and evaluate
- kinematics_->rotateAndUpdateKinematics();
- for (UInt_t iAmp = 0; iAmp < nAmp_; ++iAmp) {
- if ( (integralsToBeCalculated_.find(iAmp) != intEnd) && !sigResonances_[iAmp]->preSymmetrised() ) {
- // Calculate the dynamics for this resonance
- ff_[iAmp] += this->resAmp(iAmp);
- // Store the new value in the integration info object
- intInfo->storeAmplitude( m13Point, m23Point, iAmp, ff_[iAmp] );
- }
- }
- for (UInt_t iAmp = 0; iAmp < nIncohAmp_; ++iAmp) {
- if ( (integralsToBeCalculated_.find(iAmp+nAmp_) != intEnd) && !sigResonances_[iAmp]->preSymmetrised() ) {
- // Calculate the dynamics for this resonance
- incohInten_[iAmp] += this->incohResAmp(iAmp);
- // Store the new value in the integration info object
- intInfo->storeIntensity( m13Point, m23Point, iAmp, incohInten_[iAmp] );
- }
- }
-
- // rotate and flip to get us back to where we started
- kinematics_->rotateAndUpdateKinematics();
- kinematics_->flipAndUpdateKinematics();
- }
-
- // If we haven't cached the data, then we need to find out the efficiency.
- eff_ = this->retrieveEfficiency();
-
- intInfo->storeEfficiency( m13Point, m23Point, eff_ );
+ const std::set<UInt_t>::const_iterator intEnd = integralsToBeCalculated_.end();
+
+ for ( UInt_t iAmp = 0; iAmp < nAmp_; ++iAmp ) {
+
+ if ( integralsToBeCalculated_.find( iAmp ) != intEnd ) {
+ // Calculate the dynamics for this resonance
+ ff_[iAmp] = this->resAmp( iAmp );
+
+ // Store the new value in the integration info object
+ intInfo->storeAmplitude( m13Point, m23Point, iAmp, ff_[iAmp] );
+ } else {
+ // Retrieve the cached value of the amplitude
+ ff_[iAmp] = intInfo->getAmplitude( m13Point, m23Point, iAmp );
+ }
+ }
+
+ for ( UInt_t iAmp = 0; iAmp < nIncohAmp_; ++iAmp ) {
+
+ if ( integralsToBeCalculated_.find( iAmp + nAmp_ ) != intEnd ) {
+ // Calculate the dynamics for this resonance
+ incohInten_[iAmp] = this->incohResAmp( iAmp );
+
+ // Store the new value in the integration info object
+ intInfo->storeIntensity( m13Point, m23Point, iAmp, incohInten_[iAmp] );
+ } else {
+ // Retrieve the cached value of the amplitude
+ incohInten_[iAmp] = intInfo->getIntensity( m13Point, m23Point, iAmp );
+ }
+ }
+
+ // If symmetric, do as above with flipped kinematics and add to amplitude
+ // (No need to retrive the cache if this was done in the first case)
+
+ if ( symmetricalDP_ == kTRUE ) {
+ kinematics_->flipAndUpdateKinematics();
+
+ for ( UInt_t iAmp = 0; iAmp < nAmp_; ++iAmp ) {
+
+ if ( ( integralsToBeCalculated_.find( iAmp ) != intEnd ) &&
+ ! sigResonances_[iAmp]->preSymmetrised() ) {
+ // Calculate the dynamics for this resonance
+ ff_[iAmp] += this->resAmp( iAmp );
+
+ // Store the new value in the integration info object
+ intInfo->storeAmplitude( m13Point, m23Point, iAmp, ff_[iAmp] );
+ }
+ }
+
+ for ( UInt_t iAmp = 0; iAmp < nIncohAmp_; ++iAmp ) {
+
+ if ( ( integralsToBeCalculated_.find( iAmp + nAmp_ ) != intEnd ) &&
+ ! sigResonances_[iAmp]->preSymmetrised() ) {
+ // Calculate the dynamics for this resonance
+ incohInten_[iAmp] += this->incohResAmp( iAmp );
+
+ // Store the new value in the integration info object
+ intInfo->storeIntensity( m13Point, m23Point, iAmp, incohInten_[iAmp] );
+ }
+ }
+
+ kinematics_->flipAndUpdateKinematics();
+ }
+
+ if ( fullySymmetricDP_ == kTRUE ) {
+ // rotate and evaluate
+ kinematics_->rotateAndUpdateKinematics();
+ for ( UInt_t iAmp = 0; iAmp < nAmp_; ++iAmp ) {
+ if ( ( integralsToBeCalculated_.find( iAmp ) != intEnd ) &&
+ ! sigResonances_[iAmp]->preSymmetrised() ) {
+ // Calculate the dynamics for this resonance
+ ff_[iAmp] += this->resAmp( iAmp );
+ // Store the new value in the integration info object
+ intInfo->storeAmplitude( m13Point, m23Point, iAmp, ff_[iAmp] );
+ }
+ }
+ for ( UInt_t iAmp = 0; iAmp < nIncohAmp_; ++iAmp ) {
+ if ( ( integralsToBeCalculated_.find( iAmp + nAmp_ ) != intEnd ) &&
+ ! sigResonances_[iAmp]->preSymmetrised() ) {
+ // Calculate the dynamics for this resonance
+ incohInten_[iAmp] += this->incohResAmp( iAmp );
+ // Store the new value in the integration info object
+ intInfo->storeIntensity( m13Point, m23Point, iAmp, incohInten_[iAmp] );
+ }
+ }
+
+ // rotate and evaluate
+ kinematics_->rotateAndUpdateKinematics();
+ for ( UInt_t iAmp = 0; iAmp < nAmp_; ++iAmp ) {
+ if ( ( integralsToBeCalculated_.find( iAmp ) != intEnd ) &&
+ ! sigResonances_[iAmp]->preSymmetrised() ) {
+ // Calculate the dynamics for this resonance
+ ff_[iAmp] += this->resAmp( iAmp );
+ // Store the new value in the integration info object
+ intInfo->storeAmplitude( m13Point, m23Point, iAmp, ff_[iAmp] );
+ }
+ }
+ for ( UInt_t iAmp = 0; iAmp < nIncohAmp_; ++iAmp ) {
+ if ( ( integralsToBeCalculated_.find( iAmp + nAmp_ ) != intEnd ) &&
+ ! sigResonances_[iAmp]->preSymmetrised() ) {
+ // Calculate the dynamics for this resonance
+ incohInten_[iAmp] += this->incohResAmp( iAmp );
+ // Store the new value in the integration info object
+ intInfo->storeIntensity( m13Point, m23Point, iAmp, incohInten_[iAmp] );
+ }
+ }
+
+ // rotate, flip and evaluate
+ kinematics_->rotateAndUpdateKinematics();
+ kinematics_->flipAndUpdateKinematics();
+ for ( UInt_t iAmp = 0; iAmp < nAmp_; ++iAmp ) {
+ if ( ( integralsToBeCalculated_.find( iAmp ) != intEnd ) &&
+ ! sigResonances_[iAmp]->preSymmetrised() ) {
+ // Calculate the dynamics for this resonance
+ ff_[iAmp] += this->resAmp( iAmp );
+ // Store the new value in the integration info object
+ intInfo->storeAmplitude( m13Point, m23Point, iAmp, ff_[iAmp] );
+ }
+ }
+ for ( UInt_t iAmp = 0; iAmp < nIncohAmp_; ++iAmp ) {
+ if ( ( integralsToBeCalculated_.find( iAmp + nAmp_ ) != intEnd ) &&
+ ! sigResonances_[iAmp]->preSymmetrised() ) {
+ // Calculate the dynamics for this resonance
+ incohInten_[iAmp] += this->incohResAmp( iAmp );
+ // Store the new value in the integration info object
+ intInfo->storeIntensity( m13Point, m23Point, iAmp, incohInten_[iAmp] );
+ }
+ }
+
+ // rotate and evaluate
+ kinematics_->rotateAndUpdateKinematics();
+ for ( UInt_t iAmp = 0; iAmp < nAmp_; ++iAmp ) {
+ if ( ( integralsToBeCalculated_.find( iAmp ) != intEnd ) &&
+ ! sigResonances_[iAmp]->preSymmetrised() ) {
+ // Calculate the dynamics for this resonance
+ ff_[iAmp] += this->resAmp( iAmp );
+ // Store the new value in the integration info object
+ intInfo->storeAmplitude( m13Point, m23Point, iAmp, ff_[iAmp] );
+ }
+ }
+ for ( UInt_t iAmp = 0; iAmp < nIncohAmp_; ++iAmp ) {
+ if ( ( integralsToBeCalculated_.find( iAmp + nAmp_ ) != intEnd ) &&
+ ! sigResonances_[iAmp]->preSymmetrised() ) {
+ // Calculate the dynamics for this resonance
+ incohInten_[iAmp] += this->incohResAmp( iAmp );
+ // Store the new value in the integration info object
+ intInfo->storeIntensity( m13Point, m23Point, iAmp, incohInten_[iAmp] );
+ }
+ }
+
+ // rotate and evaluate
+ kinematics_->rotateAndUpdateKinematics();
+ for ( UInt_t iAmp = 0; iAmp < nAmp_; ++iAmp ) {
+ if ( ( integralsToBeCalculated_.find( iAmp ) != intEnd ) &&
+ ! sigResonances_[iAmp]->preSymmetrised() ) {
+ // Calculate the dynamics for this resonance
+ ff_[iAmp] += this->resAmp( iAmp );
+ // Store the new value in the integration info object
+ intInfo->storeAmplitude( m13Point, m23Point, iAmp, ff_[iAmp] );
+ }
+ }
+ for ( UInt_t iAmp = 0; iAmp < nIncohAmp_; ++iAmp ) {
+ if ( ( integralsToBeCalculated_.find( iAmp + nAmp_ ) != intEnd ) &&
+ ! sigResonances_[iAmp]->preSymmetrised() ) {
+ // Calculate the dynamics for this resonance
+ incohInten_[iAmp] += this->incohResAmp( iAmp );
+ // Store the new value in the integration info object
+ intInfo->storeIntensity( m13Point, m23Point, iAmp, incohInten_[iAmp] );
+ }
+ }
+
+ // rotate and flip to get us back to where we started
+ kinematics_->rotateAndUpdateKinematics();
+ kinematics_->flipAndUpdateKinematics();
+ }
+
+ // If we haven't cached the data, then we need to find out the efficiency.
+ eff_ = this->retrieveEfficiency();
+
+ intInfo->storeEfficiency( m13Point, m23Point, eff_ );
}
void LauIsobarDynamics::calculateAmplitudes()
{
- std::set<UInt_t>::const_iterator iter = integralsToBeCalculated_.begin();
- const std::set<UInt_t>::const_iterator intEnd = integralsToBeCalculated_.end();
-
- for ( iter = integralsToBeCalculated_.begin(); iter != intEnd; ++iter) {
-
- // Calculate the dynamics for this resonance
- if(*iter < nAmp_) {
- ff_[*iter] = this->resAmp(*iter);
- } else {
- incohInten_[*iter-nAmp_] = this->incohResAmp(*iter-nAmp_);
- }
- }
-
- if ( symmetricalDP_ == kTRUE ) {
- kinematics_->flipAndUpdateKinematics();
-
- for ( iter = integralsToBeCalculated_.begin(); iter != intEnd; ++iter) {
-
- // Calculate the dynamics for this resonance
- if(*iter < nAmp_ && !sigResonances_[*iter]->preSymmetrised() ) {
- ff_[*iter] += this->resAmp(*iter);
- } else if (*iter >= nAmp_ && !sigResonances_[*iter-nAmp_]->preSymmetrised() ){
- incohInten_[*iter-nAmp_] += this->incohResAmp(*iter-nAmp_);
- }
-
- }
-
- kinematics_->flipAndUpdateKinematics();
- }
-
- if ( fullySymmetricDP_ == kTRUE ) {
- // rotate and evaluate
- kinematics_->rotateAndUpdateKinematics();
- for ( iter = integralsToBeCalculated_.begin(); iter != intEnd; ++iter) {
- if(*iter < nAmp_ && !sigResonances_[*iter]->preSymmetrised() ) {
- ff_[*iter] += this->resAmp(*iter);
- } else if (*iter >= nAmp_ && !sigResonances_[*iter-nAmp_]->preSymmetrised() ){
- incohInten_[*iter-nAmp_] += this->incohResAmp(*iter-nAmp_);
- }
- }
-
- // rotate and evaluate
- kinematics_->rotateAndUpdateKinematics();
- for ( iter = integralsToBeCalculated_.begin(); iter != intEnd; ++iter) {
- if(*iter < nAmp_ && !sigResonances_[*iter]->preSymmetrised() ) {
- ff_[*iter] += this->resAmp(*iter);
- } else if (*iter >= nAmp_ && !sigResonances_[*iter-nAmp_]->preSymmetrised() ){
- incohInten_[*iter-nAmp_] += this->incohResAmp(*iter-nAmp_);
- }
- }
-
- // rotate, flip and evaluate
- kinematics_->rotateAndUpdateKinematics();
- kinematics_->flipAndUpdateKinematics();
- for ( iter = integralsToBeCalculated_.begin(); iter != intEnd; ++iter) {
- if(*iter < nAmp_ && !sigResonances_[*iter]->preSymmetrised() ) {
- ff_[*iter] += this->resAmp(*iter);
- } else if (*iter >= nAmp_ && !sigResonances_[*iter-nAmp_]->preSymmetrised() ){
- incohInten_[*iter-nAmp_] += this->incohResAmp(*iter-nAmp_);
- }
- }
-
- // rotate and evaluate
- kinematics_->rotateAndUpdateKinematics();
- for ( iter = integralsToBeCalculated_.begin(); iter != intEnd; ++iter) {
- if(*iter < nAmp_ && !sigResonances_[*iter]->preSymmetrised() ) {
- ff_[*iter] += this->resAmp(*iter);
- } else if (*iter >= nAmp_ && !sigResonances_[*iter-nAmp_]->preSymmetrised() ){
- incohInten_[*iter-nAmp_] += this->incohResAmp(*iter-nAmp_);
- }
- }
-
- // rotate and evaluate
- kinematics_->rotateAndUpdateKinematics();
- for ( iter = integralsToBeCalculated_.begin(); iter != intEnd; ++iter) {
- if(*iter < nAmp_ && !sigResonances_[*iter]->preSymmetrised() ) {
- ff_[*iter] += this->resAmp(*iter);
- } else if (*iter >= nAmp_ && !sigResonances_[*iter-nAmp_]->preSymmetrised() ){
- incohInten_[*iter-nAmp_] += this->incohResAmp(*iter-nAmp_);
- }
- }
-
- // rotate and flip to get us back to where we started
- kinematics_->rotateAndUpdateKinematics();
- kinematics_->flipAndUpdateKinematics();
- }
-
- // If we haven't cached the data, then we need to find out the efficiency.
- eff_ = this->retrieveEfficiency();
+ std::set<UInt_t>::const_iterator iter = integralsToBeCalculated_.begin();
+ const std::set<UInt_t>::const_iterator intEnd = integralsToBeCalculated_.end();
+
+ for ( iter = integralsToBeCalculated_.begin(); iter != intEnd; ++iter ) {
+
+ // Calculate the dynamics for this resonance
+ if ( *iter < nAmp_ ) {
+ ff_[*iter] = this->resAmp( *iter );
+ } else {
+ incohInten_[*iter - nAmp_] = this->incohResAmp( *iter - nAmp_ );
+ }
+ }
+
+ if ( symmetricalDP_ == kTRUE ) {
+ kinematics_->flipAndUpdateKinematics();
+
+ for ( iter = integralsToBeCalculated_.begin(); iter != intEnd; ++iter ) {
+
+ // Calculate the dynamics for this resonance
+ if ( *iter < nAmp_ && ! sigResonances_[*iter]->preSymmetrised() ) {
+ ff_[*iter] += this->resAmp( *iter );
+ } else if ( *iter >= nAmp_ && ! sigResonances_[*iter - nAmp_]->preSymmetrised() ) {
+ incohInten_[*iter - nAmp_] += this->incohResAmp( *iter - nAmp_ );
+ }
+ }
+
+ kinematics_->flipAndUpdateKinematics();
+ }
+
+ if ( fullySymmetricDP_ == kTRUE ) {
+ // rotate and evaluate
+ kinematics_->rotateAndUpdateKinematics();
+ for ( iter = integralsToBeCalculated_.begin(); iter != intEnd; ++iter ) {
+ if ( *iter < nAmp_ && ! sigResonances_[*iter]->preSymmetrised() ) {
+ ff_[*iter] += this->resAmp( *iter );
+ } else if ( *iter >= nAmp_ && ! sigResonances_[*iter - nAmp_]->preSymmetrised() ) {
+ incohInten_[*iter - nAmp_] += this->incohResAmp( *iter - nAmp_ );
+ }
+ }
+
+ // rotate and evaluate
+ kinematics_->rotateAndUpdateKinematics();
+ for ( iter = integralsToBeCalculated_.begin(); iter != intEnd; ++iter ) {
+ if ( *iter < nAmp_ && ! sigResonances_[*iter]->preSymmetrised() ) {
+ ff_[*iter] += this->resAmp( *iter );
+ } else if ( *iter >= nAmp_ && ! sigResonances_[*iter - nAmp_]->preSymmetrised() ) {
+ incohInten_[*iter - nAmp_] += this->incohResAmp( *iter - nAmp_ );
+ }
+ }
+
+ // rotate, flip and evaluate
+ kinematics_->rotateAndUpdateKinematics();
+ kinematics_->flipAndUpdateKinematics();
+ for ( iter = integralsToBeCalculated_.begin(); iter != intEnd; ++iter ) {
+ if ( *iter < nAmp_ && ! sigResonances_[*iter]->preSymmetrised() ) {
+ ff_[*iter] += this->resAmp( *iter );
+ } else if ( *iter >= nAmp_ && ! sigResonances_[*iter - nAmp_]->preSymmetrised() ) {
+ incohInten_[*iter - nAmp_] += this->incohResAmp( *iter - nAmp_ );
+ }
+ }
+
+ // rotate and evaluate
+ kinematics_->rotateAndUpdateKinematics();
+ for ( iter = integralsToBeCalculated_.begin(); iter != intEnd; ++iter ) {
+ if ( *iter < nAmp_ && ! sigResonances_[*iter]->preSymmetrised() ) {
+ ff_[*iter] += this->resAmp( *iter );
+ } else if ( *iter >= nAmp_ && ! sigResonances_[*iter - nAmp_]->preSymmetrised() ) {
+ incohInten_[*iter - nAmp_] += this->incohResAmp( *iter - nAmp_ );
+ }
+ }
+
+ // rotate and evaluate
+ kinematics_->rotateAndUpdateKinematics();
+ for ( iter = integralsToBeCalculated_.begin(); iter != intEnd; ++iter ) {
+ if ( *iter < nAmp_ && ! sigResonances_[*iter]->preSymmetrised() ) {
+ ff_[*iter] += this->resAmp( *iter );
+ } else if ( *iter >= nAmp_ && ! sigResonances_[*iter - nAmp_]->preSymmetrised() ) {
+ incohInten_[*iter - nAmp_] += this->incohResAmp( *iter - nAmp_ );
+ }
+ }
+
+ // rotate and flip to get us back to where we started
+ kinematics_->rotateAndUpdateKinematics();
+ kinematics_->flipAndUpdateKinematics();
+ }
+
+ // If we haven't cached the data, then we need to find out the efficiency.
+ eff_ = this->retrieveEfficiency();
}
-void LauIsobarDynamics::calcTotalAmp(const Bool_t useEff)
+void LauIsobarDynamics::calcTotalAmp( const Bool_t useEff )
{
- // Reset the total amplitude to zero
- totAmp_.zero();
-
- // Loop over all signal amplitudes
- LauComplex ATerm;
- for (UInt_t i = 0; i < nAmp_; ++i) {
+ // Reset the total amplitude to zero
+ totAmp_.zero();
- // Get the partial complex amplitude - (mag, phase)*(resonance dynamics)
- ATerm = Amp_[i]*ff_[i];
+ // Loop over all signal amplitudes
+ LauComplex ATerm;
+ for ( UInt_t i = 0; i < nAmp_; ++i ) {
- // Scale this contribution by its relative normalisation w.r.t. the whole dynamics
- ATerm.rescale(fNorm_[i]);
+ // Get the partial complex amplitude - (mag, phase)*(resonance dynamics)
+ ATerm = Amp_[i] * ff_[i];
- // Add this partial amplitude to the sum
- totAmp_ += ATerm;
+ // Scale this contribution by its relative normalisation w.r.t. the whole dynamics
+ ATerm.rescale( fNorm_[i] );
- } // Loop over amplitudes
+ // Add this partial amplitude to the sum
+ totAmp_ += ATerm;
- // |Sum of partial amplitudes|^2
- ASq_ = totAmp_.abs2();
+ } // Loop over amplitudes
- for (UInt_t i = 0; i < nIncohAmp_; ++i) {
+ // |Sum of partial amplitudes|^2
+ ASq_ = totAmp_.abs2();
- // Get the partial complex amplitude - (mag, phase)
- ATerm = Amp_[i+nAmp_];
+ for ( UInt_t i = 0; i < nIncohAmp_; ++i ) {
- // Scale this contribution by its relative normalisation w.r.t. the whole dynamics
- ATerm.rescale(fNorm_[i+nAmp_]);
+ // Get the partial complex amplitude - (mag, phase)
+ ATerm = Amp_[i + nAmp_];
- // Add this partial amplitude to the sum
- ASq_ += ATerm.abs2()*incohInten_[i];
+ // Scale this contribution by its relative normalisation w.r.t. the whole dynamics
+ ATerm.rescale( fNorm_[i + nAmp_] );
- }
+ // Add this partial amplitude to the sum
+ ASq_ += ATerm.abs2() * incohInten_[i];
+ }
- // Apply the efficiency correction for this event.
- // Multiply the amplitude squared sum by the DP efficiency
- if ( useEff ) {
- ASq_ *= eff_;
- }
+ // Apply the efficiency correction for this event.
+ // Multiply the amplitude squared sum by the DP efficiency
+ if ( useEff ) {
+ ASq_ *= eff_;
+ }
}
-void LauIsobarDynamics::addGridPointToIntegrals(const Double_t weight)
+void LauIsobarDynamics::addGridPointToIntegrals( const Double_t weight )
{
- // Combine the Gauss-Legendre weight with the efficiency
- const Double_t effWeight = eff_*weight;
-
- LauComplex fifjEffSumTerm;
- LauComplex fifjSumTerm;
-
- // Calculates the half-matrix of amplitude-squared and interference
- // terms (dynamical part only)
- // Add the values at this point on the integration grid to the sums
- // (one weighted only by the integration weights, one also weighted by
- // the efficiency)
- for (UInt_t i = 0; i < nAmp_; ++i) {
-
- // Add the dynamical amplitude squared for this resonance.
- Double_t fSqVal = ff_[i].abs2();
- fSqSum_[i] += fSqVal*weight;
- fSqEffSum_[i] += fSqVal*effWeight;
-
- for (UInt_t j = i; j < nAmp_; ++j) {
-
- fifjEffSumTerm = fifjSumTerm = ff_[i]*ff_[j].conj();
-
- fifjEffSumTerm.rescale(effWeight);
- fifjEffSum_[i][j] += fifjEffSumTerm;
-
- fifjSumTerm.rescale(weight);
- fifjSum_[i][j] += fifjSumTerm;
- }
- }
- for (UInt_t i = 0; i < nIncohAmp_; ++i) {
-
- // Add the dynamical amplitude squared for this resonance.
- Double_t fSqVal = incohInten_[i];
- fSqSum_[i+nAmp_] += fSqVal*weight;
- fSqEffSum_[i+nAmp_] += fSqVal*effWeight;
- }
+ // Combine the Gauss-Legendre weight with the efficiency
+ const Double_t effWeight = eff_ * weight;
+
+ LauComplex fifjEffSumTerm;
+ LauComplex fifjSumTerm;
+
+ // Calculates the half-matrix of amplitude-squared and interference
+ // terms (dynamical part only)
+ // Add the values at this point on the integration grid to the sums
+ // (one weighted only by the integration weights, one also weighted by
+ // the efficiency)
+ for ( UInt_t i = 0; i < nAmp_; ++i ) {
+
+ // Add the dynamical amplitude squared for this resonance.
+ Double_t fSqVal = ff_[i].abs2();
+ fSqSum_[i] += fSqVal * weight;
+ fSqEffSum_[i] += fSqVal * effWeight;
+
+ for ( UInt_t j = i; j < nAmp_; ++j ) {
+
+ fifjEffSumTerm = fifjSumTerm = ff_[i] * ff_[j].conj();
+
+ fifjEffSumTerm.rescale( effWeight );
+ fifjEffSum_[i][j] += fifjEffSumTerm;
+
+ fifjSumTerm.rescale( weight );
+ fifjSum_[i][j] += fifjSumTerm;
+ }
+ }
+ for ( UInt_t i = 0; i < nIncohAmp_; ++i ) {
+
+ // Add the dynamical amplitude squared for this resonance.
+ Double_t fSqVal = incohInten_[i];
+ fSqSum_[i + nAmp_] += fSqVal * weight;
+ fSqEffSum_[i + nAmp_] += fSqVal * effWeight;
+ }
}
-LauComplex LauIsobarDynamics::resAmp(const UInt_t index)
+LauComplex LauIsobarDynamics::resAmp( const UInt_t index )
{
- // Routine to calculate the resonance dynamics (amplitude)
- // using the appropriate Breit-Wigner/Form Factors.
+ // Routine to calculate the resonance dynamics (amplitude)
+ // using the appropriate Breit-Wigner/Form Factors.
- LauComplex amp = LauComplex(0.0, 0.0);
+ LauComplex amp = LauComplex( 0.0, 0.0 );
- if ( index >= nAmp_ ) {
- std::cerr<<"ERROR in LauIsobarDynamics::resAmp : index = "<<index<<" is not within the range 0 to "<<nAmp_-1<<std::endl;
- return amp;
- }
+ if ( index >= nAmp_ ) {
+ std::cerr << "ERROR in LauIsobarDynamics::resAmp : index = " << index
+ << " is not within the range 0 to " << nAmp_ - 1 << std::endl;
+ return amp;
+ }
- // Get the signal resonance from the stored vector
- LauAbsResonance* sigResonance = sigResonances_[index];
+ // Get the signal resonance from the stored vector
+ LauAbsResonance* sigResonance = sigResonances_[index];
- if (sigResonance == 0) {
- std::cerr<<"ERROR in LauIsobarDynamics::resAmp : Couldn't retrieve valid resonance with index = "<<index<<std::endl;
- return amp;
- }
+ if ( sigResonance == 0 ) {
+ std::cerr << "ERROR in LauIsobarDynamics::resAmp : Couldn't retrieve valid resonance with index = "
+ << index << std::endl;
+ return amp;
+ }
- amp = sigResonance->amplitude(kinematics_);
+ amp = sigResonance->amplitude( kinematics_ );
- return amp;
+ return amp;
}
-Double_t LauIsobarDynamics::incohResAmp(const UInt_t index)
+Double_t LauIsobarDynamics::incohResAmp( const UInt_t index )
{
- // Routine to calculate the resonance dynamics (amplitude)
- // using the appropriate Breit-Wigner/Form Factors.
+ // Routine to calculate the resonance dynamics (amplitude)
+ // using the appropriate Breit-Wigner/Form Factors.
- Double_t intensity = 0.;
+ Double_t intensity = 0.;
- if ( index >= nIncohAmp_ ) {
- std::cerr<<"ERROR in LauIsobarDynamics::incohResAmp : index = "<<index<<" is not within the range 0 to "<<nIncohAmp_-1<<std::endl;
- return intensity;
- }
+ if ( index >= nIncohAmp_ ) {
+ std::cerr << "ERROR in LauIsobarDynamics::incohResAmp : index = " << index
+ << " is not within the range 0 to " << nIncohAmp_ - 1 << std::endl;
+ return intensity;
+ }
- // Get the signal resonance from the stored vector
- LauAbsIncohRes* sigResonance = sigIncohResonances_[index];
+ // Get the signal resonance from the stored vector
+ LauAbsIncohRes* sigResonance = sigIncohResonances_[index];
- if (sigResonance == 0) {
- std::cerr<<"ERROR in LauIsobarDynamics::incohResAmp : Couldn't retrieve valid incoherent resonance with index = "<<index<<std::endl;
- return intensity;
- }
+ if ( sigResonance == 0 ) {
+ std::cerr << "ERROR in LauIsobarDynamics::incohResAmp : Couldn't retrieve valid incoherent resonance with index = "
+ << index << std::endl;
+ return intensity;
+ }
- LauComplex ff = sigResonance->amplitude(kinematics_);
- intensity = sigResonance->intensityFactor(kinematics_)*ff.abs2();
-
- return intensity;
+ LauComplex ff = sigResonance->amplitude( kinematics_ );
+ intensity = sigResonance->intensityFactor( kinematics_ ) * ff.abs2();
+ return intensity;
}
-void LauIsobarDynamics::setFFTerm(const UInt_t index, const Double_t realPart, const Double_t imagPart)
+void LauIsobarDynamics::setFFTerm( const UInt_t index, const Double_t realPart, const Double_t imagPart )
{
- // Function to set the internal ff term (normally calculated using resAmp(index).
- if ( index >= nAmp_ ) {
- std::cerr<<"ERROR in LauIsobarDynamics::setFFTerm : index = "<<index<<" is not within the range 0 to "<<nAmp_-1<<std::endl;
- return;
- }
-
- ff_[index].setRealImagPart( realPart, imagPart );
+ // Function to set the internal ff term (normally calculated using resAmp(index).
+ if ( index >= nAmp_ ) {
+ std::cerr << "ERROR in LauIsobarDynamics::setFFTerm : index = " << index
+ << " is not within the range 0 to " << nAmp_ - 1 << std::endl;
+ return;
+ }
+
+ ff_[index].setRealImagPart( realPart, imagPart );
}
-void LauIsobarDynamics::setIncohIntenTerm(const UInt_t index, const Double_t value)
+void LauIsobarDynamics::setIncohIntenTerm( const UInt_t index, const Double_t value )
{
- // Function to set the internal incoherent intensity term (normally calculated using incohResAmp(index).
- if ( index >= nIncohAmp_ ) {
- std::cerr<<"ERROR in LauIsobarDynamics::setFFTerm : index = "<<index<<" is not within the range 0 to "<<nIncohAmp_-1<<std::endl;
- return;
- }
-
- incohInten_[index] = value;
+ // Function to set the internal incoherent intensity term (normally calculated using incohResAmp(index).
+ if ( index >= nIncohAmp_ ) {
+ std::cerr << "ERROR in LauIsobarDynamics::setFFTerm : index = " << index
+ << " is not within the range 0 to " << nIncohAmp_ - 1 << std::endl;
+ return;
+ }
+
+ incohInten_[index] = value;
}
-void LauIsobarDynamics::calcExtraInfo(const Bool_t init)
+void LauIsobarDynamics::calcExtraInfo( const Bool_t init )
{
- // This method calculates the fit fractions, mean efficiency and total DP rate
-
- Double_t fifjEffTot(0.0), fifjTot(0.0);
- UInt_t i, j;
- for (i = 0; i < nAmp_; i++) {
-
- // Calculate the diagonal terms
- TString name = "A"; name += i; name += "Sq_FitFrac";
- fitFrac_[i][i].name(name);
-
- name += "EffUnCorr";
- fitFracEffUnCorr_[i][i].name(name);
-
- Double_t fifjSumReal = fifjSum_[i][i].re();
- Double_t sumTerm = Amp_[i].abs2()*fifjSumReal*fNorm_[i]*fNorm_[i];
- fifjTot += sumTerm;
-
- Double_t fifjEffSumReal = fifjEffSum_[i][i].re();
- Double_t sumEffTerm = Amp_[i].abs2()*fifjEffSumReal*fNorm_[i]*fNorm_[i];
- fifjEffTot += sumEffTerm;
-
- fitFrac_[i][i].value(sumTerm);
- fitFracEffUnCorr_[i][i].value(sumEffTerm);
- }
-
- for (i = 0; i < nAmp_; i++) {
- for (j = i+1; j < nAmp_+nIncohAmp_; j++) {
- // Calculate the cross-terms
- TString name = "A"; name += i; name += "A"; name += j; name += "_FitFrac";
- fitFrac_[i][j].name(name);
-
- name += "EffUnCorr";
- fitFracEffUnCorr_[i][j].name(name);
-
- if(j >= nAmp_) {
- //Set off-diagonal incoherent terms to zero
- fitFrac_[i][j].value(0.);
- fitFracEffUnCorr_[i][j].value(0.);
- continue;
- }
-
- LauComplex AmpjConj = Amp_[j].conj();
- LauComplex AmpTerm = Amp_[i]*AmpjConj;
-
- Double_t crossTerm = 2.0*(AmpTerm*fifjSum_[i][j]).re()*fNorm_[i]*fNorm_[j];
- fifjTot += crossTerm;
-
- Double_t crossEffTerm = 2.0*(AmpTerm*fifjEffSum_[i][j]).re()*fNorm_[i]*fNorm_[j];
- fifjEffTot += crossEffTerm;
-
- fitFrac_[i][j].value(crossTerm);
- fitFracEffUnCorr_[i][j].value(crossEffTerm);
- }
- }
-
- for (i = nAmp_; i < nAmp_+nIncohAmp_; i++) {
-
- // Calculate the incoherent terms
- TString name = "A"; name += i; name += "Sq_FitFrac";
- fitFrac_[i][i].name(name);
-
- name += "EffUnCorr";
- fitFracEffUnCorr_[i][i].name(name);
-
- Double_t sumTerm = Amp_[i].abs2()*fSqSum_[i]*fNorm_[i]*fNorm_[i];
- fifjTot += sumTerm;
-
- Double_t sumEffTerm = Amp_[i].abs2()*fSqEffSum_[i]*fNorm_[i]*fNorm_[i];
- fifjEffTot += sumEffTerm;
-
- fitFrac_[i][i].value(sumTerm);
- fitFracEffUnCorr_[i][i].value(sumEffTerm);
- }
-
- for (i = nAmp_; i < nAmp_+nIncohAmp_; i++) {
- for (j = i+1; j < nAmp_+nIncohAmp_; j++) {
- //Set off-diagonal incoherent terms to zero
- TString name = "A"; name += i; name += "A"; name += j; name += "_FitFrac";
- fitFrac_[i][j].name(name);
-
- name += "EffUnCorr";
- fitFracEffUnCorr_[i][j].name(name);
-
- fitFrac_[i][j].value(0.);
- fitFracEffUnCorr_[i][j].value(0.);
- }
- }
-
- if (TMath::Abs(fifjTot) > 1e-10) {
- meanDPEff_.value(fifjEffTot/fifjTot);
- if (init) {
- meanDPEff_.genValue( meanDPEff_.value() );
- meanDPEff_.initValue( meanDPEff_.value() );
- }
- }
- DPRate_.value(fifjTot);
- if (init) {
- DPRate_.genValue( DPRate_.value() );
- DPRate_.initValue( DPRate_.value() );
- }
-
- // Now divide the fitFraction sums by the overall integral
- for (i = 0; i < nAmp_+nIncohAmp_; i++) {
- for (j = i; j < nAmp_+nIncohAmp_; j++) {
- // Get the actual fractions by dividing by the total DP rate
- Double_t fitFracVal = fitFrac_[i][j].value();
- fitFracVal /= fifjTot;
- fitFrac_[i][j].value( fitFracVal );
-
- Double_t fitFracEffUnCorrVal = fitFracEffUnCorr_[i][j].value();
- fitFracEffUnCorrVal /= fifjEffTot;
- fitFracEffUnCorr_[i][j].value( fitFracEffUnCorrVal );
-
- if (init) {
- fitFrac_[i][j].genValue( fitFrac_[i][j].value() );
- fitFrac_[i][j].initValue( fitFrac_[i][j].value() );
- fitFracEffUnCorr_[i][j].genValue( fitFracEffUnCorr_[i][j].value() );
- fitFracEffUnCorr_[i][j].initValue( fitFracEffUnCorr_[i][j].value() );
- }
- }
- }
-
- // Work out total fit fraction over all K-matrix components (for each propagator)
- KMPropMap::iterator mapIter;
- Int_t propInt(0);
-
- for (mapIter = kMatrixPropagators_.begin(); mapIter != kMatrixPropagators_.end(); ++mapIter) {
-
- LauKMatrixPropagator* thePropagator = mapIter->second;
+ // This method calculates the fit fractions, mean efficiency and total DP rate
+
+ Double_t fifjEffTot( 0.0 ), fifjTot( 0.0 );
+ UInt_t i, j;
+ for ( i = 0; i < nAmp_; i++ ) {
+
+ // Calculate the diagonal terms
+ TString name = "A";
+ name += i;
+ name += "Sq_FitFrac";
+ fitFrac_[i][i].name( name );
+
+ name += "EffUnCorr";
+ fitFracEffUnCorr_[i][i].name( name );
+
+ Double_t fifjSumReal = fifjSum_[i][i].re();
+ Double_t sumTerm = Amp_[i].abs2() * fifjSumReal * fNorm_[i] * fNorm_[i];
+ fifjTot += sumTerm;
+
+ Double_t fifjEffSumReal = fifjEffSum_[i][i].re();
+ Double_t sumEffTerm = Amp_[i].abs2() * fifjEffSumReal * fNorm_[i] * fNorm_[i];
+ fifjEffTot += sumEffTerm;
+
+ fitFrac_[i][i].value( sumTerm );
+ fitFracEffUnCorr_[i][i].value( sumEffTerm );
+ }
+
+ for ( i = 0; i < nAmp_; i++ ) {
+ for ( j = i + 1; j < nAmp_ + nIncohAmp_; j++ ) {
+ // Calculate the cross-terms
+ TString name = "A";
+ name += i;
+ name += "A";
+ name += j;
+ name += "_FitFrac";
+ fitFrac_[i][j].name( name );
+
+ name += "EffUnCorr";
+ fitFracEffUnCorr_[i][j].name( name );
+
+ if ( j >= nAmp_ ) {
+ //Set off-diagonal incoherent terms to zero
+ fitFrac_[i][j].value( 0. );
+ fitFracEffUnCorr_[i][j].value( 0. );
+ continue;
+ }
+
+ LauComplex AmpjConj = Amp_[j].conj();
+ LauComplex AmpTerm = Amp_[i] * AmpjConj;
+
+ Double_t crossTerm = 2.0 * ( AmpTerm * fifjSum_[i][j] ).re() * fNorm_[i] * fNorm_[j];
+ fifjTot += crossTerm;
+
+ Double_t crossEffTerm = 2.0 * ( AmpTerm * fifjEffSum_[i][j] ).re() * fNorm_[i] *
+ fNorm_[j];
+ fifjEffTot += crossEffTerm;
+
+ fitFrac_[i][j].value( crossTerm );
+ fitFracEffUnCorr_[i][j].value( crossEffTerm );
+ }
+ }
+
+ for ( i = nAmp_; i < nAmp_ + nIncohAmp_; i++ ) {
+
+ // Calculate the incoherent terms
+ TString name = "A";
+ name += i;
+ name += "Sq_FitFrac";
+ fitFrac_[i][i].name( name );
+
+ name += "EffUnCorr";
+ fitFracEffUnCorr_[i][i].name( name );
+
+ Double_t sumTerm = Amp_[i].abs2() * fSqSum_[i] * fNorm_[i] * fNorm_[i];
+ fifjTot += sumTerm;
+
+ Double_t sumEffTerm = Amp_[i].abs2() * fSqEffSum_[i] * fNorm_[i] * fNorm_[i];
+ fifjEffTot += sumEffTerm;
+
+ fitFrac_[i][i].value( sumTerm );
+ fitFracEffUnCorr_[i][i].value( sumEffTerm );
+ }
+
+ for ( i = nAmp_; i < nAmp_ + nIncohAmp_; i++ ) {
+ for ( j = i + 1; j < nAmp_ + nIncohAmp_; j++ ) {
+ //Set off-diagonal incoherent terms to zero
+ TString name = "A";
+ name += i;
+ name += "A";
+ name += j;
+ name += "_FitFrac";
+ fitFrac_[i][j].name( name );
+
+ name += "EffUnCorr";
+ fitFracEffUnCorr_[i][j].name( name );
+
+ fitFrac_[i][j].value( 0. );
+ fitFracEffUnCorr_[i][j].value( 0. );
+ }
+ }
+
+ if ( TMath::Abs( fifjTot ) > 1e-10 ) {
+ meanDPEff_.value( fifjEffTot / fifjTot );
+ if ( init ) {
+ meanDPEff_.genValue( meanDPEff_.value() );
+ meanDPEff_.initValue( meanDPEff_.value() );
+ }
+ }
+ DPRate_.value( fifjTot );
+ if ( init ) {
+ DPRate_.genValue( DPRate_.value() );
+ DPRate_.initValue( DPRate_.value() );
+ }
+
+ // Now divide the fitFraction sums by the overall integral
+ for ( i = 0; i < nAmp_ + nIncohAmp_; i++ ) {
+ for ( j = i; j < nAmp_ + nIncohAmp_; j++ ) {
+ // Get the actual fractions by dividing by the total DP rate
+ Double_t fitFracVal = fitFrac_[i][j].value();
+ fitFracVal /= fifjTot;
+ fitFrac_[i][j].value( fitFracVal );
+
+ Double_t fitFracEffUnCorrVal = fitFracEffUnCorr_[i][j].value();
+ fitFracEffUnCorrVal /= fifjEffTot;
+ fitFracEffUnCorr_[i][j].value( fitFracEffUnCorrVal );
+
+ if ( init ) {
+ fitFrac_[i][j].genValue( fitFrac_[i][j].value() );
+ fitFrac_[i][j].initValue( fitFrac_[i][j].value() );
+ fitFracEffUnCorr_[i][j].genValue( fitFracEffUnCorr_[i][j].value() );
+ fitFracEffUnCorr_[i][j].initValue( fitFracEffUnCorr_[i][j].value() );
+ }
+ }
+ }
- TString propName = thePropagator->getName();
+ // Work out total fit fraction over all K-matrix components (for each propagator)
+ KMPropMap::iterator mapIter;
+ Int_t propInt( 0 );
- // Now loop over all resonances and find those which are K-matrix components for this propagator
- Double_t kMatrixTotFitFrac(0.0);
+ for ( mapIter = kMatrixPropagators_.begin(); mapIter != kMatrixPropagators_.end(); ++mapIter ) {
- for (i = 0; i < nAmp_; i++) {
+ LauKMatrixPropagator* thePropagator = mapIter->second;
- Bool_t gotKMRes1 = this->gotKMatrixMatch(i, propName);
- if (gotKMRes1 == kFALSE) {continue;}
+ TString propName = thePropagator->getName();
- Double_t fifjSumReal = fifjSum_[i][i].re();
- Double_t sumTerm = Amp_[i].abs2()*fifjSumReal*fNorm_[i]*fNorm_[i];
+ // Now loop over all resonances and find those which are K-matrix components for this propagator
+ Double_t kMatrixTotFitFrac( 0.0 );
- //Double_t fifjEffSumReal = fifjEffSum_[i][i].re();
- //Double_t sumEffTerm = Amp_[i].abs2()*fifjEffSumReal*fNorm_[i]*fNorm_[i];
+ for ( i = 0; i < nAmp_; i++ ) {
- kMatrixTotFitFrac += sumTerm;
+ Bool_t gotKMRes1 = this->gotKMatrixMatch( i, propName );
+ if ( gotKMRes1 == kFALSE ) {
+ continue;
+ }
- for (j = i+1; j < nAmp_; j++) {
+ Double_t fifjSumReal = fifjSum_[i][i].re();
+ Double_t sumTerm = Amp_[i].abs2() * fifjSumReal * fNorm_[i] * fNorm_[i];
- Bool_t gotKMRes2 = this->gotKMatrixMatch(j, propName);
- if (gotKMRes2 == kFALSE) {continue;}
+ //Double_t fifjEffSumReal = fifjEffSum_[i][i].re();
+ //Double_t sumEffTerm = Amp_[i].abs2()*fifjEffSumReal*fNorm_[i]*fNorm_[i];
- LauComplex AmpjConj = Amp_[j].conj();
- LauComplex AmpTerm = Amp_[i]*AmpjConj;
+ kMatrixTotFitFrac += sumTerm;
- Double_t crossTerm = 2.0*(AmpTerm*fifjSum_[i][j]).re()*fNorm_[i]*fNorm_[j];
- //Double_t crossEffTerm = 2.0*(AmpTerm*fifjEffSum_[i][j]).re()*fNorm_[i]*fNorm_[j];
+ for ( j = i + 1; j < nAmp_; j++ ) {
- kMatrixTotFitFrac += crossTerm;
+ Bool_t gotKMRes2 = this->gotKMatrixMatch( j, propName );
+ if ( gotKMRes2 == kFALSE ) {
+ continue;
+ }
- }
+ LauComplex AmpjConj = Amp_[j].conj();
+ LauComplex AmpTerm = Amp_[i] * AmpjConj;
- }
+ Double_t crossTerm = 2.0 * ( AmpTerm * fifjSum_[i][j] ).re() * fNorm_[i] * fNorm_[j];
+ //Double_t crossEffTerm = 2.0*(AmpTerm*fifjEffSum_[i][j]).re()*fNorm_[i]*fNorm_[j];
- kMatrixTotFitFrac /= fifjTot;
+ kMatrixTotFitFrac += crossTerm;
+ }
+ }
- TString parName("KMatrixTotFF_"); parName += propInt;
- extraParameters_[propInt].name( parName );
- extraParameters_[propInt].value(kMatrixTotFitFrac);
- if (init) {
- extraParameters_[propInt].genValue(kMatrixTotFitFrac);
- extraParameters_[propInt].initValue(kMatrixTotFitFrac);
- }
+ kMatrixTotFitFrac /= fifjTot;
- std::cout<<"INFO in LauIsobarDynamics::calcExtraInfo : Total K-matrix fit fraction for propagator "<<propName<<" is "<<kMatrixTotFitFrac<<std::endl;
+ TString parName( "KMatrixTotFF_" );
+ parName += propInt;
+ extraParameters_[propInt].name( parName );
+ extraParameters_[propInt].value( kMatrixTotFitFrac );
+ if ( init ) {
+ extraParameters_[propInt].genValue( kMatrixTotFitFrac );
+ extraParameters_[propInt].initValue( kMatrixTotFitFrac );
+ }
- ++propInt;
+ std::cout << "INFO in LauIsobarDynamics::calcExtraInfo : Total K-matrix fit fraction for propagator "
+ << propName << " is " << kMatrixTotFitFrac << std::endl;
- }
+ ++propInt;
+ }
- // Calculate rho and omega fit fractions from LauRhoOmegaMix
+ // Calculate rho and omega fit fractions from LauRhoOmegaMix
- // In principle the presence of LauRhoOmegaMix can be detected, however
- // working out the index of the correct component is hard.
+ // In principle the presence of LauRhoOmegaMix can be detected, however
+ // working out the index of the correct component is hard.
- // To prevent unwanted effects, this has to be manually turned on, with the
- // assumption that the first two components are rho and rho_COPY in a LauCPFitModel
+ // To prevent unwanted effects, this has to be manually turned on, with the
+ // assumption that the first two components are rho and rho_COPY in a LauCPFitModel
- if (this->calculateRhoOmegaFitFractions_ && !init) {
+ if ( this->calculateRhoOmegaFitFractions_ && ! init ) {
- int omegaID = 0;
- int storeID = 1;
+ int omegaID = 0;
+ int storeID = 1;
- // Check which B flavour (and therefore which rho_COPY we are) by whether the FF is non-zero
- // Only for CP fit though - for a 'simple' fit this is more complicated
- if (fitFrac_[omegaID][omegaID].value() < 1E-4) {
- omegaID = 1;
- storeID = 0;
- }
+ // Check which B flavour (and therefore which rho_COPY we are) by whether the FF is non-zero
+ // Only for CP fit though - for a 'simple' fit this is more complicated
+ if ( fitFrac_[omegaID][omegaID].value() < 1E-4 ) {
+ omegaID = 1;
+ storeID = 0;
+ }
- // Check this is really the correct model
+ // Check this is really the correct model
- LauRhoOmegaMix * rhomega = dynamic_cast<LauRhoOmegaMix *>(getResonance(omegaID));
+ LauRhoOmegaMix* rhomega = dynamic_cast<LauRhoOmegaMix*>( getResonance( omegaID ) );
- if (rhomega != NULL) { // Bail out
+ if ( rhomega != NULL ) { // Bail out
- std::cout << "INFO in LauIsobarDynamics::calcExtraInfo : Calculating omega fit fraction from resonance " << omegaID << std::endl;
- std::cout << "INFO in LauIsobarDynamics::calcExtraInfo : Storing omega fit fraction in resonance " << storeID << std::endl;
+ std::cout << "INFO in LauIsobarDynamics::calcExtraInfo : Calculating omega fit fraction from resonance "
+ << omegaID << std::endl;
+ std::cout << "INFO in LauIsobarDynamics::calcExtraInfo : Storing omega fit fraction in resonance "
+ << storeID << std::endl;
- // Tell the RhoOmegaMix model only to give us the omega amplitude-squared
+ // Tell the RhoOmegaMix model only to give us the omega amplitude-squared
- rhomega->setWhichAmpSq(1);
+ rhomega->setWhichAmpSq( 1 );
- // Recalculate the integrals for the omega fit-fraction
+ // Recalculate the integrals for the omega fit-fraction
- integralsDone_ = kFALSE;
+ integralsDone_ = kFALSE;
- this->resetNormVectors();
- for ( UInt_t k(0); k < nAmp_+nIncohAmp_; ++k ) {
- integralsToBeCalculated_.insert(k);
- }
- this->calcDPNormalisation();
+ this->resetNormVectors();
+ for ( UInt_t k( 0 ); k < nAmp_ + nIncohAmp_; ++k ) {
+ integralsToBeCalculated_.insert( k );
+ }
+ this->calcDPNormalisation();
- integralsDone_ = kTRUE;
+ integralsDone_ = kTRUE;
- Double_t fifjSumRealOmega = fifjSum_[omegaID][omegaID].re();
+ Double_t fifjSumRealOmega = fifjSum_[omegaID][omegaID].re();
- // Recalculate the integrals for the rho fit-fraction
+ // Recalculate the integrals for the rho fit-fraction
- rhomega->setWhichAmpSq(2);
+ rhomega->setWhichAmpSq( 2 );
- integralsDone_ = kFALSE;
+ integralsDone_ = kFALSE;
- this->resetNormVectors();
- for ( UInt_t k(0); k < nAmp_+nIncohAmp_; ++k ) {
- integralsToBeCalculated_.insert(k);
- }
- this->calcDPNormalisation();
+ this->resetNormVectors();
+ for ( UInt_t k( 0 ); k < nAmp_ + nIncohAmp_; ++k ) {
+ integralsToBeCalculated_.insert( k );
+ }
+ this->calcDPNormalisation();
- integralsDone_ = kTRUE;
+ integralsDone_ = kTRUE;
- Double_t fitFracPartRho = Amp_[omegaID].abs2()*fifjSum_[omegaID][omegaID].re();
+ Double_t fitFracPartRho = Amp_[omegaID].abs2() * fifjSum_[omegaID][omegaID].re();
- // Reset the RhoOmegaMix model and the integrals
+ // Reset the RhoOmegaMix model and the integrals
- rhomega->setWhichAmpSq(0);
+ rhomega->setWhichAmpSq( 0 );
- integralsDone_ = kFALSE;
+ integralsDone_ = kFALSE;
- this->resetNormVectors();
- for ( UInt_t k(0); k < nAmp_+nIncohAmp_; ++k ) {
- integralsToBeCalculated_.insert(k);
- }
- this->calcDPNormalisation();
+ this->resetNormVectors();
+ for ( UInt_t k( 0 ); k < nAmp_ + nIncohAmp_; ++k ) {
+ integralsToBeCalculated_.insert( k );
+ }
+ this->calcDPNormalisation();
- integralsDone_ = kTRUE;
+ integralsDone_ = kTRUE;
- // Store the omega fit-fraction in the rho_COPY location (which is otherwise empty)
- // Store the rho fit-fraction in the rho location (overwriting the combined FF)
+ // Store the omega fit-fraction in the rho_COPY location (which is otherwise empty)
+ // Store the rho fit-fraction in the rho location (overwriting the combined FF)
- Double_t omegaFF = fifjSumRealOmega * fitFrac_[omegaID][omegaID].value();
+ Double_t omegaFF = fifjSumRealOmega * fitFrac_[omegaID][omegaID].value();
- fitFrac_[storeID][storeID].value(omegaFF);
- fitFrac_[omegaID][omegaID].value(fitFracPartRho * fNorm_[omegaID] * fNorm_[omegaID] / DPRate_.value());
-
- } else {
- std::cout << "INFO in LauIsobarDynamics::calcExtraInfo : calculateRhoOmegaFitFractions is set, but the RhoOmegaMix model isn't in the right place. Ignoring this option." << std::endl;
- }
-
- }
+ fitFrac_[storeID][storeID].value( omegaFF );
+ fitFrac_[omegaID][omegaID].value( fitFracPartRho * fNorm_[omegaID] * fNorm_[omegaID] /
+ DPRate_.value() );
+ } else {
+ std::cout << "INFO in LauIsobarDynamics::calcExtraInfo : calculateRhoOmegaFitFractions is set, but the RhoOmegaMix model isn't in the right place. Ignoring this option."
+ << std::endl;
+ }
+ }
}
-Bool_t LauIsobarDynamics::gotKMatrixMatch(UInt_t resAmpInt, const TString& propName) const
+Bool_t LauIsobarDynamics::gotKMatrixMatch( UInt_t resAmpInt, const TString& propName ) const
{
- Bool_t gotMatch(kFALSE);
-
- if (resAmpInt >= nAmp_) {return kFALSE;}
+ Bool_t gotMatch( kFALSE );
- const LauAbsResonance* theResonance = sigResonances_[resAmpInt];
+ if ( resAmpInt >= nAmp_ ) {
+ return kFALSE;
+ }
- if (theResonance == 0) {return kFALSE;}
+ const LauAbsResonance* theResonance = sigResonances_[resAmpInt];
- Int_t resModelInt = theResonance->getResonanceModel();
+ if ( theResonance == 0 ) {
+ return kFALSE;
+ }
- if (resModelInt == LauAbsResonance::KMatrix) {
+ Int_t resModelInt = theResonance->getResonanceModel();
- TString resName = theResonance->getResonanceName();
+ if ( resModelInt == LauAbsResonance::KMatrix ) {
- KMStringMap::const_iterator kMPropSetIter = kMatrixPropSet_.find(resName);
+ TString resName = theResonance->getResonanceName();
- if (kMPropSetIter != kMatrixPropSet_.end()) {
- TString kmPropString = kMPropSetIter->second;
- if (kmPropString == propName) {gotMatch = kTRUE;}
- }
+ KMStringMap::const_iterator kMPropSetIter = kMatrixPropSet_.find( resName );
- }
-
- return gotMatch;
+ if ( kMPropSetIter != kMatrixPropSet_.end() ) {
+ TString kmPropString = kMPropSetIter->second;
+ if ( kmPropString == propName ) {
+ gotMatch = kTRUE;
+ }
+ }
+ }
+ return gotMatch;
}
Double_t LauIsobarDynamics::calcSigDPNorm()
{
- // Calculate the normalisation for the log-likelihood function.
- DPNorm_ = 0.0;
-
- for (UInt_t i = 0; i < nAmp_; i++) {
- // fifjEffSum is the contribution from the term involving the resonance
- // dynamics (f_i for resonance i) and the efficiency term.
- Double_t fifjEffSumReal = fifjEffSum_[i][i].re();
- // We need to normalise this contribution w.r.t. the complete dynamics in the DP.
- // Hence we scale by the fNorm_i factor (squared), which is calculated by the
- // initialise() function, when the normalisation integrals are calculated and cached.
- // We also include the complex amplitude squared to get the total normalisation
- // contribution from this resonance.
- DPNorm_ += Amp_[i].abs2()*fifjEffSumReal*fNorm_[i]*fNorm_[i];
- }
-
- // We now come to the cross-terms (between resonances i and j) in the normalisation.
- for (UInt_t i = 0; i < nAmp_; i++) {
- for (UInt_t j = i+1; j < nAmp_; j++) {
- LauComplex AmpjConj = Amp_[j].conj();
- LauComplex AmpTerm = Amp_[i]*AmpjConj;
- // Again, fifjEffSum is the contribution from the term involving the resonance
- // dynamics (f_i*f_j_conjugate) and the efficiency cross term.
- // Also include the relative normalisation between these two resonances w.r.t. the
- // total DP dynamical structure (fNorm_i and fNorm_j) and the complex
- // amplitude squared (mag,phase) part.
- DPNorm_ += 2.0*(AmpTerm*fifjEffSum_[i][j]).re()*fNorm_[i]*fNorm_[j];
- }
- }
-
- for (UInt_t i = 0; i < nIncohAmp_; i++) {
- DPNorm_ += Amp_[i+nAmp_].abs2()*fSqEffSum_[i+nAmp_]*fNorm_[i+nAmp_]*fNorm_[i+nAmp_];
- }
-
- return DPNorm_;
+ // Calculate the normalisation for the log-likelihood function.
+ DPNorm_ = 0.0;
+
+ for ( UInt_t i = 0; i < nAmp_; i++ ) {
+ // fifjEffSum is the contribution from the term involving the resonance
+ // dynamics (f_i for resonance i) and the efficiency term.
+ Double_t fifjEffSumReal = fifjEffSum_[i][i].re();
+ // We need to normalise this contribution w.r.t. the complete dynamics in the DP.
+ // Hence we scale by the fNorm_i factor (squared), which is calculated by the
+ // initialise() function, when the normalisation integrals are calculated and cached.
+ // We also include the complex amplitude squared to get the total normalisation
+ // contribution from this resonance.
+ DPNorm_ += Amp_[i].abs2() * fifjEffSumReal * fNorm_[i] * fNorm_[i];
+ }
+
+ // We now come to the cross-terms (between resonances i and j) in the normalisation.
+ for ( UInt_t i = 0; i < nAmp_; i++ ) {
+ for ( UInt_t j = i + 1; j < nAmp_; j++ ) {
+ LauComplex AmpjConj = Amp_[j].conj();
+ LauComplex AmpTerm = Amp_[i] * AmpjConj;
+ // Again, fifjEffSum is the contribution from the term involving the resonance
+ // dynamics (f_i*f_j_conjugate) and the efficiency cross term.
+ // Also include the relative normalisation between these two resonances w.r.t. the
+ // total DP dynamical structure (fNorm_i and fNorm_j) and the complex
+ // amplitude squared (mag,phase) part.
+ DPNorm_ += 2.0 * ( AmpTerm * fifjEffSum_[i][j] ).re() * fNorm_[i] * fNorm_[j];
+ }
+ }
+
+ for ( UInt_t i = 0; i < nIncohAmp_; i++ ) {
+ DPNorm_ += Amp_[i + nAmp_].abs2() * fSqEffSum_[i + nAmp_] * fNorm_[i + nAmp_] *
+ fNorm_[i + nAmp_];
+ }
+
+ return DPNorm_;
}
Bool_t LauIsobarDynamics::generate()
{
- // Routine to generate a signal event according to the Dalitz plot
- // model we have defined.
-
- // We need to make sure to calculate everything for every resonance
- integralsToBeCalculated_.clear();
- for ( UInt_t i{0}; i < nAmp_+nIncohAmp_; ++i ) {
- integralsToBeCalculated_.insert(i);
- }
-
- if ( aSqMaxAuto_ ) {
- std::cout<<"INFO in LauIsobarDynamics::generate : Starting auto-location of |A|^2 maximum"<<std::endl;
-
- LauASqMaxFinder finder{*this};
- aSqMaxSet_ = finder.find();
- aSqMaxAuto_ = kFALSE;
-
- std::cout<<"INFO in LauIsobarDynamics::generate : auto-location of |A|^2 maximum finds: "<<aSqMaxSet_<<std::endl;
- aSqMaxSet_ *= 1.10;
- std::cout<<" : applying safety factor of 10\% gives: "<<aSqMaxSet_<<std::endl;
- }
-
- nSigGenLoop_ = 0;
- Bool_t generatedSig(kFALSE);
-
- while (generatedSig == kFALSE && nSigGenLoop_ < iterationsMax_) {
-
- // Generates uniform DP phase-space distribution
- Double_t m13Sq(0.0), m23Sq(0.0);
- kinematics_->genFlatPhaseSpace(m13Sq, m23Sq);
-
- // If we're in a symmetrical DP then we should only generate events in one half
- // TODO - what do we do for fully symmetric?
- if ( symmetricalDP_ && !fullySymmetricDP_ && m13Sq > m23Sq ) {
- Double_t tmpSq = m13Sq;
- m13Sq = m23Sq;
- m23Sq = tmpSq;
- }
-
- // Calculate the amplitudes and total amplitude for the given DP point
- this->calcLikelihoodInfo(m13Sq, m23Sq);
-
-
- // Throw the random number and check it against the ratio of ASq and the accept/reject ceiling
- const Double_t randNo = LauRandom::randomFun()->Rndm();
- if (randNo > ASq_/aSqMaxSet_) {
- ++nSigGenLoop_;
- } else {
- generatedSig = kTRUE;
- nSigGenLoop_ = 0;
-
- // Keep a note of the maximum ASq that we've found
- if (ASq_ > aSqMaxVar_) {aSqMaxVar_ = ASq_;}
- }
-
- } // while loop
-
- // Check that all is well with the generation
- Bool_t sigGenOK(kTRUE);
- if (GenOK != this->checkToyMC(kTRUE,kFALSE)) {
- sigGenOK = kFALSE;
- }
-
- return sigGenOK;
+ // Routine to generate a signal event according to the Dalitz plot
+ // model we have defined.
+
+ // We need to make sure to calculate everything for every resonance
+ integralsToBeCalculated_.clear();
+ for ( UInt_t i { 0 }; i < nAmp_ + nIncohAmp_; ++i ) {
+ integralsToBeCalculated_.insert( i );
+ }
+
+ if ( aSqMaxAuto_ ) {
+ std::cout << "INFO in LauIsobarDynamics::generate : Starting auto-location of |A|^2 maximum"
+ << std::endl;
+
+ LauASqMaxFinder finder { *this };
+ aSqMaxSet_ = finder.find();
+ aSqMaxAuto_ = kFALSE;
+
+ std::cout << "INFO in LauIsobarDynamics::generate : auto-location of |A|^2 maximum finds: "
+ << aSqMaxSet_ << std::endl;
+ aSqMaxSet_ *= 1.10;
+ std::cout << " : applying safety factor of 10\% gives: "
+ << aSqMaxSet_ << std::endl;
+ }
+
+ nSigGenLoop_ = 0;
+ Bool_t generatedSig( kFALSE );
+
+ while ( generatedSig == kFALSE && nSigGenLoop_ < iterationsMax_ ) {
+
+ // Generates uniform DP phase-space distribution
+ Double_t m13Sq( 0.0 ), m23Sq( 0.0 );
+ kinematics_->genFlatPhaseSpace( m13Sq, m23Sq );
+
+ // If we're in a symmetrical DP then we should only generate events in one half
+ // TODO - what do we do for fully symmetric?
+ if ( symmetricalDP_ && ! fullySymmetricDP_ && m13Sq > m23Sq ) {
+ Double_t tmpSq = m13Sq;
+ m13Sq = m23Sq;
+ m23Sq = tmpSq;
+ }
+
+ // Calculate the amplitudes and total amplitude for the given DP point
+ this->calcLikelihoodInfo( m13Sq, m23Sq );
+
+ // Throw the random number and check it against the ratio of ASq and the accept/reject ceiling
+ const Double_t randNo = LauRandom::randomFun()->Rndm();
+ if ( randNo > ASq_ / aSqMaxSet_ ) {
+ ++nSigGenLoop_;
+ } else {
+ generatedSig = kTRUE;
+ nSigGenLoop_ = 0;
+
+ // Keep a note of the maximum ASq that we've found
+ if ( ASq_ > aSqMaxVar_ ) {
+ aSqMaxVar_ = ASq_;
+ }
+ }
+
+ } // while loop
+
+ // Check that all is well with the generation
+ Bool_t sigGenOK( kTRUE );
+ if ( GenOK != this->checkToyMC( kTRUE, kFALSE ) ) {
+ sigGenOK = kFALSE;
+ }
+
+ return sigGenOK;
}
-LauIsobarDynamics::ToyMCStatus LauIsobarDynamics::checkToyMC(Bool_t printErrorMessages, Bool_t printInfoMessages)
+LauIsobarDynamics::ToyMCStatus LauIsobarDynamics::checkToyMC( Bool_t printErrorMessages,
+ Bool_t printInfoMessages )
{
- // Check whether we have generated the toy MC OK.
- ToyMCStatus ok(GenOK);
-
- if (nSigGenLoop_ >= iterationsMax_) {
- // Exceeded maximum allowed iterations - the generation is too inefficient
- if (printErrorMessages) {
- std::cerr<<"WARNING in LauIsobarDynamics::checkToyMC : More than "<<iterationsMax_<<" iterations performed and no event accepted."<<std::endl;
- }
-
- if ( aSqMaxSet_ > 1.01 * aSqMaxVar_ ) {
- if (printErrorMessages) {
- std::cerr<<" : |A|^2 maximum was set to "<<aSqMaxSet_<<" but this appears to be too high."<<std::endl;
- std::cerr<<" : Maximum value of |A|^2 found so far = "<<aSqMaxVar_<<std::endl;
- std::cerr<<" : The value of |A|^2 maximum will be decreased and the generation restarted."<<std::endl;
- }
- aSqMaxSet_ = 1.01 * aSqMaxVar_;
- std::cout<<"INFO in LauIsobarDynamics::checkToyMC : |A|^2 max reset to "<<aSqMaxSet_<<std::endl;
- ok = MaxIterError;
- } else {
- if (printErrorMessages) {
- std::cerr<<" : |A|^2 maximum was set to "<<aSqMaxSet_<<", which seems to be correct for the given model."<<std::endl;
- std::cerr<<" : However, the generation is very inefficient - please check your model."<<std::endl;
- std::cerr<<" : The maximum number of iterations will be increased and the generation restarted."<<std::endl;
- }
- iterationsMax_ *= 2;
- std::cout<<"INFO in LauIsobarDynamics::checkToyMC : max number of iterations reset to "<<iterationsMax_<<std::endl;
- ok = MaxIterError;
- }
- } else if (aSqMaxVar_ > aSqMaxSet_) {
- // Found a value of ASq higher than the accept/reject ceiling - the generation is biased
- if (printErrorMessages) {
- std::cerr<<"WARNING in LauIsobarDynamics::checkToyMC : |A|^2 maximum was set to "<<aSqMaxSet_<<" but a value exceeding this was found: "<<aSqMaxVar_<<std::endl;
- std::cerr<<" : This value was found at m13Sq = "<<kinematics_->getm13Sq()<<" and m23Sq = "<<kinematics_->getm23Sq()<<std::endl;
- std::cerr<<" : Run was invalid, as any generated MC will be biased, according to the accept/reject method!"<<std::endl;
- std::cerr<<" : The value of |A|^2 maximum be reset to be > "<<aSqMaxVar_<<" and the generation restarted."<<std::endl;
- }
- aSqMaxSet_ = 1.01 * aSqMaxVar_;
- std::cout<<"INFO in LauIsobarDynamics::checkToyMC : |A|^2 max reset to "<<aSqMaxSet_<<std::endl;
- ok = ASqMaxError;
- } else if (printInfoMessages) {
- std::cout<<"INFO in LauIsobarDynamics::checkToyMC : aSqMaxSet = "<<aSqMaxSet_<<" and aSqMaxVar = "<<aSqMaxVar_<<std::endl;
- }
-
- return ok;
+ // Check whether we have generated the toy MC OK.
+ ToyMCStatus ok( GenOK );
+
+ if ( nSigGenLoop_ >= iterationsMax_ ) {
+ // Exceeded maximum allowed iterations - the generation is too inefficient
+ if ( printErrorMessages ) {
+ std::cerr << "WARNING in LauIsobarDynamics::checkToyMC : More than " << iterationsMax_
+ << " iterations performed and no event accepted." << std::endl;
+ }
+
+ if ( aSqMaxSet_ > 1.01 * aSqMaxVar_ ) {
+ if ( printErrorMessages ) {
+ std::cerr << " : |A|^2 maximum was set to "
+ << aSqMaxSet_ << " but this appears to be too high." << std::endl;
+ std::cerr << " : Maximum value of |A|^2 found so far = "
+ << aSqMaxVar_ << std::endl;
+ std::cerr << " : The value of |A|^2 maximum will be decreased and the generation restarted."
+ << std::endl;
+ }
+ aSqMaxSet_ = 1.01 * aSqMaxVar_;
+ std::cout << "INFO in LauIsobarDynamics::checkToyMC : |A|^2 max reset to " << aSqMaxSet_
+ << std::endl;
+ ok = MaxIterError;
+ } else {
+ if ( printErrorMessages ) {
+ std::cerr << " : |A|^2 maximum was set to "
+ << aSqMaxSet_ << ", which seems to be correct for the given model."
+ << std::endl;
+ std::cerr << " : However, the generation is very inefficient - please check your model."
+ << std::endl;
+ std::cerr << " : The maximum number of iterations will be increased and the generation restarted."
+ << std::endl;
+ }
+ iterationsMax_ *= 2;
+ std::cout << "INFO in LauIsobarDynamics::checkToyMC : max number of iterations reset to "
+ << iterationsMax_ << std::endl;
+ ok = MaxIterError;
+ }
+ } else if ( aSqMaxVar_ > aSqMaxSet_ ) {
+ // Found a value of ASq higher than the accept/reject ceiling - the generation is biased
+ if ( printErrorMessages ) {
+ std::cerr << "WARNING in LauIsobarDynamics::checkToyMC : |A|^2 maximum was set to "
+ << aSqMaxSet_ << " but a value exceeding this was found: " << aSqMaxVar_
+ << std::endl;
+ std::cerr << " : This value was found at m13Sq = "
+ << kinematics_->getm13Sq() << " and m23Sq = " << kinematics_->getm23Sq()
+ << std::endl;
+ std::cerr << " : Run was invalid, as any generated MC will be biased, according to the accept/reject method!"
+ << std::endl;
+ std::cerr << " : The value of |A|^2 maximum be reset to be > "
+ << aSqMaxVar_ << " and the generation restarted." << std::endl;
+ }
+ aSqMaxSet_ = 1.01 * aSqMaxVar_;
+ std::cout << "INFO in LauIsobarDynamics::checkToyMC : |A|^2 max reset to " << aSqMaxSet_
+ << std::endl;
+ ok = ASqMaxError;
+ } else if ( printInfoMessages ) {
+ std::cout << "INFO in LauIsobarDynamics::checkToyMC : aSqMaxSet = " << aSqMaxSet_
+ << " and aSqMaxVar = " << aSqMaxVar_ << std::endl;
+ }
+
+ return ok;
}
-void LauIsobarDynamics::setDataEventNo(UInt_t iEvt)
+void LauIsobarDynamics::setDataEventNo( UInt_t iEvt )
{
- // Retrieve the data for event iEvt
- if (data_.size() > iEvt) {
- currentEvent_ = data_[iEvt];
- } else {
- std::cerr<<"ERROR in LauIsobarDynamics::setDataEventNo : Event index too large: "<<iEvt<<" >= "<<data_.size()<<"."<<std::endl;
- }
-
- m13Sq_ = currentEvent_->retrievem13Sq();
- m23Sq_ = currentEvent_->retrievem23Sq();
- mPrime_ = currentEvent_->retrievemPrime();
- thPrime_ = currentEvent_->retrievethPrime();
- tagCat_ = currentEvent_->retrieveTagCat();
- eff_ = currentEvent_->retrieveEff();
- scfFraction_ = currentEvent_->retrieveScfFraction(); // These two are necessary, even though the dynamics don't actually use scfFraction_ or jacobian_,
- jacobian_ = currentEvent_->retrieveJacobian(); // since this is at the heart of the caching mechanism.
+ // Retrieve the data for event iEvt
+ if ( data_.size() > iEvt ) {
+ currentEvent_ = data_[iEvt];
+ } else {
+ std::cerr << "ERROR in LauIsobarDynamics::setDataEventNo : Event index too large: " << iEvt
+ << " >= " << data_.size() << "." << std::endl;
+ }
+
+ m13Sq_ = currentEvent_->retrievem13Sq();
+ m23Sq_ = currentEvent_->retrievem23Sq();
+ mPrime_ = currentEvent_->retrievemPrime();
+ thPrime_ = currentEvent_->retrievethPrime();
+ tagCat_ = currentEvent_->retrieveTagCat();
+ eff_ = currentEvent_->retrieveEff();
+ scfFraction_ =
+ currentEvent_->retrieveScfFraction(); // These two are necessary, even though the dynamics don't actually use scfFraction_ or jacobian_,
+ jacobian_ = currentEvent_->retrieveJacobian(); // since this is at the heart of the caching mechanism.
}
-void LauIsobarDynamics::calcLikelihoodInfo(const UInt_t iEvt)
+void LauIsobarDynamics::calcLikelihoodInfo( const UInt_t iEvt )
{
- // Calculate the likelihood and associated info
- // for the given event using cached information
- evtLike_ = 0.0;
-
- // retrieve the cached dynamics from the tree:
- // realAmp, imagAmp for each resonance plus efficiency, scf fraction and jacobian
- this->setDataEventNo(iEvt);
-
- // use realAmp and imagAmp to create the resonance amplitudes
- const std::vector<Double_t>& realAmp = currentEvent_->retrieveRealAmp();
- const std::vector<Double_t>& imagAmp = currentEvent_->retrieveImagAmp();
- const std::vector<Double_t>& incohInten = currentEvent_->retrieveIncohIntensities();
- for (UInt_t i = 0; i < nAmp_; i++) {
- this->setFFTerm(i, realAmp[i], imagAmp[i]);
- }
- for (UInt_t i = 0; i < nIncohAmp_; i++) {
- this->setIncohIntenTerm(i, incohInten[i]);
- }
-
- // Update the dynamics - calculates totAmp_ and then ASq_ = totAmp_.abs2() * eff_
- // All calculated using cached information on the individual amplitudes and efficiency.
- this->calcTotalAmp(kTRUE);
-
- // Calculate the normalised matrix element squared value
- if (DPNorm_ > 1e-10) {
- evtLike_ = ASq_/DPNorm_;
- }
+ // Calculate the likelihood and associated info
+ // for the given event using cached information
+ evtLike_ = 0.0;
+
+ // retrieve the cached dynamics from the tree:
+ // realAmp, imagAmp for each resonance plus efficiency, scf fraction and jacobian
+ this->setDataEventNo( iEvt );
+
+ // use realAmp and imagAmp to create the resonance amplitudes
+ const std::vector<Double_t>& realAmp = currentEvent_->retrieveRealAmp();
+ const std::vector<Double_t>& imagAmp = currentEvent_->retrieveImagAmp();
+ const std::vector<Double_t>& incohInten = currentEvent_->retrieveIncohIntensities();
+ for ( UInt_t i = 0; i < nAmp_; i++ ) {
+ this->setFFTerm( i, realAmp[i], imagAmp[i] );
+ }
+ for ( UInt_t i = 0; i < nIncohAmp_; i++ ) {
+ this->setIncohIntenTerm( i, incohInten[i] );
+ }
+
+ // Update the dynamics - calculates totAmp_ and then ASq_ = totAmp_.abs2() * eff_
+ // All calculated using cached information on the individual amplitudes and efficiency.
+ this->calcTotalAmp( kTRUE );
+
+ // Calculate the normalised matrix element squared value
+ if ( DPNorm_ > 1e-10 ) {
+ evtLike_ = ASq_ / DPNorm_;
+ }
}
-void LauIsobarDynamics::calcLikelihoodInfo(const Double_t m13Sq, const Double_t m23Sq)
+void LauIsobarDynamics::calcLikelihoodInfo( const Double_t m13Sq, const Double_t m23Sq )
{
- this->calcLikelihoodInfo(m13Sq, m23Sq, -1);
+ this->calcLikelihoodInfo( m13Sq, m23Sq, -1 );
}
-void LauIsobarDynamics::calcLikelihoodInfo(const Double_t m13Sq, const Double_t m23Sq, const Int_t tagCat)
+void LauIsobarDynamics::calcLikelihoodInfo( const Double_t m13Sq,
+ const Double_t m23Sq,
+ const Int_t tagCat )
{
- // Calculate the likelihood and associated info
- // for the given point in the Dalitz plot
- // Also retrieves the SCF fraction in the bin where the event lies (done
- // here to cache it along with the the rest of the DP quantities, like eff)
- // The jacobian for the square DP is calculated here for the same reason.
- evtLike_ = 0.0;
-
- // update the kinematics for the specified DP point
- kinematics_->updateKinematics(m13Sq, m23Sq);
-
- // calculate the jacobian and the scfFraction to cache them later
- scfFraction_ = this->retrieveScfFraction(tagCat);
- if (kinematics_->squareDP() == kTRUE) {
- jacobian_ = kinematics_->calcSqDPJacobian();
- }
-
- // calculate the ff_ terms and retrieves eff_ from the efficiency model
- this->calculateAmplitudes();
- // then calculate totAmp_ and finally ASq_ = totAmp_.abs2() * eff_
- this->calcTotalAmp(kTRUE);
-
- // Calculate the normalised matrix element squared value
- if (DPNorm_ > 1e-10) {
- evtLike_ = ASq_/DPNorm_;
- }
+ // Calculate the likelihood and associated info
+ // for the given point in the Dalitz plot
+ // Also retrieves the SCF fraction in the bin where the event lies (done
+ // here to cache it along with the the rest of the DP quantities, like eff)
+ // The jacobian for the square DP is calculated here for the same reason.
+ evtLike_ = 0.0;
+
+ // update the kinematics for the specified DP point
+ kinematics_->updateKinematics( m13Sq, m23Sq );
+
+ // calculate the jacobian and the scfFraction to cache them later
+ scfFraction_ = this->retrieveScfFraction( tagCat );
+ if ( kinematics_->squareDP() == kTRUE ) {
+ jacobian_ = kinematics_->calcSqDPJacobian();
+ }
+
+ // calculate the ff_ terms and retrieves eff_ from the efficiency model
+ this->calculateAmplitudes();
+ // then calculate totAmp_ and finally ASq_ = totAmp_.abs2() * eff_
+ this->calcTotalAmp( kTRUE );
+
+ // Calculate the normalised matrix element squared value
+ if ( DPNorm_ > 1e-10 ) {
+ evtLike_ = ASq_ / DPNorm_;
+ }
}
void LauIsobarDynamics::modifyDataTree()
{
- if ( recalcNormalisation_ == kFALSE ) {
- return;
- }
+ if ( recalcNormalisation_ == kFALSE ) {
+ return;
+ }
- const UInt_t nEvents = data_.size();
+ const UInt_t nEvents = data_.size();
- std::set<UInt_t>::const_iterator iter = integralsToBeCalculated_.begin();
- const std::set<UInt_t>::const_iterator intEnd = integralsToBeCalculated_.end();
+ std::set<UInt_t>::const_iterator iter = integralsToBeCalculated_.begin();
+ const std::set<UInt_t>::const_iterator intEnd = integralsToBeCalculated_.end();
- for (UInt_t iEvt = 0; iEvt < nEvents; ++iEvt) {
+ for ( UInt_t iEvt = 0; iEvt < nEvents; ++iEvt ) {
- currentEvent_ = data_[iEvt];
+ currentEvent_ = data_[iEvt];
- std::vector<Double_t>& realAmp = currentEvent_->retrieveRealAmp();
- std::vector<Double_t>& imagAmp = currentEvent_->retrieveImagAmp();
- std::vector<Double_t>& incohInten = currentEvent_->retrieveIncohIntensities();
+ std::vector<Double_t>& realAmp = currentEvent_->retrieveRealAmp();
+ std::vector<Double_t>& imagAmp = currentEvent_->retrieveImagAmp();
+ std::vector<Double_t>& incohInten = currentEvent_->retrieveIncohIntensities();
- const Double_t m13Sq = currentEvent_->retrievem13Sq();
- const Double_t m23Sq = currentEvent_->retrievem23Sq();
- const Int_t tagCat = currentEvent_->retrieveTagCat();
+ const Double_t m13Sq = currentEvent_->retrievem13Sq();
+ const Double_t m23Sq = currentEvent_->retrievem23Sq();
+ const Int_t tagCat = currentEvent_->retrieveTagCat();
- this->calcLikelihoodInfo(m13Sq, m23Sq, tagCat);
+ this->calcLikelihoodInfo( m13Sq, m23Sq, tagCat );
- for ( iter = integralsToBeCalculated_.begin(); iter != intEnd; ++iter) {
- const UInt_t i = *iter;
- if(*iter < nAmp_) {
- realAmp[i] = ff_[i].re();
- imagAmp[i] = ff_[i].im();
- } else {
- incohInten[i-nAmp_] = incohInten_[i-nAmp_];
- }
- }
- }
+ for ( iter = integralsToBeCalculated_.begin(); iter != intEnd; ++iter ) {
+ const UInt_t i = *iter;
+ if ( *iter < nAmp_ ) {
+ realAmp[i] = ff_[i].re();
+ imagAmp[i] = ff_[i].im();
+ } else {
+ incohInten[i - nAmp_] = incohInten_[i - nAmp_];
+ }
+ }
+ }
}
-void LauIsobarDynamics::fillDataTree(const LauFitDataTree& inputFitTree)
+void LauIsobarDynamics::fillDataTree( const LauFitDataTree& inputFitTree )
{
- // In LauFitDataTree, the first two variables should always be m13^2 and m23^2.
- // Other variables follow thus: charge/flavour tag prob, etc.
-
- // Since this is the first caching, we need to make sure to calculate everything for every resonance
- integralsToBeCalculated_.clear();
- for ( UInt_t i(0); i < nAmp_+nIncohAmp_; ++i ) {
- integralsToBeCalculated_.insert(i);
- }
-
- UInt_t nBranches = inputFitTree.nBranches();
-
- if (nBranches < 2) {
- std::cerr<<"ERROR in LauIsobarDynamics::fillDataTree : Expecting at least 2 variables " <<"in input data tree, but there are "<<nBranches<<"!\n";
- std::cerr<<" : Make sure you have the right number of variables in your input data file!"<<std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // Data structure that will cache the variables required to
- // calculate the signal likelihood for this experiment
- for ( std::vector<LauCacheData*>::iterator iter = data_.begin(); iter != data_.end(); ++iter ) {
- delete (*iter);
- }
- data_.clear();
-
- Double_t m13Sq(0.0), m23Sq(0.0);
- Double_t mPrime(0.0), thPrime(0.0);
- Int_t tagCat(-1);
- std::vector<Double_t> realAmp(nAmp_), imagAmp(nAmp_);
- Double_t eff(0.0), scfFraction(0.0), jacobian(0.0);
-
- UInt_t nEvents = inputFitTree.nEvents() + inputFitTree.nFakeEvents();
-
- data_.reserve(nEvents);
-
- for (UInt_t iEvt = 0; iEvt < nEvents; ++iEvt) {
-
- const LauFitData& dataValues = inputFitTree.getData(iEvt);
- LauFitData::const_iterator iter = dataValues.find("m13Sq");
- m13Sq = iter->second;
- iter = dataValues.find("m23Sq");
- m23Sq = iter->second;
-
- // is there more than one tagging category?
- // if so then we need to know the category from the data
- if (scfFractionModel_.size()>1) {
- iter = dataValues.find("tagCat");
- tagCat = static_cast<Int_t>(iter->second);
- }
-
- // calculates the amplitudes and total amplitude for the given DP point
- // tagging category not needed by dynamics, but to find out the scfFraction
- this->calcLikelihoodInfo(m13Sq, m23Sq, tagCat);
-
- // extract the real and imaginary parts of the ff_ terms for storage
- for (UInt_t i = 0; i < nAmp_; i++) {
- realAmp[i] = ff_[i].re();
- imagAmp[i] = ff_[i].im();
- }
-
- if ( kinematics_->squareDP() ) {
- mPrime = kinematics_->getmPrime();
- thPrime = kinematics_->getThetaPrime();
- }
-
- eff = this->getEvtEff();
- scfFraction = this->getEvtScfFraction();
- jacobian = this->getEvtJacobian();
-
- // store the data for each event in the list
- data_.push_back( new LauCacheData() );
- data_[iEvt]->storem13Sq(m13Sq);
- data_[iEvt]->storem23Sq(m23Sq);
- data_[iEvt]->storemPrime(mPrime);
- data_[iEvt]->storethPrime(thPrime);
- data_[iEvt]->storeTagCat(tagCat);
- data_[iEvt]->storeEff(eff);
- data_[iEvt]->storeScfFraction(scfFraction);
- data_[iEvt]->storeJacobian(jacobian);
- data_[iEvt]->storeRealAmp(realAmp);
- data_[iEvt]->storeImagAmp(imagAmp);
- data_[iEvt]->storeIncohIntensities(incohInten_);
- }
+ // In LauFitDataTree, the first two variables should always be m13^2 and m23^2.
+ // Other variables follow thus: charge/flavour tag prob, etc.
+
+ // Since this is the first caching, we need to make sure to calculate everything for every resonance
+ integralsToBeCalculated_.clear();
+ for ( UInt_t i( 0 ); i < nAmp_ + nIncohAmp_; ++i ) {
+ integralsToBeCalculated_.insert( i );
+ }
+
+ UInt_t nBranches = inputFitTree.nBranches();
+
+ if ( nBranches < 2 ) {
+ std::cerr << "ERROR in LauIsobarDynamics::fillDataTree : Expecting at least 2 variables "
+ << "in input data tree, but there are " << nBranches << "!\n";
+ std::cerr << " : Make sure you have the right number of variables in your input data file!"
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // Data structure that will cache the variables required to
+ // calculate the signal likelihood for this experiment
+ for ( std::vector<LauCacheData*>::iterator iter = data_.begin(); iter != data_.end(); ++iter ) {
+ delete ( *iter );
+ }
+ data_.clear();
+
+ Double_t m13Sq( 0.0 ), m23Sq( 0.0 );
+ Double_t mPrime( 0.0 ), thPrime( 0.0 );
+ Int_t tagCat( -1 );
+ std::vector<Double_t> realAmp( nAmp_ ), imagAmp( nAmp_ );
+ Double_t eff( 0.0 ), scfFraction( 0.0 ), jacobian( 0.0 );
+
+ UInt_t nEvents = inputFitTree.nEvents() + inputFitTree.nFakeEvents();
+
+ data_.reserve( nEvents );
+
+ for ( UInt_t iEvt = 0; iEvt < nEvents; ++iEvt ) {
+
+ const LauFitData& dataValues = inputFitTree.getData( iEvt );
+ LauFitData::const_iterator iter = dataValues.find( "m13Sq" );
+ m13Sq = iter->second;
+ iter = dataValues.find( "m23Sq" );
+ m23Sq = iter->second;
+
+ // is there more than one tagging category?
+ // if so then we need to know the category from the data
+ if ( scfFractionModel_.size() > 1 ) {
+ iter = dataValues.find( "tagCat" );
+ tagCat = static_cast<Int_t>( iter->second );
+ }
+
+ // calculates the amplitudes and total amplitude for the given DP point
+ // tagging category not needed by dynamics, but to find out the scfFraction
+ this->calcLikelihoodInfo( m13Sq, m23Sq, tagCat );
+
+ // extract the real and imaginary parts of the ff_ terms for storage
+ for ( UInt_t i = 0; i < nAmp_; i++ ) {
+ realAmp[i] = ff_[i].re();
+ imagAmp[i] = ff_[i].im();
+ }
+
+ if ( kinematics_->squareDP() ) {
+ mPrime = kinematics_->getmPrime();
+ thPrime = kinematics_->getThetaPrime();
+ }
+
+ eff = this->getEvtEff();
+ scfFraction = this->getEvtScfFraction();
+ jacobian = this->getEvtJacobian();
+
+ // store the data for each event in the list
+ data_.push_back( new LauCacheData() );
+ data_[iEvt]->storem13Sq( m13Sq );
+ data_[iEvt]->storem23Sq( m23Sq );
+ data_[iEvt]->storemPrime( mPrime );
+ data_[iEvt]->storethPrime( thPrime );
+ data_[iEvt]->storeTagCat( tagCat );
+ data_[iEvt]->storeEff( eff );
+ data_[iEvt]->storeScfFraction( scfFraction );
+ data_[iEvt]->storeJacobian( jacobian );
+ data_[iEvt]->storeRealAmp( realAmp );
+ data_[iEvt]->storeImagAmp( imagAmp );
+ data_[iEvt]->storeIncohIntensities( incohInten_ );
+ }
}
Bool_t LauIsobarDynamics::gotReweightedEvent()
{
- // Select the event (kinematics_) using an accept/reject method based on the
- // ratio of the current value of ASq to the maximal value.
- Bool_t accepted(kFALSE);
+ // Select the event (kinematics_) using an accept/reject method based on the
+ // ratio of the current value of ASq to the maximal value.
+ Bool_t accepted( kFALSE );
- // calculate the ff_ terms and retrieves eff_ from the efficiency model
- this->calculateAmplitudes();
- // then calculate totAmp_ and finally ASq_ = totAmp_.abs2() (without the efficiency correction!)
- this->calcTotalAmp(kFALSE);
+ // calculate the ff_ terms and retrieves eff_ from the efficiency model
+ this->calculateAmplitudes();
+ // then calculate totAmp_ and finally ASq_ = totAmp_.abs2() (without the efficiency correction!)
+ this->calcTotalAmp( kFALSE );
- // Compare the ASq value with the maximal value (set by the user)
- if (LauRandom::randomFun()->Rndm() < ASq_/aSqMaxSet_) {
- accepted = kTRUE;
- }
+ // Compare the ASq value with the maximal value (set by the user)
+ if ( LauRandom::randomFun()->Rndm() < ASq_ / aSqMaxSet_ ) {
+ accepted = kTRUE;
+ }
- if (ASq_ > aSqMaxVar_) {aSqMaxVar_ = ASq_;}
+ if ( ASq_ > aSqMaxVar_ ) {
+ aSqMaxVar_ = ASq_;
+ }
- return accepted;
+ return accepted;
}
Double_t LauIsobarDynamics::getEventWeight()
{
- // calculate the ff_ terms and retrieves eff_ from the efficiency model
- this->calculateAmplitudes();
+ // calculate the ff_ terms and retrieves eff_ from the efficiency model
+ this->calculateAmplitudes();
- // then calculate totAmp_ and finally ASq_ = totAmp_.abs2() (without the efficiency correction!)
- this->calcTotalAmp(kFALSE);
+ // then calculate totAmp_ and finally ASq_ = totAmp_.abs2() (without the efficiency correction!)
+ this->calcTotalAmp( kFALSE );
- // return the event weight = the value of the squared amplitude
- return ASq_;
+ // return the event weight = the value of the squared amplitude
+ return ASq_;
}
-void LauIsobarDynamics::updateCoeffs(const std::vector<LauComplex>& coeffs)
+void LauIsobarDynamics::updateCoeffs( const std::vector<LauComplex>& coeffs )
{
- // Check that the number of coeffs is correct
- if (coeffs.size() != this->getnTotAmp()) {
- std::cerr << "ERROR in LauIsobarDynamics::updateCoeffs : Expected " << this->getnTotAmp() << " but got " << coeffs.size() << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // Now check if the coeffs have changed
- Bool_t changed = (Amp_ != coeffs);
- if (changed) {
- // Copy the coeffs
- Amp_ = coeffs;
- }
-
- // TODO should perhaps keep track of whether the resonance parameters have changed here and if none of those and none of the coeffs have changed then we don't need to update the norm
-
- // Update the total normalisation for the signal likelihood
- this->calcSigDPNorm();
+ // Check that the number of coeffs is correct
+ if ( coeffs.size() != this->getnTotAmp() ) {
+ std::cerr << "ERROR in LauIsobarDynamics::updateCoeffs : Expected " << this->getnTotAmp()
+ << " but got " << coeffs.size() << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // Now check if the coeffs have changed
+ Bool_t changed = ( Amp_ != coeffs );
+ if ( changed ) {
+ // Copy the coeffs
+ Amp_ = coeffs;
+ }
+
+ // TODO should perhaps keep track of whether the resonance parameters have changed here and if none of those and none of the coeffs have changed then we don't need to update the norm
+
+ // Update the total normalisation for the signal likelihood
+ this->calcSigDPNorm();
}
-TString LauIsobarDynamics::getConjResName(const TString& resName) const
+TString LauIsobarDynamics::getConjResName( const TString& resName ) const
{
- // Get the name of the charge conjugate resonance
- TString conjName(resName);
-
- Ssiz_t index1 = resName.Index("+");
- Ssiz_t index2 = resName.Index("-");
- if (index1 != -1) {
- conjName.Replace(index1, 1, "-");
- } else if (index2 != -1) {
- conjName.Replace(index2, 1, "+");
- }
-
- return conjName;
+ // Get the name of the charge conjugate resonance
+ TString conjName( resName );
+
+ Ssiz_t index1 = resName.Index( "+" );
+ Ssiz_t index2 = resName.Index( "-" );
+ if ( index1 != -1 ) {
+ conjName.Replace( index1, 1, "-" );
+ } else if ( index2 != -1 ) {
+ conjName.Replace( index2, 1, "+" );
+ }
+
+ return conjName;
}
Double_t LauIsobarDynamics::retrieveEfficiency()
{
- Double_t eff(1.0);
- if (effModel_ != 0) {
- eff = effModel_->calcEfficiency(kinematics_);
- }
- return eff;
+ Double_t eff( 1.0 );
+ if ( effModel_ != 0 ) {
+ eff = effModel_->calcEfficiency( kinematics_ );
+ }
+ return eff;
}
-Double_t LauIsobarDynamics::retrieveScfFraction(Int_t tagCat)
+Double_t LauIsobarDynamics::retrieveScfFraction( Int_t tagCat )
{
- Double_t scfFraction(0.0);
-
- // scf model and eff model are exactly the same, functionally
- // so we use an instance of LauAbsEffModel, and the method
- // calcEfficiency actually calculates the scf fraction
- if (tagCat == -1) {
- if (!scfFractionModel_.empty()) {
- scfFraction = scfFractionModel_[0]->calcEfficiency(kinematics_);
- }
- } else {
- scfFraction = scfFractionModel_[tagCat]->calcEfficiency(kinematics_);
- }
- return scfFraction;
+ Double_t scfFraction( 0.0 );
+
+ // scf model and eff model are exactly the same, functionally
+ // so we use an instance of LauAbsEffModel, and the method
+ // calcEfficiency actually calculates the scf fraction
+ if ( tagCat == -1 ) {
+ if ( ! scfFractionModel_.empty() ) {
+ scfFraction = scfFractionModel_[0]->calcEfficiency( kinematics_ );
+ }
+ } else {
+ scfFraction = scfFractionModel_[tagCat]->calcEfficiency( kinematics_ );
+ }
+ return scfFraction;
}
diff --git a/src/LauKMatrixProdPole.cc b/src/LauKMatrixProdPole.cc
index 2d62cef..0859303 100644
--- a/src/LauKMatrixProdPole.cc
+++ b/src/LauKMatrixProdPole.cc
@@ -1,167 +1,170 @@
/*
Copyright 2008 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauKMatrixProdPole.cc
\brief File containing implementation of LauKMatrixProdPole class.
*/
#include "LauKMatrixProdPole.hh"
+
#include "LauKMatrixPropagator.hh"
#include "LauResonanceMaker.hh"
#include <iostream>
-
-LauKMatrixProdPole::LauKMatrixProdPole( const TString& poleName, Int_t poleIndex, Int_t resPairAmpInt,
- LauKMatrixPropagator* propagator, const LauDaughters* daughters,
- Bool_t useProdAdler) :
- LauAbsResonance( poleName, resPairAmpInt, daughters, propagator->getL(propagator->getIndex()) ),
- thePropagator_(propagator),
- poleIndex_(poleIndex - 1), // poleIndex goes from 1 to nPoles
- useProdAdler_(useProdAdler)
+LauKMatrixProdPole::LauKMatrixProdPole( const TString& poleName,
+ Int_t poleIndex,
+ Int_t resPairAmpInt,
+ LauKMatrixPropagator* propagator,
+ const LauDaughters* daughters,
+ Bool_t useProdAdler ) :
+ LauAbsResonance( poleName, resPairAmpInt, daughters, propagator->getL( propagator->getIndex() ) ),
+ thePropagator_( propagator ),
+ poleIndex_( poleIndex - 1 ), // poleIndex goes from 1 to nPoles
+ useProdAdler_( useProdAdler )
{
- if (useProdAdler_) {
- std::cout <<"Creating K matrix production pole "<<poleName<<" with poleIndex = "
- <<poleIndex<<" with s-dependent production Adler zero term"<<std::endl;
- } else {
- std::cout <<"Creating K matrix production pole "<<poleName<<" with poleIndex = "
- <<poleIndex<<" with production Adler zero factor = 1"<<std::endl;
- }
-
- // `Resonance' Blatt-Weisskopf factor is handled internally, but parent must be set here. For other lineshapes, LauResonanceMaker handles this.
- this->setBarrierRadii( nullptr,LauResonanceMaker::get().getParentBWFactor( propagator->getL(propagator->getIndex()), LauBlattWeisskopfFactor::BWBarrier ) );
+ if ( useProdAdler_ ) {
+ std::cout << "Creating K matrix production pole " << poleName
+ << " with poleIndex = " << poleIndex
+ << " with s-dependent production Adler zero term" << std::endl;
+ } else {
+ std::cout << "Creating K matrix production pole " << poleName
+ << " with poleIndex = " << poleIndex << " with production Adler zero factor = 1"
+ << std::endl;
+ }
+
+ // `Resonance' Blatt-Weisskopf factor is handled internally, but parent must be set here. For other lineshapes, LauResonanceMaker handles this.
+ this->setBarrierRadii(
+ nullptr,
+ LauResonanceMaker::get().getParentBWFactor( propagator->getL( propagator->getIndex() ),
+ LauBlattWeisskopfFactor::BWBarrier ) );
}
-LauKMatrixProdPole::~LauKMatrixProdPole()
+LauKMatrixProdPole::~LauKMatrixProdPole()
{
}
-LauComplex LauKMatrixProdPole::resAmp(const Double_t mass, const Double_t spinTerm)
+LauComplex LauKMatrixProdPole::resAmp( const Double_t mass, const Double_t spinTerm )
{
- // Calculate the amplitude for the K-matrix production pole.
- LauComplex amp(0.0, 0.0);
-
- if (thePropagator_ == 0) {
- std::cerr << "ERROR in LauKMatrixProdPole::amplitude : The propagator is null" << std::endl;
- return amp;
- }
-
- // Get barrier factors ('resonance' factor is already accounted for internally via propagator 'Gamma' matrix)
- Double_t fFactorB(1.0);
-
- const Int_t resSpin = this->getSpin();
- const Double_t pstar = this->getPstar();
-
- if ( resSpin > 0 ) {
- const LauBlattWeisskopfFactor* parBWFactor = this->getParBWFactor();
- if ( parBWFactor != nullptr ) {
- switch ( parBWFactor->getRestFrame() ) {
- case LauBlattWeisskopfFactor::ResonanceFrame:
- fFactorB = parBWFactor->calcFormFactor(this->getP());
- break;
- case LauBlattWeisskopfFactor::ParentFrame:
- fFactorB = parBWFactor->calcFormFactor(pstar);
- break;
- case LauBlattWeisskopfFactor::Covariant:
- {
- Double_t covFactor = this->getCovFactor();
- if ( resSpin > 2 ) {
- covFactor = TMath::Power( covFactor, 1.0/resSpin );
- } else if ( resSpin == 2 ) {
- covFactor = TMath::Sqrt( covFactor );
- }
- fFactorB = parBWFactor->calcFormFactor(pstar*covFactor);
- break;
- }
- }
- }
- }
-
- // Make sure the K-matrix propagator is up-to-date for
- // the given centre-of-mass squared value ("s")
- thePropagator_->updatePropagator(mass*mass);
-
- // Sum the pole denominator terms over all channels j, multiplying by
- // the propagator terms. Note that we do not sum over poles, since we
- // only want one of the production pole terms.
- Int_t nChannels = thePropagator_->getNChannels();
- Int_t jChannel;
-
- for (jChannel = 0; jChannel < nChannels; jChannel++) {
-
- Double_t gj = thePropagator_->getCouplingConstant(poleIndex_, jChannel);
- LauComplex prodTerm = thePropagator_->getPropTerm(jChannel);
-
- prodTerm.rescale(gj);
-
- amp += prodTerm;
-
- }
-
- Double_t poleDenom = thePropagator_->getPoleDenomTerm(poleIndex_);
-
- // Include Adler zero factor if requested
- Double_t adlerZero(1.0);
- if (useProdAdler_) {adlerZero = thePropagator_->getAdlerZero();}
-
- amp.rescale(poleDenom*adlerZero);
-
- // Scale by the spin term
- Double_t scale = spinTerm;
-
- // Include Blatt-Weisskopf barrier factor for parent
- scale *= fFactorB;
-
- amp.rescale(scale);
-
- return amp;
-
+ // Calculate the amplitude for the K-matrix production pole.
+ LauComplex amp( 0.0, 0.0 );
+
+ if ( thePropagator_ == 0 ) {
+ std::cerr << "ERROR in LauKMatrixProdPole::amplitude : The propagator is null" << std::endl;
+ return amp;
+ }
+
+ // Get barrier factors ('resonance' factor is already accounted for internally via propagator 'Gamma' matrix)
+ Double_t fFactorB( 1.0 );
+
+ const Int_t resSpin = this->getSpin();
+ const Double_t pstar = this->getPstar();
+
+ if ( resSpin > 0 ) {
+ const LauBlattWeisskopfFactor* parBWFactor = this->getParBWFactor();
+ if ( parBWFactor != nullptr ) {
+ switch ( parBWFactor->getRestFrame() ) {
+ case LauBlattWeisskopfFactor::ResonanceFrame :
+ fFactorB = parBWFactor->calcFormFactor( this->getP() );
+ break;
+ case LauBlattWeisskopfFactor::ParentFrame :
+ fFactorB = parBWFactor->calcFormFactor( pstar );
+ break;
+ case LauBlattWeisskopfFactor::Covariant : {
+ Double_t covFactor = this->getCovFactor();
+ if ( resSpin > 2 ) {
+ covFactor = TMath::Power( covFactor, 1.0 / resSpin );
+ } else if ( resSpin == 2 ) {
+ covFactor = TMath::Sqrt( covFactor );
+ }
+ fFactorB = parBWFactor->calcFormFactor( pstar * covFactor );
+ break;
+ }
+ }
+ }
+ }
+
+ // Make sure the K-matrix propagator is up-to-date for
+ // the given centre-of-mass squared value ("s")
+ thePropagator_->updatePropagator( mass * mass );
+
+ // Sum the pole denominator terms over all channels j, multiplying by
+ // the propagator terms. Note that we do not sum over poles, since we
+ // only want one of the production pole terms.
+ Int_t nChannels = thePropagator_->getNChannels();
+ Int_t jChannel;
+
+ for ( jChannel = 0; jChannel < nChannels; jChannel++ ) {
+
+ Double_t gj = thePropagator_->getCouplingConstant( poleIndex_, jChannel );
+ LauComplex prodTerm = thePropagator_->getPropTerm( jChannel );
+
+ prodTerm.rescale( gj );
+
+ amp += prodTerm;
+ }
+
+ Double_t poleDenom = thePropagator_->getPoleDenomTerm( poleIndex_ );
+
+ // Include Adler zero factor if requested
+ Double_t adlerZero( 1.0 );
+ if ( useProdAdler_ ) {
+ adlerZero = thePropagator_->getAdlerZero();
+ }
+
+ amp.rescale( poleDenom * adlerZero );
+
+ // Scale by the spin term
+ Double_t scale = spinTerm;
+
+ // Include Blatt-Weisskopf barrier factor for parent
+ scale *= fFactorB;
+
+ amp.rescale( scale );
+
+ return amp;
}
const std::vector<LauParameter*>& LauKMatrixProdPole::getFloatingParameters()
{
- this->clearFloatingParameters();
-
- Int_t nChannels = thePropagator_->getNChannels();
+ this->clearFloatingParameters();
- for (int jChannel = 0 ; jChannel < nChannels ; jChannel++)
- {
- LauParameter& par_gj_ = thePropagator_->getCouplingParameter(poleIndex_, jChannel);
- if ( !par_gj_.fixed() )
- {
- this->addFloatingParameter( &par_gj_ );
- }
- }
+ Int_t nChannels = thePropagator_->getNChannels();
- LauParameter& par_polemasssq_ = thePropagator_->getPoleMassSqParameter(poleIndex_);
- if ( !par_polemasssq_.fixed() )
- {
- this->addFloatingParameter( &par_polemasssq_ );
- }
+ for ( int jChannel = 0; jChannel < nChannels; jChannel++ ) {
+ LauParameter& par_gj_ = thePropagator_->getCouplingParameter( poleIndex_, jChannel );
+ if ( ! par_gj_.fixed() ) {
+ this->addFloatingParameter( &par_gj_ );
+ }
+ }
- return this->getParameters();
+ LauParameter& par_polemasssq_ = thePropagator_->getPoleMassSqParameter( poleIndex_ );
+ if ( ! par_polemasssq_.fixed() ) {
+ this->addFloatingParameter( &par_polemasssq_ );
+ }
+ return this->getParameters();
}
diff --git a/src/LauKMatrixProdSVP.cc b/src/LauKMatrixProdSVP.cc
index f034a28..0a8c942 100644
--- a/src/LauKMatrixProdSVP.cc
+++ b/src/LauKMatrixProdSVP.cc
@@ -1,176 +1,171 @@
/*
Copyright 2008 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauKMatrixProdSVP.cc
\brief File containing implementation of LauKMatrixProdSVP class.
*/
#include "LauKMatrixProdSVP.hh"
+
#include "LauKMatrixPropagator.hh"
#include <iostream>
-
-LauKMatrixProdSVP::LauKMatrixProdSVP( const TString& SVPName, Int_t channelIndex, Int_t resPairAmpInt,
- LauKMatrixPropagator* propagator, const LauDaughters* daughters,
- Bool_t useProdAdler) :
- LauAbsResonance( SVPName, resPairAmpInt, daughters, propagator->getL(propagator->getIndex()) ),
- thePropagator_(propagator),
- channelIndex_(channelIndex - 1), // channelIndex goes from 1 to nChannels.
- useProdAdler_(useProdAdler)
+LauKMatrixProdSVP::LauKMatrixProdSVP( const TString& SVPName,
+ Int_t channelIndex,
+ Int_t resPairAmpInt,
+ LauKMatrixPropagator* propagator,
+ const LauDaughters* daughters,
+ Bool_t useProdAdler ) :
+ LauAbsResonance( SVPName, resPairAmpInt, daughters, propagator->getL( propagator->getIndex() ) ),
+ thePropagator_( propagator ),
+ channelIndex_( channelIndex - 1 ), // channelIndex goes from 1 to nChannels.
+ useProdAdler_( useProdAdler )
{
- // Constructor
- if (useProdAdler_) {
- std::cout <<"Creating K matrix production SVP "<<SVPName<<" with channelIndex = "
- <<channelIndex<<" with s-dependent production Adler zero term"<<std::endl;
- } else {
- std::cout <<"Creating K matrix production SVP "<<SVPName<<" with channelIndex = "
- <<channelIndex<<" with production Adler zero factor = 1"<<std::endl;
- }
-
+ // Constructor
+ if ( useProdAdler_ ) {
+ std::cout << "Creating K matrix production SVP " << SVPName
+ << " with channelIndex = " << channelIndex
+ << " with s-dependent production Adler zero term" << std::endl;
+ } else {
+ std::cout << "Creating K matrix production SVP " << SVPName
+ << " with channelIndex = " << channelIndex
+ << " with production Adler zero factor = 1" << std::endl;
+ }
}
-LauKMatrixProdSVP::~LauKMatrixProdSVP()
+LauKMatrixProdSVP::~LauKMatrixProdSVP()
{
- // Destructor
+ // Destructor
}
-LauComplex LauKMatrixProdSVP::resAmp(const Double_t mass, const Double_t spinTerm)
+LauComplex LauKMatrixProdSVP::resAmp( const Double_t mass, const Double_t spinTerm )
{
- // Calculate the amplitude for the K-matrix production pole.
- // First, make sure the K-matrix propagator is up-to-date for
- // the given centre-of-mass squared value ("s") from the kinematics.
- LauComplex amp(0.0, 0.0);
-
- if (thePropagator_ == 0) {
- std::cerr << "ERROR in LauKMatrixProdSVP::amplitude : The propagator is null" << std::endl;
- return amp;
- }
-
- // Get barrier factors ('resonance' factor is already accounted for internally via propagator 'Gamma' matrix)
- Double_t fFactorB(1.0);
-
- const Int_t resSpin = this->getSpin();
- const Double_t pstar = this->getPstar();
-
- if ( resSpin > 0 ) {
- const LauBlattWeisskopfFactor* parBWFactor = this->getParBWFactor();
- if ( parBWFactor != nullptr ) {
- switch ( parBWFactor->getRestFrame() ) {
- case LauBlattWeisskopfFactor::ResonanceFrame:
- fFactorB = parBWFactor->calcFormFactor(this->getP());
- break;
- case LauBlattWeisskopfFactor::ParentFrame:
- fFactorB = parBWFactor->calcFormFactor(pstar);
- break;
- case LauBlattWeisskopfFactor::Covariant:
- {
- Double_t covFactor = this->getCovFactor();
- if ( resSpin > 2 ) {
- covFactor = TMath::Power( covFactor, 1.0/resSpin );
- } else if ( resSpin == 2 ) {
- covFactor = TMath::Sqrt( covFactor );
- }
- fFactorB = parBWFactor->calcFormFactor(pstar*covFactor);
- break;
- }
- }
- }
- }
-
- thePropagator_->updatePropagator(mass*mass);
-
- Double_t SVPTerm = thePropagator_->getProdSVPTerm();
-
- amp = thePropagator_->getPropTerm(channelIndex_);
-
- // Include Adler zero factor if requested
- Double_t adlerZero(1.0);
- if (useProdAdler_) {adlerZero = thePropagator_->getAdlerZero();}
-
- amp.rescale(SVPTerm*adlerZero);
-
- // Scale by the spin term
- Double_t scale = spinTerm;
-
- // Include Blatt-Weisskopf barrier factor for parent
- scale *= fFactorB;
-
- amp.rescale(scale);
-
- return amp;
-
+ // Calculate the amplitude for the K-matrix production pole.
+ // First, make sure the K-matrix propagator is up-to-date for
+ // the given centre-of-mass squared value ("s") from the kinematics.
+ LauComplex amp( 0.0, 0.0 );
+
+ if ( thePropagator_ == 0 ) {
+ std::cerr << "ERROR in LauKMatrixProdSVP::amplitude : The propagator is null" << std::endl;
+ return amp;
+ }
+
+ // Get barrier factors ('resonance' factor is already accounted for internally via propagator 'Gamma' matrix)
+ Double_t fFactorB( 1.0 );
+
+ const Int_t resSpin = this->getSpin();
+ const Double_t pstar = this->getPstar();
+
+ if ( resSpin > 0 ) {
+ const LauBlattWeisskopfFactor* parBWFactor = this->getParBWFactor();
+ if ( parBWFactor != nullptr ) {
+ switch ( parBWFactor->getRestFrame() ) {
+ case LauBlattWeisskopfFactor::ResonanceFrame :
+ fFactorB = parBWFactor->calcFormFactor( this->getP() );
+ break;
+ case LauBlattWeisskopfFactor::ParentFrame :
+ fFactorB = parBWFactor->calcFormFactor( pstar );
+ break;
+ case LauBlattWeisskopfFactor::Covariant : {
+ Double_t covFactor = this->getCovFactor();
+ if ( resSpin > 2 ) {
+ covFactor = TMath::Power( covFactor, 1.0 / resSpin );
+ } else if ( resSpin == 2 ) {
+ covFactor = TMath::Sqrt( covFactor );
+ }
+ fFactorB = parBWFactor->calcFormFactor( pstar * covFactor );
+ break;
+ }
+ }
+ }
+ }
+
+ thePropagator_->updatePropagator( mass * mass );
+
+ Double_t SVPTerm = thePropagator_->getProdSVPTerm();
+
+ amp = thePropagator_->getPropTerm( channelIndex_ );
+
+ // Include Adler zero factor if requested
+ Double_t adlerZero( 1.0 );
+ if ( useProdAdler_ ) {
+ adlerZero = thePropagator_->getAdlerZero();
+ }
+
+ amp.rescale( SVPTerm * adlerZero );
+
+ // Scale by the spin term
+ Double_t scale = spinTerm;
+
+ // Include Blatt-Weisskopf barrier factor for parent
+ scale *= fFactorB;
+
+ amp.rescale( scale );
+
+ return amp;
}
const std::vector<LauParameter*>& LauKMatrixProdSVP::getFloatingParameters()
{
- this->clearFloatingParameters();
-
- Int_t nChannels = thePropagator_->getNChannels();
-
- for (int jChannel = 0 ; jChannel < nChannels ; jChannel++)
- {
- LauParameter& par_f_ = thePropagator_->getScatteringParameter(channelIndex_, jChannel);
- if ( !par_f_.fixed() )
- {
- this->addFloatingParameter( &par_f_ );
- }
-
- }
-
- LauParameter& par_mSq0_ = thePropagator_->getmSq0();
- if ( !par_mSq0_.fixed() )
- {
- this->addFloatingParameter( &par_mSq0_ );
- }
-
- LauParameter& par_s0Scatt_ = thePropagator_->gets0Scatt();
- if ( !par_s0Scatt_.fixed() )
- {
- this->addFloatingParameter( &par_s0Scatt_ );
- }
-
- LauParameter& par_s0Prod_ = thePropagator_->gets0Prod();
- if ( !par_s0Prod_.fixed() )
- {
- this->addFloatingParameter( &par_s0Prod_ );
- }
-
- LauParameter& par_sA_ = thePropagator_->getsA();
- if ( !par_sA_.fixed() )
- {
- this->addFloatingParameter( &par_sA_ );
- }
-
- LauParameter& par_sA0_ = thePropagator_->getsA0();
- if ( !par_sA0_.fixed() )
- {
- this->addFloatingParameter( &par_sA0_ );
- }
-
- return this->getParameters();
-
-}
\ No newline at end of file
+ this->clearFloatingParameters();
+
+ Int_t nChannels = thePropagator_->getNChannels();
+
+ for ( int jChannel = 0; jChannel < nChannels; jChannel++ ) {
+ LauParameter& par_f_ = thePropagator_->getScatteringParameter( channelIndex_, jChannel );
+ if ( ! par_f_.fixed() ) {
+ this->addFloatingParameter( &par_f_ );
+ }
+ }
+
+ LauParameter& par_mSq0_ = thePropagator_->getmSq0();
+ if ( ! par_mSq0_.fixed() ) {
+ this->addFloatingParameter( &par_mSq0_ );
+ }
+
+ LauParameter& par_s0Scatt_ = thePropagator_->gets0Scatt();
+ if ( ! par_s0Scatt_.fixed() ) {
+ this->addFloatingParameter( &par_s0Scatt_ );
+ }
+
+ LauParameter& par_s0Prod_ = thePropagator_->gets0Prod();
+ if ( ! par_s0Prod_.fixed() ) {
+ this->addFloatingParameter( &par_s0Prod_ );
+ }
+
+ LauParameter& par_sA_ = thePropagator_->getsA();
+ if ( ! par_sA_.fixed() ) {
+ this->addFloatingParameter( &par_sA_ );
+ }
+
+ LauParameter& par_sA0_ = thePropagator_->getsA0();
+ if ( ! par_sA0_.fixed() ) {
+ this->addFloatingParameter( &par_sA0_ );
+ }
+
+ return this->getParameters();
+}
diff --git a/src/LauKMatrixPropFactory.cc b/src/LauKMatrixPropFactory.cc
index 6189451..e88109b 100644
--- a/src/LauKMatrixPropFactory.cc
+++ b/src/LauKMatrixPropFactory.cc
@@ -1,89 +1,90 @@
/*
Copyright 2008 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauKMatrixPropFactory.cc
\brief File containing implementation of LauKMatrixPropFactory class.
*/
// Class for storing K-matrix propagator objects
// using the factory method.
#include "LauKMatrixPropFactory.hh"
+
#include "LauKMatrixPropagator.hh"
#include <iostream>
using std::cout;
using std::endl;
-
// the singleton instance
LauKMatrixPropFactory* LauKMatrixPropFactory::theFactory_ = 0;
-
LauKMatrixPropFactory::LauKMatrixPropFactory()
{
- // Constructor
- map_.clear();
+ // Constructor
+ map_.clear();
}
-LauKMatrixPropFactory::~LauKMatrixPropFactory()
+LauKMatrixPropFactory::~LauKMatrixPropFactory()
{
- // Destructor
- KMatrixPropMap::iterator iter;
- for (iter = map_.begin(); iter != map_.end(); ++iter) {
- LauKMatrixPropagator* thePropagator = iter->second;
- delete thePropagator;
- }
- map_.clear();
+ // Destructor
+ KMatrixPropMap::iterator iter;
+ for ( iter = map_.begin(); iter != map_.end(); ++iter ) {
+ LauKMatrixPropagator* thePropagator = iter->second;
+ delete thePropagator;
+ }
+ map_.clear();
}
LauKMatrixPropFactory* LauKMatrixPropFactory::getInstance()
{
- if (theFactory_ == 0) {
- theFactory_ = new LauKMatrixPropFactory();
- }
- return theFactory_;
+ if ( theFactory_ == 0 ) {
+ theFactory_ = new LauKMatrixPropFactory();
+ }
+ return theFactory_;
}
-LauKMatrixPropagator* LauKMatrixPropFactory::getPropagator(const TString& name, const TString& paramFileName,
- Int_t resPairAmpInt, Int_t nChannels,
- Int_t nPoles, Int_t rowIndex)
+LauKMatrixPropagator* LauKMatrixPropFactory::getPropagator( const TString& name,
+ const TString& paramFileName,
+ Int_t resPairAmpInt,
+ Int_t nChannels,
+ Int_t nPoles,
+ Int_t rowIndex )
{
- LauKMatrixPropagator* thePropagator(0);
+ LauKMatrixPropagator* thePropagator( 0 );
- KMatrixPropMap::iterator iter = map_.find(name);
+ KMatrixPropMap::iterator iter = map_.find( name );
- if ( iter != map_.end() ) {
- // We have already made this propagator
- thePropagator = iter->second;
- } else {
- // The propagator does not exist. Create it and store it in the map.
- thePropagator = new LauKMatrixPropagator(name, paramFileName, resPairAmpInt,
- nChannels, nPoles, rowIndex);
- map_[name] = thePropagator;
- }
+ if ( iter != map_.end() ) {
+ // We have already made this propagator
+ thePropagator = iter->second;
+ } else {
+ // The propagator does not exist. Create it and store it in the map.
+ thePropagator =
+ new LauKMatrixPropagator( name, paramFileName, resPairAmpInt, nChannels, nPoles, rowIndex );
+ map_[name] = thePropagator;
+ }
- return thePropagator;
+ return thePropagator;
}
-
diff --git a/src/LauKMatrixPropagator.cc b/src/LauKMatrixPropagator.cc
index a2b2b1c..2d72cda 100644
--- a/src/LauKMatrixPropagator.cc
+++ b/src/LauKMatrixPropagator.cc
@@ -1,1424 +1,1464 @@
/*
Copyright 2008 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
+ http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauKMatrixPropagator.cc
- \brief File containing implementation of LauKMatrixPropagator class.
+ \brief File containing implementation of LauKMatrixPropagator class.
*/
#include "LauKMatrixPropagator.hh"
-#include "LauTextFileParser.hh"
-#include "LauKinematics.hh"
+
#include "LauComplex.hh"
+#include "LauKinematics.hh"
+#include "LauTextFileParser.hh"
#include "TMath.h"
#include "TSystem.h"
-#include <iostream>
-#include <fstream>
#include <cmath>
#include <cstdlib>
+#include <fstream>
+#include <iostream>
+using std::cerr;
using std::cout;
using std::endl;
-using std::cerr;
-
-LauKMatrixPropagator::LauKMatrixPropagator(const TString& name, const TString& paramFile,
- Int_t resPairAmpInt, Int_t nChannels,
- Int_t nPoles, Int_t rowIndex) :
- name_(name),
- paramFileName_(paramFile),
- resPairAmpInt_(resPairAmpInt),
- index_(rowIndex - 1),
- nChannels_(nChannels),
- nPoles_(nPoles)
+LauKMatrixPropagator::LauKMatrixPropagator( const TString& name,
+ const TString& paramFile,
+ Int_t resPairAmpInt,
+ Int_t nChannels,
+ Int_t nPoles,
+ Int_t rowIndex ) :
+ name_( name ),
+ paramFileName_( paramFile ),
+ resPairAmpInt_( resPairAmpInt ),
+ index_( rowIndex - 1 ),
+ nChannels_( nChannels ),
+ nPoles_( nPoles )
{
- // Constructor
+ // Constructor
- // Check that the index is OK
- if (index_ < 0 || index_ >= nChannels_) {
- std::cerr << "ERROR in LauKMatrixPropagator constructor. The rowIndex, which is set to "
- << rowIndex << ", must be between 1 and the number of channels "
- << nChannels_ << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
+ // Check that the index is OK
+ if ( index_ < 0 || index_ >= nChannels_ ) {
+ std::cerr << "ERROR in LauKMatrixPropagator constructor. The rowIndex, which is set to "
+ << rowIndex << ", must be between 1 and the number of channels " << nChannels_
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
- this->setParameters(paramFile);
+ this->setParameters( paramFile );
}
-LauKMatrixPropagator::~LauKMatrixPropagator()
+LauKMatrixPropagator::~LauKMatrixPropagator()
{
- // Destructor
- realProp_.Clear();
- negImagProp_.Clear();
- ScattKMatrix_.Clear();
- ReRhoMatrix_.Clear();
- ImRhoMatrix_.Clear();
- GammaMatrix_.Clear();
- ReTMatrix_.Clear();
- ImTMatrix_.Clear();
- IMatrix_.Clear();
- zeroMatrix_.Clear();
+ // Destructor
+ realProp_.Clear();
+ negImagProp_.Clear();
+ ScattKMatrix_.Clear();
+ ReRhoMatrix_.Clear();
+ ImRhoMatrix_.Clear();
+ GammaMatrix_.Clear();
+ ReTMatrix_.Clear();
+ ImTMatrix_.Clear();
+ IMatrix_.Clear();
+ zeroMatrix_.Clear();
}
-LauComplex LauKMatrixPropagator::getPropTerm(const Int_t channel) const
+LauComplex LauKMatrixPropagator::getPropTerm( const Int_t channel ) const
{
- // Get the (i,j) = (index_, channel) term of the propagator
- // matrix. This allows us not to return the full propagator matrix.
- Double_t realTerm = this->getRealPropTerm(channel);
- Double_t imagTerm = this->getImagPropTerm(channel);
-
- LauComplex propTerm(realTerm, imagTerm);
- return propTerm;
+ // Get the (i,j) = (index_, channel) term of the propagator
+ // matrix. This allows us not to return the full propagator matrix.
+ Double_t realTerm = this->getRealPropTerm( channel );
+ Double_t imagTerm = this->getImagPropTerm( channel );
+ LauComplex propTerm( realTerm, imagTerm );
+ return propTerm;
}
-Double_t LauKMatrixPropagator::getRealPropTerm(const Int_t channel) const
+Double_t LauKMatrixPropagator::getRealPropTerm( const Int_t channel ) const
{
- // Get the real part of the (i,j) = (index_, channel) term of the propagator
- // matrix. This allows us not to return the full propagator matrix.
- if (parametersSet_ == kFALSE) {return 0.0;}
-
- Double_t propTerm = realProp_[index_][channel];
- return propTerm;
-
+ // Get the real part of the (i,j) = (index_, channel) term of the propagator
+ // matrix. This allows us not to return the full propagator matrix.
+ if ( parametersSet_ == kFALSE ) {
+ return 0.0;
+ }
+
+ Double_t propTerm = realProp_[index_][channel];
+ return propTerm;
}
-Double_t LauKMatrixPropagator::getImagPropTerm(const Int_t channel) const
+Double_t LauKMatrixPropagator::getImagPropTerm( const Int_t channel ) const
{
- // Get the imaginary part of the (i,j) = (index_, channel) term of the propagator
- // matrix. This allows us not to return the full propagator matrix.
- if (parametersSet_ == kFALSE) {return 0.0;}
-
- Double_t imagTerm = -1.0*negImagProp_[index_][channel];
- return imagTerm;
-
+ // Get the imaginary part of the (i,j) = (index_, channel) term of the propagator
+ // matrix. This allows us not to return the full propagator matrix.
+ if ( parametersSet_ == kFALSE ) {
+ return 0.0;
+ }
+
+ Double_t imagTerm = -1.0 * negImagProp_[index_][channel];
+ return imagTerm;
}
-void LauKMatrixPropagator::updatePropagator(const Double_t s)
+void LauKMatrixPropagator::updatePropagator( const Double_t s )
{
- // Calculate the K-matrix propagator for the given s value.
- // The K-matrix amplitude is given by
- // T_i = sum_{ij} (I - iK*rho)^-1 * P_j, where P is the production K-matrix.
- // i = index for the state (e.g. S-wave index = 0).
- // Here, we only find the (I - iK*rho)^-1 matrix part.
-
- // Check if we have almost the same s value as before. If so, don't re-calculate
- // the propagator nor any of the pole mass summation terms.
- if (TMath::Abs(s - previousS_) < 1e-6*s) {
- //cout<<"Already got propagator for s = "<<s<<endl;
- return;
- }
-
- if (parametersSet_ == kFALSE) {
- //cerr<<"ERROR in LauKMatrixPropagator::updatePropagator. Parameters have not been set."<<endl;
- return;
- }
-
- // Calculate the denominator pole mass terms and Adler zero factor
- this->calcPoleDenomVect(s);
- this->updateAdlerZeroFactor(s);
-
- // Calculate the scattering K-matrix (real and symmetric)
- this->calcScattKMatrix(s);
- // Calculate the phase space density matrix, which is diagonal, but can be complex
- // if the quantity s is below various threshold values (analytic continuation).
- this->calcRhoMatrix(s);
-
- // Calculate the angular momentum barrier matrix, which is real and diagonal
- this->calcGammaMatrix(s);
-
- // Calculate K*rho*(gamma^2) (real and imaginary parts, since rho can be complex)
- TMatrixD GammaMatrixSq = (GammaMatrix_*GammaMatrix_);
- TMatrixD K_realRhoGammaSq(ScattKMatrix_);
-
- K_realRhoGammaSq *= ReRhoMatrix_;
- K_realRhoGammaSq *= GammaMatrixSq;
- TMatrixD K_imagRhoGammaSq(ScattKMatrix_);
-
- K_imagRhoGammaSq *= ImRhoMatrix_;
- K_imagRhoGammaSq *= GammaMatrixSq;
-
-
- // A = I + K*Imag(rho)Gamma^2, B = -K*Real(Rho)Gamma^2
- // Calculate C and D matrices such that (A + iB)*(C + iD) = I,
- // ie. C + iD = (I - i K*rhoGamma^2)^-1, separated into real and imaginary parts.
- // realProp C = (A + B A^-1 B)^-1, imagProp D = -A^-1 B C
- TMatrixD A(IMatrix_);
- A += K_imagRhoGammaSq;
- TMatrixD B(zeroMatrix_);
- B -= K_realRhoGammaSq;
-
- TMatrixD invA(TMatrixD::kInverted, A);
- TMatrixD invA_B(invA);
- invA_B *= B;
- TMatrixD B_invA_B(B);
- B_invA_B *= invA_B;
-
- TMatrixD invC(A);
- invC += B_invA_B;
- // Set the real part of the propagator matrix ("C")
- realProp_ = TMatrixD(TMatrixD::kInverted, invC);
-
- // Set the (negative) imaginary part of the propagator matrix ("-D")
- TMatrixD BC(B);
- BC *= realProp_;
- negImagProp_ = TMatrixD(invA);
- negImagProp_ *= BC;
-
- // Pre-multiply by the Gamma matrix:
- realProp_ = GammaMatrix_ * realProp_;
- negImagProp_ = GammaMatrix_ * negImagProp_;
-
- if(verbose_)
- {
- std::cout << "In LauKMatrixPropagator::updatePropagator(s). D[1-iKrhoD^2]^-1: " << std::endl;
- TString realOutput("Real part:"), imagOutput("Imag part:");
- for (int iChannel = 0; iChannel < nChannels_; iChannel++)
- {
- for (int jChannel = 0; jChannel < nChannels_; jChannel++)
- {
- realOutput += Form("\t%.6f",realProp_[iChannel][jChannel]);
- imagOutput += Form("\t%.6f",-1*negImagProp_[iChannel][jChannel]);
- }
- realOutput += "\n ";
- imagOutput += "\n ";
- }
- std::cout << realOutput << std::endl;
- std::cout << imagOutput << std::endl;
- }
-
-
- // Also calculate the production SVP term, since this uses Adler-zero parameters
- // defined in the parameter file.
- this->updateProdSVPTerm(s);
-
- // Finally, keep track of the value of s we just used.
- previousS_ = s;
-
+ // Calculate the K-matrix propagator for the given s value.
+ // The K-matrix amplitude is given by
+ // T_i = sum_{ij} (I - iK*rho)^-1 * P_j, where P is the production K-matrix.
+ // i = index for the state (e.g. S-wave index = 0).
+ // Here, we only find the (I - iK*rho)^-1 matrix part.
+
+ // Check if we have almost the same s value as before. If so, don't re-calculate
+ // the propagator nor any of the pole mass summation terms.
+ if ( TMath::Abs( s - previousS_ ) < 1e-6 * s ) {
+ //cout<<"Already got propagator for s = "<<s<<endl;
+ return;
+ }
+
+ if ( parametersSet_ == kFALSE ) {
+ //cerr<<"ERROR in LauKMatrixPropagator::updatePropagator. Parameters have not been set."<<endl;
+ return;
+ }
+
+ // Calculate the denominator pole mass terms and Adler zero factor
+ this->calcPoleDenomVect( s );
+ this->updateAdlerZeroFactor( s );
+
+ // Calculate the scattering K-matrix (real and symmetric)
+ this->calcScattKMatrix( s );
+ // Calculate the phase space density matrix, which is diagonal, but can be complex
+ // if the quantity s is below various threshold values (analytic continuation).
+ this->calcRhoMatrix( s );
+
+ // Calculate the angular momentum barrier matrix, which is real and diagonal
+ this->calcGammaMatrix( s );
+
+ // Calculate K*rho*(gamma^2) (real and imaginary parts, since rho can be complex)
+ TMatrixD GammaMatrixSq = ( GammaMatrix_ * GammaMatrix_ );
+ TMatrixD K_realRhoGammaSq( ScattKMatrix_ );
+
+ K_realRhoGammaSq *= ReRhoMatrix_;
+ K_realRhoGammaSq *= GammaMatrixSq;
+ TMatrixD K_imagRhoGammaSq( ScattKMatrix_ );
+
+ K_imagRhoGammaSq *= ImRhoMatrix_;
+ K_imagRhoGammaSq *= GammaMatrixSq;
+
+ // A = I + K*Imag(rho)Gamma^2, B = -K*Real(Rho)Gamma^2
+ // Calculate C and D matrices such that (A + iB)*(C + iD) = I,
+ // ie. C + iD = (I - i K*rhoGamma^2)^-1, separated into real and imaginary parts.
+ // realProp C = (A + B A^-1 B)^-1, imagProp D = -A^-1 B C
+ TMatrixD A( IMatrix_ );
+ A += K_imagRhoGammaSq;
+ TMatrixD B( zeroMatrix_ );
+ B -= K_realRhoGammaSq;
+
+ TMatrixD invA( TMatrixD::kInverted, A );
+ TMatrixD invA_B( invA );
+ invA_B *= B;
+ TMatrixD B_invA_B( B );
+ B_invA_B *= invA_B;
+
+ TMatrixD invC( A );
+ invC += B_invA_B;
+ // Set the real part of the propagator matrix ("C")
+ realProp_ = TMatrixD( TMatrixD::kInverted, invC );
+
+ // Set the (negative) imaginary part of the propagator matrix ("-D")
+ TMatrixD BC( B );
+ BC *= realProp_;
+ negImagProp_ = TMatrixD( invA );
+ negImagProp_ *= BC;
+
+ // Pre-multiply by the Gamma matrix:
+ realProp_ = GammaMatrix_ * realProp_;
+ negImagProp_ = GammaMatrix_ * negImagProp_;
+
+ if ( verbose_ ) {
+ std::cout << "In LauKMatrixPropagator::updatePropagator(s). D[1-iKrhoD^2]^-1: " << std::endl;
+ TString realOutput( "Real part:" ), imagOutput( "Imag part:" );
+ for ( int iChannel = 0; iChannel < nChannels_; iChannel++ ) {
+ for ( int jChannel = 0; jChannel < nChannels_; jChannel++ ) {
+ realOutput += Form( "\t%.6f", realProp_[iChannel][jChannel] );
+ imagOutput += Form( "\t%.6f", -1 * negImagProp_[iChannel][jChannel] );
+ }
+ realOutput += "\n ";
+ imagOutput += "\n ";
+ }
+ std::cout << realOutput << std::endl;
+ std::cout << imagOutput << std::endl;
+ }
+
+ // Also calculate the production SVP term, since this uses Adler-zero parameters
+ // defined in the parameter file.
+ this->updateProdSVPTerm( s );
+
+ // Finally, keep track of the value of s we just used.
+ previousS_ = s;
}
-void LauKMatrixPropagator::setParameters(const TString& inputFile)
+void LauKMatrixPropagator::setParameters( const TString& inputFile )
{
- // Read an input file that specifies the values of the coupling constants g_i for
- // the given number of poles and their (bare) masses. Also provided are the f_{ab}
- // slow-varying constants. The input file should also provide the Adler zero
- // constants s_0, s_A and s_A0.
-
- parametersSet_ = kFALSE;
-
- cout<<"Initialising K-matrix propagator "<<name_<<" parameters from "<<inputFile.Data()<<endl;
+ // Read an input file that specifies the values of the coupling constants g_i for
+ // the given number of poles and their (bare) masses. Also provided are the f_{ab}
+ // slow-varying constants. The input file should also provide the Adler zero
+ // constants s_0, s_A and s_A0.
- cout<<"nChannels = "<<nChannels_<<", nPoles = "<<nPoles_<<endl;
+ parametersSet_ = kFALSE;
- // Initialise various matrices
- this->initialiseMatrices();
- std::vector<Int_t> a(nChannels_,0);
+ cout << "Initialising K-matrix propagator " << name_ << " parameters from " << inputFile.Data()
+ << endl;
- // The format of the input file contains lines starting with a keyword followed by the
- // appropriate set of parameters. Keywords are case insensitive (treated as lower-case).
- // 1) Indices (nChannels) of N phase space channel types (defined in KMatrixChannels enum)
- // "Channels iChannel1 iChannel2 ... iChannelN"
- // 2) Definition of poles: bare mass (GeV), pole index (1 to NPoles), N channel couplings g_j
- // "Pole poleIndex mass g_1 g_2 ... g_N"
- // 3) Definition of scattering f_{ij} constants: scattering index (1 to N), channel values
- // "Scatt index f_{i1} f_{i2} ... f_{iN}", where i = index
- // 4) Orbital angular momentu for each channel. If not set here, defaults to 0
- // "AngularMomentum L[0] L[1] ... L[N]"
- // 5) Barrier factor parameter, which appears in the denominator and multiplies the term involving
- // the nominal radius. If not set here, defaults to 0 or values appropriate to non-zero angular
- // momenta as set in in (4) above.
- // "BarrierFactorParameter a[0] a[1] ... a[N]"
- // 6) Characteristic radius for each channel. If not set here, defaults to 3.0 GeV^{-1}
- // "Radii radChannel1 radChannel2 ... radChannelN"
- // 7) Various Adler zero and scattering constants; each line is "name value".
- // Possible names are mSq0, s0Scatt, s0Prod, sA, sA0
- //
- // By default, the scattering constants are symmetrised: f_{ji} = f_{ij}.
- // To not assume this use "ScattSymmetry 0" on a line
+ cout << "nChannels = " << nChannels_ << ", nPoles = " << nPoles_ << endl;
- LauTextFileParser readFile(inputFile);
- readFile.processFile();
+ // Initialise various matrices
+ this->initialiseMatrices();
+ std::vector<Int_t> a( nChannels_, 0 );
- // Loop over the (non-commented) lines
- UInt_t nTotLines = readFile.getTotalNumLines();
+ // The format of the input file contains lines starting with a keyword followed by the
+ // appropriate set of parameters. Keywords are case insensitive (treated as lower-case).
+ // 1) Indices (nChannels) of N phase space channel types (defined in KMatrixChannels enum)
+ // "Channels iChannel1 iChannel2 ... iChannelN"
+ // 2) Definition of poles: bare mass (GeV), pole index (1 to NPoles), N channel couplings g_j
+ // "Pole poleIndex mass g_1 g_2 ... g_N"
+ // 3) Definition of scattering f_{ij} constants: scattering index (1 to N), channel values
+ // "Scatt index f_{i1} f_{i2} ... f_{iN}", where i = index
+ // 4) Orbital angular momentu for each channel. If not set here, defaults to 0
+ // "AngularMomentum L[0] L[1] ... L[N]"
+ // 5) Barrier factor parameter, which appears in the denominator and multiplies the term involving
+ // the nominal radius. If not set here, defaults to 0 or values appropriate to non-zero angular
+ // momenta as set in in (4) above.
+ // "BarrierFactorParameter a[0] a[1] ... a[N]"
+ // 6) Characteristic radius for each channel. If not set here, defaults to 3.0 GeV^{-1}
+ // "Radii radChannel1 radChannel2 ... radChannelN"
+ // 7) Various Adler zero and scattering constants; each line is "name value".
+ // Possible names are mSq0, s0Scatt, s0Prod, sA, sA0
+ //
+ // By default, the scattering constants are symmetrised: f_{ji} = f_{ij}.
+ // To not assume this use "ScattSymmetry 0" on a line
- if (nTotLines == 0) {
- std::cerr << "ERROR in LauKMatrixPropagator::setParameters : K-matrix parameter file not present - exiting." << std::endl;
+ LauTextFileParser readFile( inputFile );
+ readFile.processFile();
- gSystem->Exit(EXIT_FAILURE);
- }
+ // Loop over the (non-commented) lines
+ UInt_t nTotLines = readFile.getTotalNumLines();
- UInt_t iLine(0);
+ if ( nTotLines == 0 ) {
+ std::cerr << "ERROR in LauKMatrixPropagator::setParameters : K-matrix parameter file not present - exiting."
+ << std::endl;
- for (iLine = 1; iLine <= nTotLines; iLine++) {
+ gSystem->Exit( EXIT_FAILURE );
+ }
- // Get the line of strings
- std::vector<std::string> theLine = readFile.getLine(iLine);
+ UInt_t iLine( 0 );
- // There should always be at least two strings: a keyword and at least 1 value
- if (theLine.size() < 2) {continue;}
+ for ( iLine = 1; iLine <= nTotLines; iLine++ ) {
- TString keyword(theLine[0].c_str());
- keyword.ToLower(); // Use lowercase
-
- if (!keyword.CompareTo("channels")) {
+ // Get the line of strings
+ std::vector<std::string> theLine = readFile.getLine( iLine );
- // Channel indices for phase-space factors
- this->storeChannels(theLine);
+ // There should always be at least two strings: a keyword and at least 1 value
+ if ( theLine.size() < 2 ) {
+ continue;
+ }
- } else if (!keyword.CompareTo("pole")) {
+ TString keyword( theLine[0].c_str() );
+ keyword.ToLower(); // Use lowercase
- // Pole terms
- this->storePole(theLine);
+ if ( ! keyword.CompareTo( "channels" ) ) {
- } else if (!keyword.CompareTo("scatt")) {
+ // Channel indices for phase-space factors
+ this->storeChannels( theLine );
- // Scattering terms
- this->storeScattering(theLine);
+ } else if ( ! keyword.CompareTo( "pole" ) ) {
- } else if (!keyword.CompareTo("angularmomentum")) {
+ // Pole terms
+ this->storePole( theLine );
- // Orbital angular momentum state for each channel & set default a values if called before storeBarrierFactorParameter
- this->storeOrbitalAngularMomenta(theLine, a);
+ } else if ( ! keyword.CompareTo( "scatt" ) ) {
- } else if (!keyword.CompareTo("barrierfactorparameter")) {
+ // Scattering terms
+ this->storeScattering( theLine );
- // Value of parameter "a" in denominator of centrifugal barrier factor, gamma
- this->storeBarrierFactorParameter(theLine, a);
+ } else if ( ! keyword.CompareTo( "angularmomentum" ) ) {
- } else if (!keyword.CompareTo("radii")) {
+ // Orbital angular momentum state for each channel & set default a values if called before storeBarrierFactorParameter
+ this->storeOrbitalAngularMomenta( theLine, a );
- // Values of characteristic radius
- this->storeRadii(theLine);
+ } else if ( ! keyword.CompareTo( "barrierfactorparameter" ) ) {
- } else {
+ // Value of parameter "a" in denominator of centrifugal barrier factor, gamma
+ this->storeBarrierFactorParameter( theLine, a );
- // Usually Adler-zero constants
- TString parString(theLine[1].c_str());
- this->storeParameter(keyword, parString);
+ } else if ( ! keyword.CompareTo( "radii" ) ) {
- }
+ // Values of characteristic radius
+ this->storeRadii( theLine );
- }
+ } else {
- sAConst_ = 0.5*sA_.unblindValue()*LauConstants::mPiSq;
+ // Usually Adler-zero constants
+ TString parString( theLine[1].c_str() );
+ this->storeParameter( keyword, parString );
+ }
+ }
- // Symmetrise scattering parameters if enabled
- if (scattSymmetry_ == kTRUE) {
+ sAConst_ = 0.5 * sA_.unblindValue() * LauConstants::mPiSq;
- for (Int_t iChannel = 0; iChannel < nChannels_; iChannel++) {
+ // Symmetrise scattering parameters if enabled
+ if ( scattSymmetry_ == kTRUE ) {
- for (Int_t jChannel = iChannel; jChannel < nChannels_; jChannel++) {
+ for ( Int_t iChannel = 0; iChannel < nChannels_; iChannel++ ) {
- LauParameter fPar = fScattering_[iChannel][jChannel];
- fScattering_[jChannel][iChannel] = LauParameter(fPar);
+ for ( Int_t jChannel = iChannel; jChannel < nChannels_; jChannel++ ) {
- }
- }
- }
+ LauParameter fPar = fScattering_[iChannel][jChannel];
+ fScattering_[jChannel][iChannel] = LauParameter( fPar );
+ }
+ }
+ }
- // Now that radii and barrier-factor-denominator parameters have been set, cache the value of "a/(R*R)"
- for (Int_t iChannel = 0; iChannel < nChannels_; iChannel++) {
- gamAInvRadSq_[iChannel] = a[iChannel]/(radii_[iChannel]*radii_[iChannel]);
- }
+ // Now that radii and barrier-factor-denominator parameters have been set, cache the value of "a/(R*R)"
+ for ( Int_t iChannel = 0; iChannel < nChannels_; iChannel++ ) {
+ gamAInvRadSq_[iChannel] = a[iChannel] / ( radii_[iChannel] * radii_[iChannel] );
+ }
- // All required parameters have been set
- parametersSet_ = kTRUE;
-
- cout<<"Finished initialising K-matrix propagator "<<name_<<endl;
+ // All required parameters have been set
+ parametersSet_ = kTRUE;
+ cout << "Finished initialising K-matrix propagator " << name_ << endl;
}
void LauKMatrixPropagator::initialiseMatrices()
{
-
- // Identity and null matrices
- IMatrix_.Clear();
- IMatrix_.ResizeTo(nChannels_, nChannels_);
- for (Int_t iChannel = 0; iChannel < nChannels_; iChannel++) {
- IMatrix_[iChannel][iChannel] = 1.0;
- }
-
- zeroMatrix_.Clear();
- zeroMatrix_.ResizeTo(nChannels_, nChannels_);
-
- // Real K matrix
- ScattKMatrix_.Clear();
- ScattKMatrix_.ResizeTo(nChannels_, nChannels_);
-
- // Real and imaginary propagator matrices
- realProp_.Clear(); negImagProp_.Clear();
- realProp_.ResizeTo(nChannels_, nChannels_);
- negImagProp_.ResizeTo(nChannels_, nChannels_);
-
- // Phase space matrices
- ReRhoMatrix_.Clear(); ImRhoMatrix_.Clear();
- ReRhoMatrix_.ResizeTo(nChannels_, nChannels_);
- ImRhoMatrix_.ResizeTo(nChannels_, nChannels_);
-
- // Gamma matrices
- GammaMatrix_.Clear();
- GammaMatrix_.ResizeTo(nChannels_, nChannels_);
-
- // Vector of orbital angular momenta for the channels (default is S-wave everywhere)
- L_.clear();
- L_.assign(nChannels_,0);
-
- // Characteristic radius (diagonal) vector (default to 3.0)
- radii_.clear();
- radii_.assign(nChannels_,3.0);
-
- // Vector to cache ratio a/R^2
- gamAInvRadSq_.clear();
- gamAInvRadSq_.resize(nChannels_);
-
- // Square-root phase space matrices
- ReSqrtRhoMatrix_.Clear(); ImSqrtRhoMatrix_.Clear();
- ReSqrtRhoMatrix_.ResizeTo(nChannels_, nChannels_);
- ImSqrtRhoMatrix_.ResizeTo(nChannels_, nChannels_);
-
- // T matrices
- ReTMatrix_.Clear(); ImTMatrix_.Clear();
- ReTMatrix_.ResizeTo(nChannels_, nChannels_);
- ImTMatrix_.ResizeTo(nChannels_, nChannels_);
-
- // For the coupling and scattering constants, use LauParArrays instead of TMatrices
- // so that the quantities remain LauParameters instead of just doubles.
- // Each array is an stl vector of another stl vector of LauParameters:
- // std::vector< std::vector<LauParameter> >.
- // Set their sizes using the number of poles and channels defined in the constructor
- gCouplings_.clear();
- gCouplings_.resize(nPoles_);
-
- for (Int_t iPole = 0; iPole < nPoles_; iPole++) {
- gCouplings_[iPole].resize(nChannels_);
- }
-
- fScattering_.clear();
- fScattering_.resize(nChannels_);
-
- for (Int_t iChannel = 0; iChannel < nChannels_; iChannel++) {
- fScattering_[iChannel].resize(nChannels_);
- }
-
- // Clear other vectors
- phaseSpaceTypes_.clear();
- phaseSpaceTypes_.resize(nChannels_);
-
- mSqPoles_.clear();
- mSqPoles_.resize(nPoles_);
-
- haveCalled_storeBarrierFactorParameter = kFALSE;
+
+ // Identity and null matrices
+ IMatrix_.Clear();
+ IMatrix_.ResizeTo( nChannels_, nChannels_ );
+ for ( Int_t iChannel = 0; iChannel < nChannels_; iChannel++ ) {
+ IMatrix_[iChannel][iChannel] = 1.0;
+ }
+
+ zeroMatrix_.Clear();
+ zeroMatrix_.ResizeTo( nChannels_, nChannels_ );
+
+ // Real K matrix
+ ScattKMatrix_.Clear();
+ ScattKMatrix_.ResizeTo( nChannels_, nChannels_ );
+
+ // Real and imaginary propagator matrices
+ realProp_.Clear();
+ negImagProp_.Clear();
+ realProp_.ResizeTo( nChannels_, nChannels_ );
+ negImagProp_.ResizeTo( nChannels_, nChannels_ );
+
+ // Phase space matrices
+ ReRhoMatrix_.Clear();
+ ImRhoMatrix_.Clear();
+ ReRhoMatrix_.ResizeTo( nChannels_, nChannels_ );
+ ImRhoMatrix_.ResizeTo( nChannels_, nChannels_ );
+
+ // Gamma matrices
+ GammaMatrix_.Clear();
+ GammaMatrix_.ResizeTo( nChannels_, nChannels_ );
+
+ // Vector of orbital angular momenta for the channels (default is S-wave everywhere)
+ L_.clear();
+ L_.assign( nChannels_, 0 );
+
+ // Characteristic radius (diagonal) vector (default to 3.0)
+ radii_.clear();
+ radii_.assign( nChannels_, 3.0 );
+
+ // Vector to cache ratio a/R^2
+ gamAInvRadSq_.clear();
+ gamAInvRadSq_.resize( nChannels_ );
+
+ // Square-root phase space matrices
+ ReSqrtRhoMatrix_.Clear();
+ ImSqrtRhoMatrix_.Clear();
+ ReSqrtRhoMatrix_.ResizeTo( nChannels_, nChannels_ );
+ ImSqrtRhoMatrix_.ResizeTo( nChannels_, nChannels_ );
+
+ // T matrices
+ ReTMatrix_.Clear();
+ ImTMatrix_.Clear();
+ ReTMatrix_.ResizeTo( nChannels_, nChannels_ );
+ ImTMatrix_.ResizeTo( nChannels_, nChannels_ );
+
+ // For the coupling and scattering constants, use LauParArrays instead of TMatrices
+ // so that the quantities remain LauParameters instead of just doubles.
+ // Each array is an stl vector of another stl vector of LauParameters:
+ // std::vector< std::vector<LauParameter> >.
+ // Set their sizes using the number of poles and channels defined in the constructor
+ gCouplings_.clear();
+ gCouplings_.resize( nPoles_ );
+
+ for ( Int_t iPole = 0; iPole < nPoles_; iPole++ ) {
+ gCouplings_[iPole].resize( nChannels_ );
+ }
+
+ fScattering_.clear();
+ fScattering_.resize( nChannels_ );
+
+ for ( Int_t iChannel = 0; iChannel < nChannels_; iChannel++ ) {
+ fScattering_[iChannel].resize( nChannels_ );
+ }
+
+ // Clear other vectors
+ phaseSpaceTypes_.clear();
+ phaseSpaceTypes_.resize( nChannels_ );
+
+ mSqPoles_.clear();
+ mSqPoles_.resize( nPoles_ );
+
+ haveCalled_storeBarrierFactorParameter = kFALSE;
}
-void LauKMatrixPropagator::storeChannels(const std::vector<std::string>& theLine)
+void LauKMatrixPropagator::storeChannels( const std::vector<std::string>& theLine )
{
- // Get the list of channel indices to specify what phase space factors should be used
- // e.g. pipi, Kpi, eta eta', 4pi etc..
-
- // Check that the line has nChannels_+1 strings
- Int_t nTypes = static_cast<Int_t>(theLine.size()) - 1;
- if (nTypes != nChannels_) {
- cerr<<"Error in LauKMatrixPropagator::storeChannels. The input file defines "
- <<nTypes<<" channels when "<<nChannels_<<" are expected"<<endl;
- return;
- }
-
- for (Int_t iChannel = 0; iChannel < nChannels_; iChannel++) {
-
- Int_t phaseSpaceInt = std::atoi(theLine[iChannel+1].c_str());
- Bool_t checkChannel = this->checkPhaseSpaceType(phaseSpaceInt);
-
- if (checkChannel == kTRUE) {
- cout<<"Adding phase space channel index "<<phaseSpaceInt
- <<" to K-matrix propagator "<<name_<<endl;
- phaseSpaceTypes_[iChannel] = static_cast<LauKMatrixPropagator::KMatrixChannels>(phaseSpaceInt);
- } else {
- cerr<<"Phase space channel index "<<phaseSpaceInt
- <<" should be between 1 and "<<static_cast<int>(LauKMatrixPropagator::KMatrixChannels::TotChannels)-1<<endl;
- }
-
- }
-
+ // Get the list of channel indices to specify what phase space factors should be used
+ // e.g. pipi, Kpi, eta eta', 4pi etc..
+
+ // Check that the line has nChannels_+1 strings
+ Int_t nTypes = static_cast<Int_t>( theLine.size() ) - 1;
+ if ( nTypes != nChannels_ ) {
+ cerr << "Error in LauKMatrixPropagator::storeChannels. The input file defines " << nTypes
+ << " channels when " << nChannels_ << " are expected" << endl;
+ return;
+ }
+
+ for ( Int_t iChannel = 0; iChannel < nChannels_; iChannel++ ) {
+
+ Int_t phaseSpaceInt = std::atoi( theLine[iChannel + 1].c_str() );
+ Bool_t checkChannel = this->checkPhaseSpaceType( phaseSpaceInt );
+
+ if ( checkChannel == kTRUE ) {
+ cout << "Adding phase space channel index " << phaseSpaceInt
+ << " to K-matrix propagator " << name_ << endl;
+ phaseSpaceTypes_[iChannel] = static_cast<LauKMatrixPropagator::KMatrixChannels>(
+ phaseSpaceInt );
+ } else {
+ cerr << "Phase space channel index " << phaseSpaceInt << " should be between 1 and "
+ << static_cast<int>( LauKMatrixPropagator::KMatrixChannels::TotChannels ) - 1
+ << endl;
+ }
+ }
}
-void LauKMatrixPropagator::storePole(const std::vector<std::string>& theLine)
+void LauKMatrixPropagator::storePole( const std::vector<std::string>& theLine )
{
- // Store the pole mass and its coupling constants for each channel.
- // Each line will contain: Pole poleNumber poleMass poleCouplingsPerChannel
-
- // Check that the line has nChannels_ + 3 strings
- Int_t nWords = static_cast<Int_t>(theLine.size());
- Int_t nExpect = nChannels_ + 3;
-
- if (nWords == nExpect) {
-
- Int_t poleIndex = std::atoi(theLine[1].c_str()) - 1;
- if (poleIndex >= 0 && poleIndex < nPoles_) {
+ // Store the pole mass and its coupling constants for each channel.
+ // Each line will contain: Pole poleNumber poleMass poleCouplingsPerChannel
- Double_t poleMass = std::atof(theLine[2].c_str());
- Double_t poleMassSq = poleMass*poleMass;
- LauParameter mPoleParam(Form("KM_%s_poleMassSq_%i",name_.Data(),poleIndex),poleMassSq);
- mSqPoles_[poleIndex] = mPoleParam;
+ // Check that the line has nChannels_ + 3 strings
+ Int_t nWords = static_cast<Int_t>( theLine.size() );
+ Int_t nExpect = nChannels_ + 3;
- cout<<"Added bare pole mass "<<poleMass<<" GeV for pole number "<<poleIndex+1<<endl;
+ if ( nWords == nExpect ) {
- for (Int_t iChannel = 0; iChannel < nChannels_; iChannel++) {
+ Int_t poleIndex = std::atoi( theLine[1].c_str() ) - 1;
+ if ( poleIndex >= 0 && poleIndex < nPoles_ ) {
- Double_t couplingConst = std::atof(theLine[iChannel+3].c_str());
- LauParameter couplingParam(Form("KM_%s_gCoupling_%i_%i",name_.Data(),poleIndex,iChannel),couplingConst);
- gCouplings_[poleIndex][iChannel] = couplingParam;
+ Double_t poleMass = std::atof( theLine[2].c_str() );
+ Double_t poleMassSq = poleMass * poleMass;
+ LauParameter mPoleParam( Form( "KM_%s_poleMassSq_%i", name_.Data(), poleIndex ),
+ poleMassSq );
+ mSqPoles_[poleIndex] = mPoleParam;
- cout<<"Added coupling parameter g^{"<<poleIndex+1<<"}_"
- <<iChannel+1<<" = "<<couplingConst<<endl;
+ cout << "Added bare pole mass " << poleMass << " GeV for pole number " << poleIndex + 1
+ << endl;
- }
+ for ( Int_t iChannel = 0; iChannel < nChannels_; iChannel++ ) {
- }
+ Double_t couplingConst = std::atof( theLine[iChannel + 3].c_str() );
+ LauParameter couplingParam(
+ Form( "KM_%s_gCoupling_%i_%i", name_.Data(), poleIndex, iChannel ),
+ couplingConst );
+ gCouplings_[poleIndex][iChannel] = couplingParam;
- } else {
+ cout << "Added coupling parameter g^{" << poleIndex + 1 << "}_" << iChannel + 1
+ << " = " << couplingConst << endl;
+ }
+ }
- cerr<<"Error in LauKMatrixPropagator::storePole. Expecting "<<nExpect
- <<" numbers for pole definition but found "<<nWords
- <<" values instead"<<endl;
-
- }
+ } else {
+ cerr << "Error in LauKMatrixPropagator::storePole. Expecting " << nExpect
+ << " numbers for pole definition but found " << nWords << " values instead" << endl;
+ }
}
-void LauKMatrixPropagator::storeScattering(const std::vector<std::string>& theLine)
+void LauKMatrixPropagator::storeScattering( const std::vector<std::string>& theLine )
{
- // Store the scattering constants (along one of the channel rows).
- // Each line will contain: Scatt ScattIndex ScattConstantsPerChannel
-
- // Check that the line has nChannels_ + 2 strings
- Int_t nWords = static_cast<Int_t>(theLine.size());
- Int_t nExpect = nChannels_ + 2;
-
- if (nWords == nExpect) {
-
- Int_t scattIndex = std::atoi(theLine[1].c_str()) - 1;
- if (scattIndex >= 0 && scattIndex < nChannels_) {
+ // Store the scattering constants (along one of the channel rows).
+ // Each line will contain: Scatt ScattIndex ScattConstantsPerChannel
- for (Int_t iChannel = 0; iChannel < nChannels_; iChannel++) {
-
- Double_t scattConst = std::atof(theLine[iChannel+2].c_str());
- LauParameter scattParam(Form("KM_%s_fScatteringConst_%i_%i",name_.Data(),scattIndex,iChannel),scattConst);
- fScattering_[scattIndex][iChannel] = scattParam;
+ // Check that the line has nChannels_ + 2 strings
+ Int_t nWords = static_cast<Int_t>( theLine.size() );
+ Int_t nExpect = nChannels_ + 2;
- cout<<"Added scattering parameter f("<<scattIndex+1<<","
- <<iChannel+1<<") = "<<scattConst<<endl;
+ if ( nWords == nExpect ) {
- }
+ Int_t scattIndex = std::atoi( theLine[1].c_str() ) - 1;
+ if ( scattIndex >= 0 && scattIndex < nChannels_ ) {
- }
+ for ( Int_t iChannel = 0; iChannel < nChannels_; iChannel++ ) {
- } else {
+ Double_t scattConst = std::atof( theLine[iChannel + 2].c_str() );
+ LauParameter scattParam(
+ Form( "KM_%s_fScatteringConst_%i_%i", name_.Data(), scattIndex, iChannel ),
+ scattConst );
+ fScattering_[scattIndex][iChannel] = scattParam;
- cerr<<"Error in LauKMatrixPropagator::storeScattering. Expecting "<<nExpect
- <<" numbers for scattering constants definition but found "<<nWords
- <<" values instead"<<endl;
+ cout << "Added scattering parameter f(" << scattIndex + 1 << "," << iChannel + 1
+ << ") = " << scattConst << endl;
+ }
+ }
- }
+ } else {
+ cerr << "Error in LauKMatrixPropagator::storeScattering. Expecting " << nExpect
+ << " numbers for scattering constants definition but found " << nWords
+ << " values instead" << endl;
+ }
}
-void LauKMatrixPropagator::storeOrbitalAngularMomenta(const std::vector<std::string>& theLine, std::vector<Int_t>& a)
+void LauKMatrixPropagator::storeOrbitalAngularMomenta( const std::vector<std::string>& theLine,
+ std::vector<Int_t>& a )
{
- // Store the orbital angular momentum for each channel
- // Each line will contain: angularmomentum OrbitalAngularMomentumPerChannel
-
- // Check that the line has nChannels_ + 1 strings
- Int_t nWords = static_cast<Int_t>(theLine.size());
- Int_t nExpect = nChannels_ + 1;
-
- if (nWords == nExpect) {
-
- for (Int_t iChannel = 0; iChannel < nChannels_; iChannel++) {
-
- Int_t angularMomentum = std::atoi(theLine[iChannel+1].c_str());
- L_[iChannel] = angularMomentum;
-
- cout<<"Defined K-matrix orbital angular momentum "<<angularMomentum<<" for channel "
- <<iChannel<<endl;
-
- }
-
- } else {
-
- cerr<<"Error in LauKMatrixPropagator::storeOrbitalAngularMomenta. Expecting "<<nExpect
- <<" numbers for orbital angular momenta definition but found "<<nWords
- <<" values instead"<<endl;
-
- }
-
- if (!haveCalled_storeBarrierFactorParameter)
- {
- // Set default value of spin-dependent centrifugal-barrier-factor parameter
- for( Int_t iCh = 0; iCh < nChannels_; iCh++ )
- {
- switch(L_[iCh]) {
- case 0:
- a[iCh] = 0;
- break;
- case 1:
- a[iCh] = 1;
- break;
- case 2:
- a[iCh] = 3;
- break;
- default:
- std::cerr << "ERROR in LauKMatrixPropagator constructor. Centrifugal barrier factor and angular-momentum terms of K-matrix are only defined for S-, P-, or D-wave."
- << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- }
- }
-
+ // Store the orbital angular momentum for each channel
+ // Each line will contain: angularmomentum OrbitalAngularMomentumPerChannel
+
+ // Check that the line has nChannels_ + 1 strings
+ Int_t nWords = static_cast<Int_t>( theLine.size() );
+ Int_t nExpect = nChannels_ + 1;
+
+ if ( nWords == nExpect ) {
+
+ for ( Int_t iChannel = 0; iChannel < nChannels_; iChannel++ ) {
+
+ Int_t angularMomentum = std::atoi( theLine[iChannel + 1].c_str() );
+ L_[iChannel] = angularMomentum;
+
+ cout << "Defined K-matrix orbital angular momentum " << angularMomentum
+ << " for channel " << iChannel << endl;
+ }
+
+ } else {
+
+ cerr << "Error in LauKMatrixPropagator::storeOrbitalAngularMomenta. Expecting " << nExpect
+ << " numbers for orbital angular momenta definition but found " << nWords
+ << " values instead" << endl;
+ }
+
+ if ( ! haveCalled_storeBarrierFactorParameter ) {
+ // Set default value of spin-dependent centrifugal-barrier-factor parameter
+ for ( Int_t iCh = 0; iCh < nChannels_; iCh++ ) {
+ switch ( L_[iCh] ) {
+ case 0 :
+ a[iCh] = 0;
+ break;
+ case 1 :
+ a[iCh] = 1;
+ break;
+ case 2 :
+ a[iCh] = 3;
+ break;
+ default :
+ std::cerr << "ERROR in LauKMatrixPropagator constructor. Centrifugal barrier factor and angular-momentum terms of K-matrix are only defined for S-, P-, or D-wave."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ }
+ }
}
-void LauKMatrixPropagator::storeRadii(const std::vector<std::string>& theLine)
+void LauKMatrixPropagator::storeRadii( const std::vector<std::string>& theLine )
{
- // Store the characteristic radii (measured in GeV^{-1})
- // Each line will contain: Radii RadiusConstantsPerChannel
-
- // Check that the line has nChannels_ + 1 strings
- Int_t nWords = static_cast<Int_t>(theLine.size());
- Int_t nExpect = nChannels_ + 1;
+ // Store the characteristic radii (measured in GeV^{-1})
+ // Each line will contain: Radii RadiusConstantsPerChannel
- if (nWords == nExpect) {
+ // Check that the line has nChannels_ + 1 strings
+ Int_t nWords = static_cast<Int_t>( theLine.size() );
+ Int_t nExpect = nChannels_ + 1;
- for (Int_t iChannel = 0; iChannel < nChannels_; iChannel++) {
+ if ( nWords == nExpect ) {
- Double_t radiusConst = std::atof(theLine[iChannel+1].c_str());
- radii_[iChannel] = radiusConst;
+ for ( Int_t iChannel = 0; iChannel < nChannels_; iChannel++ ) {
- cout<<"Added K-matrix radius "<<radiusConst<<" for channel "
- <<iChannel<<endl;
+ Double_t radiusConst = std::atof( theLine[iChannel + 1].c_str() );
+ radii_[iChannel] = radiusConst;
- }
+ cout << "Added K-matrix radius " << radiusConst << " for channel " << iChannel << endl;
+ }
- } else {
-
- cerr<<"Error in LauKMatrixPropagator::storeRadii. Expecting "<<nExpect
- <<" numbers for radii definition but found "<<nWords
- <<" values instead"<<endl;
-
- }
+ } else {
+ cerr << "Error in LauKMatrixPropagator::storeRadii. Expecting " << nExpect
+ << " numbers for radii definition but found " << nWords << " values instead" << endl;
+ }
}
-void LauKMatrixPropagator::storeBarrierFactorParameter(const std::vector<std::string>& theLine, std::vector<Int_t>& a)
+void LauKMatrixPropagator::storeBarrierFactorParameter( const std::vector<std::string>& theLine,
+ std::vector<Int_t>& a )
{
- // Store the parameter of the barrier factor
- // Each line will contain: barrierfactorparameter ParameterValuePerchannel
-
- // Check that the line has nChannels_ + 1 strings
- Int_t nWords = static_cast<Int_t>(theLine.size());
- Int_t nExpect = nChannels_ + 1;
+ // Store the parameter of the barrier factor
+ // Each line will contain: barrierfactorparameter ParameterValuePerchannel
- if (nWords == nExpect) {
+ // Check that the line has nChannels_ + 1 strings
+ Int_t nWords = static_cast<Int_t>( theLine.size() );
+ Int_t nExpect = nChannels_ + 1;
- for (Int_t iChannel = 0; iChannel < nChannels_; iChannel++) {
+ if ( nWords == nExpect ) {
- Double_t parameterValue = std::atof(theLine[iChannel+1].c_str());
- a[iChannel] = parameterValue;
+ for ( Int_t iChannel = 0; iChannel < nChannels_; iChannel++ ) {
- cout<<"Added K-matrix barrier factor parameter value "<<parameterValue<<" for channel "
- <<iChannel<<endl;
+ Double_t parameterValue = std::atof( theLine[iChannel + 1].c_str() );
+ a[iChannel] = parameterValue;
- }
+ cout << "Added K-matrix barrier factor parameter value " << parameterValue
+ << " for channel " << iChannel << endl;
+ }
- // Set flag to stop storeOrbitalAngularMomenta overriding these a values
- haveCalled_storeBarrierFactorParameter = kTRUE;
+ // Set flag to stop storeOrbitalAngularMomenta overriding these a values
+ haveCalled_storeBarrierFactorParameter = kTRUE;
- } else {
+ } else {
- cerr<<"Error in LauKMatrixPropagator::storeBarrierFactorParameter. Expecting "<<nExpect
- <<" numbers for barrier factor parameter definition but found "<<nWords
- <<" values instead"<<endl;
-
- }
+ cerr << "Error in LauKMatrixPropagator::storeBarrierFactorParameter. Expecting " << nExpect
+ << " numbers for barrier factor parameter definition but found " << nWords
+ << " values instead" << endl;
+ }
}
-void LauKMatrixPropagator::storeParameter(const TString& keyword, const TString& parString)
+void LauKMatrixPropagator::storeParameter( const TString& keyword, const TString& parString )
{
- if (!keyword.CompareTo("msq0")) {
-
- Double_t mSq0Value = std::atof(parString.Data());
- cout<<"Adler zero constant m0Sq = "<<mSq0Value<<endl;
- mSq0_ = LauParameter(Form("KM_%s_mSq0",name_.Data()), mSq0Value);
+ if ( ! keyword.CompareTo( "msq0" ) ) {
- } else if (!keyword.CompareTo("s0scatt")) {
+ Double_t mSq0Value = std::atof( parString.Data() );
+ cout << "Adler zero constant m0Sq = " << mSq0Value << endl;
+ mSq0_ = LauParameter( Form( "KM_%s_mSq0", name_.Data() ), mSq0Value );
- Double_t s0ScattValue = std::atof(parString.Data());
- cout<<"Adler zero constant s0Scatt = "<<s0ScattValue<<endl;
- s0Scatt_ = LauParameter(Form("KM_%s_s0Scatt",name_.Data()), s0ScattValue);
+ } else if ( ! keyword.CompareTo( "s0scatt" ) ) {
- } else if (!keyword.CompareTo("s0prod")) {
+ Double_t s0ScattValue = std::atof( parString.Data() );
+ cout << "Adler zero constant s0Scatt = " << s0ScattValue << endl;
+ s0Scatt_ = LauParameter( Form( "KM_%s_s0Scatt", name_.Data() ), s0ScattValue );
- Double_t s0ProdValue = std::atof(parString.Data());
- cout<<"Adler zero constant s0Prod = "<<s0ProdValue<<endl;
- s0Prod_ = LauParameter(Form("KM_%s_s0Prod",name_.Data()), s0ProdValue);
+ } else if ( ! keyword.CompareTo( "s0prod" ) ) {
- } else if (!keyword.CompareTo("sa0")) {
+ Double_t s0ProdValue = std::atof( parString.Data() );
+ cout << "Adler zero constant s0Prod = " << s0ProdValue << endl;
+ s0Prod_ = LauParameter( Form( "KM_%s_s0Prod", name_.Data() ), s0ProdValue );
- Double_t sA0Value = std::atof(parString.Data());
- cout<<"Adler zero constant sA0 = "<<sA0Value<<endl;
- sA0_ = LauParameter(Form("KM_%s_sA0",name_.Data()), sA0Value);
+ } else if ( ! keyword.CompareTo( "sa0" ) ) {
- } else if (!keyword.CompareTo("sa")) {
+ Double_t sA0Value = std::atof( parString.Data() );
+ cout << "Adler zero constant sA0 = " << sA0Value << endl;
+ sA0_ = LauParameter( Form( "KM_%s_sA0", name_.Data() ), sA0Value );
- Double_t sAValue = std::atof(parString.Data());
- cout<<"Adler zero constant sA = "<<sAValue<<endl;
- sA_ = LauParameter(Form("KM_%s_sA",name_.Data()), sAValue);
+ } else if ( ! keyword.CompareTo( "sa" ) ) {
- } else if (!keyword.CompareTo("scattsymmetry")) {
+ Double_t sAValue = std::atof( parString.Data() );
+ cout << "Adler zero constant sA = " << sAValue << endl;
+ sA_ = LauParameter( Form( "KM_%s_sA", name_.Data() ), sAValue );
- Int_t flag = std::atoi(parString.Data());
- if (flag == 0) {
- cout<<"Turning off scattering parameter symmetry: f_ji = f_ij will not be assumed"<<endl;
- scattSymmetry_ = kFALSE;
- }
-
- }
+ } else if ( ! keyword.CompareTo( "scattsymmetry" ) ) {
+ Int_t flag = std::atoi( parString.Data() );
+ if ( flag == 0 ) {
+ cout << "Turning off scattering parameter symmetry: f_ji = f_ij will not be assumed"
+ << endl;
+ scattSymmetry_ = kFALSE;
+ }
+ }
}
-void LauKMatrixPropagator::calcScattKMatrix(const Double_t s)
+void LauKMatrixPropagator::calcScattKMatrix( const Double_t s )
{
- // Calculate the scattering K-matrix for the given value of s.
- // We need to obtain the complete matrix (not just one row/column)
- // to get the correct inverted (I - i K rho) terms for the propagator.
-
- if (verbose_) {cout<<"Within calcScattKMatrix for s = "<<s<<endl;}
+ // Calculate the scattering K-matrix for the given value of s.
+ // We need to obtain the complete matrix (not just one row/column)
+ // to get the correct inverted (I - i K rho) terms for the propagator.
- // Initialise the K matrix to zero
- ScattKMatrix_.Zero();
+ if ( verbose_ ) {
+ cout << "Within calcScattKMatrix for s = " << s << endl;
+ }
- Int_t iChannel(0), jChannel(0), iPole(0);
+ // Initialise the K matrix to zero
+ ScattKMatrix_.Zero();
- // The pole denominator 1/(m^2 - s) terms should already be calculated
- // by the calcPoleDenomVect() function. These same terms are also
- // used for calculating the production K-matrix elements.
+ Int_t iChannel( 0 ), jChannel( 0 ), iPole( 0 );
- // Calculate the "slowly-varying part" (SVP), e.g. (1 GeV - s0)/(s - s0)
- this->updateScattSVPTerm(s);
+ // The pole denominator 1/(m^2 - s) terms should already be calculated
+ // by the calcPoleDenomVect() function. These same terms are also
+ // used for calculating the production K-matrix elements.
- // Now loop over iChannel, jChannel to calculate Kij = Kji.
- for (iChannel = 0; iChannel < nChannels_; iChannel++) {
+ // Calculate the "slowly-varying part" (SVP), e.g. (1 GeV - s0)/(s - s0)
+ this->updateScattSVPTerm( s );
- // Scattering matrix is real and symmetric. Start j loop from i.
- for (jChannel = iChannel; jChannel < nChannels_; jChannel++) {
+ // Now loop over iChannel, jChannel to calculate Kij = Kji.
+ for ( iChannel = 0; iChannel < nChannels_; iChannel++ ) {
- Double_t Kij(0.0);
+ // Scattering matrix is real and symmetric. Start j loop from i.
+ for ( jChannel = iChannel; jChannel < nChannels_; jChannel++ ) {
- // Calculate pole mass summation term
- for (iPole = 0; iPole < nPoles_; iPole++) {
+ Double_t Kij( 0.0 );
- Double_t g_i = this->getCouplingConstant(iPole, iChannel);
- Double_t g_j = this->getCouplingConstant(iPole, jChannel);
+ // Calculate pole mass summation term
+ for ( iPole = 0; iPole < nPoles_; iPole++ ) {
- Kij += poleDenomVect_[iPole]*g_i*g_j;
- if (verbose_) {cout<<"1: Kij for i = "<<iChannel<<", j = "<<jChannel<<" = "<<Kij<<endl;}
+ Double_t g_i = this->getCouplingConstant( iPole, iChannel );
+ Double_t g_j = this->getCouplingConstant( iPole, jChannel );
- }
+ Kij += poleDenomVect_[iPole] * g_i * g_j;
+ if ( verbose_ ) {
+ cout << "1: Kij for i = " << iChannel << ", j = " << jChannel << " = " << Kij
+ << endl;
+ }
+ }
- Double_t fij = this->getScatteringConstant(iChannel, jChannel);
- Kij += fij*scattSVP_;
+ Double_t fij = this->getScatteringConstant( iChannel, jChannel );
+ Kij += fij * scattSVP_;
- Kij *= adlerZeroFactor_;
- if (verbose_) {cout<<"2: Kij for i = "<<iChannel<<", j = "<<jChannel<<" = "<<Kij<<endl;}
+ Kij *= adlerZeroFactor_;
+ if ( verbose_ ) {
+ cout << "2: Kij for i = " << iChannel << ", j = " << jChannel << " = " << Kij << endl;
+ }
- // Assign the TMatrix (i,j) element to the variable Kij and Kji (symmetry)
- ScattKMatrix_(iChannel, jChannel) = Kij;
- ScattKMatrix_(jChannel, iChannel) = Kij;
+ // Assign the TMatrix (i,j) element to the variable Kij and Kji (symmetry)
+ ScattKMatrix_( iChannel, jChannel ) = Kij;
+ ScattKMatrix_( jChannel, iChannel ) = Kij;
- } // j loop
-
- } // i loop
+ } // j loop
+ } // i loop
}
-void LauKMatrixPropagator::calcPoleDenomVect(const Double_t s)
+void LauKMatrixPropagator::calcPoleDenomVect( const Double_t s )
{
- // Calculate the 1/(m_pole^2 - s) terms for the scattering
- // and production K-matrix formulae.
- poleDenomVect_.clear();
- Int_t iPole(0);
- for (iPole = 0; iPole < nPoles_; iPole++) {
-
- Double_t poleTerm = mSqPoles_[iPole].unblindValue() - s;
- Double_t invPoleTerm(0.0);
- if (TMath::Abs(poleTerm) > 1.0e-6) {invPoleTerm = 1.0/poleTerm;}
-
- poleDenomVect_.push_back(invPoleTerm);
-
- }
+ // Calculate the 1/(m_pole^2 - s) terms for the scattering
+ // and production K-matrix formulae.
+ poleDenomVect_.clear();
+ Int_t iPole( 0 );
+ for ( iPole = 0; iPole < nPoles_; iPole++ ) {
+
+ Double_t poleTerm = mSqPoles_[iPole].unblindValue() - s;
+ Double_t invPoleTerm( 0.0 );
+ if ( TMath::Abs( poleTerm ) > 1.0e-6 ) {
+ invPoleTerm = 1.0 / poleTerm;
+ }
+
+ poleDenomVect_.push_back( invPoleTerm );
+ }
}
-Double_t LauKMatrixPropagator::getPoleDenomTerm(const Int_t poleIndex) const
+Double_t LauKMatrixPropagator::getPoleDenomTerm( const Int_t poleIndex ) const
{
- if (parametersSet_ == kFALSE) {return 0.0;}
-
- Double_t poleDenom(0.0);
- poleDenom = poleDenomVect_[poleIndex];
- return poleDenom;
+ if ( parametersSet_ == kFALSE ) {
+ return 0.0;
+ }
+ Double_t poleDenom( 0.0 );
+ poleDenom = poleDenomVect_[poleIndex];
+ return poleDenom;
}
-LauParameter& LauKMatrixPropagator::getPoleMassSqParameter(const Int_t poleIndex)
+LauParameter& LauKMatrixPropagator::getPoleMassSqParameter( const Int_t poleIndex )
{
- if ( (parametersSet_ == kFALSE) || (poleIndex < 0 || poleIndex >= nPoles_) ) {
- std::cerr << "ERROR from LauKMatrixPropagator::getPoleMassSqParameter(). Invalid pole." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
+ if ( ( parametersSet_ == kFALSE ) || ( poleIndex < 0 || poleIndex >= nPoles_ ) ) {
+ std::cerr << "ERROR from LauKMatrixPropagator::getPoleMassSqParameter(). Invalid pole."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
- return mSqPoles_[poleIndex];
+ return mSqPoles_[poleIndex];
}
-Double_t LauKMatrixPropagator::getCouplingConstant(const Int_t poleIndex, const Int_t channelIndex) const
+Double_t LauKMatrixPropagator::getCouplingConstant( const Int_t poleIndex,
+ const Int_t channelIndex ) const
{
- if (parametersSet_ == kFALSE) {return 0.0;}
- if (poleIndex < 0 || poleIndex >= nPoles_) {return 0.0;}
- if (channelIndex < 0 || channelIndex >= nChannels_) {return 0.0;}
-
- Double_t couplingConst = gCouplings_[poleIndex][channelIndex].unblindValue();
- return couplingConst;
-
+ if ( parametersSet_ == kFALSE ) {
+ return 0.0;
+ }
+ if ( poleIndex < 0 || poleIndex >= nPoles_ ) {
+ return 0.0;
+ }
+ if ( channelIndex < 0 || channelIndex >= nChannels_ ) {
+ return 0.0;
+ }
+
+ Double_t couplingConst = gCouplings_[poleIndex][channelIndex].unblindValue();
+ return couplingConst;
}
-LauParameter& LauKMatrixPropagator::getCouplingParameter(const Int_t poleIndex, const Int_t channelIndex)
+LauParameter& LauKMatrixPropagator::getCouplingParameter( const Int_t poleIndex,
+ const Int_t channelIndex )
{
- if ( (parametersSet_ == kFALSE) || (poleIndex < 0 || poleIndex >= nPoles_) || (channelIndex < 0 || channelIndex >= nChannels_) ) {
- std::cerr << "ERROR from LauKMatrixPropagator::getCouplingParameter(). Invalid coupling." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
+ if ( ( parametersSet_ == kFALSE ) || ( poleIndex < 0 || poleIndex >= nPoles_ ) ||
+ ( channelIndex < 0 || channelIndex >= nChannels_ ) ) {
+ std::cerr << "ERROR from LauKMatrixPropagator::getCouplingParameter(). Invalid coupling."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
- //std::cout << "Minvalue + range for " << poleIndex << ", " << channelIndex << ": " << gCouplings_[poleIndex][channelIndex].minValue() << " => + " << gCouplings_[poleIndex][channelIndex].range() <<
- // " and init value: " << gCouplings_[poleIndex][channelIndex].initValue() << std::endl;
- return gCouplings_[poleIndex][channelIndex];
+ //std::cout << "Minvalue + range for " << poleIndex << ", " << channelIndex << ": " << gCouplings_[poleIndex][channelIndex].minValue() << " => + " << gCouplings_[poleIndex][channelIndex].range() <<
+ // " and init value: " << gCouplings_[poleIndex][channelIndex].initValue() << std::endl;
+ return gCouplings_[poleIndex][channelIndex];
}
-Double_t LauKMatrixPropagator::getScatteringConstant(const Int_t channel1Index, const Int_t channel2Index) const
+Double_t LauKMatrixPropagator::getScatteringConstant( const Int_t channel1Index,
+ const Int_t channel2Index ) const
{
- if (parametersSet_ == kFALSE) {return 0.0;}
- if (channel1Index < 0 || channel1Index >= nChannels_) {return 0.0;}
- if (channel2Index < 0 || channel2Index >= nChannels_) {return 0.0;}
-
- Double_t scatteringConst = fScattering_[channel1Index][channel2Index].unblindValue();
- return scatteringConst;
-
+ if ( parametersSet_ == kFALSE ) {
+ return 0.0;
+ }
+ if ( channel1Index < 0 || channel1Index >= nChannels_ ) {
+ return 0.0;
+ }
+ if ( channel2Index < 0 || channel2Index >= nChannels_ ) {
+ return 0.0;
+ }
+
+ Double_t scatteringConst = fScattering_[channel1Index][channel2Index].unblindValue();
+ return scatteringConst;
}
-LauParameter& LauKMatrixPropagator::getScatteringParameter(const Int_t channel1Index, const Int_t channel2Index)
+LauParameter& LauKMatrixPropagator::getScatteringParameter( const Int_t channel1Index,
+ const Int_t channel2Index )
{
- if ( (parametersSet_ == kFALSE) || (channel1Index < 0 || channel1Index >= nChannels_) || (channel2Index < 0 || channel2Index >= nChannels_) ) {
- std::cerr << "ERROR from LauKMatrixPropagator::getScatteringParameter(). Invalid chanel index." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
+ if ( ( parametersSet_ == kFALSE ) || ( channel1Index < 0 || channel1Index >= nChannels_ ) ||
+ ( channel2Index < 0 || channel2Index >= nChannels_ ) ) {
+ std::cerr << "ERROR from LauKMatrixPropagator::getScatteringParameter(). Invalid chanel index."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
- return fScattering_[channel1Index][channel2Index];
+ return fScattering_[channel1Index][channel2Index];
}
-Double_t LauKMatrixPropagator::calcSVPTerm(const Double_t s, const Double_t s0) const
+Double_t LauKMatrixPropagator::calcSVPTerm( const Double_t s, const Double_t s0 ) const
{
- if (parametersSet_ == kFALSE) {return 0.0;}
-
- // Calculate the "slowly-varying part" (SVP)
- Double_t result(0.0);
- Double_t deltaS = s - s0;
- if (TMath::Abs(deltaS) > 1.0e-6) {
- result = (mSq0_.unblindValue() - s0)/deltaS;
- }
+ if ( parametersSet_ == kFALSE ) {
+ return 0.0;
+ }
- return result;
+ // Calculate the "slowly-varying part" (SVP)
+ Double_t result( 0.0 );
+ Double_t deltaS = s - s0;
+ if ( TMath::Abs( deltaS ) > 1.0e-6 ) {
+ result = ( mSq0_.unblindValue() - s0 ) / deltaS;
+ }
+ return result;
}
-void LauKMatrixPropagator::updateScattSVPTerm(const Double_t s)
+void LauKMatrixPropagator::updateScattSVPTerm( const Double_t s )
{
- // Update the scattering "slowly-varying part" (SVP)
- Double_t s0Scatt = s0Scatt_.unblindValue();
- scattSVP_ = this->calcSVPTerm(s, s0Scatt);
+ // Update the scattering "slowly-varying part" (SVP)
+ Double_t s0Scatt = s0Scatt_.unblindValue();
+ scattSVP_ = this->calcSVPTerm( s, s0Scatt );
}
-void LauKMatrixPropagator::updateProdSVPTerm(const Double_t s)
+void LauKMatrixPropagator::updateProdSVPTerm( const Double_t s )
{
- // Update the production "slowly-varying part" (SVP)
- Double_t s0Prod = s0Prod_.unblindValue();
- prodSVP_ = this->calcSVPTerm(s, s0Prod);
+ // Update the production "slowly-varying part" (SVP)
+ Double_t s0Prod = s0Prod_.unblindValue();
+ prodSVP_ = this->calcSVPTerm( s, s0Prod );
}
-void LauKMatrixPropagator::updateAdlerZeroFactor(const Double_t s)
+void LauKMatrixPropagator::updateAdlerZeroFactor( const Double_t s )
{
- // Calculate the multiplicative factor containing various Adler zero
- // constants.
- adlerZeroFactor_ = 0.0;
-
- Double_t sA0Val = sA0_.unblindValue();
- Double_t deltaS = s - sA0Val;
- if (TMath::Abs(deltaS) > 1e-6) {
- adlerZeroFactor_ = (s - sAConst_)*(1.0 - sA0Val)/deltaS;
- }
+ // Calculate the multiplicative factor containing various Adler zero
+ // constants.
+ adlerZeroFactor_ = 0.0;
+ Double_t sA0Val = sA0_.unblindValue();
+ Double_t deltaS = s - sA0Val;
+ if ( TMath::Abs( deltaS ) > 1e-6 ) {
+ adlerZeroFactor_ = ( s - sAConst_ ) * ( 1.0 - sA0Val ) / deltaS;
+ }
}
-void LauKMatrixPropagator::calcGammaMatrix(const Double_t s)
+void LauKMatrixPropagator::calcGammaMatrix( const Double_t s )
{
- // Calculate the gamma angular momentum barrier matrix
- // for the given invariant mass squared quantity, s.
-
- // Initialise all entries to zero
- GammaMatrix_.Zero();
+ // Calculate the gamma angular momentum barrier matrix
+ // for the given invariant mass squared quantity, s.
- Double_t gamma(0.0);
+ // Initialise all entries to zero
+ GammaMatrix_.Zero();
- for (Int_t iChannel (0); iChannel < nChannels_; ++iChannel) {
+ Double_t gamma( 0.0 );
- if ( L_[iChannel] != 0 ) {
- gamma = this->calcGamma(iChannel,s);
- } else {
- gamma = 1.0; // S-wave
- }
-
- if (verbose_) {
- cout<<"GammaMatrix("<<iChannel<<", "<<iChannel<<") = "<<gamma<<endl;
- }
+ for ( Int_t iChannel( 0 ); iChannel < nChannels_; ++iChannel ) {
- GammaMatrix_(iChannel, iChannel) = gamma;
+ if ( L_[iChannel] != 0 ) {
+ gamma = this->calcGamma( iChannel, s );
+ } else {
+ gamma = 1.0; // S-wave
+ }
- }
+ if ( verbose_ ) {
+ cout << "GammaMatrix(" << iChannel << ", " << iChannel << ") = " << gamma << endl;
+ }
+ GammaMatrix_( iChannel, iChannel ) = gamma;
+ }
}
-Double_t LauKMatrixPropagator::calcGamma(const Int_t iCh, const Double_t s) const
+Double_t LauKMatrixPropagator::calcGamma( const Int_t iCh, const Double_t s ) const
{
- // Calculate the barrier factor
- Double_t gamma(0.0);
+ // Calculate the barrier factor
+ Double_t gamma( 0.0 );
- LauKMatrixPropagator::KMatrixChannels phaseSpaceIndex = phaseSpaceTypes_[iCh];
+ LauKMatrixPropagator::KMatrixChannels phaseSpaceIndex = phaseSpaceTypes_[iCh];
- LauComplex rho = getRho(s,phaseSpaceIndex);
- Double_t q = 0.5 * sqrt(s) * rho.abs();
+ LauComplex rho = getRho( s, phaseSpaceIndex );
+ Double_t q = 0.5 * sqrt( s ) * rho.abs();
- gamma = pow(q,L_[iCh]);
- if (includeBWBarrierFactor_)
- {
- gamma /= pow( q*q + gamAInvRadSq_[iCh] , L_[iCh]/2. );
- }
+ gamma = pow( q, L_[iCh] );
+ if ( includeBWBarrierFactor_ ) {
+ gamma /= pow( q * q + gamAInvRadSq_[iCh], L_[iCh] / 2. );
+ }
- if(verbose_)
- {
- std::cout << "In LauKMatrixPropagator::calcGamma(iCh=" << iCh << ", s=" << s << ", prop). ";
- std::cout << "|q(iCh="<<iCh<<")|: " << q << std::endl;
- }
+ if ( verbose_ ) {
+ std::cout << "In LauKMatrixPropagator::calcGamma(iCh=" << iCh << ", s=" << s << ", prop). ";
+ std::cout << "|q(iCh=" << iCh << ")|: " << q << std::endl;
+ }
- return gamma;
+ return gamma;
}
-void LauKMatrixPropagator::calcRhoMatrix(const Double_t s)
+void LauKMatrixPropagator::calcRhoMatrix( const Double_t s )
{
- // Calculate the real and imaginary part of the phase space density
- // diagonal matrix for the given invariant mass squared quantity, s.
- // The matrix can be complex if s is below threshold (so that
- // the amplitude continues analytically).
-
- // Initialise all entries to zero
- ReRhoMatrix_.Zero(); ImRhoMatrix_.Zero();
+ // Calculate the real and imaginary part of the phase space density
+ // diagonal matrix for the given invariant mass squared quantity, s.
+ // The matrix can be complex if s is below threshold (so that
+ // the amplitude continues analytically).
- for (Int_t iChannel (0); iChannel < nChannels_; ++iChannel) {
+ // Initialise all entries to zero
+ ReRhoMatrix_.Zero();
+ ImRhoMatrix_.Zero();
- LauKMatrixPropagator::KMatrixChannels phaseSpaceIndex = phaseSpaceTypes_[iChannel];
+ for ( Int_t iChannel( 0 ); iChannel < nChannels_; ++iChannel ) {
- LauComplex rho = getRho(s, phaseSpaceIndex);
+ LauKMatrixPropagator::KMatrixChannels phaseSpaceIndex = phaseSpaceTypes_[iChannel];
- if (verbose_) {
- cout<<"ReRhoMatrix("<<iChannel<<", "<<iChannel<<") = "<<rho.re()<<endl;
- cout<<"ImRhoMatrix("<<iChannel<<", "<<iChannel<<") = "<<rho.im()<<endl;
- }
+ LauComplex rho = getRho( s, phaseSpaceIndex );
- ReRhoMatrix_(iChannel, iChannel) = rho.re();
- ImRhoMatrix_(iChannel, iChannel) = rho.im();
-
- }
+ if ( verbose_ ) {
+ cout << "ReRhoMatrix(" << iChannel << ", " << iChannel << ") = " << rho.re() << endl;
+ cout << "ImRhoMatrix(" << iChannel << ", " << iChannel << ") = " << rho.im() << endl;
+ }
+ ReRhoMatrix_( iChannel, iChannel ) = rho.re();
+ ImRhoMatrix_( iChannel, iChannel ) = rho.im();
+ }
}
-LauComplex LauKMatrixPropagator::getRho(const Double_t s, const LauKMatrixPropagator::KMatrixChannels phaseSpaceIndex) const
+LauComplex LauKMatrixPropagator::getRho( const Double_t s,
+ const LauKMatrixPropagator::KMatrixChannels phaseSpaceIndex ) const
{
- LauComplex rho(0.0, 0.0);
- switch (phaseSpaceIndex)
- {
- case LauKMatrixPropagator::KMatrixChannels::PiPi :
- rho = this->calcPiPiRho(s);
- break;
- case LauKMatrixPropagator::KMatrixChannels::KK :
- rho = this->calcKKRho(s);
- break;
- case LauKMatrixPropagator::KMatrixChannels::FourPi :
- rho = this->calcFourPiRho(s);
- break;
- case LauKMatrixPropagator::KMatrixChannels::EtaEta :
- rho = this->calcEtaEtaRho(s);
- break;
- case LauKMatrixPropagator::KMatrixChannels::EtaEtaP :
- rho = this->calcEtaEtaPRho(s);
- break;
- case LauKMatrixPropagator::KMatrixChannels::KPi :
- rho = this->calcKPiRho(s);
- break;
- case LauKMatrixPropagator::KMatrixChannels::KEtaP :
- rho = this->calcKEtaPRho(s);
- break;
- case LauKMatrixPropagator::KMatrixChannels::KThreePi :
- rho = this->calcKThreePiRho(s);
- break;
- case LauKMatrixPropagator::KMatrixChannels::D0K :
- rho = this->calcD0KRho(s);
- break;
- case LauKMatrixPropagator::KMatrixChannels::Dstar0K :
- rho = this->calcDstar0KRho(s);
- break;
- default :
- std::cerr << "ERROR in LauKMatrixPropagator::getRho(...). Phase-space index not recognised for this channel"
- << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- return rho;
+ LauComplex rho( 0.0, 0.0 );
+ switch ( phaseSpaceIndex ) {
+ case LauKMatrixPropagator::KMatrixChannels::PiPi :
+ rho = this->calcPiPiRho( s );
+ break;
+ case LauKMatrixPropagator::KMatrixChannels::KK :
+ rho = this->calcKKRho( s );
+ break;
+ case LauKMatrixPropagator::KMatrixChannels::FourPi :
+ rho = this->calcFourPiRho( s );
+ break;
+ case LauKMatrixPropagator::KMatrixChannels::EtaEta :
+ rho = this->calcEtaEtaRho( s );
+ break;
+ case LauKMatrixPropagator::KMatrixChannels::EtaEtaP :
+ rho = this->calcEtaEtaPRho( s );
+ break;
+ case LauKMatrixPropagator::KMatrixChannels::KPi :
+ rho = this->calcKPiRho( s );
+ break;
+ case LauKMatrixPropagator::KMatrixChannels::KEtaP :
+ rho = this->calcKEtaPRho( s );
+ break;
+ case LauKMatrixPropagator::KMatrixChannels::KThreePi :
+ rho = this->calcKThreePiRho( s );
+ break;
+ case LauKMatrixPropagator::KMatrixChannels::D0K :
+ rho = this->calcD0KRho( s );
+ break;
+ case LauKMatrixPropagator::KMatrixChannels::Dstar0K :
+ rho = this->calcDstar0KRho( s );
+ break;
+ default :
+ std::cerr << "ERROR in LauKMatrixPropagator::getRho(...). Phase-space index not recognised for this channel"
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ return rho;
}
-LauComplex LauKMatrixPropagator::calcD0KRho(const Double_t s) const
+LauComplex LauKMatrixPropagator::calcD0KRho( const Double_t s ) const
{
- // Calculate the D0K+ phase space factor
- LauComplex rho(0.0, 0.0);
- if (TMath::Abs(s) < 1e-10) {return rho;}
-
- Double_t sqrtTerm1 = (-mD0KSumSq_/s) + 1.0;
- Double_t sqrtTerm2 = (-mD0KDiffSq_/s) + 1.0;
- Double_t sqrtTerm = sqrtTerm1*sqrtTerm2;
- if (sqrtTerm < 0.0) {
- rho.setImagPart( TMath::Sqrt(-sqrtTerm) );
- } else {
- rho.setRealPart( TMath::Sqrt(sqrtTerm) );
- }
-
- return rho;
+ // Calculate the D0K+ phase space factor
+ LauComplex rho( 0.0, 0.0 );
+ if ( TMath::Abs( s ) < 1e-10 ) {
+ return rho;
+ }
+
+ Double_t sqrtTerm1 = ( -mD0KSumSq_ / s ) + 1.0;
+ Double_t sqrtTerm2 = ( -mD0KDiffSq_ / s ) + 1.0;
+ Double_t sqrtTerm = sqrtTerm1 * sqrtTerm2;
+ if ( sqrtTerm < 0.0 ) {
+ rho.setImagPart( TMath::Sqrt( -sqrtTerm ) );
+ } else {
+ rho.setRealPart( TMath::Sqrt( sqrtTerm ) );
+ }
+
+ return rho;
}
-LauComplex LauKMatrixPropagator::calcDstar0KRho(const Double_t s) const
+LauComplex LauKMatrixPropagator::calcDstar0KRho( const Double_t s ) const
{
- // Calculate the Dstar0K+ phase space factor
- LauComplex rho(0.0, 0.0);
- if (TMath::Abs(s) < 1e-10) {return rho;}
-
- Double_t sqrtTerm1 = (-mDstar0KSumSq_/s) + 1.0;
- Double_t sqrtTerm2 = (-mDstar0KDiffSq_/s) + 1.0;
- Double_t sqrtTerm = sqrtTerm1*sqrtTerm2;
- if (sqrtTerm < 0.0) {
- rho.setImagPart( TMath::Sqrt(-sqrtTerm) );
- } else {
- rho.setRealPart( TMath::Sqrt(sqrtTerm) );
- }
-
- return rho;
+ // Calculate the Dstar0K+ phase space factor
+ LauComplex rho( 0.0, 0.0 );
+ if ( TMath::Abs( s ) < 1e-10 ) {
+ return rho;
+ }
+
+ Double_t sqrtTerm1 = ( -mDstar0KSumSq_ / s ) + 1.0;
+ Double_t sqrtTerm2 = ( -mDstar0KDiffSq_ / s ) + 1.0;
+ Double_t sqrtTerm = sqrtTerm1 * sqrtTerm2;
+ if ( sqrtTerm < 0.0 ) {
+ rho.setImagPart( TMath::Sqrt( -sqrtTerm ) );
+ } else {
+ rho.setRealPart( TMath::Sqrt( sqrtTerm ) );
+ }
+
+ return rho;
}
-LauComplex LauKMatrixPropagator::calcPiPiRho(const Double_t s) const
+LauComplex LauKMatrixPropagator::calcPiPiRho( const Double_t s ) const
{
- // Calculate the pipi phase space factor
- LauComplex rho(0.0, 0.0);
- if (TMath::Abs(s) < 1e-10) {return rho;}
-
- Double_t sqrtTerm = (-m2piSq_/s) + 1.0;
- if (sqrtTerm < 0.0) {
- rho.setImagPart( TMath::Sqrt(-sqrtTerm) );
- } else {
- rho.setRealPart( TMath::Sqrt(sqrtTerm) );
- }
-
- return rho;
+ // Calculate the pipi phase space factor
+ LauComplex rho( 0.0, 0.0 );
+ if ( TMath::Abs( s ) < 1e-10 ) {
+ return rho;
+ }
+
+ Double_t sqrtTerm = ( -m2piSq_ / s ) + 1.0;
+ if ( sqrtTerm < 0.0 ) {
+ rho.setImagPart( TMath::Sqrt( -sqrtTerm ) );
+ } else {
+ rho.setRealPart( TMath::Sqrt( sqrtTerm ) );
+ }
+
+ return rho;
}
-LauComplex LauKMatrixPropagator::calcKKRho(const Double_t s) const
+LauComplex LauKMatrixPropagator::calcKKRho( const Double_t s ) const
{
- // Calculate the KK phase space factor
- LauComplex rho(0.0, 0.0);
- if (TMath::Abs(s) < 1e-10) {return rho;}
-
- Double_t sqrtTerm = (-m2KSq_/s) + 1.0;
- if (sqrtTerm < 0.0) {
- rho.setImagPart( TMath::Sqrt(-sqrtTerm) );
- } else {
- rho.setRealPart( TMath::Sqrt(sqrtTerm) );
- }
-
- return rho;
+ // Calculate the KK phase space factor
+ LauComplex rho( 0.0, 0.0 );
+ if ( TMath::Abs( s ) < 1e-10 ) {
+ return rho;
+ }
+
+ Double_t sqrtTerm = ( -m2KSq_ / s ) + 1.0;
+ if ( sqrtTerm < 0.0 ) {
+ rho.setImagPart( TMath::Sqrt( -sqrtTerm ) );
+ } else {
+ rho.setRealPart( TMath::Sqrt( sqrtTerm ) );
+ }
+
+ return rho;
}
-LauComplex LauKMatrixPropagator::calcFourPiRho(const Double_t s) const
+LauComplex LauKMatrixPropagator::calcFourPiRho( const Double_t s ) const
{
- // Calculate the 4pi phase space factor. This uses a 6th-order polynomial
- // parameterisation that approximates the multi-body phase space double integral
- // defined in Eq 4 of the A&S paper hep-ph/0204328. This form agrees with the
- // BaBar model (another 6th order polynomial from s^4 down to 1/s^2), but avoids the
- // exponential increase at small values of s (~< 0.1) arising from 1/s and 1/s^2.
- // Eq 4 is evaluated for each value of s by assuming incremental steps of 1e-3 GeV^2
- // for s1 and s2, the invariant energy squared of each of the di-pion states,
- // with the integration limits of s1 = (2*mpi)^2 to (sqrt(s) - 2*mpi)^2 and
- // s2 = (2*mpi)^2 to (sqrt(s) - sqrt(s1))^2. The mass M of the rho is taken to be
- // 0.775 GeV and the energy-dependent width of the 4pi system
- // Gamma(s) = gamma_0*rho1^3(s), where rho1 = sqrt(1.0 - 4*mpiSq/s) and gamma_0 is
- // the "width" of the 4pi state at s = 1, which is taken to be 0.3 GeV
- // (~75% of the total width from PDG estimates of the f0(1370) -> 4pi state).
- // The normalisation term rho_0 is found by ensuring that the phase space integral
- // at s = 1 is equal to sqrt(1.0 - 16*mpiSq/s). Note that the exponent for this
- // factor in hep-ph/0204328 is wrong; it should be 0.5, i.e. sqrt, not n = 1 to 5.
- // Plotting the value of this double integral as a function of s can then be fitted
- // to a 6th-order polynomial (for s < 1), which is the result used below
-
- LauComplex rho(0.0, 0.0);
- if (TMath::Abs(s) < 1e-10) {return rho;}
-
- if (s <= 1.0) {
- Double_t rhoTerm = ((1.07885*s + 0.13655)*s - 0.29744)*s - 0.20840;
- rhoTerm = ((rhoTerm*s + 0.13851)*s - 0.01933)*s + 0.00051;
- // For some values of s (below 2*mpi), this term is a very small
- // negative number. Check for this and set the rho term to zero.
- if (rhoTerm < 0.0) {rhoTerm = 0.0;}
- rho.setRealPart( rhoTerm );
- } else {
- rho.setRealPart( TMath::Sqrt(1.0 - (fourPiFactor1_/s)) );
- }
-
- return rho;
+ // Calculate the 4pi phase space factor. This uses a 6th-order polynomial
+ // parameterisation that approximates the multi-body phase space double integral
+ // defined in Eq 4 of the A&S paper hep-ph/0204328. This form agrees with the
+ // BaBar model (another 6th order polynomial from s^4 down to 1/s^2), but avoids the
+ // exponential increase at small values of s (~< 0.1) arising from 1/s and 1/s^2.
+ // Eq 4 is evaluated for each value of s by assuming incremental steps of 1e-3 GeV^2
+ // for s1 and s2, the invariant energy squared of each of the di-pion states,
+ // with the integration limits of s1 = (2*mpi)^2 to (sqrt(s) - 2*mpi)^2 and
+ // s2 = (2*mpi)^2 to (sqrt(s) - sqrt(s1))^2. The mass M of the rho is taken to be
+ // 0.775 GeV and the energy-dependent width of the 4pi system
+ // Gamma(s) = gamma_0*rho1^3(s), where rho1 = sqrt(1.0 - 4*mpiSq/s) and gamma_0 is
+ // the "width" of the 4pi state at s = 1, which is taken to be 0.3 GeV
+ // (~75% of the total width from PDG estimates of the f0(1370) -> 4pi state).
+ // The normalisation term rho_0 is found by ensuring that the phase space integral
+ // at s = 1 is equal to sqrt(1.0 - 16*mpiSq/s). Note that the exponent for this
+ // factor in hep-ph/0204328 is wrong; it should be 0.5, i.e. sqrt, not n = 1 to 5.
+ // Plotting the value of this double integral as a function of s can then be fitted
+ // to a 6th-order polynomial (for s < 1), which is the result used below
+
+ LauComplex rho( 0.0, 0.0 );
+ if ( TMath::Abs( s ) < 1e-10 ) {
+ return rho;
+ }
+
+ if ( s <= 1.0 ) {
+ Double_t rhoTerm = ( ( 1.07885 * s + 0.13655 ) * s - 0.29744 ) * s - 0.20840;
+ rhoTerm = ( ( rhoTerm * s + 0.13851 ) * s - 0.01933 ) * s + 0.00051;
+ // For some values of s (below 2*mpi), this term is a very small
+ // negative number. Check for this and set the rho term to zero.
+ if ( rhoTerm < 0.0 ) {
+ rhoTerm = 0.0;
+ }
+ rho.setRealPart( rhoTerm );
+ } else {
+ rho.setRealPart( TMath::Sqrt( 1.0 - ( fourPiFactor1_ / s ) ) );
+ }
+
+ return rho;
}
-LauComplex LauKMatrixPropagator::calcEtaEtaRho(const Double_t s) const
+LauComplex LauKMatrixPropagator::calcEtaEtaRho( const Double_t s ) const
{
- // Calculate the eta-eta phase space factor
- LauComplex rho(0.0, 0.0);
- if (TMath::Abs(s) < 1e-10) {return rho;}
-
- Double_t sqrtTerm = (-m2EtaSq_/s) + 1.0;
- if (sqrtTerm < 0.0) {
- rho.setImagPart( TMath::Sqrt(-sqrtTerm) );
- } else {
- rho.setRealPart( TMath::Sqrt(sqrtTerm) );
- }
-
- return rho;
+ // Calculate the eta-eta phase space factor
+ LauComplex rho( 0.0, 0.0 );
+ if ( TMath::Abs( s ) < 1e-10 ) {
+ return rho;
+ }
+
+ Double_t sqrtTerm = ( -m2EtaSq_ / s ) + 1.0;
+ if ( sqrtTerm < 0.0 ) {
+ rho.setImagPart( TMath::Sqrt( -sqrtTerm ) );
+ } else {
+ rho.setRealPart( TMath::Sqrt( sqrtTerm ) );
+ }
+
+ return rho;
}
-LauComplex LauKMatrixPropagator::calcEtaEtaPRho(const Double_t s) const
+LauComplex LauKMatrixPropagator::calcEtaEtaPRho( const Double_t s ) const
{
- // Calculate the eta-eta' phase space factor. Note that the
- // mass difference term m_eta - m_eta' is not included,
- // since this corresponds to a "t or u-channel crossing",
- // which means that we cannot simply analytically continue
- // this part of the phase space factor below threshold, which
- // we can do for s-channel contributions. This is actually an
- // unsolved problem, e.g. see Guo et al 1409.8652, and
- // Danilkin et al 1409.7708. Anisovich and Sarantsev in
- // hep-ph/0204328 "solve" this issue by setting the mass
- // difference term to unity, which is what we do here...
-
- LauComplex rho(0.0, 0.0);
- if (TMath::Abs(s) < 1e-10) {return rho;}
-
- Double_t sqrtTerm = (-mEtaEtaPSumSq_/s) + 1.0;
- if (sqrtTerm < 0.0) {
- rho.setImagPart( TMath::Sqrt(-sqrtTerm) );
- } else {
- rho.setRealPart( TMath::Sqrt(sqrtTerm) );
- }
-
- return rho;
+ // Calculate the eta-eta' phase space factor. Note that the
+ // mass difference term m_eta - m_eta' is not included,
+ // since this corresponds to a "t or u-channel crossing",
+ // which means that we cannot simply analytically continue
+ // this part of the phase space factor below threshold, which
+ // we can do for s-channel contributions. This is actually an
+ // unsolved problem, e.g. see Guo et al 1409.8652, and
+ // Danilkin et al 1409.7708. Anisovich and Sarantsev in
+ // hep-ph/0204328 "solve" this issue by setting the mass
+ // difference term to unity, which is what we do here...
+
+ LauComplex rho( 0.0, 0.0 );
+ if ( TMath::Abs( s ) < 1e-10 ) {
+ return rho;
+ }
+
+ Double_t sqrtTerm = ( -mEtaEtaPSumSq_ / s ) + 1.0;
+ if ( sqrtTerm < 0.0 ) {
+ rho.setImagPart( TMath::Sqrt( -sqrtTerm ) );
+ } else {
+ rho.setRealPart( TMath::Sqrt( sqrtTerm ) );
+ }
+
+ return rho;
}
-
-LauComplex LauKMatrixPropagator::calcKPiRho(const Double_t s) const
+LauComplex LauKMatrixPropagator::calcKPiRho( const Double_t s ) const
{
- // Calculate the K-pi phase space factor
- LauComplex rho(0.0, 0.0);
- if (TMath::Abs(s) < 1e-10) {return rho;}
-
- Double_t sqrtTerm1 = (-mKpiSumSq_/s) + 1.0;
- Double_t sqrtTerm2 = (-mKpiDiffSq_/s) + 1.0;
- Double_t sqrtTerm = sqrtTerm1*sqrtTerm2;
- if (sqrtTerm < 0.0) {
- rho.setImagPart( TMath::Sqrt(-sqrtTerm) );
- } else {
- rho.setRealPart( TMath::Sqrt(sqrtTerm) );
- }
-
- return rho;
+ // Calculate the K-pi phase space factor
+ LauComplex rho( 0.0, 0.0 );
+ if ( TMath::Abs( s ) < 1e-10 ) {
+ return rho;
+ }
+
+ Double_t sqrtTerm1 = ( -mKpiSumSq_ / s ) + 1.0;
+ Double_t sqrtTerm2 = ( -mKpiDiffSq_ / s ) + 1.0;
+ Double_t sqrtTerm = sqrtTerm1 * sqrtTerm2;
+ if ( sqrtTerm < 0.0 ) {
+ rho.setImagPart( TMath::Sqrt( -sqrtTerm ) );
+ } else {
+ rho.setRealPart( TMath::Sqrt( sqrtTerm ) );
+ }
+
+ return rho;
}
-LauComplex LauKMatrixPropagator::calcKEtaPRho(const Double_t s) const
+LauComplex LauKMatrixPropagator::calcKEtaPRho( const Double_t s ) const
{
- // Calculate the K-eta' phase space factor
- LauComplex rho(0.0, 0.0);
- if (TMath::Abs(s) < 1e-10) {return rho;}
-
- Double_t sqrtTerm1 = (-mKEtaPSumSq_/s) + 1.0;
- Double_t sqrtTerm2 = (-mKEtaPDiffSq_/s) + 1.0;
- Double_t sqrtTerm = sqrtTerm1*sqrtTerm2;
- if (sqrtTerm < 0.0) {
- rho.setImagPart( TMath::Sqrt(-sqrtTerm) );
- } else {
- rho.setRealPart( TMath::Sqrt(sqrtTerm) );
- }
-
- return rho;
+ // Calculate the K-eta' phase space factor
+ LauComplex rho( 0.0, 0.0 );
+ if ( TMath::Abs( s ) < 1e-10 ) {
+ return rho;
+ }
+
+ Double_t sqrtTerm1 = ( -mKEtaPSumSq_ / s ) + 1.0;
+ Double_t sqrtTerm2 = ( -mKEtaPDiffSq_ / s ) + 1.0;
+ Double_t sqrtTerm = sqrtTerm1 * sqrtTerm2;
+ if ( sqrtTerm < 0.0 ) {
+ rho.setImagPart( TMath::Sqrt( -sqrtTerm ) );
+ } else {
+ rho.setRealPart( TMath::Sqrt( sqrtTerm ) );
+ }
+
+ return rho;
}
-LauComplex LauKMatrixPropagator::calcKThreePiRho(const Double_t s) const
+LauComplex LauKMatrixPropagator::calcKThreePiRho( const Double_t s ) const
{
- // Calculate the Kpipipi + multimeson phase space factor.
- // Use the simplest definition in hep-ph/9705401 (Eq 14), which is the form
- // used for the rest of that paper (thankfully, the amplitude does not depend
- // significantly on the form used for the K3pi phase space factor).
- LauComplex rho(0.0, 0.0);
- if (TMath::Abs(s) < 1e-10) {return rho;}
-
- if (s < 1.44) {
-
- Double_t powerTerm = (-mK3piDiffSq_/s) + 1.0;
- if (powerTerm < 0.0) {
- rho.setImagPart( k3piFactor_*TMath::Power(-powerTerm, 2.5) );
- } else {
- rho.setRealPart( k3piFactor_*TMath::Power(powerTerm, 2.5) );
- }
-
- } else {
- rho.setRealPart( 1.0 );
- }
-
- return rho;
+ // Calculate the Kpipipi + multimeson phase space factor.
+ // Use the simplest definition in hep-ph/9705401 (Eq 14), which is the form
+ // used for the rest of that paper (thankfully, the amplitude does not depend
+ // significantly on the form used for the K3pi phase space factor).
+ LauComplex rho( 0.0, 0.0 );
+ if ( TMath::Abs( s ) < 1e-10 ) {
+ return rho;
+ }
+
+ if ( s < 1.44 ) {
+
+ Double_t powerTerm = ( -mK3piDiffSq_ / s ) + 1.0;
+ if ( powerTerm < 0.0 ) {
+ rho.setImagPart( k3piFactor_ * TMath::Power( -powerTerm, 2.5 ) );
+ } else {
+ rho.setRealPart( k3piFactor_ * TMath::Power( powerTerm, 2.5 ) );
+ }
+
+ } else {
+ rho.setRealPart( 1.0 );
+ }
+
+ return rho;
}
-Bool_t LauKMatrixPropagator::checkPhaseSpaceType(const Int_t phaseSpaceInt) const
+Bool_t LauKMatrixPropagator::checkPhaseSpaceType( const Int_t phaseSpaceInt ) const
{
- Bool_t passed(kFALSE);
+ Bool_t passed( kFALSE );
- if (phaseSpaceInt >= 1 && phaseSpaceInt < static_cast<Int_t>(LauKMatrixPropagator::KMatrixChannels::TotChannels)) {
- passed = kTRUE;
- }
+ if ( phaseSpaceInt >= 1 &&
+ phaseSpaceInt < static_cast<Int_t>( LauKMatrixPropagator::KMatrixChannels::TotChannels ) ) {
+ passed = kTRUE;
+ }
- return passed;
+ return passed;
}
-LauComplex LauKMatrixPropagator::getTransitionAmp(const Double_t s, const Int_t channel)
+LauComplex LauKMatrixPropagator::getTransitionAmp( const Double_t s, const Int_t channel )
{
- // Get the complex (unitary) transition amplitude T for the given channel
- LauComplex TAmp(0.0, 0.0);
+ // Get the complex (unitary) transition amplitude T for the given channel
+ LauComplex TAmp( 0.0, 0.0 );
- if (channel <= 0 || channel > nChannels_) {return TAmp;}
+ if ( channel <= 0 || channel > nChannels_ ) {
+ return TAmp;
+ }
- this->getTMatrix(s);
-
- TAmp.setRealPart(ReTMatrix_[index_][channel-1]);
- TAmp.setImagPart(ImTMatrix_[index_][channel-1]);
+ this->getTMatrix( s );
- return TAmp;
+ TAmp.setRealPart( ReTMatrix_[index_][channel - 1] );
+ TAmp.setImagPart( ImTMatrix_[index_][channel - 1] );
+ return TAmp;
}
-LauComplex LauKMatrixPropagator::getPhaseSpaceTerm(const Double_t s, const Int_t channel)
+LauComplex LauKMatrixPropagator::getPhaseSpaceTerm( const Double_t s, const Int_t channel )
{
- // Get the complex (unitary) transition amplitude T for the given channel
- LauComplex rho(0.0, 0.0);
+ // Get the complex (unitary) transition amplitude T for the given channel
+ LauComplex rho( 0.0, 0.0 );
- if (channel <= 0 || channel > nChannels_) {return rho;}
+ if ( channel <= 0 || channel > nChannels_ ) {
+ return rho;
+ }
- // If s has changed from the previous value, recalculate rho
- if (TMath::Abs(s - previousS_) > 1e-6*s) {
- this->calcRhoMatrix(s);
- }
+ // If s has changed from the previous value, recalculate rho
+ if ( TMath::Abs( s - previousS_ ) > 1e-6 * s ) {
+ this->calcRhoMatrix( s );
+ }
- rho.setRealPart(ReRhoMatrix_[channel][channel-1]);
- rho.setImagPart(ImRhoMatrix_[channel][channel-1]);
-
- return rho;
+ rho.setRealPart( ReRhoMatrix_[channel][channel - 1] );
+ rho.setImagPart( ImRhoMatrix_[channel][channel - 1] );
+ return rho;
}
-void LauKMatrixPropagator::getTMatrix(const LauKinematics* kinematics) {
-
- // Find the unitary T matrix, where T = [sqrt(rho)]^{*} T_hat sqrt(rho),
- // and T_hat = (I - i K rho)^-1 * K is the Lorentz-invariant T matrix,
- // which has phase-space factors included (rho). This function is not
- // needed to calculate the K-matrix amplitudes, but allows us
- // to check the variation of T as a function of s (kinematics)
-
- if (!kinematics) {return;}
-
- // Get the invariant mass squared (s) from the kinematics object.
- // Use the resPairAmpInt to find which mass-squared combination to use.
- Double_t s(0.0);
-
- if (resPairAmpInt_ == 1) {
- s = kinematics->getm23Sq();
- } else if (resPairAmpInt_ == 2) {
- s = kinematics->getm13Sq();
- } else if (resPairAmpInt_ == 3) {
- s = kinematics->getm12Sq();
- }
-
- this->getTMatrix(s);
+void LauKMatrixPropagator::getTMatrix( const LauKinematics* kinematics )
+{
+ // Find the unitary T matrix, where T = [sqrt(rho)]^{*} T_hat sqrt(rho),
+ // and T_hat = (I - i K rho)^-1 * K is the Lorentz-invariant T matrix,
+ // which has phase-space factors included (rho). This function is not
+ // needed to calculate the K-matrix amplitudes, but allows us
+ // to check the variation of T as a function of s (kinematics)
+
+ if ( ! kinematics ) {
+ return;
+ }
+
+ // Get the invariant mass squared (s) from the kinematics object.
+ // Use the resPairAmpInt to find which mass-squared combination to use.
+ Double_t s( 0.0 );
+
+ if ( resPairAmpInt_ == 1 ) {
+ s = kinematics->getm23Sq();
+ } else if ( resPairAmpInt_ == 2 ) {
+ s = kinematics->getm13Sq();
+ } else if ( resPairAmpInt_ == 3 ) {
+ s = kinematics->getm12Sq();
+ }
+
+ this->getTMatrix( s );
}
-
-void LauKMatrixPropagator::getTMatrix(const Double_t s)
+void LauKMatrixPropagator::getTMatrix( const Double_t s )
{
- // Find the unitary transition T matrix, where
- // T = [sqrt(rho)]^{*} T_hat sqrt(rho), and
- // T_hat = (I - i K rho)^-1 * K is the Lorentz-invariant T matrix,
- // which has phase-space factors included (rho). Note that the first
- // sqrt of the rho matrix is complex conjugated.
-
- // This function is not needed to calculate the K-matrix amplitudes, but
- // allows us to check the variation of T as a function of s (kinematics)
-
- // Initialse the real and imaginary parts of the T matrix to zero
- ReTMatrix_.Zero(); ImTMatrix_.Zero();
-
- if (parametersSet_ == kFALSE) {return;}
-
- // Update K, rho and the propagator (I - i K rho)^-1
- this->updatePropagator(s);
-
- // Find the real and imaginary T_hat matrices
- TMatrixD THatReal = realProp_*ScattKMatrix_;
- TMatrixD THatImag(zeroMatrix_);
- THatImag -= negImagProp_*ScattKMatrix_;
-
- // Find the square-root of the phase space matrix
- this->getSqrtRhoMatrix();
-
- // Let sqrt(rho) = A + iB and T_hat = C + iD
- // => T = A(CA-DB) + B(DA+CB) + i[A(DA+CB) + B(DB-CA)]
- TMatrixD CA(THatReal);
- CA *= ReSqrtRhoMatrix_;
- TMatrixD DA(THatImag);
- DA *= ReSqrtRhoMatrix_;
- TMatrixD CB(THatReal);
- CB *= ImSqrtRhoMatrix_;
- TMatrixD DB(THatImag);
- DB *= ImSqrtRhoMatrix_;
-
- TMatrixD CAmDB(CA);
- CAmDB -= DB;
- TMatrixD DApCB(DA);
- DApCB += CB;
- TMatrixD DBmCA(DB);
- DBmCA -= CA;
-
- // Find the real and imaginary parts of the transition matrix T
- ReTMatrix_ = ReSqrtRhoMatrix_*CAmDB + ImSqrtRhoMatrix_*DApCB;
- ImTMatrix_ = ReSqrtRhoMatrix_*DApCB + ImSqrtRhoMatrix_*DBmCA;
-
+ // Find the unitary transition T matrix, where
+ // T = [sqrt(rho)]^{*} T_hat sqrt(rho), and
+ // T_hat = (I - i K rho)^-1 * K is the Lorentz-invariant T matrix,
+ // which has phase-space factors included (rho). Note that the first
+ // sqrt of the rho matrix is complex conjugated.
+
+ // This function is not needed to calculate the K-matrix amplitudes, but
+ // allows us to check the variation of T as a function of s (kinematics)
+
+ // Initialse the real and imaginary parts of the T matrix to zero
+ ReTMatrix_.Zero();
+ ImTMatrix_.Zero();
+
+ if ( parametersSet_ == kFALSE ) {
+ return;
+ }
+
+ // Update K, rho and the propagator (I - i K rho)^-1
+ this->updatePropagator( s );
+
+ // Find the real and imaginary T_hat matrices
+ TMatrixD THatReal = realProp_ * ScattKMatrix_;
+ TMatrixD THatImag( zeroMatrix_ );
+ THatImag -= negImagProp_ * ScattKMatrix_;
+
+ // Find the square-root of the phase space matrix
+ this->getSqrtRhoMatrix();
+
+ // Let sqrt(rho) = A + iB and T_hat = C + iD
+ // => T = A(CA-DB) + B(DA+CB) + i[A(DA+CB) + B(DB-CA)]
+ TMatrixD CA( THatReal );
+ CA *= ReSqrtRhoMatrix_;
+ TMatrixD DA( THatImag );
+ DA *= ReSqrtRhoMatrix_;
+ TMatrixD CB( THatReal );
+ CB *= ImSqrtRhoMatrix_;
+ TMatrixD DB( THatImag );
+ DB *= ImSqrtRhoMatrix_;
+
+ TMatrixD CAmDB( CA );
+ CAmDB -= DB;
+ TMatrixD DApCB( DA );
+ DApCB += CB;
+ TMatrixD DBmCA( DB );
+ DBmCA -= CA;
+
+ // Find the real and imaginary parts of the transition matrix T
+ ReTMatrix_ = ReSqrtRhoMatrix_ * CAmDB + ImSqrtRhoMatrix_ * DApCB;
+ ImTMatrix_ = ReSqrtRhoMatrix_ * DApCB + ImSqrtRhoMatrix_ * DBmCA;
}
void LauKMatrixPropagator::getSqrtRhoMatrix()
{
- // Find the square root of the (current) phase space matrix so that
- // we can find T = [sqrt(rho)}^{*} T_hat sqrt(rho), where T_hat is the
- // Lorentz-invariant T matrix = (I - i K rho)^-1 * K; note that the first
- // sqrt of rho matrix is complex conjugated
-
- // If rho = rho_i + i rho_r = a + i b, then sqrt(rho) = c + i d, where
- // c = sqrt(0.5*(r+a)) and d = sqrt(0.5(r-a)), where r = sqrt(a^2 + b^2).
- // Since rho is diagonal, then the square root of rho will also be diagonal,
- // with its real and imaginary matrix elements equal to c and d, respectively
-
- // Initialise the real and imaginary parts of the square root of
- // the rho matrix to zero
- ReSqrtRhoMatrix_.Zero(); ImSqrtRhoMatrix_.Zero();
-
- for (Int_t iChannel (0); iChannel < nChannels_; ++iChannel) {
-
- Double_t realRho = ReRhoMatrix_[iChannel][iChannel];
- Double_t imagRho = ImRhoMatrix_[iChannel][iChannel];
-
- Double_t rhoMag = sqrt(realRho*realRho + imagRho*imagRho);
- Double_t rhoSum = rhoMag + realRho;
- Double_t rhoDiff = rhoMag - realRho;
-
- Double_t reSqrtRho(0.0), imSqrtRho(0.0);
- if (rhoSum > 0.0) {reSqrtRho = sqrt(0.5*rhoSum);}
- if (rhoDiff > 0.0) {imSqrtRho = sqrt(0.5*rhoDiff);}
-
- ReSqrtRhoMatrix_[iChannel][iChannel] = reSqrtRho;
- ImSqrtRhoMatrix_[iChannel][iChannel] = imSqrtRho;
-
- }
-
+ // Find the square root of the (current) phase space matrix so that
+ // we can find T = [sqrt(rho)}^{*} T_hat sqrt(rho), where T_hat is the
+ // Lorentz-invariant T matrix = (I - i K rho)^-1 * K; note that the first
+ // sqrt of rho matrix is complex conjugated
+
+ // If rho = rho_i + i rho_r = a + i b, then sqrt(rho) = c + i d, where
+ // c = sqrt(0.5*(r+a)) and d = sqrt(0.5(r-a)), where r = sqrt(a^2 + b^2).
+ // Since rho is diagonal, then the square root of rho will also be diagonal,
+ // with its real and imaginary matrix elements equal to c and d, respectively
+
+ // Initialise the real and imaginary parts of the square root of
+ // the rho matrix to zero
+ ReSqrtRhoMatrix_.Zero();
+ ImSqrtRhoMatrix_.Zero();
+
+ for ( Int_t iChannel( 0 ); iChannel < nChannels_; ++iChannel ) {
+
+ Double_t realRho = ReRhoMatrix_[iChannel][iChannel];
+ Double_t imagRho = ImRhoMatrix_[iChannel][iChannel];
+
+ Double_t rhoMag = sqrt( realRho * realRho + imagRho * imagRho );
+ Double_t rhoSum = rhoMag + realRho;
+ Double_t rhoDiff = rhoMag - realRho;
+
+ Double_t reSqrtRho( 0.0 ), imSqrtRho( 0.0 );
+ if ( rhoSum > 0.0 ) {
+ reSqrtRho = sqrt( 0.5 * rhoSum );
+ }
+ if ( rhoDiff > 0.0 ) {
+ imSqrtRho = sqrt( 0.5 * rhoDiff );
+ }
+
+ ReSqrtRhoMatrix_[iChannel][iChannel] = reSqrtRho;
+ ImSqrtRhoMatrix_[iChannel][iChannel] = imSqrtRho;
+ }
}
-LauComplex LauKMatrixPropagator::getTHat(const Double_t s, const Int_t channel) {
+LauComplex LauKMatrixPropagator::getTHat( const Double_t s, const Int_t channel )
+{
- LauComplex THat(0.0, 0.0);
+ LauComplex THat( 0.0, 0.0 );
- if (channel <= 0 || channel > nChannels_) {return THat;}
+ if ( channel <= 0 || channel > nChannels_ ) {
+ return THat;
+ }
- this->updatePropagator(s);
+ this->updatePropagator( s );
- // Find the real and imaginary T_hat matrices
- TMatrixD THatReal = realProp_*ScattKMatrix_;
- TMatrixD THatImag(zeroMatrix_);
- THatImag -= negImagProp_*ScattKMatrix_;
+ // Find the real and imaginary T_hat matrices
+ TMatrixD THatReal = realProp_ * ScattKMatrix_;
+ TMatrixD THatImag( zeroMatrix_ );
+ THatImag -= negImagProp_ * ScattKMatrix_;
- // Return the specific THat component
- THat.setRealPart(THatReal[index_][channel-1]);
- THat.setImagPart(THatImag[index_][channel-1]);
-
- return THat;
+ // Return the specific THat component
+ THat.setRealPart( THatReal[index_][channel - 1] );
+ THat.setImagPart( THatImag[index_][channel - 1] );
+ return THat;
}
-
diff --git a/src/LauKappaRes.cc b/src/LauKappaRes.cc
index 24834d2..e2f1653 100644
--- a/src/LauKappaRes.cc
+++ b/src/LauKappaRes.cc
@@ -1,299 +1,317 @@
/*
Copyright 2004 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauKappaRes.cc
\brief File containing implementation of LauKappaRes class.
*/
-#include <iostream>
+#include "LauKappaRes.hh"
#include "LauConstants.hh"
-#include "LauKappaRes.hh"
#include "LauResonanceInfo.hh"
+#include <iostream>
-
-LauKappaRes::LauKappaRes(LauResonanceInfo* resInfo, const Int_t resPairAmpInt, const LauDaughters* daughters) :
- LauAbsResonance(resInfo, resPairAmpInt, daughters),
- mSumSq_((LauConstants::mPi+LauConstants::mK)*(LauConstants::mPi+LauConstants::mK)),
- sAdler_(LauConstants::mKSq-0.5*LauConstants::mPiSq),
- b1_(0),
- b2_(0),
- a_(0),
- m0_(0)
+LauKappaRes::LauKappaRes( LauResonanceInfo* resInfo,
+ const Int_t resPairAmpInt,
+ const LauDaughters* daughters ) :
+ LauAbsResonance( resInfo, resPairAmpInt, daughters ),
+ mSumSq_( ( LauConstants::mPi + LauConstants::mK ) * ( LauConstants::mPi + LauConstants::mK ) ),
+ sAdler_( LauConstants::mKSq - 0.5 * LauConstants::mPiSq ),
+ b1_( 0 ),
+ b2_( 0 ),
+ a_( 0 ),
+ m0_( 0 )
{
- // Default constant factors from BES data
- const Double_t b1Val = 24.49;
- const Double_t b2Val = 0.0;
- const Double_t aVal = 2.5;
- const Double_t m0Val = 3.3;
-
- const TString& parNameBase = this->getSanitisedName();
-
- TString b1Name(parNameBase);
- b1Name += "_b1";
- b1_ = resInfo->getExtraParameter( b1Name );
- if ( b1_ == 0 ) {
- b1_ = new LauParameter( b1Name, b1Val, 0.0, 100.0, kTRUE );
- b1_->secondStage(kTRUE);
- resInfo->addExtraParameter( b1_ );
- }
-
- TString b2Name(parNameBase);
- b2Name += "_b2";
- b2_ = resInfo->getExtraParameter( b2Name );
- if ( b2_ == 0 ) {
- b2_ = new LauParameter( b2Name, b2Val, 0.0, 100.0, kTRUE );
- b2_->secondStage(kTRUE);
- resInfo->addExtraParameter( b2_ );
- }
-
- TString aName(parNameBase);
- aName += "_A";
- a_ = resInfo->getExtraParameter( aName );
- if ( a_ == 0 ) {
- a_ = new LauParameter( aName, aVal, 0.0, 10.0, kTRUE );
- a_->secondStage(kTRUE);
- resInfo->addExtraParameter( a_ );
- }
-
- TString m0Name(parNameBase);
- m0Name += "_m0";
- m0_ = resInfo->getExtraParameter( m0Name );
- if ( m0_ == 0 ) {
- m0_ = new LauParameter( m0Name, m0Val, 0.0, 10.0, kTRUE );
- m0_->secondStage(kTRUE);
- resInfo->addExtraParameter( m0_ );
- }
+ // Default constant factors from BES data
+ const Double_t b1Val = 24.49;
+ const Double_t b2Val = 0.0;
+ const Double_t aVal = 2.5;
+ const Double_t m0Val = 3.3;
+
+ const TString& parNameBase = this->getSanitisedName();
+
+ TString b1Name( parNameBase );
+ b1Name += "_b1";
+ b1_ = resInfo->getExtraParameter( b1Name );
+ if ( b1_ == 0 ) {
+ b1_ = new LauParameter( b1Name, b1Val, 0.0, 100.0, kTRUE );
+ b1_->secondStage( kTRUE );
+ resInfo->addExtraParameter( b1_ );
+ }
+
+ TString b2Name( parNameBase );
+ b2Name += "_b2";
+ b2_ = resInfo->getExtraParameter( b2Name );
+ if ( b2_ == 0 ) {
+ b2_ = new LauParameter( b2Name, b2Val, 0.0, 100.0, kTRUE );
+ b2_->secondStage( kTRUE );
+ resInfo->addExtraParameter( b2_ );
+ }
+
+ TString aName( parNameBase );
+ aName += "_A";
+ a_ = resInfo->getExtraParameter( aName );
+ if ( a_ == 0 ) {
+ a_ = new LauParameter( aName, aVal, 0.0, 10.0, kTRUE );
+ a_->secondStage( kTRUE );
+ resInfo->addExtraParameter( a_ );
+ }
+
+ TString m0Name( parNameBase );
+ m0Name += "_m0";
+ m0_ = resInfo->getExtraParameter( m0Name );
+ if ( m0_ == 0 ) {
+ m0_ = new LauParameter( m0Name, m0Val, 0.0, 10.0, kTRUE );
+ m0_->secondStage( kTRUE );
+ resInfo->addExtraParameter( m0_ );
+ }
}
LauKappaRes::~LauKappaRes()
{
}
void LauKappaRes::initialise()
{
- this->checkDaughterTypes();
-
- Double_t resSpin = this->getSpin();
- if (resSpin != 0) {
- std::cerr << "WARNING in LauKappaRes::initialise : Resonance spin is " << resSpin << "." << std::endl;
- std::cerr << " : Kappa amplitude is only for scalers, resetting spin to 0." << std::endl;
- this->changeResonance( -1.0, -1.0, 0 );
- }
+ this->checkDaughterTypes();
+
+ Double_t resSpin = this->getSpin();
+ if ( resSpin != 0 ) {
+ std::cerr << "WARNING in LauKappaRes::initialise : Resonance spin is " << resSpin << "."
+ << std::endl;
+ std::cerr << " : Kappa amplitude is only for scalers, resetting spin to 0."
+ << std::endl;
+ this->changeResonance( -1.0, -1.0, 0 );
+ }
}
void LauKappaRes::checkDaughterTypes() const
{
- // Check that the daughter tracks are K and pi. Otherwise issue a warning.
-
- Int_t resPairAmpInt = this->getPairInt();
- if (resPairAmpInt < 1 || resPairAmpInt > 3) {
- std::cerr << "WARNING in LauKappaRes::checkDaughterTypes : resPairAmpInt = " << resPairAmpInt << " is out of the range [1,2,3]." << std::endl;
- return;
- }
-
- const TString& nameDaug1 = this->getNameDaug1();
- const TString& nameDaug2 = this->getNameDaug2();
- if ( !( nameDaug1.Contains("pi", TString::kIgnoreCase) && nameDaug2.Contains("k", TString::kIgnoreCase) ) ) {
- if ( !( nameDaug2.Contains("pi", TString::kIgnoreCase) && nameDaug1.Contains("k", TString::kIgnoreCase) ) ) {
- std::cerr << "ERROR in LauKappaRes::checkDaughterTypes : Kappa model is using daughters \"" << nameDaug1 << "\" and \"" << nameDaug2 << "\" that are not a kaon and a pion." << std::endl;
- }
- }
+ // Check that the daughter tracks are K and pi. Otherwise issue a warning.
+
+ Int_t resPairAmpInt = this->getPairInt();
+ if ( resPairAmpInt < 1 || resPairAmpInt > 3 ) {
+ std::cerr << "WARNING in LauKappaRes::checkDaughterTypes : resPairAmpInt = " << resPairAmpInt
+ << " is out of the range [1,2,3]." << std::endl;
+ return;
+ }
+
+ const TString& nameDaug1 = this->getNameDaug1();
+ const TString& nameDaug2 = this->getNameDaug2();
+ if ( ! ( nameDaug1.Contains( "pi", TString::kIgnoreCase ) &&
+ nameDaug2.Contains( "k", TString::kIgnoreCase ) ) ) {
+ if ( ! ( nameDaug2.Contains( "pi", TString::kIgnoreCase ) &&
+ nameDaug1.Contains( "k", TString::kIgnoreCase ) ) ) {
+ std::cerr << "ERROR in LauKappaRes::checkDaughterTypes : Kappa model is using daughters \""
+ << nameDaug1 << "\" and \"" << nameDaug2
+ << "\" that are not a kaon and a pion." << std::endl;
+ }
+ }
}
-LauComplex LauKappaRes::resAmp(Double_t mass, Double_t spinTerm)
+LauComplex LauKappaRes::resAmp( Double_t mass, Double_t spinTerm )
{
- // This function returns the complex dynamical amplitude for a Kappa distribution
- // given the invariant mass and cos(helicity) values.
-
- // First check that the appropriate daughters are either pi+pi- or K+K-
- // Check that the daughter tracks are the same type. Otherwise issue a warning
- // and set the type to be pion for the Kappa distribution. Returns the
- // integer defined by the enum LauKappaRes::KappaPartType.
-
- Double_t s = mass*mass; // Invariant mass squared combination for the system
- Double_t rho(0.0); // Phase-space factor
- if (s > mSumSq_) {rho = TMath::Sqrt(1.0 - mSumSq_/s);}
-
- const Double_t m0Val = this->getM0Value();
- const Double_t m0Sq = m0Val * m0Val;
-
- const Double_t aVal = this->getAValue();
- const Double_t b1Val = this->getB1Value();
- const Double_t b2Val = this->getB2Value();
-
- Double_t f = b2Val*s + b1Val; // f(s) function
- Double_t numerator = s - sAdler_;
- Double_t denom = m0Sq - sAdler_;
- Double_t gamma(0.0);
- if (TMath::Abs(denom) > 1e-10 && TMath::Abs(aVal) > 1e-10) {
- // Decay width of the system
- gamma = rho*(numerator/denom)*f*TMath::Exp(-(s - m0Sq)/aVal);
- }
-
- // Now form the complex amplitude - use relativistic BW form (without barrier factors)
- // Note that the M factor in the denominator is not the "pole" at ~500 MeV, but is
- // m0_ = 0.9264, the mass when the phase shift goes through 90 degrees.
-
- Double_t dMSq = m0Sq - s;
- Double_t widthTerm = gamma*m0Val;
- LauComplex resAmplitude(dMSq, widthTerm);
-
- Double_t denomFactor = dMSq*dMSq + widthTerm*widthTerm;
-
- Double_t invDenomFactor = 0.0;
- if (denomFactor > 1e-10) {invDenomFactor = 1.0/denomFactor;}
-
- resAmplitude.rescale(spinTerm*invDenomFactor);
-
- return resAmplitude;
+ // This function returns the complex dynamical amplitude for a Kappa distribution
+ // given the invariant mass and cos(helicity) values.
+
+ // First check that the appropriate daughters are either pi+pi- or K+K-
+ // Check that the daughter tracks are the same type. Otherwise issue a warning
+ // and set the type to be pion for the Kappa distribution. Returns the
+ // integer defined by the enum LauKappaRes::KappaPartType.
+
+ Double_t s = mass * mass; // Invariant mass squared combination for the system
+ Double_t rho( 0.0 ); // Phase-space factor
+ if ( s > mSumSq_ ) {
+ rho = TMath::Sqrt( 1.0 - mSumSq_ / s );
+ }
+
+ const Double_t m0Val = this->getM0Value();
+ const Double_t m0Sq = m0Val * m0Val;
+
+ const Double_t aVal = this->getAValue();
+ const Double_t b1Val = this->getB1Value();
+ const Double_t b2Val = this->getB2Value();
+
+ Double_t f = b2Val * s + b1Val; // f(s) function
+ Double_t numerator = s - sAdler_;
+ Double_t denom = m0Sq - sAdler_;
+ Double_t gamma( 0.0 );
+ if ( TMath::Abs( denom ) > 1e-10 && TMath::Abs( aVal ) > 1e-10 ) {
+ // Decay width of the system
+ gamma = rho * ( numerator / denom ) * f * TMath::Exp( -( s - m0Sq ) / aVal );
+ }
+
+ // Now form the complex amplitude - use relativistic BW form (without barrier factors)
+ // Note that the M factor in the denominator is not the "pole" at ~500 MeV, but is
+ // m0_ = 0.9264, the mass when the phase shift goes through 90 degrees.
+
+ Double_t dMSq = m0Sq - s;
+ Double_t widthTerm = gamma * m0Val;
+ LauComplex resAmplitude( dMSq, widthTerm );
+
+ Double_t denomFactor = dMSq * dMSq + widthTerm * widthTerm;
+
+ Double_t invDenomFactor = 0.0;
+ if ( denomFactor > 1e-10 ) {
+ invDenomFactor = 1.0 / denomFactor;
+ }
+
+ resAmplitude.rescale( spinTerm * invDenomFactor );
+
+ return resAmplitude;
}
const std::vector<LauParameter*>& LauKappaRes::getFloatingParameters()
{
- this->clearFloatingParameters();
+ this->clearFloatingParameters();
- if ( ! this->fixB1Value() ) {
- this->addFloatingParameter( b1_ );
- }
+ if ( ! this->fixB1Value() ) {
+ this->addFloatingParameter( b1_ );
+ }
- if ( ! this->fixB2Value() ) {
- this->addFloatingParameter( b2_ );
- }
+ if ( ! this->fixB2Value() ) {
+ this->addFloatingParameter( b2_ );
+ }
- if ( ! this->fixAValue() ) {
- this->addFloatingParameter( a_ );
- }
+ if ( ! this->fixAValue() ) {
+ this->addFloatingParameter( a_ );
+ }
- if ( ! this->fixM0Value() ) {
- this->addFloatingParameter( m0_ );
- }
+ if ( ! this->fixM0Value() ) {
+ this->addFloatingParameter( m0_ );
+ }
- return this->getParameters();
+ return this->getParameters();
}
-void LauKappaRes::setResonanceParameter(const TString& name, const Double_t value)
+void LauKappaRes::setResonanceParameter( const TString& name, const Double_t value )
{
- // Set various parameters for the lineshape
- if (name == "b1") {
- this->setB1Value(value);
- std::cout << "INFO in LauKappaRes::setResonanceParameter : Setting parameter b1 = " << this->getB1Value() << std::endl;
- }
- else if (name == "b2") {
- this->setB2Value(value);
- std::cout << "INFO in LauKappaRes::setResonanceParameter : Setting parameter b2 = " << this->getB2Value() << std::endl;
- }
- else if (name == "A") {
- this->setAValue(value);
- std::cout << "INFO in LauKappaRes::setResonanceParameter : Setting parameter A = " << this->getAValue() << std::endl;
- }
- else if (name == "m0") {
- this->setM0Value(value);
- std::cout << "INFO in LauKappaRes::setResonanceParameter : Setting parameter m0 = " << this->getM0Value() << std::endl;
- }
- else {
- std::cerr << "WARNING in LauKappaRes::setResonanceParameter: Parameter name not reconised. No parameter changes made." << std::endl;
- }
+ // Set various parameters for the lineshape
+ if ( name == "b1" ) {
+ this->setB1Value( value );
+ std::cout << "INFO in LauKappaRes::setResonanceParameter : Setting parameter b1 = "
+ << this->getB1Value() << std::endl;
+ } else if ( name == "b2" ) {
+ this->setB2Value( value );
+ std::cout << "INFO in LauKappaRes::setResonanceParameter : Setting parameter b2 = "
+ << this->getB2Value() << std::endl;
+ } else if ( name == "A" ) {
+ this->setAValue( value );
+ std::cout << "INFO in LauKappaRes::setResonanceParameter : Setting parameter A = "
+ << this->getAValue() << std::endl;
+ } else if ( name == "m0" ) {
+ this->setM0Value( value );
+ std::cout << "INFO in LauKappaRes::setResonanceParameter : Setting parameter m0 = "
+ << this->getM0Value() << std::endl;
+ } else {
+ std::cerr << "WARNING in LauKappaRes::setResonanceParameter: Parameter name not reconised. No parameter changes made."
+ << std::endl;
+ }
}
-void LauKappaRes::floatResonanceParameter(const TString& name)
+void LauKappaRes::floatResonanceParameter( const TString& name )
{
- if (name == "b1") {
- if ( b1_->fixed() ) {
- b1_->fixed( kFALSE );
- this->addFloatingParameter( b1_ );
- } else {
- std::cerr << "WARNING in LauKappaRes::floatResonanceParameter: Parameter already floating. No parameter changes made." << std::endl;
- }
- } else if (name == "b2") {
- if ( b2_->fixed() ) {
- b2_->fixed( kFALSE );
- this->addFloatingParameter( b2_ );
- } else {
- std::cerr << "WARNING in LauKappaRes::floatResonanceParameter: Parameter already floating. No parameter changes made." << std::endl;
- }
- } else if (name == "A") {
- if ( a_->fixed() ) {
- a_->fixed( kFALSE );
- this->addFloatingParameter( a_ );
- } else {
- std::cerr << "WARNING in LauKappaRes::floatResonanceParameter: Parameter already floating. No parameter changes made." << std::endl;
- }
- } else if (name == "m0") {
- if ( m0_->fixed() ) {
- m0_->fixed( kFALSE );
- this->addFloatingParameter( m0_ );
- } else {
- std::cerr << "WARNING in LauKappaRes::floatResonanceParameter: Parameter already floating. No parameter changes made." << std::endl;
- }
- } else {
- std::cerr << "WARNING in LauKappaRes::fixResonanceParameter: Parameter name not reconised. No parameter changes made." << std::endl;
- }
+ if ( name == "b1" ) {
+ if ( b1_->fixed() ) {
+ b1_->fixed( kFALSE );
+ this->addFloatingParameter( b1_ );
+ } else {
+ std::cerr << "WARNING in LauKappaRes::floatResonanceParameter: Parameter already floating. No parameter changes made."
+ << std::endl;
+ }
+ } else if ( name == "b2" ) {
+ if ( b2_->fixed() ) {
+ b2_->fixed( kFALSE );
+ this->addFloatingParameter( b2_ );
+ } else {
+ std::cerr << "WARNING in LauKappaRes::floatResonanceParameter: Parameter already floating. No parameter changes made."
+ << std::endl;
+ }
+ } else if ( name == "A" ) {
+ if ( a_->fixed() ) {
+ a_->fixed( kFALSE );
+ this->addFloatingParameter( a_ );
+ } else {
+ std::cerr << "WARNING in LauKappaRes::floatResonanceParameter: Parameter already floating. No parameter changes made."
+ << std::endl;
+ }
+ } else if ( name == "m0" ) {
+ if ( m0_->fixed() ) {
+ m0_->fixed( kFALSE );
+ this->addFloatingParameter( m0_ );
+ } else {
+ std::cerr << "WARNING in LauKappaRes::floatResonanceParameter: Parameter already floating. No parameter changes made."
+ << std::endl;
+ }
+ } else {
+ std::cerr << "WARNING in LauKappaRes::fixResonanceParameter: Parameter name not reconised. No parameter changes made."
+ << std::endl;
+ }
}
-LauParameter* LauKappaRes::getResonanceParameter(const TString& name)
+LauParameter* LauKappaRes::getResonanceParameter( const TString& name )
{
- if (name == "b1") {
- return b1_;
- } else if (name == "b2") {
- return b2_;
- } else if (name == "A") {
- return a_;
- } else if (name == "m0") {
- return m0_;
- } else {
- std::cerr << "WARNING in LauKappaRes::getResonanceParameter: Parameter name not reconised." << std::endl;
- return 0;
- }
+ if ( name == "b1" ) {
+ return b1_;
+ } else if ( name == "b2" ) {
+ return b2_;
+ } else if ( name == "A" ) {
+ return a_;
+ } else if ( name == "m0" ) {
+ return m0_;
+ } else {
+ std::cerr << "WARNING in LauKappaRes::getResonanceParameter: Parameter name not reconised."
+ << std::endl;
+ return 0;
+ }
}
-void LauKappaRes::setB1Value(const Double_t b1)
+void LauKappaRes::setB1Value( const Double_t b1 )
{
- b1_->value( b1 );
- b1_->genValue( b1 );
- b1_->initValue( b1 );
+ b1_->value( b1 );
+ b1_->genValue( b1 );
+ b1_->initValue( b1 );
}
-void LauKappaRes::setB2Value(const Double_t b2)
+void LauKappaRes::setB2Value( const Double_t b2 )
{
- b2_->value( b2 );
- b2_->genValue( b2 );
- b2_->initValue( b2 );
+ b2_->value( b2 );
+ b2_->genValue( b2 );
+ b2_->initValue( b2 );
}
-void LauKappaRes::setAValue(const Double_t A)
+void LauKappaRes::setAValue( const Double_t A )
{
- a_->value( A );
- a_->genValue( A );
- a_->initValue( A );
+ a_->value( A );
+ a_->genValue( A );
+ a_->initValue( A );
}
-void LauKappaRes::setM0Value(const Double_t m0)
+void LauKappaRes::setM0Value( const Double_t m0 )
{
- m0_->value( m0 );
- m0_->genValue( m0 );
- m0_->initValue( m0 );
+ m0_->value( m0 );
+ m0_->genValue( m0 );
+ m0_->initValue( m0 );
}
-
diff --git a/src/LauKinematics.cc b/src/LauKinematics.cc
index c6ed3df..7987f45 100644
--- a/src/LauKinematics.cc
+++ b/src/LauKinematics.cc
@@ -1,742 +1,826 @@
/*
Copyright 2004 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauKinematics.cc
\brief File containing implementation of LauKinematics class.
*/
-#include <iostream>
-
-#include "TF2.h"
-#include "TMath.h"
-#include "TRandom.h"
+#include "LauKinematics.hh"
#include "LauConstants.hh"
-#include "LauKinematics.hh"
#include "LauRandom.hh"
+#include "TF2.h"
+#include "TMath.h"
+#include "TRandom.h"
+#include <iostream>
-LauKinematics::LauKinematics(const Double_t m1, const Double_t m2, const Double_t m3, const Double_t mParent, const Bool_t calcSquareDPCoords, const Bool_t symmetricalDP, const Bool_t fullySymmetricDP) :
- symmetricalDP_(symmetricalDP),
- fullySymmetricDP_(fullySymmetricDP),
- m1_(m1), m2_(m2), m3_(m3), mParent_(mParent),
- m1Sq_(m1*m1), m2Sq_(m2*m2), m3Sq_(m3*m3), mParentSq_(mParent*mParent),
- mDTot_(m1 + m2 + m3),
- massInt_(mParent - (m1+m2+m3)),
- mSqDTot_(m1*m1 + m2*m2 + m3*m3),
- m12_(0.0), m23_(0.0), m13_(0.0),
- m12Sq_(0.0), m23Sq_(0.0), m13Sq_(0.0),
- c12_(0.0), c23_(0.0), c13_(0.0),
- mPrime_(0.0), thetaPrime_(0.0),
- qi_(0.0), qk_(0.0),
- p1_12_(0.0), p3_12_(0.0),
- p2_23_(0.0), p1_23_(0.0),
- p1_13_(0.0), p2_13_(0.0),
- p1_Parent_(0.0), p2_Parent_(0.0), p3_Parent_(0.0),
- squareDP_(calcSquareDPCoords), warnings_(kTRUE)
-{
- // Constructor
- mass_.clear(); mMin_.clear(); mMax_.clear(); mSqMin_.clear(); mSqMax_.clear();
- mSq_.clear();
- mSqDiff_.clear();
- mDiff_.clear();
-
- mass_.push_back(m1_);
- mass_.push_back(m2_);
- mass_.push_back(m3_);
-
- mSq_.push_back(m1Sq_);
- mSq_.push_back(m2Sq_);
- mSq_.push_back(m3Sq_);
-
- // DP max and min kinematic boundary for circumscribed box
- // (see figure in PDG book).
- for (Int_t i = 0; i < 3; i++) {
- mMin_.push_back(mDTot_ - mass_[i]);
- mMax_.push_back(mParent_ - mass_[i]);
- mSqMin_.push_back(mMin_[i]*mMin_[i]);
- mSqMax_.push_back(mMax_[i]*mMax_[i]);
- mSqDiff_.push_back(mSqMax_[i] - mSqMin_[i]);
- mDiff_.push_back(mMax_[i] - mMin_[i]);
- }
-
- if (this->squareDP()) {
- std::cout<<"INFO in LauKinematics::LauKinematics : squareDP = kTRUE"<<std::endl;
- } else {
- std::cout<<"INFO in LauKinematics::LauKinematics : squareDP = kFALSE"<<std::endl;
- }
-
- // add covariant factor calculation
+LauKinematics::LauKinematics( const Double_t m1,
+ const Double_t m2,
+ const Double_t m3,
+ const Double_t mParent,
+ const Bool_t calcSquareDPCoords,
+ const Bool_t symmetricalDP,
+ const Bool_t fullySymmetricDP ) :
+ symmetricalDP_( symmetricalDP ),
+ fullySymmetricDP_( fullySymmetricDP ),
+ m1_( m1 ),
+ m2_( m2 ),
+ m3_( m3 ),
+ mParent_( mParent ),
+ m1Sq_( m1 * m1 ),
+ m2Sq_( m2 * m2 ),
+ m3Sq_( m3 * m3 ),
+ mParentSq_( mParent * mParent ),
+ mDTot_( m1 + m2 + m3 ),
+ massInt_( mParent - ( m1 + m2 + m3 ) ),
+ mSqDTot_( m1 * m1 + m2 * m2 + m3 * m3 ),
+ m12_( 0.0 ),
+ m23_( 0.0 ),
+ m13_( 0.0 ),
+ m12Sq_( 0.0 ),
+ m23Sq_( 0.0 ),
+ m13Sq_( 0.0 ),
+ c12_( 0.0 ),
+ c23_( 0.0 ),
+ c13_( 0.0 ),
+ mPrime_( 0.0 ),
+ thetaPrime_( 0.0 ),
+ qi_( 0.0 ),
+ qk_( 0.0 ),
+ p1_12_( 0.0 ),
+ p3_12_( 0.0 ),
+ p2_23_( 0.0 ),
+ p1_23_( 0.0 ),
+ p1_13_( 0.0 ),
+ p2_13_( 0.0 ),
+ p1_Parent_( 0.0 ),
+ p2_Parent_( 0.0 ),
+ p3_Parent_( 0.0 ),
+ squareDP_( calcSquareDPCoords ),
+ warnings_( kTRUE )
+{
+ // Constructor
+ mass_.clear();
+ mMin_.clear();
+ mMax_.clear();
+ mSqMin_.clear();
+ mSqMax_.clear();
+ mSq_.clear();
+ mSqDiff_.clear();
+ mDiff_.clear();
+
+ mass_.push_back( m1_ );
+ mass_.push_back( m2_ );
+ mass_.push_back( m3_ );
+
+ mSq_.push_back( m1Sq_ );
+ mSq_.push_back( m2Sq_ );
+ mSq_.push_back( m3Sq_ );
+
+ // DP max and min kinematic boundary for circumscribed box
+ // (see figure in PDG book).
+ for ( Int_t i = 0; i < 3; i++ ) {
+ mMin_.push_back( mDTot_ - mass_[i] );
+ mMax_.push_back( mParent_ - mass_[i] );
+ mSqMin_.push_back( mMin_[i] * mMin_[i] );
+ mSqMax_.push_back( mMax_[i] * mMax_[i] );
+ mSqDiff_.push_back( mSqMax_[i] - mSqMin_[i] );
+ mDiff_.push_back( mMax_[i] - mMin_[i] );
+ }
+
+ if ( this->squareDP() ) {
+ std::cout << "INFO in LauKinematics::LauKinematics : squareDP = kTRUE" << std::endl;
+ } else {
+ std::cout << "INFO in LauKinematics::LauKinematics : squareDP = kFALSE" << std::endl;
+ }
+
+ // add covariant factor calculation
}
LauKinematics::~LauKinematics()
{
- // Destructor
+ // Destructor
}
-void LauKinematics::updateKinematics(const Double_t m13Sq, const Double_t m23Sq)
+void LauKinematics::updateKinematics( const Double_t m13Sq, const Double_t m23Sq )
{
- // Sets the internal private data members
- // m13Sq and m23Sq, as well as m13 and m23.
- // Also calculate m12Sq and m12, given mParent defined in the constructor.
- // Lastly, calculate the helicity cosines.
+ // Sets the internal private data members
+ // m13Sq and m23Sq, as well as m13 and m23.
+ // Also calculate m12Sq and m12, given mParent defined in the constructor.
+ // Lastly, calculate the helicity cosines.
- // Update the 3 mass-squares
- this->updateMassSquares(m13Sq, m23Sq);
+ // Update the 3 mass-squares
+ this->updateMassSquares( m13Sq, m23Sq );
- // Now update the helicity cosines
- this->calcHelicities();
+ // Now update the helicity cosines
+ this->calcHelicities();
- // Also calculate the m', theta' variables
- if (squareDP_) {this->calcSqDPVars();}
+ // Also calculate the m', theta' variables
+ if ( squareDP_ ) {
+ this->calcSqDPVars();
+ }
}
-void LauKinematics::updateSqDPKinematics(const Double_t mPrime, const Double_t thetaPrime)
+void LauKinematics::updateSqDPKinematics( const Double_t mPrime, const Double_t thetaPrime )
{
- // From square DP co-ordinates, calculate remaining kinematic variables
- this->updateSqDPMassSquares(mPrime, thetaPrime);
+ // From square DP co-ordinates, calculate remaining kinematic variables
+ this->updateSqDPMassSquares( mPrime, thetaPrime );
- // Finally calculate the helicities and track momenta
- this->calcHelicities();
+ // Finally calculate the helicities and track momenta
+ this->calcHelicities();
}
void LauKinematics::calcSqDPVars()
{
- // For given m_12 and cos(theta_12) values, calculate m' and theta' for the square Dalitz plot
- Double_t value = (2.0*(m12_ - mMin_[2])/mDiff_[2]) - 1.0;
- mPrime_ = LauConstants::invPi*TMath::ACos(value);
- thetaPrime_ = LauConstants::invPi*TMath::ACos(c12_);
- // Sometimes events are assigned exactly thetaPrime = 0.0 or 1.0
- // which gives problems with efficiency and other histograms
- if (thetaPrime_ == 0.0)
- {
- thetaPrime_ += 1.0e-10;
- } else if (thetaPrime_ == 1.0)
- {
- thetaPrime_ -= 1.0e-10;
- }
+ // For given m_12 and cos(theta_12) values, calculate m' and theta' for the square Dalitz plot
+ Double_t value = ( 2.0 * ( m12_ - mMin_[2] ) / mDiff_[2] ) - 1.0;
+ mPrime_ = LauConstants::invPi * TMath::ACos( value );
+ thetaPrime_ = LauConstants::invPi * TMath::ACos( c12_ );
+ // Sometimes events are assigned exactly thetaPrime = 0.0 or 1.0
+ // which gives problems with efficiency and other histograms
+ if ( thetaPrime_ == 0.0 ) {
+ thetaPrime_ += 1.0e-10;
+ } else if ( thetaPrime_ == 1.0 ) {
+ thetaPrime_ -= 1.0e-10;
+ }
}
Double_t LauKinematics::calcSqDPJacobian() const
{
- return this->calcSqDPJacobian(mPrime_,thetaPrime_);
+ return this->calcSqDPJacobian( mPrime_, thetaPrime_ );
}
-Double_t LauKinematics::calcSqDPJacobian(const Double_t mPrime, const Double_t thPrime) const
+Double_t LauKinematics::calcSqDPJacobian( const Double_t mPrime, const Double_t thPrime ) const
{
- // Calculate the Jacobian for the transformation
- // m23^2, m13^2 -> m', theta' (square DP)
- const Double_t m12 = 0.5*mDiff_[2]*(1.0 + TMath::Cos(LauConstants::pi*mPrime)) + mMin_[2];
- const Double_t m12Sq = m12*m12;
+ // Calculate the Jacobian for the transformation
+ // m23^2, m13^2 -> m', theta' (square DP)
+ const Double_t m12 = 0.5 * mDiff_[2] * ( 1.0 + TMath::Cos( LauConstants::pi * mPrime ) ) +
+ mMin_[2];
+ const Double_t m12Sq = m12 * m12;
- const Double_t e1Cms12 = (m12Sq - m2Sq_ + m1Sq_)/(2.0*m12);
- const Double_t e3Cms12 = (mParentSq_ - m12Sq - m3Sq_)/(2.0*m12);
+ const Double_t e1Cms12 = ( m12Sq - m2Sq_ + m1Sq_ ) / ( 2.0 * m12 );
+ const Double_t e3Cms12 = ( mParentSq_ - m12Sq - m3Sq_ ) / ( 2.0 * m12 );
- const Double_t p1Cms12 = this->pCalc(e1Cms12, m1Sq_);
- const Double_t p3Cms12 = this->pCalc(e3Cms12, m3Sq_);
+ const Double_t p1Cms12 = this->pCalc( e1Cms12, m1Sq_ );
+ const Double_t p3Cms12 = this->pCalc( e3Cms12, m3Sq_ );
- const Double_t deriv1 = LauConstants::piBy2*mDiff_[2]*TMath::Sin(LauConstants::pi*mPrime);
- const Double_t deriv2 = LauConstants::pi*TMath::Sin(LauConstants::pi*thPrime);
+ const Double_t deriv1 = LauConstants::piBy2 * mDiff_[2] * TMath::Sin( LauConstants::pi * mPrime );
+ const Double_t deriv2 = LauConstants::pi * TMath::Sin( LauConstants::pi * thPrime );
- const Double_t jacobian = 4.0*p1Cms12*p3Cms12*m12*deriv1*deriv2;
+ const Double_t jacobian = 4.0 * p1Cms12 * p3Cms12 * m12 * deriv1 * deriv2;
- return jacobian;
+ return jacobian;
}
-void LauKinematics::updateMassSquares(const Double_t m13Sq, const Double_t m23Sq)
+void LauKinematics::updateMassSquares( const Double_t m13Sq, const Double_t m23Sq )
{
- m13Sq_ = m13Sq;
- if (m13Sq_ > 0.0) {
- m13_ = TMath::Sqrt(m13Sq_);
- } else {
- m13_ = 0.0;
- }
+ m13Sq_ = m13Sq;
+ if ( m13Sq_ > 0.0 ) {
+ m13_ = TMath::Sqrt( m13Sq_ );
+ } else {
+ m13_ = 0.0;
+ }
- m23Sq_ = m23Sq;
- if (m23Sq_ > 0.0) {
- m23_ = TMath::Sqrt(m23Sq_);
- } else {
- m23_ = 0.0;
- }
+ m23Sq_ = m23Sq;
+ if ( m23Sq_ > 0.0 ) {
+ m23_ = TMath::Sqrt( m23Sq_ );
+ } else {
+ m23_ = 0.0;
+ }
- // Now calculate m12Sq and m12.
- this->calcm12Sq();
+ // Now calculate m12Sq and m12.
+ this->calcm12Sq();
- // Calculate momenta of tracks in parent (B, D etc.) rest-frame
- this->calcParentFrameMomenta();
+ // Calculate momenta of tracks in parent (B, D etc.) rest-frame
+ this->calcParentFrameMomenta();
}
-void LauKinematics::updateSqDPMassSquares(const Double_t mPrime, const Double_t thetaPrime)
+void LauKinematics::updateSqDPMassSquares( const Double_t mPrime, const Double_t thetaPrime )
{
- // From square DP co-ordinates, calculate only the mass-squares
+ // From square DP co-ordinates, calculate only the mass-squares
- // First set the square-DP variables
- mPrime_ = mPrime; thetaPrime_ = thetaPrime;
+ // First set the square-DP variables
+ mPrime_ = mPrime;
+ thetaPrime_ = thetaPrime;
- // Next calculate m12 and c12
- Double_t m12 = 0.5*mDiff_[2]*(1.0 + TMath::Cos(LauConstants::pi*mPrime)) + mMin_[2];
- Double_t c12 = TMath::Cos(LauConstants::pi*thetaPrime);
+ // Next calculate m12 and c12
+ Double_t m12 = 0.5 * mDiff_[2] * ( 1.0 + TMath::Cos( LauConstants::pi * mPrime ) ) + mMin_[2];
+ Double_t c12 = TMath::Cos( LauConstants::pi * thetaPrime );
- // From these calculate m13Sq and m23Sq
- this->updateMassSq_m12(m12, c12);
+ // From these calculate m13Sq and m23Sq
+ this->updateMassSq_m12( m12, c12 );
- // Calculate momenta of tracks in parent (B, D etc.) rest-frame
- this->calcParentFrameMomenta();
+ // Calculate momenta of tracks in parent (B, D etc.) rest-frame
+ this->calcParentFrameMomenta();
}
void LauKinematics::calcm12Sq()
{
- // Calculate m12Sq from m13Sq and m23Sq.
- m12Sq_ = mParentSq_ + mSqDTot_ - m13Sq_ - m23Sq_;
+ // Calculate m12Sq from m13Sq and m23Sq.
+ m12Sq_ = mParentSq_ + mSqDTot_ - m13Sq_ - m23Sq_;
- // If m12Sq is too low, return lower limit,
- // and modify m13Sq accordingly.
- if (m12Sq_ < mSqMin_[2]) {
- m12Sq_ = mSqMin_[2] + 1.0e-3;
- m13Sq_ = mParentSq_ + mSqDTot_ - m12Sq_ - m23Sq_;
- }
+ // If m12Sq is too low, return lower limit,
+ // and modify m13Sq accordingly.
+ if ( m12Sq_ < mSqMin_[2] ) {
+ m12Sq_ = mSqMin_[2] + 1.0e-3;
+ m13Sq_ = mParentSq_ + mSqDTot_ - m12Sq_ - m23Sq_;
+ }
- if (m12Sq_ > 0.0) {
- m12_ = TMath::Sqrt(m12Sq_);
- } else {
- m12_ = 0.0;
- }
+ if ( m12Sq_ > 0.0 ) {
+ m12_ = TMath::Sqrt( m12Sq_ );
+ } else {
+ m12_ = 0.0;
+ }
}
void LauKinematics::calcParentFrameMomenta()
{
- Double_t e1 = (mParentSq_ + m1Sq_ - m23Sq_) / (2.0*mParent_);
- Double_t e2 = (mParentSq_ + m2Sq_ - m13Sq_) / (2.0*mParent_);
- Double_t e3 = (mParentSq_ + m3Sq_ - m12Sq_) / (2.0*mParent_);
+ Double_t e1 = ( mParentSq_ + m1Sq_ - m23Sq_ ) / ( 2.0 * mParent_ );
+ Double_t e2 = ( mParentSq_ + m2Sq_ - m13Sq_ ) / ( 2.0 * mParent_ );
+ Double_t e3 = ( mParentSq_ + m3Sq_ - m12Sq_ ) / ( 2.0 * mParent_ );
- p1_Parent_ = this->pCalc(e1, m1Sq_);
- p2_Parent_ = this->pCalc(e2, m2Sq_);
- p3_Parent_ = this->pCalc(e3, m3Sq_);
+ p1_Parent_ = this->pCalc( e1, m1Sq_ );
+ p2_Parent_ = this->pCalc( e2, m2Sq_ );
+ p3_Parent_ = this->pCalc( e3, m3Sq_ );
}
void LauKinematics::calcHelicities()
{
- // Calculate helicity angle cosines, given m12Sq, m13Sq and m23Sq.
- // cij_ is the cosine of the helicity angle in the rest frame of the
- // system of particles i and j.
- // It is (but note the caveat below) the angle between tracks i and k
- // in the ij rest frame with indices permuted cyclically.
- // However, it is important to note that it is not exactly a cyclic
- // permutation (there is a special treatment for c23 inside the cFromM
- // function) for reasons of preserving the symmetry about m13=m23 for
- // symmetric final states.
- // The precise definitions are:
- // theta12 is defined as the angle between 1&3 in the rest frame of 1&2
- // theta23 is defined as the angle between 3&1 in the rest frame of 2&3
- // theta13 is defined as the angle between 3&2 in the rest frame of 1&3
- //
- // It is a prerequisite that all mij_ and mijSq_ variables be correctly set.
-
- Int_t zero(0), one(1), two(2);
-
- c12_ = cFromM(m12Sq_, m13Sq_, m12_, zero, one, two);
- p1_12_ = qi_; p3_12_ = qk_; // i, j = 12 (rest frame), k = 3
- c23_ = cFromM(m23Sq_, m12Sq_, m23_, one, two, zero);
- p2_23_ = qi_; p1_23_ = qk_; // i, j = 23 (rest frame), k = 1
- c13_ = cFromM(m13Sq_, m23Sq_, m13_, two, zero, one);
- p1_13_ = qi_; p2_13_ = qk_; // i, j = 31 (rest frame), k = 2
-
-}
-
-Double_t LauKinematics::cFromM(const Double_t mijSq, const Double_t mikSq, const Double_t mij, const Int_t i, const Int_t j, const Int_t k) const
-{
- // Routine to calculate the cos(helicity) variables from the masses of the particles.
- // (See comment in LauKinematics::calcHelicities for futher information.)
-
- Double_t EiCmsij = (mijSq - mSq_[j] + mSq_[i])/(2.0*mij);
- Double_t EkCmsij = (mParentSq_ - mijSq - mSq_[k])/(2.0*mij);
-
- if (EiCmsij < mass_[i]) {
- if (warnings_) {
- std::cerr<<"WARNING in LauKinematics::cFromM : EiCmsij = "<<EiCmsij<<" too small < mass_["<<i<<"] = "<<mass_[i]<<" in cFromM, i, j, k = "<<i<<", "<<j<<", "<<k<<std::endl;
- std::cerr<<" : mijSq = "<<mijSq<<"; mij = "<<mij<<"; mSq_["<<j<<"] = "<<mSq_[j]<<"; mSq_["<<i<<"] = "<<mSq_[i]<<std::endl;
- }
- return 0.0;
- }
- if (EkCmsij < mass_[k]) {
- if (warnings_) {
- std::cerr<<"WARNING in LauKinematics::cFromM : EkCmsij = "<<EkCmsij<<" too small < mass_["<<k<<"] = "<<mass_[k]<<" in cFromM, i, j, k = "<<i<<", "<<j<<", "<<k<<std::endl;
- std::cerr<<" : mijSq = "<<mijSq<<"; mij = "<<mij<<"; mSq_["<<j<<"] = "<<mSq_[j]<<"; mSq_["<<i<<"] = "<<mSq_[i]<<std::endl;
- }
- return 0.0;
- }
-
- // Find track i and k momenta in ij rest frame
- qi_ = this->pCalc(EiCmsij, mSq_[i]);
- qk_ = this->pCalc(EkCmsij, mSq_[k]);
-
- // Find ij helicity angle
- Double_t cosHel = -(mikSq - mSq_[i] - mSq_[k] - 2.0*EiCmsij*EkCmsij)/(2.0*qi_*qk_);
+ // Calculate helicity angle cosines, given m12Sq, m13Sq and m23Sq.
+ // cij_ is the cosine of the helicity angle in the rest frame of the
+ // system of particles i and j.
+ // It is (but note the caveat below) the angle between tracks i and k
+ // in the ij rest frame with indices permuted cyclically.
+ // However, it is important to note that it is not exactly a cyclic
+ // permutation (there is a special treatment for c23 inside the cFromM
+ // function) for reasons of preserving the symmetry about m13=m23 for
+ // symmetric final states.
+ // The precise definitions are:
+ // theta12 is defined as the angle between 1&3 in the rest frame of 1&2
+ // theta23 is defined as the angle between 3&1 in the rest frame of 2&3
+ // theta13 is defined as the angle between 3&2 in the rest frame of 1&3
+ //
+ // It is a prerequisite that all mij_ and mijSq_ variables be correctly set.
+
+ Int_t zero( 0 ), one( 1 ), two( 2 );
+
+ c12_ = cFromM( m12Sq_, m13Sq_, m12_, zero, one, two );
+ p1_12_ = qi_;
+ p3_12_ = qk_; // i, j = 12 (rest frame), k = 3
+ c23_ = cFromM( m23Sq_, m12Sq_, m23_, one, two, zero );
+ p2_23_ = qi_;
+ p1_23_ = qk_; // i, j = 23 (rest frame), k = 1
+ c13_ = cFromM( m13Sq_, m23Sq_, m13_, two, zero, one );
+ p1_13_ = qi_;
+ p2_13_ = qk_; // i, j = 31 (rest frame), k = 2
+}
+
+Double_t LauKinematics::cFromM( const Double_t mijSq,
+ const Double_t mikSq,
+ const Double_t mij,
+ const Int_t i,
+ const Int_t j,
+ const Int_t k ) const
+{
+ // Routine to calculate the cos(helicity) variables from the masses of the particles.
+ // (See comment in LauKinematics::calcHelicities for futher information.)
+
+ Double_t EiCmsij = ( mijSq - mSq_[j] + mSq_[i] ) / ( 2.0 * mij );
+ Double_t EkCmsij = ( mParentSq_ - mijSq - mSq_[k] ) / ( 2.0 * mij );
+
+ if ( EiCmsij < mass_[i] ) {
+ if ( warnings_ ) {
+ std::cerr << "WARNING in LauKinematics::cFromM : EiCmsij = " << EiCmsij
+ << " too small < mass_[" << i << "] = " << mass_[i]
+ << " in cFromM, i, j, k = " << i << ", " << j << ", " << k << std::endl;
+ std::cerr << " : mijSq = " << mijSq << "; mij = " << mij
+ << "; mSq_[" << j << "] = " << mSq_[j] << "; mSq_[" << i << "] = " << mSq_[i]
+ << std::endl;
+ }
+ return 0.0;
+ }
+ if ( EkCmsij < mass_[k] ) {
+ if ( warnings_ ) {
+ std::cerr << "WARNING in LauKinematics::cFromM : EkCmsij = " << EkCmsij
+ << " too small < mass_[" << k << "] = " << mass_[k]
+ << " in cFromM, i, j, k = " << i << ", " << j << ", " << k << std::endl;
+ std::cerr << " : mijSq = " << mijSq << "; mij = " << mij
+ << "; mSq_[" << j << "] = " << mSq_[j] << "; mSq_[" << i << "] = " << mSq_[i]
+ << std::endl;
+ }
+ return 0.0;
+ }
+
+ // Find track i and k momenta in ij rest frame
+ qi_ = this->pCalc( EiCmsij, mSq_[i] );
+ qk_ = this->pCalc( EkCmsij, mSq_[k] );
+
+ // Find ij helicity angle
+ Double_t cosHel = -( mikSq - mSq_[i] - mSq_[k] - 2.0 * EiCmsij * EkCmsij ) / ( 2.0 * qi_ * qk_ );
+
+ if ( cosHel > 1.0 ) {
+ cosHel = 1.0;
+ } else if ( cosHel < -1.0 ) {
+ cosHel = -1.0;
+ }
+
+ if ( i == 1 ) {
+ cosHel *= -1.0;
+ }
+
+ return cosHel;
+}
+
+Double_t LauKinematics::mFromC( const Double_t mijSq,
+ const Double_t cij,
+ const Double_t mij,
+ const Int_t i,
+ const Int_t j,
+ const Int_t k ) const
+{
+ // Returns the mass-squared for a pair of particles, i,j, given their
+ // invariant mass (squared) and the helicity angle.
+ // cij is helicity angle for the pair which is made from tracks i and j.
+ // It is the angle between tracks i and k in the ij rest frame.
+
+ Double_t cosHel( cij );
+ if ( i == 1 ) {
+ cosHel *= -1.0;
+ }
+
+ Double_t EiCmsij = ( mijSq - mSq_[j] + mSq_[i] ) / ( 2.0 * mij );
+ Double_t EkCmsij = ( mParentSq_ - mijSq - mSq_[k] ) / ( 2.0 * mij );
+
+ if ( TMath::Abs( EiCmsij - mass_[i] ) > 1e-6 && EiCmsij < mass_[i] ) {
+ if ( warnings_ ) {
+ std::cerr << "WARNING in LauKinematics::mFromC : EiCmsij = " << EiCmsij << " < "
+ << mass_[i] << " in mFromC, i, j, k = " << i << ", " << j << ", " << k
+ << std::endl;
+ }
+ return 0.0;
+ }
+ if ( TMath::Abs( EkCmsij - mass_[k] ) > 1e-6 && EkCmsij < mass_[k] ) {
+ if ( warnings_ ) {
+ std::cerr << "WARNING in LauKinematics::mFromC : EkCmsij = " << EkCmsij << " < "
+ << mass_[k] << " in mFromC, i, j, k = " << i << ", " << j << ", " << k
+ << std::endl;
+ }
+ return 0.0;
+ }
+
+ // Find track i and k momenta in ij rest fram
+ Double_t qi = this->pCalc( EiCmsij, mSq_[i] );
+ Double_t qk = this->pCalc( EkCmsij, mSq_[k] );
- if (cosHel > 1.0) {
- cosHel = 1.0;
- } else if (cosHel < -1.0) {
- cosHel = -1.0;
- }
+ // Find mikSq
+ Double_t massSq = mSq_[i] + mSq_[k] + 2.0 * EiCmsij * EkCmsij - 2.0 * qi * qk * cosHel;
- if (i == 1) {cosHel *= -1.0;}
+ if ( massSq < mSqMin_[j] ) {
+ if ( warnings_ ) {
+ std::cerr << "WARNING in LauKinematics::mFromC : mFromC below bound: i, j, k = " << i
+ << ", " << j << ", " << k << std::endl;
+ }
+ massSq = mSqMin_[j];
+ }
- return cosHel;
+ return massSq;
}
-Double_t LauKinematics::mFromC(const Double_t mijSq, const Double_t cij, const Double_t mij, const Int_t i, const Int_t j, const Int_t k) const
+void LauKinematics::genFlatPhaseSpace( Double_t& m13Sq, Double_t& m23Sq ) const
{
- // Returns the mass-squared for a pair of particles, i,j, given their
- // invariant mass (squared) and the helicity angle.
- // cij is helicity angle for the pair which is made from tracks i and j.
- // It is the angle between tracks i and k in the ij rest frame.
+ // Routine to generate flat phase-space events.
+ // DP max kinematic boundaries in circumscribed box
+ // See DP figure in PDG book.
+ // m13max=mbrec-mass(2)
+ // m13sqmax=m13max*m13max
+ // m23max=mbrec-mass(1)
+ // m23sqmax=m23max*m23max
- Double_t cosHel( cij );
- if (i == 1) {cosHel *= -1.0;}
+ // Generate m13Sq and m23Sq flat within DP overall rectangular box
+ // Loop if the generated point is not within the DP kinematic boundary
- Double_t EiCmsij = (mijSq - mSq_[j] + mSq_[i])/(2.0*mij);
- Double_t EkCmsij = (mParentSq_ - mijSq - mSq_[k])/(2.0*mij);
+ do {
+ m13Sq = mSqMin_[1] + LauRandom::randomFun()->Rndm() * mSqDiff_[1];
+ m23Sq = mSqMin_[0] + LauRandom::randomFun()->Rndm() * mSqDiff_[0];
- if (TMath::Abs(EiCmsij - mass_[i]) > 1e-6 && EiCmsij < mass_[i]) {
- if (warnings_) {
- std::cerr<<"WARNING in LauKinematics::mFromC : EiCmsij = "<<EiCmsij<<" < "<<mass_[i]<<" in mFromC, i, j, k = "<<i<<", "<<j<<", "<<k<<std::endl;
- }
- return 0.0;
- }
- if (TMath::Abs(EkCmsij - mass_[k]) > 1e-6 && EkCmsij < mass_[k]) {
- if (warnings_) {
- std::cerr<<"WARNING in LauKinematics::mFromC : EkCmsij = "<<EkCmsij<<" < "<<mass_[k]<<" in mFromC, i, j, k = "<<i<<", "<<j<<", "<<k<<std::endl;
- }
- return 0.0;
- }
-
- // Find track i and k momenta in ij rest fram
- Double_t qi = this->pCalc(EiCmsij, mSq_[i]);
- Double_t qk = this->pCalc(EkCmsij, mSq_[k]);
-
- // Find mikSq
- Double_t massSq = mSq_[i] + mSq_[k] + 2.0*EiCmsij*EkCmsij - 2.0*qi*qk*cosHel;
-
- if (massSq < mSqMin_[j]) {
- if (warnings_) {
- std::cerr<<"WARNING in LauKinematics::mFromC : mFromC below bound: i, j, k = "<<i<<", "<<j<<", "<<k<<std::endl;
- }
- massSq = mSqMin_[j];
- }
-
- return massSq;
-}
-
-void LauKinematics::genFlatPhaseSpace(Double_t& m13Sq, Double_t& m23Sq) const
-{
- // Routine to generate flat phase-space events.
- // DP max kinematic boundaries in circumscribed box
- // See DP figure in PDG book.
- // m13max=mbrec-mass(2)
- // m13sqmax=m13max*m13max
- // m23max=mbrec-mass(1)
- // m23sqmax=m23max*m23max
-
- // Generate m13Sq and m23Sq flat within DP overall rectangular box
- // Loop if the generated point is not within the DP kinematic boundary
-
- do {
- m13Sq = mSqMin_[1] + LauRandom::randomFun()->Rndm()*mSqDiff_[1];
- m23Sq = mSqMin_[0] + LauRandom::randomFun()->Rndm()*mSqDiff_[0];
-
- } while ( ! this->withinDPLimits( m13Sq, m23Sq ) );
+ } while ( ! this->withinDPLimits( m13Sq, m23Sq ) );
}
-void LauKinematics::genFlatSqDP(Double_t& mPrime, Double_t& thetaPrime) const
+void LauKinematics::genFlatSqDP( Double_t& mPrime, Double_t& thetaPrime ) const
{
- // Generate random event in the square Dalitz plot
- mPrime = LauRandom::randomFun()->Rndm();
- thetaPrime = LauRandom::randomFun()->Rndm();
+ // Generate random event in the square Dalitz plot
+ mPrime = LauRandom::randomFun()->Rndm();
+ thetaPrime = LauRandom::randomFun()->Rndm();
}
-Bool_t LauKinematics::withinDPLimits(const Double_t m13Sq, const Double_t m23Sq) const
+Bool_t LauKinematics::withinDPLimits( const Double_t m13Sq, const Double_t m23Sq ) const
{
- // Find out whether the point (m13Sq,m23Sq) is within the limits of the
- // Dalitz plot. The limits are specified by the invariant masses
- // of the parent (e.g. B) and its three daughters that were
- // defined in the constructor of this class. Here
- // m_13Sq = square of invariant mass of daughters 1 and 3
- // m_23Sq = square of invariant mass of daughters 2 and 3.
+ // Find out whether the point (m13Sq,m23Sq) is within the limits of the
+ // Dalitz plot. The limits are specified by the invariant masses
+ // of the parent (e.g. B) and its three daughters that were
+ // defined in the constructor of this class. Here
+ // m_13Sq = square of invariant mass of daughters 1 and 3
+ // m_23Sq = square of invariant mass of daughters 2 and 3.
- Bool_t withinDP = kFALSE;
+ Bool_t withinDP = kFALSE;
- // First check that m13Sq is within its absolute min and max
- if (!((m13Sq > mSqMin_[1]) && (m13Sq < mSqMax_[1]))) {
- return kFALSE;
- }
+ // First check that m13Sq is within its absolute min and max
+ if ( ! ( ( m13Sq > mSqMin_[1] ) && ( m13Sq < mSqMax_[1] ) ) ) {
+ return kFALSE;
+ }
- // Now for the given value of m13Sq calculate the local min and max of m23Sq
- Double_t m13 = TMath::Sqrt(m13Sq);
+ // Now for the given value of m13Sq calculate the local min and max of m23Sq
+ Double_t m13 = TMath::Sqrt( m13Sq );
- Double_t e3Cms13 = (m13Sq - m1Sq_ + m3Sq_)/(2.0*m13);
- Double_t p3Cms13 = this->pCalc(e3Cms13, m3Sq_);
+ Double_t e3Cms13 = ( m13Sq - m1Sq_ + m3Sq_ ) / ( 2.0 * m13 );
+ Double_t p3Cms13 = this->pCalc( e3Cms13, m3Sq_ );
- Double_t e2Cms13 = (mParentSq_ - m13Sq - m2Sq_)/(2.0*m13);
- Double_t p2Cms13 = this->pCalc(e2Cms13, m2Sq_);
+ Double_t e2Cms13 = ( mParentSq_ - m13Sq - m2Sq_ ) / ( 2.0 * m13 );
+ Double_t p2Cms13 = this->pCalc( e2Cms13, m2Sq_ );
- Double_t term = 2.0*e2Cms13*e3Cms13 + m2Sq_ + m3Sq_;
+ Double_t term = 2.0 * e2Cms13 * e3Cms13 + m2Sq_ + m3Sq_;
- Double_t m23SqLocMin = term - 2.0*p2Cms13*p3Cms13;
- Double_t m23SqLocMax = term + 2.0*p2Cms13*p3Cms13;
+ Double_t m23SqLocMin = term - 2.0 * p2Cms13 * p3Cms13;
+ Double_t m23SqLocMax = term + 2.0 * p2Cms13 * p3Cms13;
- // Check whether the given value of m23Sq satisfies these bounds
- if (m23Sq > m23SqLocMin && m23Sq < m23SqLocMax) {
- withinDP = kTRUE;
- }
+ // Check whether the given value of m23Sq satisfies these bounds
+ if ( m23Sq > m23SqLocMin && m23Sq < m23SqLocMax ) {
+ withinDP = kTRUE;
+ }
- return withinDP;
+ return withinDP;
}
-Bool_t LauKinematics::withinDPLimits2(const Double_t m13Sq, const Double_t m23Sq) const
+Bool_t LauKinematics::withinDPLimits2( const Double_t m13Sq, const Double_t m23Sq ) const
{
- // Same as withinDPLimits, but this time testing whether the m13Sq
- // variable is within the kinematic boundary for the given m23Sq value
+ // Same as withinDPLimits, but this time testing whether the m13Sq
+ // variable is within the kinematic boundary for the given m23Sq value
- Bool_t withinDP = kFALSE;
+ Bool_t withinDP = kFALSE;
- // First check that m13Sq is within its absolute min and max
- if (!((m23Sq > mSqMin_[0]) && (m23Sq < mSqMax_[0]))) {
- return kFALSE;
- }
+ // First check that m13Sq is within its absolute min and max
+ if ( ! ( ( m23Sq > mSqMin_[0] ) && ( m23Sq < mSqMax_[0] ) ) ) {
+ return kFALSE;
+ }
- // Now for the given value of m13Sq calculate the local min and max of m23Sq
- Double_t m23 = TMath::Sqrt(m23Sq);
+ // Now for the given value of m13Sq calculate the local min and max of m23Sq
+ Double_t m23 = TMath::Sqrt( m23Sq );
- Double_t e3Cms23 = (m23Sq - m2Sq_ + m3Sq_)/(2.0*m23);
- Double_t p3Cms23 = this->pCalc(e3Cms23, m3Sq_);
+ Double_t e3Cms23 = ( m23Sq - m2Sq_ + m3Sq_ ) / ( 2.0 * m23 );
+ Double_t p3Cms23 = this->pCalc( e3Cms23, m3Sq_ );
- Double_t e1Cms23 = (mParentSq_ - m23Sq - m1Sq_)/(2.0*m23);
- Double_t p1Cms23 = this->pCalc(e1Cms23, m1Sq_);
+ Double_t e1Cms23 = ( mParentSq_ - m23Sq - m1Sq_ ) / ( 2.0 * m23 );
+ Double_t p1Cms23 = this->pCalc( e1Cms23, m1Sq_ );
- Double_t term = 2.0*e3Cms23*e1Cms23 + m1Sq_ + m3Sq_;
+ Double_t term = 2.0 * e3Cms23 * e1Cms23 + m1Sq_ + m3Sq_;
- Double_t m13SqLocMin = term - 2.0*p3Cms23*p1Cms23;
- Double_t m13SqLocMax = term + 2.0*p3Cms23*p1Cms23;
+ Double_t m13SqLocMin = term - 2.0 * p3Cms23 * p1Cms23;
+ Double_t m13SqLocMax = term + 2.0 * p3Cms23 * p1Cms23;
- // Check whether the given value of m23Sq satisfies these bounds
- if (m13Sq > m13SqLocMin && m13Sq < m13SqLocMax) {
- withinDP = kTRUE;
- }
+ // Check whether the given value of m23Sq satisfies these bounds
+ if ( m13Sq > m13SqLocMin && m13Sq < m13SqLocMax ) {
+ withinDP = kTRUE;
+ }
- return withinDP;
+ return withinDP;
}
-Bool_t LauKinematics::withinSqDPLimits(const Double_t mPrime, const Double_t thetaPrime) const
+Bool_t LauKinematics::withinSqDPLimits( const Double_t mPrime, const Double_t thetaPrime ) const
{
- // Check whether m' and theta' are between 0 and 1
- Bool_t withinDP(kFALSE);
- if (mPrime > 0.0 && mPrime < 1.0 &&
- thetaPrime > 0.0 && thetaPrime < 1.0) {
- withinDP = kTRUE;
- }
+ // Check whether m' and theta' are between 0 and 1
+ Bool_t withinDP( kFALSE );
+ if ( mPrime > 0.0 && mPrime < 1.0 && thetaPrime > 0.0 && thetaPrime < 1.0 ) {
+ withinDP = kTRUE;
+ }
- return withinDP;
+ return withinDP;
}
-Double_t LauKinematics::calcThirdMassSq(const Double_t firstMassSq, const Double_t secondMassSq) const
+Double_t LauKinematics::calcThirdMassSq( const Double_t firstMassSq, const Double_t secondMassSq ) const
{
- // Calculate one massSq from the other two
- return mParentSq_ + mSqDTot_ - firstMassSq - secondMassSq;
+ // Calculate one massSq from the other two
+ return mParentSq_ + mSqDTot_ - firstMassSq - secondMassSq;
}
Double_t LauKinematics::distanceFromDPCentre() const
{
- return this->distanceFromDPCentre(m13Sq_,m23Sq_);
+ return this->distanceFromDPCentre( m13Sq_, m23Sq_ );
}
-Double_t LauKinematics::distanceFromDPCentre(const Double_t m13Sq, const Double_t m23Sq) const
+Double_t LauKinematics::distanceFromDPCentre( const Double_t m13Sq, const Double_t m23Sq ) const
{
- // DP centre is defined as the point where m12=m13=m23
+ // DP centre is defined as the point where m12=m13=m23
- // First find the m^2_ij value for the centre
- Double_t centreMijSq = (mParentSq_ + m1Sq_ + m2Sq_ + m3Sq_)/3.0;
+ // First find the m^2_ij value for the centre
+ Double_t centreMijSq = ( mParentSq_ + m1Sq_ + m2Sq_ + m3Sq_ ) / 3.0;
- // Then find the difference between this and the two provided co-ords
- Double_t diff13 = m13Sq - centreMijSq;
- Double_t diff23 = m23Sq - centreMijSq;
+ // Then find the difference between this and the two provided co-ords
+ Double_t diff13 = m13Sq - centreMijSq;
+ Double_t diff23 = m23Sq - centreMijSq;
- // Calculate the total distance
- Double_t distance = TMath::Sqrt(diff13*diff13 + diff23*diff23);
- return distance;
+ // Calculate the total distance
+ Double_t distance = TMath::Sqrt( diff13 * diff13 + diff23 * diff23 );
+ return distance;
}
-Double_t LauKinematics::pCalc(const Double_t energy, const Double_t massSq) const
+Double_t LauKinematics::pCalc( const Double_t energy, const Double_t massSq ) const
{
- // Routine to calculate the momentum of a particle, given its energy and
- // invariant mass (squared).
- Double_t arg = energy*energy - massSq;
-
- if (arg < 0.0) {
- //if (warnings_) {
- //std::cerr<<"WARNING in LauKinematics::pCalc : arg < 0.0: "<<arg<<" for e = "<<energy<<", mSq = "<<massSq<<std::endl;
- //}
- arg = 0.0;
- }
- Double_t pCalcVal = TMath::Sqrt(arg);
- return pCalcVal;
+ // Routine to calculate the momentum of a particle, given its energy and
+ // invariant mass (squared).
+ Double_t arg = energy * energy - massSq;
+ if ( arg < 0.0 ) {
+ //if (warnings_) {
+ //std::cerr<<"WARNING in LauKinematics::pCalc : arg < 0.0: "<<arg<<" for e = "<<energy<<", mSq = "<<massSq<<std::endl;
+ //}
+ arg = 0.0;
+ }
+ Double_t pCalcVal = TMath::Sqrt( arg );
+ return pCalcVal;
}
void LauKinematics::flipAndUpdateKinematics()
{
- // Flips the DP variables m13^2 <-> m23^2.
- // Used in the case of symmetrical Dalitz plots (i.e. when two of the
- // daughter tracks are the same type) within the
- // LauIsobarDynamics::resAmp function.
- this->updateKinematics(m23Sq_, m13Sq_);
+ // Flips the DP variables m13^2 <-> m23^2.
+ // Used in the case of symmetrical Dalitz plots (i.e. when two of the
+ // daughter tracks are the same type) within the
+ // LauIsobarDynamics::resAmp function.
+ this->updateKinematics( m23Sq_, m13Sq_ );
}
void LauKinematics::rotateAndUpdateKinematics()
{
- // Cyclically rotates the DP variables (m12 -> m23, m23 -> m13, m13 -> m12)
- // Used in the case of fully symmetric Dalitz plots (i.e. when all
- // three of the daughter tracks are the same type) within the
- // LauIsobarDynamics::resAmp function.
- this->updateKinematics(m12Sq_, m13Sq_);
+ // Cyclically rotates the DP variables (m12 -> m23, m23 -> m13, m13 -> m12)
+ // Used in the case of fully symmetric Dalitz plots (i.e. when all
+ // three of the daughter tracks are the same type) within the
+ // LauIsobarDynamics::resAmp function.
+ this->updateKinematics( m12Sq_, m13Sq_ );
}
-void LauKinematics::updateMassSq_m23(const Double_t m23, const Double_t c23)
+void LauKinematics::updateMassSq_m23( const Double_t m23, const Double_t c23 )
{
- // Update the variables m12Sq_ and m13Sq_ given m23 and c23.
- m23_ = m23; m23Sq_ = m23*m23; c23_ = c23;
+ // Update the variables m12Sq_ and m13Sq_ given m23 and c23.
+ m23_ = m23;
+ m23Sq_ = m23 * m23;
+ c23_ = c23;
- const Int_t zero(0), one(1), two(2);
- m12Sq_ = this->mFromC(m23Sq_, c23_, m23_, one, two, zero);
- m13Sq_ = mParentSq_ - m23Sq_ - m12Sq_ + mSqDTot_;
+ const Int_t zero( 0 ), one( 1 ), two( 2 );
+ m12Sq_ = this->mFromC( m23Sq_, c23_, m23_, one, two, zero );
+ m13Sq_ = mParentSq_ - m23Sq_ - m12Sq_ + mSqDTot_;
- m12_ = TMath::Sqrt(m12Sq_);
- m13_ = TMath::Sqrt(m13Sq_);
+ m12_ = TMath::Sqrt( m12Sq_ );
+ m13_ = TMath::Sqrt( m13Sq_ );
}
-void LauKinematics::updateMassSq_m13(const Double_t m13, const Double_t c13)
+void LauKinematics::updateMassSq_m13( const Double_t m13, const Double_t c13 )
{
- // Update the variables m12Sq_ and m23Sq_ given m13 and c13.
- m13_ = m13; m13Sq_ = m13*m13; c13_ = c13;
+ // Update the variables m12Sq_ and m23Sq_ given m13 and c13.
+ m13_ = m13;
+ m13Sq_ = m13 * m13;
+ c13_ = c13;
- const Int_t zero(0), one(1), two(2);
- m23Sq_ = this->mFromC(m13Sq_, c13_, m13_, two, zero, one);
- m12Sq_ = mParentSq_ - m23Sq_ - m13Sq_ + mSqDTot_;
+ const Int_t zero( 0 ), one( 1 ), two( 2 );
+ m23Sq_ = this->mFromC( m13Sq_, c13_, m13_, two, zero, one );
+ m12Sq_ = mParentSq_ - m23Sq_ - m13Sq_ + mSqDTot_;
- m23_ = TMath::Sqrt(m23Sq_);
- m12_ = TMath::Sqrt(m12Sq_);
+ m23_ = TMath::Sqrt( m23Sq_ );
+ m12_ = TMath::Sqrt( m12Sq_ );
}
-void LauKinematics::updateMassSq_m12(const Double_t m12, const Double_t c12)
+void LauKinematics::updateMassSq_m12( const Double_t m12, const Double_t c12 )
{
- // Update the variables m23Sq_ and m13Sq_ given m12 and c12.
- m12_ = m12; m12Sq_ = m12*m12; c12_ = c12;
+ // Update the variables m23Sq_ and m13Sq_ given m12 and c12.
+ m12_ = m12;
+ m12Sq_ = m12 * m12;
+ c12_ = c12;
- const Int_t zero(0), one(1), two(2);
- m13Sq_ = this->mFromC(m12Sq_, c12_, m12_, zero, one, two);
- m23Sq_ = mParentSq_ - m12Sq_ - m13Sq_ + mSqDTot_;
- m13_ = TMath::Sqrt(m13Sq_);
- m23_ = TMath::Sqrt(m23Sq_);
+ const Int_t zero( 0 ), one( 1 ), two( 2 );
+ m13Sq_ = this->mFromC( m12Sq_, c12_, m12_, zero, one, two );
+ m23Sq_ = mParentSq_ - m12Sq_ - m13Sq_ + mSqDTot_;
+ m13_ = TMath::Sqrt( m13Sq_ );
+ m23_ = TMath::Sqrt( m23Sq_ );
}
-void LauKinematics::updateKinematicsFrom23(const Double_t m23, const Double_t c23)
+void LauKinematics::updateKinematicsFrom23( const Double_t m23, const Double_t c23 )
{
- // Calculate the other mass squares
- this->updateMassSq_m23(m23,c23);
+ // Calculate the other mass squares
+ this->updateMassSq_m23( m23, c23 );
- // Calculate the remaining helicity angles
- this->calcHelicities();
+ // Calculate the remaining helicity angles
+ this->calcHelicities();
- // Calculate momenta of tracks in parent (B, D etc.) rest-frame
- this->calcParentFrameMomenta();
+ // Calculate momenta of tracks in parent (B, D etc.) rest-frame
+ this->calcParentFrameMomenta();
- // Also calculate the m', theta' variables
- if (squareDP_) {this->calcSqDPVars();}
+ // Also calculate the m', theta' variables
+ if ( squareDP_ ) {
+ this->calcSqDPVars();
+ }
}
-void LauKinematics::updateKinematicsFrom13(const Double_t m13, const Double_t c13)
+void LauKinematics::updateKinematicsFrom13( const Double_t m13, const Double_t c13 )
{
- // Calculate the other mass squares
- this->updateMassSq_m13(m13,c13);
+ // Calculate the other mass squares
+ this->updateMassSq_m13( m13, c13 );
- // Calculate the remaining helicity angles
- this->calcHelicities();
+ // Calculate the remaining helicity angles
+ this->calcHelicities();
- // Calculate momenta of tracks in parent (B, D etc.) rest-frame
- this->calcParentFrameMomenta();
+ // Calculate momenta of tracks in parent (B, D etc.) rest-frame
+ this->calcParentFrameMomenta();
- // Also calculate the m', theta' variables
- if (squareDP_) {this->calcSqDPVars();}
+ // Also calculate the m', theta' variables
+ if ( squareDP_ ) {
+ this->calcSqDPVars();
+ }
}
-void LauKinematics::updateKinematicsFrom12(const Double_t m12, const Double_t c12)
+void LauKinematics::updateKinematicsFrom12( const Double_t m12, const Double_t c12 )
{
- // Calculate the other mass squares
- this->updateMassSq_m12(m12,c12);
+ // Calculate the other mass squares
+ this->updateMassSq_m12( m12, c12 );
- // Calculate the remaining helicity angles
- this->calcHelicities();
+ // Calculate the remaining helicity angles
+ this->calcHelicities();
- // Calculate momenta of tracks in parent (B, D etc.) rest-frame
- this->calcParentFrameMomenta();
+ // Calculate momenta of tracks in parent (B, D etc.) rest-frame
+ this->calcParentFrameMomenta();
- // Also calculate the m', theta' variables
- if (squareDP_) {this->calcSqDPVars();}
+ // Also calculate the m', theta' variables
+ if ( squareDP_ ) {
+ this->calcSqDPVars();
+ }
}
Double_t LauKinematics::genm13Sq() const
{
- Double_t m13Sq = mSqMin_[1] + LauRandom::randomFun()->Rndm()*mSqDiff_[1];
- return m13Sq;
+ Double_t m13Sq = mSqMin_[1] + LauRandom::randomFun()->Rndm() * mSqDiff_[1];
+ return m13Sq;
}
Double_t LauKinematics::genm23Sq() const
{
- Double_t m23Sq = mSqMin_[0] + LauRandom::randomFun()->Rndm()*mSqDiff_[0];
- return m23Sq;
+ Double_t m23Sq = mSqMin_[0] + LauRandom::randomFun()->Rndm() * mSqDiff_[0];
+ return m23Sq;
}
Double_t LauKinematics::genm12Sq() const
{
- Double_t m12Sq = mSqMin_[2] + LauRandom::randomFun()->Rndm()*mSqDiff_[2];
- return m12Sq;
-}
-
-Double_t dal(Double_t* x, Double_t* par)
-{
- Double_t mParent = par[0];
- Double_t mi = par[1];
- Double_t mj = par[2];
- Double_t mk = par[3];
-
- Double_t mikSq=x[0];
- Double_t mjkSq=x[1];
- Double_t mik = TMath::Sqrt(mikSq);
- Double_t mjk = TMath::Sqrt(mjkSq);
-
- Double_t ejcmsik = (mParent*mParent-mj*mj-mik*mik)/(2.0*mik);
- Double_t ekcmsik = (mik*mik+mk*mk-mi*mi)/(2.0*mik);
- if (ekcmsik<mk || ejcmsik<mj) return 2.0;
-
- Double_t pj = TMath::Sqrt(ejcmsik*ejcmsik-mj*mj);
- Double_t pk = TMath::Sqrt(ekcmsik*ekcmsik-mk*mk);
- Double_t coshelik = (mjk*mjk - mk*mk - mj*mj - 2.0*ejcmsik*ekcmsik)/(2.0*pj*pk);
-
- Double_t coshelikSq = coshelik*coshelik;
- return coshelikSq;
-}
-
-void LauKinematics::drawDPContour(Int_t orientation, Int_t nbins)
-{
- // orientation -
- // 1323 : x = m13, y = m23
- // etc.
-
- Double_t m1 = this->getm1();
- Double_t m2 = this->getm2();
- Double_t m3 = this->getm3();
- Double_t mParent = this->getmParent();
-
- Double_t m13SqMin = this->getm13SqMin();
- Double_t m23SqMin = this->getm23SqMin();
- Double_t m12SqMin = this->getm12SqMin();
- Double_t m13SqMax = this->getm13SqMax();
- Double_t m23SqMax = this->getm23SqMax();
- Double_t m12SqMax = this->getm12SqMax();
-
- Double_t xMin(0.0);
- Double_t xMax(mParent*mParent);
- Double_t yMin(0.0);
- Double_t yMax(mParent*mParent);
- if (orientation == 1323) {
- xMin = m13SqMin-1.0; xMax = m13SqMax+1.0;
- yMin = m23SqMin-1.0; yMax = m23SqMax+1.0;
- } else if (orientation == 2313) {
- xMin = m23SqMin-1.0; xMax = m23SqMax+1.0;
- yMin = m13SqMin-1.0; yMax = m13SqMax+1.0;
- } else if (orientation == 1213) {
- xMin = m12SqMin-1.0; xMax = m12SqMax+1.0;
- yMin = m13SqMin-1.0; yMax = m13SqMax+1.0;
- } else if (orientation == 1312) {
- xMin = m13SqMin-1.0; xMax = m13SqMax+1.0;
- yMin = m12SqMin-1.0; yMax = m12SqMax+1.0;
- } else if (orientation == 1223) {
- xMin = m12SqMin-1.0; xMax = m12SqMax+1.0;
- yMin = m23SqMin-1.0; yMax = m23SqMax+1.0;
- } else if (orientation == 2312) {
- xMin = m23SqMin-1.0; xMax = m23SqMax+1.0;
- yMin = m12SqMin-1.0; yMax = m12SqMax+1.0;
- } else {
- std::cerr<<"ERROR in LauKinematics::drawDPContour : Unrecognised orientation, not drawing contour."<<std::endl;
- return;
- }
-
- Int_t npar = 4;
- TF2 * f2 = new TF2("contour", &dal, xMin, xMax, yMin, yMax, npar);
-
- // Set the parameters
- f2->SetParameter(0,mParent);
- if (orientation == 1323) {
- f2->SetParameter(1,m1);
- f2->SetParameter(2,m2);
- f2->SetParameter(3,m3);
- } else if (orientation == 2313) {
- f2->SetParameter(1,m2);
- f2->SetParameter(2,m1);
- f2->SetParameter(3,m3);
- } else if (orientation == 1213) {
- f2->SetParameter(1,m2);
- f2->SetParameter(2,m3);
- f2->SetParameter(3,m1);
- } else if (orientation == 1312) {
- f2->SetParameter(1,m3);
- f2->SetParameter(2,m2);
- f2->SetParameter(3,m1);
- } else if (orientation == 1223) {
- f2->SetParameter(1,m1);
- f2->SetParameter(2,m3);
- f2->SetParameter(3,m2);
- } else if (orientation == 2312) {
- f2->SetParameter(1,m3);
- f2->SetParameter(2,m1);
- f2->SetParameter(3,m2);
- }
-
- // Set up the contour to be drawn when the value of the function == 1.0
- Double_t b[]={1.0};
- f2->SetContour(1,b);
-
- // Set the number of bins for the contour to be sampled over
- f2->SetNpx(nbins);
- f2->SetNpy(nbins);
- // and the line style
- f2->SetLineWidth(3);
- f2->SetLineStyle(kSolid);
-
- // Draw the contour on top of the histo that should already have been drawn
- f2->DrawCopy("same");
-
- delete f2;
+ Double_t m12Sq = mSqMin_[2] + LauRandom::randomFun()->Rndm() * mSqDiff_[2];
+ return m12Sq;
+}
+
+Double_t dal( Double_t* x, Double_t* par )
+{
+ Double_t mParent = par[0];
+ Double_t mi = par[1];
+ Double_t mj = par[2];
+ Double_t mk = par[3];
+
+ Double_t mikSq = x[0];
+ Double_t mjkSq = x[1];
+ Double_t mik = TMath::Sqrt( mikSq );
+ Double_t mjk = TMath::Sqrt( mjkSq );
+
+ Double_t ejcmsik = ( mParent * mParent - mj * mj - mik * mik ) / ( 2.0 * mik );
+ Double_t ekcmsik = ( mik * mik + mk * mk - mi * mi ) / ( 2.0 * mik );
+ if ( ekcmsik < mk || ejcmsik < mj )
+ return 2.0;
+
+ Double_t pj = TMath::Sqrt( ejcmsik * ejcmsik - mj * mj );
+ Double_t pk = TMath::Sqrt( ekcmsik * ekcmsik - mk * mk );
+ Double_t coshelik = ( mjk * mjk - mk * mk - mj * mj - 2.0 * ejcmsik * ekcmsik ) /
+ ( 2.0 * pj * pk );
+
+ Double_t coshelikSq = coshelik * coshelik;
+ return coshelikSq;
+}
+
+void LauKinematics::drawDPContour( Int_t orientation, Int_t nbins )
+{
+ // orientation -
+ // 1323 : x = m13, y = m23
+ // etc.
+
+ Double_t m1 = this->getm1();
+ Double_t m2 = this->getm2();
+ Double_t m3 = this->getm3();
+ Double_t mParent = this->getmParent();
+
+ Double_t m13SqMin = this->getm13SqMin();
+ Double_t m23SqMin = this->getm23SqMin();
+ Double_t m12SqMin = this->getm12SqMin();
+ Double_t m13SqMax = this->getm13SqMax();
+ Double_t m23SqMax = this->getm23SqMax();
+ Double_t m12SqMax = this->getm12SqMax();
+
+ Double_t xMin( 0.0 );
+ Double_t xMax( mParent * mParent );
+ Double_t yMin( 0.0 );
+ Double_t yMax( mParent * mParent );
+ if ( orientation == 1323 ) {
+ xMin = m13SqMin - 1.0;
+ xMax = m13SqMax + 1.0;
+ yMin = m23SqMin - 1.0;
+ yMax = m23SqMax + 1.0;
+ } else if ( orientation == 2313 ) {
+ xMin = m23SqMin - 1.0;
+ xMax = m23SqMax + 1.0;
+ yMin = m13SqMin - 1.0;
+ yMax = m13SqMax + 1.0;
+ } else if ( orientation == 1213 ) {
+ xMin = m12SqMin - 1.0;
+ xMax = m12SqMax + 1.0;
+ yMin = m13SqMin - 1.0;
+ yMax = m13SqMax + 1.0;
+ } else if ( orientation == 1312 ) {
+ xMin = m13SqMin - 1.0;
+ xMax = m13SqMax + 1.0;
+ yMin = m12SqMin - 1.0;
+ yMax = m12SqMax + 1.0;
+ } else if ( orientation == 1223 ) {
+ xMin = m12SqMin - 1.0;
+ xMax = m12SqMax + 1.0;
+ yMin = m23SqMin - 1.0;
+ yMax = m23SqMax + 1.0;
+ } else if ( orientation == 2312 ) {
+ xMin = m23SqMin - 1.0;
+ xMax = m23SqMax + 1.0;
+ yMin = m12SqMin - 1.0;
+ yMax = m12SqMax + 1.0;
+ } else {
+ std::cerr << "ERROR in LauKinematics::drawDPContour : Unrecognised orientation, not drawing contour."
+ << std::endl;
+ return;
+ }
+
+ Int_t npar = 4;
+ TF2* f2 = new TF2( "contour", &dal, xMin, xMax, yMin, yMax, npar );
+
+ // Set the parameters
+ f2->SetParameter( 0, mParent );
+ if ( orientation == 1323 ) {
+ f2->SetParameter( 1, m1 );
+ f2->SetParameter( 2, m2 );
+ f2->SetParameter( 3, m3 );
+ } else if ( orientation == 2313 ) {
+ f2->SetParameter( 1, m2 );
+ f2->SetParameter( 2, m1 );
+ f2->SetParameter( 3, m3 );
+ } else if ( orientation == 1213 ) {
+ f2->SetParameter( 1, m2 );
+ f2->SetParameter( 2, m3 );
+ f2->SetParameter( 3, m1 );
+ } else if ( orientation == 1312 ) {
+ f2->SetParameter( 1, m3 );
+ f2->SetParameter( 2, m2 );
+ f2->SetParameter( 3, m1 );
+ } else if ( orientation == 1223 ) {
+ f2->SetParameter( 1, m1 );
+ f2->SetParameter( 2, m3 );
+ f2->SetParameter( 3, m2 );
+ } else if ( orientation == 2312 ) {
+ f2->SetParameter( 1, m3 );
+ f2->SetParameter( 2, m1 );
+ f2->SetParameter( 3, m2 );
+ }
+
+ // Set up the contour to be drawn when the value of the function == 1.0
+ Double_t b[] = { 1.0 };
+ f2->SetContour( 1, b );
+
+ // Set the number of bins for the contour to be sampled over
+ f2->SetNpx( nbins );
+ f2->SetNpy( nbins );
+ // and the line style
+ f2->SetLineWidth( 3 );
+ f2->SetLineStyle( kSolid );
+
+ // Draw the contour on top of the histo that should already have been drawn
+ f2->DrawCopy( "same" );
+
+ delete f2;
}
-
diff --git a/src/LauLASSBWRes.cc b/src/LauLASSBWRes.cc
index 4f55668..5298795 100644
--- a/src/LauLASSBWRes.cc
+++ b/src/LauLASSBWRes.cc
@@ -1,241 +1,252 @@
/*
Copyright 2008 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauLASSBWRes.cc
\brief File containing implementation of LauLASSBWRes class.
*/
-#include <iostream>
+#include "LauLASSBWRes.hh"
#include "LauConstants.hh"
-#include "LauLASSBWRes.hh"
#include "LauResonanceInfo.hh"
+#include <iostream>
-
-LauLASSBWRes::LauLASSBWRes(LauResonanceInfo* resInfo, const Int_t resPairAmpInt, const LauDaughters* daughters) :
- LauAbsResonance(resInfo, resPairAmpInt, daughters),
- q0_(0.0),
- mDaugSum_(0.0),
- mDaugSumSq_(0.0),
- mDaugDiff_(0.0),
- mDaugDiffSq_(0.0),
- resMassSq_(0.0),
- r_(0),
- a_(0)
+LauLASSBWRes::LauLASSBWRes( LauResonanceInfo* resInfo,
+ const Int_t resPairAmpInt,
+ const LauDaughters* daughters ) :
+ LauAbsResonance( resInfo, resPairAmpInt, daughters ),
+ q0_( 0.0 ),
+ mDaugSum_( 0.0 ),
+ mDaugSumSq_( 0.0 ),
+ mDaugDiff_( 0.0 ),
+ mDaugDiffSq_( 0.0 ),
+ resMassSq_( 0.0 ),
+ r_( 0 ),
+ a_( 0 )
{
- // Default values for LASS parameters
- const Double_t rVal = 3.32;
- const Double_t aVal = 2.07;
-
- const TString& parNameBase = this->getSanitisedName();
-
- TString rName(parNameBase);
- rName += "_r";
- r_ = resInfo->getExtraParameter( rName );
- if ( r_ == 0 ) {
- r_ = new LauParameter( rName, rVal, 0.0, 10.0, kTRUE );
- r_->secondStage(kTRUE);
- resInfo->addExtraParameter( r_ );
- }
-
- TString aName(parNameBase);
- aName += "_a";
- a_ = resInfo->getExtraParameter( aName );
- if ( a_ == 0 ) {
- a_ = new LauParameter( aName, aVal, 0.0, 10.0, kTRUE );
- a_->secondStage(kTRUE);
- resInfo->addExtraParameter( a_ );
- }
+ // Default values for LASS parameters
+ const Double_t rVal = 3.32;
+ const Double_t aVal = 2.07;
+
+ const TString& parNameBase = this->getSanitisedName();
+
+ TString rName( parNameBase );
+ rName += "_r";
+ r_ = resInfo->getExtraParameter( rName );
+ if ( r_ == 0 ) {
+ r_ = new LauParameter( rName, rVal, 0.0, 10.0, kTRUE );
+ r_->secondStage( kTRUE );
+ resInfo->addExtraParameter( r_ );
+ }
+
+ TString aName( parNameBase );
+ aName += "_a";
+ a_ = resInfo->getExtraParameter( aName );
+ if ( a_ == 0 ) {
+ a_ = new LauParameter( aName, aVal, 0.0, 10.0, kTRUE );
+ a_->secondStage( kTRUE );
+ resInfo->addExtraParameter( a_ );
+ }
}
LauLASSBWRes::~LauLASSBWRes()
{
}
void LauLASSBWRes::initialise()
{
- // Create the mass sums and differences
- Double_t massDaug1 = this->getMassDaug1();
- Double_t massDaug2 = this->getMassDaug2();
-
- mDaugSum_ = massDaug1 + massDaug2;
- mDaugSumSq_ = mDaugSum_*mDaugSum_;
-
- mDaugDiff_ = massDaug1 - massDaug2;
- mDaugDiffSq_ = mDaugDiff_*mDaugDiff_;
-
- Int_t resSpin = this->getSpin();
- if (resSpin != 0) {
- std::cerr << "WARNING in LauLASSBWRes::amplitude : Resonance spin is " << resSpin << "." << std::endl;
- std::cerr << " : LASS amplitude is only for scalers, resetting spin to 0." << std::endl;
- this->changeResonance( -1.0, -1.0, 0 );
- }
-
- this->calcQ0();
+ // Create the mass sums and differences
+ Double_t massDaug1 = this->getMassDaug1();
+ Double_t massDaug2 = this->getMassDaug2();
+
+ mDaugSum_ = massDaug1 + massDaug2;
+ mDaugSumSq_ = mDaugSum_ * mDaugSum_;
+
+ mDaugDiff_ = massDaug1 - massDaug2;
+ mDaugDiffSq_ = mDaugDiff_ * mDaugDiff_;
+
+ Int_t resSpin = this->getSpin();
+ if ( resSpin != 0 ) {
+ std::cerr << "WARNING in LauLASSBWRes::amplitude : Resonance spin is " << resSpin << "."
+ << std::endl;
+ std::cerr << " : LASS amplitude is only for scalers, resetting spin to 0."
+ << std::endl;
+ this->changeResonance( -1.0, -1.0, 0 );
+ }
+
+ this->calcQ0();
}
void LauLASSBWRes::calcQ0()
{
- // Decay momentum of either daughter in the resonance rest frame
- // when resonance mass = rest-mass value, m_0 (PDG value)
+ // Decay momentum of either daughter in the resonance rest frame
+ // when resonance mass = rest-mass value, m_0 (PDG value)
- resMass_ = this->getMass();
- resMassSq_ = resMass_*resMass_;
+ resMass_ = this->getMass();
+ resMassSq_ = resMass_ * resMass_;
- q0_ = TMath::Sqrt((resMassSq_ - mDaugSumSq_)*(resMassSq_ - mDaugDiffSq_))/(2.0*resMass_);
+ q0_ = TMath::Sqrt( ( resMassSq_ - mDaugSumSq_ ) * ( resMassSq_ - mDaugDiffSq_ ) ) /
+ ( 2.0 * resMass_ );
}
-LauComplex LauLASSBWRes::resAmp(Double_t mass, Double_t /*spinTerm*/)
+LauComplex LauLASSBWRes::resAmp( Double_t mass, Double_t /*spinTerm*/ )
{
- LauComplex resAmplitude(0.0, 0.0);
-
- if (mass < 1e-10) {
- std::cerr << "WARNING in LauLASSBWRes::amplitude : mass < 1e-10." << std::endl;
- return LauComplex(0.0, 0.0);
- }
-
- // Calculate the width of the resonance (as a function of mass)
- // q is the momentum of either daughter in the resonance rest-frame
- const Double_t q = this->getQ();
- const Double_t resMass = this->getMass();
- const Double_t resWidth = this->getWidth();
-
- // If the mass is floating and their value have changed
- // we need to recalculate everything that assumes this value
- if ( (!this->fixMass()) && resMass != resMass_ ) {
- this->calcQ0();
- }
-
- Double_t qRatio = q/q0_;
- Double_t totWidth = resWidth*qRatio*(resMass/mass);
-
- Double_t massSq = mass*mass;
- Double_t massSqTerm = resMassSq_ - massSq;
-
- // Compute the complex amplitude
- resAmplitude = LauComplex(massSqTerm, resMass*totWidth);
-
- // Scale by the denominator factor
- resAmplitude.rescale((resMassSq_*resWidth/q0_)/(massSqTerm*massSqTerm + resMassSq_*totWidth*totWidth));
-
- // Calculate the phase shift term
- const Double_t rVal = this->getEffectiveRange();
- const Double_t aVal = this->getScatteringLength();
- const Double_t tandeltaB = (2.0*aVal*q)/(2.0 + aVal*rVal*q*q);
- const Double_t tanSq = tandeltaB*tandeltaB;
- const Double_t cos2PhaseShift = (1.0 - tanSq) / (1.0 + tanSq);
- const Double_t sin2PhaseShift = 2.0*tandeltaB / (1.0 + tanSq);
- LauComplex phaseShift(cos2PhaseShift, sin2PhaseShift);
-
- // Multiply by the phase shift
- resAmplitude = resAmplitude * phaseShift;
-
- return resAmplitude;
+ LauComplex resAmplitude( 0.0, 0.0 );
+
+ if ( mass < 1e-10 ) {
+ std::cerr << "WARNING in LauLASSBWRes::amplitude : mass < 1e-10." << std::endl;
+ return LauComplex( 0.0, 0.0 );
+ }
+
+ // Calculate the width of the resonance (as a function of mass)
+ // q is the momentum of either daughter in the resonance rest-frame
+ const Double_t q = this->getQ();
+ const Double_t resMass = this->getMass();
+ const Double_t resWidth = this->getWidth();
+
+ // If the mass is floating and their value have changed
+ // we need to recalculate everything that assumes this value
+ if ( ( ! this->fixMass() ) && resMass != resMass_ ) {
+ this->calcQ0();
+ }
+
+ Double_t qRatio = q / q0_;
+ Double_t totWidth = resWidth * qRatio * ( resMass / mass );
+
+ Double_t massSq = mass * mass;
+ Double_t massSqTerm = resMassSq_ - massSq;
+
+ // Compute the complex amplitude
+ resAmplitude = LauComplex( massSqTerm, resMass * totWidth );
+
+ // Scale by the denominator factor
+ resAmplitude.rescale( ( resMassSq_ * resWidth / q0_ ) /
+ ( massSqTerm * massSqTerm + resMassSq_ * totWidth * totWidth ) );
+
+ // Calculate the phase shift term
+ const Double_t rVal = this->getEffectiveRange();
+ const Double_t aVal = this->getScatteringLength();
+ const Double_t tandeltaB = ( 2.0 * aVal * q ) / ( 2.0 + aVal * rVal * q * q );
+ const Double_t tanSq = tandeltaB * tandeltaB;
+ const Double_t cos2PhaseShift = ( 1.0 - tanSq ) / ( 1.0 + tanSq );
+ const Double_t sin2PhaseShift = 2.0 * tandeltaB / ( 1.0 + tanSq );
+ LauComplex phaseShift( cos2PhaseShift, sin2PhaseShift );
+
+ // Multiply by the phase shift
+ resAmplitude = resAmplitude * phaseShift;
+
+ return resAmplitude;
}
const std::vector<LauParameter*>& LauLASSBWRes::getFloatingParameters()
{
- this->clearFloatingParameters();
+ this->clearFloatingParameters();
- if ( ! this->fixMass() ) {
- this->addFloatingParameter( this->getMassPar() );
- }
+ if ( ! this->fixMass() ) {
+ this->addFloatingParameter( this->getMassPar() );
+ }
- if ( ! this->fixWidth() ) {
- this->addFloatingParameter( this->getWidthPar() );
- }
+ if ( ! this->fixWidth() ) {
+ this->addFloatingParameter( this->getWidthPar() );
+ }
- if ( ! this->fixEffectiveRange() ) {
- this->addFloatingParameter( r_ );
- }
+ if ( ! this->fixEffectiveRange() ) {
+ this->addFloatingParameter( r_ );
+ }
- if ( ! this->fixScatteringLength() ) {
- this->addFloatingParameter( a_ );
- }
+ if ( ! this->fixScatteringLength() ) {
+ this->addFloatingParameter( a_ );
+ }
- return this->getParameters();
+ return this->getParameters();
}
-void LauLASSBWRes::setResonanceParameter(const TString& name, const Double_t value)
+void LauLASSBWRes::setResonanceParameter( const TString& name, const Double_t value )
{
- // Set various parameters for the LASS lineshape dynamics
- if (name == "a") {
- this->setScatteringLength(value);
- std::cout << "INFO in LauLASSBWRes::setResonanceParameter : Setting LASS Scattering Length = " << this->getScatteringLength() << std::endl;
- } else if (name == "r") {
- this->setEffectiveRange(value);
- std::cout << "INFO in LauLASSBWRes::setResonanceParameter : Setting LASS Effective Range = " << this->getEffectiveRange() << std::endl;
- } else {
- std::cerr << "WARNING in LauLASSBWRes::setResonanceParameter: Parameter name not reconised. No parameter changes made." << std::endl;
- }
+ // Set various parameters for the LASS lineshape dynamics
+ if ( name == "a" ) {
+ this->setScatteringLength( value );
+ std::cout << "INFO in LauLASSBWRes::setResonanceParameter : Setting LASS Scattering Length = "
+ << this->getScatteringLength() << std::endl;
+ } else if ( name == "r" ) {
+ this->setEffectiveRange( value );
+ std::cout << "INFO in LauLASSBWRes::setResonanceParameter : Setting LASS Effective Range = "
+ << this->getEffectiveRange() << std::endl;
+ } else {
+ std::cerr << "WARNING in LauLASSBWRes::setResonanceParameter: Parameter name not reconised. No parameter changes made."
+ << std::endl;
+ }
}
-void LauLASSBWRes::floatResonanceParameter(const TString& name)
+void LauLASSBWRes::floatResonanceParameter( const TString& name )
{
- if (name == "a") {
- if ( a_->fixed() ) {
- a_->fixed( kFALSE );
- this->addFloatingParameter( a_ );
- } else {
- std::cerr << "WARNING in LauLASSBWRes::floatResonanceParameter: Parameter already floating. No parameter changes made." << std::endl;
- }
- } else if (name == "r") {
- if ( r_->fixed() ) {
- r_->fixed( kFALSE );
- this->addFloatingParameter( r_ );
- } else {
- std::cerr << "WARNING in LauLASSBWRes::floatResonanceParameter: Parameter already floating. No parameter changes made." << std::endl;
- }
- } else {
- std::cerr << "WARNING in LauLASSBWRes::fixResonanceParameter: Parameter name not reconised. No parameter changes made." << std::endl;
- }
+ if ( name == "a" ) {
+ if ( a_->fixed() ) {
+ a_->fixed( kFALSE );
+ this->addFloatingParameter( a_ );
+ } else {
+ std::cerr << "WARNING in LauLASSBWRes::floatResonanceParameter: Parameter already floating. No parameter changes made."
+ << std::endl;
+ }
+ } else if ( name == "r" ) {
+ if ( r_->fixed() ) {
+ r_->fixed( kFALSE );
+ this->addFloatingParameter( r_ );
+ } else {
+ std::cerr << "WARNING in LauLASSBWRes::floatResonanceParameter: Parameter already floating. No parameter changes made."
+ << std::endl;
+ }
+ } else {
+ std::cerr << "WARNING in LauLASSBWRes::fixResonanceParameter: Parameter name not reconised. No parameter changes made."
+ << std::endl;
+ }
}
-LauParameter* LauLASSBWRes::getResonanceParameter(const TString& name)
+LauParameter* LauLASSBWRes::getResonanceParameter( const TString& name )
{
- if (name == "a") {
- return a_;
- } else if (name == "r") {
- return r_;
- } else {
- std::cerr << "WARNING in LauLASSBWRes::getResonanceParameter: Parameter name not reconised." << std::endl;
- return 0;
- }
+ if ( name == "a" ) {
+ return a_;
+ } else if ( name == "r" ) {
+ return r_;
+ } else {
+ std::cerr << "WARNING in LauLASSBWRes::getResonanceParameter: Parameter name not reconised."
+ << std::endl;
+ return 0;
+ }
}
-void LauLASSBWRes::setEffectiveRange(const Double_t r)
+void LauLASSBWRes::setEffectiveRange( const Double_t r )
{
- r_->value( r );
- r_->genValue( r );
- r_->initValue( r );
+ r_->value( r );
+ r_->genValue( r );
+ r_->initValue( r );
}
-void LauLASSBWRes::setScatteringLength(const Double_t a)
+void LauLASSBWRes::setScatteringLength( const Double_t a )
{
- a_->value( a );
- a_->genValue( a );
- a_->initValue( a );
+ a_->value( a );
+ a_->genValue( a );
+ a_->initValue( a );
}
-
diff --git a/src/LauLASSNRRes.cc b/src/LauLASSNRRes.cc
index 2c19a78..6ae272c 100644
--- a/src/LauLASSNRRes.cc
+++ b/src/LauLASSNRRes.cc
@@ -1,195 +1,203 @@
/*
Copyright 2008 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauLASSNRRes.cc
\brief File containing implementation of LauLASSNRRes class.
*/
-#include <iostream>
+#include "LauLASSNRRes.hh"
#include "LauConstants.hh"
-#include "LauLASSNRRes.hh"
#include "LauResonanceInfo.hh"
+#include <iostream>
-
-LauLASSNRRes::LauLASSNRRes(LauResonanceInfo* resInfo, const Int_t resPairAmpInt, const LauDaughters* daughters) :
- LauAbsResonance(resInfo, resPairAmpInt, daughters),
- r_(0),
- a_(0),
- cutOff_(0.0)
+LauLASSNRRes::LauLASSNRRes( LauResonanceInfo* resInfo,
+ const Int_t resPairAmpInt,
+ const LauDaughters* daughters ) :
+ LauAbsResonance( resInfo, resPairAmpInt, daughters ),
+ r_( 0 ),
+ a_( 0 ),
+ cutOff_( 0.0 )
{
- // Default values for LASS parameters
- cutOff_ = 1.8;
- const Double_t rVal = 3.32;
- const Double_t aVal = 2.07;
-
- const TString& parNameBase = this->getSanitisedName();
-
- TString rName(parNameBase);
- rName += "_r";
- r_ = resInfo->getExtraParameter( rName );
- if ( r_ == 0 ) {
- r_ = new LauParameter( rName, rVal, 0.0, 10.0, kTRUE );
- r_->secondStage(kTRUE);
- resInfo->addExtraParameter( r_ );
- }
-
- TString aName(parNameBase);
- aName += "_a";
- a_ = resInfo->getExtraParameter( aName );
- if ( a_ == 0 ) {
- a_ = new LauParameter( aName, aVal, 0.0, 10.0, kTRUE );
- a_->secondStage(kTRUE);
- resInfo->addExtraParameter( a_ );
- }
+ // Default values for LASS parameters
+ cutOff_ = 1.8;
+ const Double_t rVal = 3.32;
+ const Double_t aVal = 2.07;
+
+ const TString& parNameBase = this->getSanitisedName();
+
+ TString rName( parNameBase );
+ rName += "_r";
+ r_ = resInfo->getExtraParameter( rName );
+ if ( r_ == 0 ) {
+ r_ = new LauParameter( rName, rVal, 0.0, 10.0, kTRUE );
+ r_->secondStage( kTRUE );
+ resInfo->addExtraParameter( r_ );
+ }
+
+ TString aName( parNameBase );
+ aName += "_a";
+ a_ = resInfo->getExtraParameter( aName );
+ if ( a_ == 0 ) {
+ a_ = new LauParameter( aName, aVal, 0.0, 10.0, kTRUE );
+ a_->secondStage( kTRUE );
+ resInfo->addExtraParameter( a_ );
+ }
}
LauLASSNRRes::~LauLASSNRRes()
{
}
void LauLASSNRRes::initialise()
{
- Int_t resSpin = this->getSpin();
- if (resSpin != 0) {
- std::cerr << "WARNING in LauLASSNRRes::amplitude : Resonance spin is " << resSpin << "." << std::endl;
- std::cerr << " : LASS amplitude is only for scalers, resetting spin to 0." << std::endl;
- this->changeResonance( -1.0, -1.0, 0 );
- }
+ Int_t resSpin = this->getSpin();
+ if ( resSpin != 0 ) {
+ std::cerr << "WARNING in LauLASSNRRes::amplitude : Resonance spin is " << resSpin << "."
+ << std::endl;
+ std::cerr << " : LASS amplitude is only for scalers, resetting spin to 0."
+ << std::endl;
+ this->changeResonance( -1.0, -1.0, 0 );
+ }
}
-LauComplex LauLASSNRRes::resAmp(Double_t mass, Double_t /*spinTerm*/)
+LauComplex LauLASSNRRes::resAmp( Double_t mass, Double_t /*spinTerm*/ )
{
- LauComplex bkgAmplitude(0.0, 0.0);
-
- if (mass < 1e-10) {
- std::cerr << "WARNING in LauLASSNRRes::amplitude : mass < 1e-10." << std::endl;
- return LauComplex(0.0, 0.0);
- }
+ LauComplex bkgAmplitude( 0.0, 0.0 );
- if (mass < cutOff_) {
- // q is the momentum of either daughter in the resonance rest-frame
- const Double_t q = this->getQ();
+ if ( mass < 1e-10 ) {
+ std::cerr << "WARNING in LauLASSNRRes::amplitude : mass < 1e-10." << std::endl;
+ return LauComplex( 0.0, 0.0 );
+ }
- // Calculate the phase shift term
- const Double_t rVal = this->getEffectiveRange();
- const Double_t aVal = this->getScatteringLength();
- const Double_t qcotdeltaB = 1.0/aVal + (rVal*q*q)/2.0;
+ if ( mass < cutOff_ ) {
+ // q is the momentum of either daughter in the resonance rest-frame
+ const Double_t q = this->getQ();
- // Compute the complex amplitude
- bkgAmplitude = LauComplex(qcotdeltaB, q);
+ // Calculate the phase shift term
+ const Double_t rVal = this->getEffectiveRange();
+ const Double_t aVal = this->getScatteringLength();
+ const Double_t qcotdeltaB = 1.0 / aVal + ( rVal * q * q ) / 2.0;
- // Scale by the numerator and denominator factors
- bkgAmplitude.rescale(mass/(qcotdeltaB*qcotdeltaB + q*q));
- }
+ // Compute the complex amplitude
+ bkgAmplitude = LauComplex( qcotdeltaB, q );
- return bkgAmplitude;
+ // Scale by the numerator and denominator factors
+ bkgAmplitude.rescale( mass / ( qcotdeltaB * qcotdeltaB + q * q ) );
+ }
+ return bkgAmplitude;
}
const std::vector<LauParameter*>& LauLASSNRRes::getFloatingParameters()
{
- this->clearFloatingParameters();
+ this->clearFloatingParameters();
- if ( ! this->fixMass() ) {
- this->addFloatingParameter( this->getMassPar() );
- }
+ if ( ! this->fixMass() ) {
+ this->addFloatingParameter( this->getMassPar() );
+ }
- if ( ! this->fixWidth() ) {
- this->addFloatingParameter( this->getWidthPar() );
- }
+ if ( ! this->fixWidth() ) {
+ this->addFloatingParameter( this->getWidthPar() );
+ }
- if ( ! this->fixEffectiveRange() ) {
- this->addFloatingParameter( r_ );
- }
+ if ( ! this->fixEffectiveRange() ) {
+ this->addFloatingParameter( r_ );
+ }
- if ( ! this->fixScatteringLength() ) {
- this->addFloatingParameter( a_ );
- }
+ if ( ! this->fixScatteringLength() ) {
+ this->addFloatingParameter( a_ );
+ }
- return this->getParameters();
+ return this->getParameters();
}
-void LauLASSNRRes::setResonanceParameter(const TString& name, const Double_t value)
+void LauLASSNRRes::setResonanceParameter( const TString& name, const Double_t value )
{
- // Set various parameters for the LASS lineshape dynamics
- if (name == "a") {
- this->setScatteringLength(value);
- std::cout << "INFO in LauLASSNRRes::setResonanceParameter : Setting LASS Scattering Length = " << this->getScatteringLength() << std::endl;
- } else if (name == "r") {
- this->setEffectiveRange(value);
- std::cout << "INFO in LauLASSNRRes::setResonanceParameter : Setting LASS Effective Range = " << this->getEffectiveRange() << std::endl;
- } else {
- std::cerr << "WARNING in LauLASSNRRes::setResonanceParameter: Parameter name not reconised. No parameter changes made." << std::endl;
- }
+ // Set various parameters for the LASS lineshape dynamics
+ if ( name == "a" ) {
+ this->setScatteringLength( value );
+ std::cout << "INFO in LauLASSNRRes::setResonanceParameter : Setting LASS Scattering Length = "
+ << this->getScatteringLength() << std::endl;
+ } else if ( name == "r" ) {
+ this->setEffectiveRange( value );
+ std::cout << "INFO in LauLASSNRRes::setResonanceParameter : Setting LASS Effective Range = "
+ << this->getEffectiveRange() << std::endl;
+ } else {
+ std::cerr << "WARNING in LauLASSNRRes::setResonanceParameter: Parameter name not reconised. No parameter changes made."
+ << std::endl;
+ }
}
-void LauLASSNRRes::floatResonanceParameter(const TString& name)
+void LauLASSNRRes::floatResonanceParameter( const TString& name )
{
- if (name == "a") {
- if ( a_->fixed() ) {
- a_->fixed( kFALSE );
- this->addFloatingParameter( a_ );
- } else {
- std::cerr << "WARNING in LauLASSNRRes::floatResonanceParameter: Parameter already floating. No parameter changes made." << std::endl;
- }
- } else if (name == "r") {
- if ( r_->fixed() ) {
- r_->fixed( kFALSE );
- this->addFloatingParameter( r_ );
- } else {
- std::cerr << "WARNING in LauLASSNRRes::floatResonanceParameter: Parameter already floating. No parameter changes made." << std::endl;
- }
- } else {
- std::cerr << "WARNING in LauLASSNRRes::fixResonanceParameter: Parameter name not reconised. No parameter changes made." << std::endl;
- }
+ if ( name == "a" ) {
+ if ( a_->fixed() ) {
+ a_->fixed( kFALSE );
+ this->addFloatingParameter( a_ );
+ } else {
+ std::cerr << "WARNING in LauLASSNRRes::floatResonanceParameter: Parameter already floating. No parameter changes made."
+ << std::endl;
+ }
+ } else if ( name == "r" ) {
+ if ( r_->fixed() ) {
+ r_->fixed( kFALSE );
+ this->addFloatingParameter( r_ );
+ } else {
+ std::cerr << "WARNING in LauLASSNRRes::floatResonanceParameter: Parameter already floating. No parameter changes made."
+ << std::endl;
+ }
+ } else {
+ std::cerr << "WARNING in LauLASSNRRes::fixResonanceParameter: Parameter name not reconised. No parameter changes made."
+ << std::endl;
+ }
}
-LauParameter* LauLASSNRRes::getResonanceParameter(const TString& name)
+LauParameter* LauLASSNRRes::getResonanceParameter( const TString& name )
{
- if (name == "a") {
- return a_;
- } else if (name == "r") {
- return r_;
- } else {
- std::cerr << "WARNING in LauLASSNRRes::getResonanceParameter: Parameter name not reconised." << std::endl;
- return 0;
- }
+ if ( name == "a" ) {
+ return a_;
+ } else if ( name == "r" ) {
+ return r_;
+ } else {
+ std::cerr << "WARNING in LauLASSNRRes::getResonanceParameter: Parameter name not reconised."
+ << std::endl;
+ return 0;
+ }
}
-void LauLASSNRRes::setEffectiveRange(const Double_t r)
+void LauLASSNRRes::setEffectiveRange( const Double_t r )
{
- r_->value( r );
- r_->genValue( r );
- r_->initValue( r );
+ r_->value( r );
+ r_->genValue( r );
+ r_->initValue( r );
}
-void LauLASSNRRes::setScatteringLength(const Double_t a)
+void LauLASSNRRes::setScatteringLength( const Double_t a )
{
- a_->value( a );
- a_->genValue( a );
- a_->initValue( a );
+ a_->value( a );
+ a_->genValue( a );
+ a_->initValue( a );
}
-
diff --git a/src/LauLASSRes.cc b/src/LauLASSRes.cc
index e63b4a5..739c382 100644
--- a/src/LauLASSRes.cc
+++ b/src/LauLASSRes.cc
@@ -1,274 +1,283 @@
/*
Copyright 2004 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauLASSRes.cc
\brief File containing implementation of LauLASSRes class.
*/
-#include <iostream>
+#include "LauLASSRes.hh"
#include "LauConstants.hh"
-#include "LauLASSRes.hh"
#include "LauResonanceInfo.hh"
+#include <iostream>
-
-LauLASSRes::LauLASSRes(LauResonanceInfo* resInfo, const Int_t resPairAmpInt, const LauDaughters* daughters) :
- LauAbsResonance(resInfo, resPairAmpInt, daughters),
- q0_(0.0),
- mDaugSum_(0.0),
- mDaugSumSq_(0.0),
- mDaugDiff_(0.0),
- mDaugDiffSq_(0.0),
- resMassSq_(0.0),
- r_(0),
- a_(0),
- cutOff_(0.0)
+LauLASSRes::LauLASSRes( LauResonanceInfo* resInfo,
+ const Int_t resPairAmpInt,
+ const LauDaughters* daughters ) :
+ LauAbsResonance( resInfo, resPairAmpInt, daughters ),
+ q0_( 0.0 ),
+ mDaugSum_( 0.0 ),
+ mDaugSumSq_( 0.0 ),
+ mDaugDiff_( 0.0 ),
+ mDaugDiffSq_( 0.0 ),
+ resMassSq_( 0.0 ),
+ r_( 0 ),
+ a_( 0 ),
+ cutOff_( 0.0 )
{
- // Default values for LASS parameters
- cutOff_ = 1.8;
- const Double_t rVal = 3.32;
- const Double_t aVal = 2.07;
-
- const TString& parNameBase = this->getSanitisedName();
-
- TString rName(parNameBase);
- rName += "_r";
- r_ = resInfo->getExtraParameter( rName );
- if ( r_ == 0 ) {
- r_ = new LauParameter( rName, rVal, 0.0, 10.0, kTRUE );
- r_->secondStage(kTRUE);
- resInfo->addExtraParameter( r_ );
- }
-
- TString aName(parNameBase);
- aName += "_a";
- a_ = resInfo->getExtraParameter( aName );
- if ( a_ == 0 ) {
- a_ = new LauParameter( aName, aVal, 0.0, 10.0, kTRUE );
- a_->secondStage(kTRUE);
- resInfo->addExtraParameter( a_ );
- }
+ // Default values for LASS parameters
+ cutOff_ = 1.8;
+ const Double_t rVal = 3.32;
+ const Double_t aVal = 2.07;
+
+ const TString& parNameBase = this->getSanitisedName();
+
+ TString rName( parNameBase );
+ rName += "_r";
+ r_ = resInfo->getExtraParameter( rName );
+ if ( r_ == 0 ) {
+ r_ = new LauParameter( rName, rVal, 0.0, 10.0, kTRUE );
+ r_->secondStage( kTRUE );
+ resInfo->addExtraParameter( r_ );
+ }
+
+ TString aName( parNameBase );
+ aName += "_a";
+ a_ = resInfo->getExtraParameter( aName );
+ if ( a_ == 0 ) {
+ a_ = new LauParameter( aName, aVal, 0.0, 10.0, kTRUE );
+ a_->secondStage( kTRUE );
+ resInfo->addExtraParameter( a_ );
+ }
}
LauLASSRes::~LauLASSRes()
{
}
void LauLASSRes::initialise()
{
- // Create the mass sums and differences
- Double_t massDaug1 = this->getMassDaug1();
- Double_t massDaug2 = this->getMassDaug2();
-
- mDaugSum_ = massDaug1 + massDaug2;
- mDaugSumSq_ = mDaugSum_*mDaugSum_;
-
- mDaugDiff_ = massDaug1 - massDaug2;
- mDaugDiffSq_ = mDaugDiff_*mDaugDiff_;
-
- Int_t resSpin = this->getSpin();
- if (resSpin != 0) {
- std::cerr << "WARNING in LauLASSRes::amplitude : Resonance spin is " << resSpin << "." << std::endl;
- std::cerr << " : LASS amplitude is only for scalers, resetting spin to 0." << std::endl;
- this->changeResonance( -1.0, -1.0, 0 );
- }
-
- this->calcQ0();
+ // Create the mass sums and differences
+ Double_t massDaug1 = this->getMassDaug1();
+ Double_t massDaug2 = this->getMassDaug2();
+
+ mDaugSum_ = massDaug1 + massDaug2;
+ mDaugSumSq_ = mDaugSum_ * mDaugSum_;
+
+ mDaugDiff_ = massDaug1 - massDaug2;
+ mDaugDiffSq_ = mDaugDiff_ * mDaugDiff_;
+
+ Int_t resSpin = this->getSpin();
+ if ( resSpin != 0 ) {
+ std::cerr << "WARNING in LauLASSRes::amplitude : Resonance spin is " << resSpin << "."
+ << std::endl;
+ std::cerr << " : LASS amplitude is only for scalers, resetting spin to 0."
+ << std::endl;
+ this->changeResonance( -1.0, -1.0, 0 );
+ }
+
+ this->calcQ0();
}
void LauLASSRes::calcQ0()
{
- // Decay momentum of either daughter in the resonance rest frame
- // when resonance mass = rest-mass value, m_0 (PDG value)
+ // Decay momentum of either daughter in the resonance rest frame
+ // when resonance mass = rest-mass value, m_0 (PDG value)
- resMass_ = this->getMass();
- resMassSq_ = resMass_*resMass_;
+ resMass_ = this->getMass();
+ resMassSq_ = resMass_ * resMass_;
- q0_ = TMath::Sqrt((resMassSq_ - mDaugSumSq_)*(resMassSq_ - mDaugDiffSq_))/(2.0*resMass_);
+ q0_ = TMath::Sqrt( ( resMassSq_ - mDaugSumSq_ ) * ( resMassSq_ - mDaugDiffSq_ ) ) /
+ ( 2.0 * resMass_ );
}
-LauComplex LauLASSRes::resAmp(Double_t mass, Double_t /*spinTerm*/)
+LauComplex LauLASSRes::resAmp( Double_t mass, Double_t /*spinTerm*/ )
{
- LauComplex resAmplitude(0.0, 0.0);
- LauComplex bkgAmplitude(0.0, 0.0);
- LauComplex totAmplitude(0.0, 0.0);
-
- if (mass < 1e-10) {
- std::cerr << "WARNING in LauLASSRes::amplitude : mass < 1e-10." << std::endl;
- return LauComplex(0.0, 0.0);
- }
-
- //---------------------------
- // First do the resonant part
- //---------------------------
-
- // Calculate the width of the resonance (as a function of mass)
- // q is the momentum of either daughter in the resonance rest-frame
- const Double_t q = this->getQ();
- const Double_t resMass = this->getMass();
- const Double_t resWidth = this->getWidth();
-
- // If the mass is floating and their value have changed
- // we need to recalculate everything that assumes this value
- if ( (!this->fixMass()) && resMass != resMass_ ) {
- this->calcQ0();
- }
-
- Double_t qRatio = q/q0_;
- Double_t totWidth = resWidth*qRatio*(resMass/mass);
-
- Double_t massSq = mass*mass;
- Double_t massSqTerm = resMassSq_ - massSq;
-
- // Compute the complex amplitude
- resAmplitude = LauComplex(massSqTerm, resMass*totWidth);
-
- // Scale by the denominator factor
- resAmplitude.rescale((resMassSq_*resWidth/q0_)/(massSqTerm*massSqTerm + resMassSq_*totWidth*totWidth));
-
- // Calculate the phase shift term
- const Double_t rVal = this->getEffectiveRange();
- const Double_t aVal = this->getScatteringLength();
- const Double_t tandeltaB = (2.0*aVal*q)/(2.0 + aVal*rVal*q*q);
- const Double_t tanSq = tandeltaB*tandeltaB;
- const Double_t cos2PhaseShift = (1.0 - tanSq) / (1.0 + tanSq);
- const Double_t sin2PhaseShift = 2.0*tandeltaB / (1.0 + tanSq);
- LauComplex phaseShift(cos2PhaseShift, sin2PhaseShift);
-
- // Multiply by the phase shift
- resAmplitude = resAmplitude * phaseShift;
-
-
- //--------------------------------
- // Now do the effective range part
- //--------------------------------
-
- // Form the real and imaginary parts
- const Double_t qcotdeltaB = 1.0/aVal + (rVal*q*q)/2.0;
-
- // Compute the complex amplitude
- bkgAmplitude = LauComplex(qcotdeltaB, q);
-
- // Scale by the numerator and denominator factors
- bkgAmplitude.rescale(mass/(qcotdeltaB*qcotdeltaB + q*q));
-
-
- //------------------
- // Add them together
- //------------------
-
- if (mass > cutOff_) {
- totAmplitude = resAmplitude;
- } else {
- totAmplitude = bkgAmplitude + resAmplitude;
- }
-
- return totAmplitude;
+ LauComplex resAmplitude( 0.0, 0.0 );
+ LauComplex bkgAmplitude( 0.0, 0.0 );
+ LauComplex totAmplitude( 0.0, 0.0 );
+
+ if ( mass < 1e-10 ) {
+ std::cerr << "WARNING in LauLASSRes::amplitude : mass < 1e-10." << std::endl;
+ return LauComplex( 0.0, 0.0 );
+ }
+
+ //---------------------------
+ // First do the resonant part
+ //---------------------------
+
+ // Calculate the width of the resonance (as a function of mass)
+ // q is the momentum of either daughter in the resonance rest-frame
+ const Double_t q = this->getQ();
+ const Double_t resMass = this->getMass();
+ const Double_t resWidth = this->getWidth();
+
+ // If the mass is floating and their value have changed
+ // we need to recalculate everything that assumes this value
+ if ( ( ! this->fixMass() ) && resMass != resMass_ ) {
+ this->calcQ0();
+ }
+
+ Double_t qRatio = q / q0_;
+ Double_t totWidth = resWidth * qRatio * ( resMass / mass );
+
+ Double_t massSq = mass * mass;
+ Double_t massSqTerm = resMassSq_ - massSq;
+
+ // Compute the complex amplitude
+ resAmplitude = LauComplex( massSqTerm, resMass * totWidth );
+
+ // Scale by the denominator factor
+ resAmplitude.rescale( ( resMassSq_ * resWidth / q0_ ) /
+ ( massSqTerm * massSqTerm + resMassSq_ * totWidth * totWidth ) );
+
+ // Calculate the phase shift term
+ const Double_t rVal = this->getEffectiveRange();
+ const Double_t aVal = this->getScatteringLength();
+ const Double_t tandeltaB = ( 2.0 * aVal * q ) / ( 2.0 + aVal * rVal * q * q );
+ const Double_t tanSq = tandeltaB * tandeltaB;
+ const Double_t cos2PhaseShift = ( 1.0 - tanSq ) / ( 1.0 + tanSq );
+ const Double_t sin2PhaseShift = 2.0 * tandeltaB / ( 1.0 + tanSq );
+ LauComplex phaseShift( cos2PhaseShift, sin2PhaseShift );
+
+ // Multiply by the phase shift
+ resAmplitude = resAmplitude * phaseShift;
+
+ //--------------------------------
+ // Now do the effective range part
+ //--------------------------------
+
+ // Form the real and imaginary parts
+ const Double_t qcotdeltaB = 1.0 / aVal + ( rVal * q * q ) / 2.0;
+
+ // Compute the complex amplitude
+ bkgAmplitude = LauComplex( qcotdeltaB, q );
+
+ // Scale by the numerator and denominator factors
+ bkgAmplitude.rescale( mass / ( qcotdeltaB * qcotdeltaB + q * q ) );
+
+ //------------------
+ // Add them together
+ //------------------
+
+ if ( mass > cutOff_ ) {
+ totAmplitude = resAmplitude;
+ } else {
+ totAmplitude = bkgAmplitude + resAmplitude;
+ }
+
+ return totAmplitude;
}
const std::vector<LauParameter*>& LauLASSRes::getFloatingParameters()
{
- this->clearFloatingParameters();
+ this->clearFloatingParameters();
- if ( ! this->fixMass() ) {
- this->addFloatingParameter( this->getMassPar() );
- }
+ if ( ! this->fixMass() ) {
+ this->addFloatingParameter( this->getMassPar() );
+ }
- if ( ! this->fixWidth() ) {
- this->addFloatingParameter( this->getWidthPar() );
- }
+ if ( ! this->fixWidth() ) {
+ this->addFloatingParameter( this->getWidthPar() );
+ }
- if ( ! this->fixEffectiveRange() ) {
- this->addFloatingParameter( r_ );
- }
+ if ( ! this->fixEffectiveRange() ) {
+ this->addFloatingParameter( r_ );
+ }
- if ( ! this->fixScatteringLength() ) {
- this->addFloatingParameter( a_ );
- }
+ if ( ! this->fixScatteringLength() ) {
+ this->addFloatingParameter( a_ );
+ }
- return this->getParameters();
+ return this->getParameters();
}
-void LauLASSRes::setResonanceParameter(const TString& name, const Double_t value)
+void LauLASSRes::setResonanceParameter( const TString& name, const Double_t value )
{
- // Set various parameters for the LASS lineshape dynamics
- if (name == "a") {
- this->setScatteringLength(value);
- std::cout << "INFO in LauLASSRes::setResonanceParameter : Setting LASS Scattering Length = " << this->getScatteringLength() << std::endl;
- } else if (name == "r") {
- this->setEffectiveRange(value);
- std::cout << "INFO in LauLASSRes::setResonanceParameter : Setting LASS Effective Range = " << this->getEffectiveRange() << std::endl;
- } else {
- std::cerr << "WARNING in LauLASSRes::setResonanceParameter: Parameter name not reconised. No parameter changes made." << std::endl;
- }
+ // Set various parameters for the LASS lineshape dynamics
+ if ( name == "a" ) {
+ this->setScatteringLength( value );
+ std::cout << "INFO in LauLASSRes::setResonanceParameter : Setting LASS Scattering Length = "
+ << this->getScatteringLength() << std::endl;
+ } else if ( name == "r" ) {
+ this->setEffectiveRange( value );
+ std::cout << "INFO in LauLASSRes::setResonanceParameter : Setting LASS Effective Range = "
+ << this->getEffectiveRange() << std::endl;
+ } else {
+ std::cerr << "WARNING in LauLASSRes::setResonanceParameter: Parameter name not reconised. No parameter changes made."
+ << std::endl;
+ }
}
-void LauLASSRes::floatResonanceParameter(const TString& name)
+void LauLASSRes::floatResonanceParameter( const TString& name )
{
- if (name == "a") {
- if ( a_->fixed() ) {
- a_->fixed( kFALSE );
- this->addFloatingParameter( a_ );
- } else {
- std::cerr << "WARNING in LauLASSRes::floatResonanceParameter: Parameter already floating. No parameter changes made." << std::endl;
- }
- } else if (name == "r") {
- if ( r_->fixed() ) {
- r_->fixed( kFALSE );
- this->addFloatingParameter( r_ );
- } else {
- std::cerr << "WARNING in LauLASSRes::floatResonanceParameter: Parameter already floating. No parameter changes made." << std::endl;
- }
- } else {
- std::cerr << "WARNING in LauLASSRes::fixResonanceParameter: Parameter name not reconised. No parameter changes made." << std::endl;
- }
+ if ( name == "a" ) {
+ if ( a_->fixed() ) {
+ a_->fixed( kFALSE );
+ this->addFloatingParameter( a_ );
+ } else {
+ std::cerr << "WARNING in LauLASSRes::floatResonanceParameter: Parameter already floating. No parameter changes made."
+ << std::endl;
+ }
+ } else if ( name == "r" ) {
+ if ( r_->fixed() ) {
+ r_->fixed( kFALSE );
+ this->addFloatingParameter( r_ );
+ } else {
+ std::cerr << "WARNING in LauLASSRes::floatResonanceParameter: Parameter already floating. No parameter changes made."
+ << std::endl;
+ }
+ } else {
+ std::cerr << "WARNING in LauLASSRes::fixResonanceParameter: Parameter name not reconised. No parameter changes made."
+ << std::endl;
+ }
}
-LauParameter* LauLASSRes::getResonanceParameter(const TString& name)
+LauParameter* LauLASSRes::getResonanceParameter( const TString& name )
{
- if (name == "a") {
- return a_;
- } else if (name == "r") {
- return r_;
- } else {
- std::cerr << "WARNING in LauLASSRes::getResonanceParameter: Parameter name not reconised." << std::endl;
- return 0;
- }
+ if ( name == "a" ) {
+ return a_;
+ } else if ( name == "r" ) {
+ return r_;
+ } else {
+ std::cerr << "WARNING in LauLASSRes::getResonanceParameter: Parameter name not reconised."
+ << std::endl;
+ return 0;
+ }
}
-void LauLASSRes::setEffectiveRange(const Double_t r)
+void LauLASSRes::setEffectiveRange( const Double_t r )
{
- r_->value( r );
- r_->genValue( r );
- r_->initValue( r );
+ r_->value( r );
+ r_->genValue( r );
+ r_->initValue( r );
}
-void LauLASSRes::setScatteringLength(const Double_t a)
+void LauLASSRes::setScatteringLength( const Double_t a )
{
- a_->value( a );
- a_->genValue( a );
- a_->initValue( a );
+ a_->value( a );
+ a_->genValue( a );
+ a_->initValue( a );
}
-
diff --git a/src/LauLinearPdf.cc b/src/LauLinearPdf.cc
index b718134..3b9a87f 100644
--- a/src/LauLinearPdf.cc
+++ b/src/LauLinearPdf.cc
@@ -1,127 +1,130 @@
/*
Copyright 2006 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauLinearPdf.cc
- \brief File containing implementation of LauLinearPdf class.
+ \brief File containing implementation of LauLinearPdf class.
*/
#include <iostream>
#include <vector>
-using std::cout;
using std::cerr;
+using std::cout;
using std::endl;
-#include "TMath.h"
-#include "TSystem.h"
-
#include "LauConstants.hh"
#include "LauLinearPdf.hh"
+#include "TMath.h"
+#include "TSystem.h"
-
- LauLinearPdf::LauLinearPdf(const TString& theVarName, const std::vector<LauAbsRValue*>& params, Double_t minAbscissa, Double_t maxAbscissa) :
- LauAbsPdf(theVarName, params, minAbscissa, maxAbscissa),
- slope_(0),posflag_(kTRUE)
+LauLinearPdf::LauLinearPdf( const TString& theVarName,
+ const std::vector<LauAbsRValue*>& params,
+ Double_t minAbscissa,
+ Double_t maxAbscissa ) :
+ LauAbsPdf( theVarName, params, minAbscissa, maxAbscissa ),
+ slope_( 0 ),
+ posflag_( kTRUE )
{
- // Constructor for the linear PDF.
- //
- // The parameters in params are the slope and y-intercept of the line.
- // The last two arguments specify the range in which the PDF is defined, and the PDF
- // will be normalised w.r.t. these limits.
+ // Constructor for the linear PDF.
+ //
+ // The parameters in params are the slope and y-intercept of the line.
+ // The last two arguments specify the range in which the PDF is defined, and the PDF
+ // will be normalised w.r.t. these limits.
- slope_ = this->findParameter("slope");
+ slope_ = this->findParameter( "slope" );
- if ((this->nParameters() != 1) || (slope_ == 0)) {
- cerr<<"Warning. LauLinearPdf requires 1 parameter: \"slope\"."<<endl;
- gSystem->Exit(EXIT_FAILURE);
- }
+ if ( ( this->nParameters() != 1 ) || ( slope_ == 0 ) ) {
+ cerr << "Warning. LauLinearPdf requires 1 parameter: \"slope\"." << endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
- // Cache the normalisation factor.
- this->calcNorm();
+ // Cache the normalisation factor.
+ this->calcNorm();
}
-LauLinearPdf::~LauLinearPdf()
+LauLinearPdf::~LauLinearPdf()
{
- // Destructor
+ // Destructor
}
-void LauLinearPdf::calcLikelihoodInfo(const LauAbscissas& abscissas)
+void LauLinearPdf::calcLikelihoodInfo( const LauAbscissas& abscissas )
{
- // Check that the given abscissa is within the allowed range
- if (!this->checkRange(abscissas)) {
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // Get our abscissa
- Double_t abscissa = abscissas[0];
-
- // Get the up to date parameter values
- Double_t slope = slope_->unblindValue();
-
- // Calculate the value of the straight line for the given value of the abscissa.
- Double_t constVal = 1.0/(this->getMaxAbscissa() - this->getMinAbscissa());
- constVal -= slope * (this->getMaxAbscissa() + this->getMinAbscissa()) * 0.5;
-
- Double_t value = slope*abscissa + constVal;
-
- // Make sure the PDF doesn't go negative
- if ( value < 0.0 ) {
- if ( posflag_ ) {
- std::cerr << "WARNING in LauLinearPdf::calcLikelihoodInfo : The PDF is negative, setting to zero" << std::endl;
- posflag_= kFALSE;
- }
- value = 0.0;
- }
-
- this->setUnNormPDFVal(value);
+ // Check that the given abscissa is within the allowed range
+ if ( ! this->checkRange( abscissas ) ) {
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // Get our abscissa
+ Double_t abscissa = abscissas[0];
+
+ // Get the up to date parameter values
+ Double_t slope = slope_->unblindValue();
+
+ // Calculate the value of the straight line for the given value of the abscissa.
+ Double_t constVal = 1.0 / ( this->getMaxAbscissa() - this->getMinAbscissa() );
+ constVal -= slope * ( this->getMaxAbscissa() + this->getMinAbscissa() ) * 0.5;
+
+ Double_t value = slope * abscissa + constVal;
+
+ // Make sure the PDF doesn't go negative
+ if ( value < 0.0 ) {
+ if ( posflag_ ) {
+ std::cerr << "WARNING in LauLinearPdf::calcLikelihoodInfo : The PDF is negative, setting to zero"
+ << std::endl;
+ posflag_ = kFALSE;
+ }
+ value = 0.0;
+ }
+
+ this->setUnNormPDFVal( value );
}
-void LauLinearPdf::calcNorm()
+void LauLinearPdf::calcNorm()
{
- // Nothing to calculate here since the PDF is already normalised to 1
- this->setNorm(1.0);
+ // Nothing to calculate here since the PDF is already normalised to 1
+ this->setNorm( 1.0 );
}
void LauLinearPdf::calcPDFHeight( const LauKinematics* /*kinematics*/ )
{
- if (this->heightUpToDate()) {
- return;
- }
+ if ( this->heightUpToDate() ) {
+ return;
+ }
- // Get the up to date parameter values
- Double_t slope = slope_->unblindValue();
+ // Get the up to date parameter values
+ Double_t slope = slope_->unblindValue();
- // Calculate the PDF height for the straight line
- LauAbscissas maxPoint(1);
- if (slope>0.0) {
- maxPoint[0] = this->getMaxAbscissa();
- } else {
- maxPoint[0] = this->getMinAbscissa();
- }
- this->calcLikelihoodInfo(maxPoint);
+ // Calculate the PDF height for the straight line
+ LauAbscissas maxPoint( 1 );
+ if ( slope > 0.0 ) {
+ maxPoint[0] = this->getMaxAbscissa();
+ } else {
+ maxPoint[0] = this->getMinAbscissa();
+ }
+ this->calcLikelihoodInfo( maxPoint );
- Double_t height = this->getUnNormLikelihood();
+ Double_t height = this->getUnNormLikelihood();
- this->setMaxHeight(height);
+ this->setMaxHeight( height );
}
diff --git a/src/LauMagPhaseCPCoeffSet.cc b/src/LauMagPhaseCPCoeffSet.cc
index 7839357..00a59e4 100644
--- a/src/LauMagPhaseCPCoeffSet.cc
+++ b/src/LauMagPhaseCPCoeffSet.cc
@@ -1,321 +1,361 @@
/*
Copyright 2011 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauMagPhaseCPCoeffSet.cc
\brief File containing implementation of LauMagPhaseCPCoeffSet class.
*/
-#include <iostream>
-#include <fstream>
-#include <vector>
-
-#include "TMath.h"
-#include "TRandom.h"
-
#include "LauMagPhaseCPCoeffSet.hh"
+
#include "LauComplex.hh"
#include "LauConstants.hh"
#include "LauParameter.hh"
#include "LauPrint.hh"
+#include "TMath.h"
+#include "TRandom.h"
+#include <fstream>
+#include <iostream>
+#include <vector>
-LauMagPhaseCPCoeffSet::LauMagPhaseCPCoeffSet(const TString& compName, Double_t mag, Double_t phase, Double_t magBar, Double_t phaseBar,
- Bool_t magFixed, Bool_t phaseFixed,Bool_t magBarFixed, Bool_t phaseBarFixed) :
- LauAbsCoeffSet(compName),
- mag_(new LauParameter("Mag", mag, minMagnitude_, maxMagnitude_, magFixed)),
- phase_(new LauParameter("Phase", phase, minPhase_, maxPhase_, phaseFixed)),
- magBar_(new LauParameter("MagBar", magBar, minMagnitude_, maxMagnitude_, magBarFixed)),
- phaseBar_(new LauParameter("PhaseBar", phaseBar, minPhase_, maxPhase_, phaseBarFixed)),
- particleCoeff_( mag*TMath::Cos(phase), mag*TMath::Sin(phase) ),
- antiparticleCoeff_( magBar*TMath::Cos(phaseBar), magBar*TMath::Sin(phaseBar) ),
- acp_("ACP", (magBar*magBar - mag*mag)/(magBar*magBar + mag*mag), -1.0, 1.0)
+LauMagPhaseCPCoeffSet::LauMagPhaseCPCoeffSet( const TString& compName,
+ Double_t mag,
+ Double_t phase,
+ Double_t magBar,
+ Double_t phaseBar,
+ Bool_t magFixed,
+ Bool_t phaseFixed,
+ Bool_t magBarFixed,
+ Bool_t phaseBarFixed ) :
+ LauAbsCoeffSet( compName ),
+ mag_( new LauParameter( "Mag", mag, minMagnitude_, maxMagnitude_, magFixed ) ),
+ phase_( new LauParameter( "Phase", phase, minPhase_, maxPhase_, phaseFixed ) ),
+ magBar_( new LauParameter( "MagBar", magBar, minMagnitude_, maxMagnitude_, magBarFixed ) ),
+ phaseBar_( new LauParameter( "PhaseBar", phaseBar, minPhase_, maxPhase_, phaseBarFixed ) ),
+ particleCoeff_( mag * TMath::Cos( phase ), mag * TMath::Sin( phase ) ),
+ antiparticleCoeff_( magBar * TMath::Cos( phaseBar ), magBar * TMath::Sin( phaseBar ) ),
+ acp_( "ACP", ( magBar * magBar - mag * mag ) / ( magBar * magBar + mag * mag ), -1.0, 1.0 )
{
}
-LauMagPhaseCPCoeffSet::LauMagPhaseCPCoeffSet(const LauMagPhaseCPCoeffSet& rhs, CloneOption cloneOption, Double_t constFactor) : LauAbsCoeffSet(rhs.name()),
- mag_(0),
- phase_(0),
- magBar_(0),
- phaseBar_(0),
- particleCoeff_( rhs.particleCoeff_ ),
- antiparticleCoeff_( rhs.antiparticleCoeff_ ),
- acp_( rhs.acp_ )
+LauMagPhaseCPCoeffSet::LauMagPhaseCPCoeffSet( const LauMagPhaseCPCoeffSet& rhs,
+ CloneOption cloneOption,
+ Double_t constFactor ) :
+ LauAbsCoeffSet( rhs.name() ),
+ mag_( 0 ),
+ phase_( 0 ),
+ magBar_( 0 ),
+ phaseBar_( 0 ),
+ particleCoeff_( rhs.particleCoeff_ ),
+ antiparticleCoeff_( rhs.antiparticleCoeff_ ),
+ acp_( rhs.acp_ )
{
- if ( cloneOption == All || cloneOption == TieMagnitude ) {
- mag_ = rhs.mag_->createClone(constFactor);
- magBar_ = rhs.magBar_->createClone(constFactor);
- } else {
- mag_ = new LauParameter("Mag", rhs.mag_->value(), minMagnitude_, maxMagnitude_, rhs.mag_->fixed());
- if ( rhs.mag_->blind() ) {
- const LauBlind* blinder = rhs.mag_->blinder();
- mag_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
- }
- magBar_ = new LauParameter("MagBar", rhs.magBar_->value(), minMagnitude_, maxMagnitude_, rhs.magBar_->fixed());
- if ( rhs.magBar_->blind() ) {
- const LauBlind* blinder = rhs.magBar_->blinder();
- magBar_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
- }
- }
-
- if ( cloneOption == All || cloneOption == TiePhase ) {
- phase_ = rhs.phase_->createClone(constFactor);
- phaseBar_ = rhs.phaseBar_->createClone(constFactor);
- } else {
- phase_ = new LauParameter("Phase", rhs.phase_->value(), minPhase_, maxPhase_, rhs.phase_->fixed());
- if ( rhs.phase_->blind() ) {
- const LauBlind* blinder = rhs.phase_->blinder();
- phase_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
- }
- phaseBar_ = new LauParameter("PhaseBar", rhs.phaseBar_->value(), minPhase_, maxPhase_, rhs.phaseBar_->fixed());
- if ( rhs.phaseBar_->blind() ) {
- const LauBlind* blinder = rhs.phaseBar_->blinder();
- phaseBar_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
- }
- }
+ if ( cloneOption == All || cloneOption == TieMagnitude ) {
+ mag_ = rhs.mag_->createClone( constFactor );
+ magBar_ = rhs.magBar_->createClone( constFactor );
+ } else {
+ mag_ = new LauParameter( "Mag",
+ rhs.mag_->value(),
+ minMagnitude_,
+ maxMagnitude_,
+ rhs.mag_->fixed() );
+ if ( rhs.mag_->blind() ) {
+ const LauBlind* blinder = rhs.mag_->blinder();
+ mag_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
+ }
+ magBar_ = new LauParameter( "MagBar",
+ rhs.magBar_->value(),
+ minMagnitude_,
+ maxMagnitude_,
+ rhs.magBar_->fixed() );
+ if ( rhs.magBar_->blind() ) {
+ const LauBlind* blinder = rhs.magBar_->blinder();
+ magBar_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
+ }
+ }
+
+ if ( cloneOption == All || cloneOption == TiePhase ) {
+ phase_ = rhs.phase_->createClone( constFactor );
+ phaseBar_ = rhs.phaseBar_->createClone( constFactor );
+ } else {
+ phase_ =
+ new LauParameter( "Phase", rhs.phase_->value(), minPhase_, maxPhase_, rhs.phase_->fixed() );
+ if ( rhs.phase_->blind() ) {
+ const LauBlind* blinder = rhs.phase_->blinder();
+ phase_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
+ }
+ phaseBar_ = new LauParameter( "PhaseBar",
+ rhs.phaseBar_->value(),
+ minPhase_,
+ maxPhase_,
+ rhs.phaseBar_->fixed() );
+ if ( rhs.phaseBar_->blind() ) {
+ const LauBlind* blinder = rhs.phaseBar_->blinder();
+ phaseBar_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
+ }
+ }
}
std::vector<LauParameter*> LauMagPhaseCPCoeffSet::getParameters()
{
- std::vector<LauParameter*> pars;
- pars.push_back(mag_);
- pars.push_back(phase_);
- pars.push_back(magBar_);
- pars.push_back(phaseBar_);
- return pars;
+ std::vector<LauParameter*> pars;
+ pars.push_back( mag_ );
+ pars.push_back( phase_ );
+ pars.push_back( magBar_ );
+ pars.push_back( phaseBar_ );
+ return pars;
}
void LauMagPhaseCPCoeffSet::printParValues() const
{
- std::cout<<"INFO in LauMagPhaseCPCoeffSet::printParValues : Component \""<<this->name()<<"\" has ";
- std::cout<<"mag = "<<mag_->value()<<",\t";
- std::cout<<"phase = "<<phase_->value()<<",\t";
- std::cout<<"magBar = "<<magBar_->value()<<",\t";
- std::cout<<"phaseBar = "<<phaseBar_->value()<<"."<<std::endl;
+ std::cout << "INFO in LauMagPhaseCPCoeffSet::printParValues : Component \"" << this->name()
+ << "\" has ";
+ std::cout << "mag = " << mag_->value() << ",\t";
+ std::cout << "phase = " << phase_->value() << ",\t";
+ std::cout << "magBar = " << magBar_->value() << ",\t";
+ std::cout << "phaseBar = " << phaseBar_->value() << "." << std::endl;
}
-void LauMagPhaseCPCoeffSet::printTableHeading(std::ostream& stream) const
+void LauMagPhaseCPCoeffSet::printTableHeading( std::ostream& stream ) const
{
- stream<<"\\begin{tabular}{|l|c|c|c|c|}"<<std::endl;
- stream<<"\\hline"<<std::endl;
- stream<<"Component & Magnitude & Phase & Magnitude_bar & Phase_bar \\\\"<<std::endl;
- stream<<"\\hline"<<std::endl;
+ stream << "\\begin{tabular}{|l|c|c|c|c|}" << std::endl;
+ stream << "\\hline" << std::endl;
+ stream << "Component & Magnitude & Phase & Magnitude_bar & Phase_bar \\\\" << std::endl;
+ stream << "\\hline" << std::endl;
}
-void LauMagPhaseCPCoeffSet::printTableRow(std::ostream& stream) const
+void LauMagPhaseCPCoeffSet::printTableRow( std::ostream& stream ) const
{
- LauPrint print;
- TString resName = this->name();
- resName = resName.ReplaceAll("_", "\\_");
- stream<<resName<<" & $";
- print.printFormat(stream, mag_->value());
- stream<<" \\pm ";
- print.printFormat(stream, mag_->error());
- stream<<"$ & $";
- print.printFormat(stream, phase_->value());
- stream<<" \\pm ";
- print.printFormat(stream, phase_->error());
- stream<<"$ & $";
- print.printFormat(stream, magBar_->value());
- stream<<" \\pm ";
- print.printFormat(stream, magBar_->error());
- stream<<"$ & $";
- print.printFormat(stream, phaseBar_->value());
- stream<<" \\pm ";
- print.printFormat(stream, phaseBar_->error());
- stream<<"$ \\\\"<<std::endl;
+ LauPrint print;
+ TString resName = this->name();
+ resName = resName.ReplaceAll( "_", "\\_" );
+ stream << resName << " & $";
+ print.printFormat( stream, mag_->value() );
+ stream << " \\pm ";
+ print.printFormat( stream, mag_->error() );
+ stream << "$ & $";
+ print.printFormat( stream, phase_->value() );
+ stream << " \\pm ";
+ print.printFormat( stream, phase_->error() );
+ stream << "$ & $";
+ print.printFormat( stream, magBar_->value() );
+ stream << " \\pm ";
+ print.printFormat( stream, magBar_->error() );
+ stream << "$ & $";
+ print.printFormat( stream, phaseBar_->value() );
+ stream << " \\pm ";
+ print.printFormat( stream, phaseBar_->error() );
+ stream << "$ \\\\" << std::endl;
}
void LauMagPhaseCPCoeffSet::randomiseInitValues()
{
- if (mag_->fixed() == kFALSE) {
- // Choose a value for "magnitude" between 0.0 and 2.0
- Double_t value = LauAbsCoeffSet::getRandomiser()->Rndm()*2.0;
- mag_->initValue(value); mag_->value(value);
- }
- if (phase_->fixed() == kFALSE) {
- // Choose a phase between +- pi
- Double_t value = LauAbsCoeffSet::getRandomiser()->Rndm()*LauConstants::twoPi - LauConstants::pi;
- phase_->initValue(value); phase_->value(value);
- }
- if (magBar_->fixed() == kFALSE) {
- // Choose a value for "magnitude" between 0.0 and 2.0
- Double_t value = LauAbsCoeffSet::getRandomiser()->Rndm()*2.0;
- magBar_->initValue(value); magBar_->value(value);
- }
- if (phaseBar_->fixed() == kFALSE) {
- // Choose a phase between +- pi
- Double_t value = LauAbsCoeffSet::getRandomiser()->Rndm()*LauConstants::twoPi - LauConstants::pi;
- phaseBar_->initValue(value); phaseBar_->value(value);
- }
+ if ( mag_->fixed() == kFALSE ) {
+ // Choose a value for "magnitude" between 0.0 and 2.0
+ Double_t value = LauAbsCoeffSet::getRandomiser()->Rndm() * 2.0;
+ mag_->initValue( value );
+ mag_->value( value );
+ }
+ if ( phase_->fixed() == kFALSE ) {
+ // Choose a phase between +- pi
+ Double_t value = LauAbsCoeffSet::getRandomiser()->Rndm() * LauConstants::twoPi -
+ LauConstants::pi;
+ phase_->initValue( value );
+ phase_->value( value );
+ }
+ if ( magBar_->fixed() == kFALSE ) {
+ // Choose a value for "magnitude" between 0.0 and 2.0
+ Double_t value = LauAbsCoeffSet::getRandomiser()->Rndm() * 2.0;
+ magBar_->initValue( value );
+ magBar_->value( value );
+ }
+ if ( phaseBar_->fixed() == kFALSE ) {
+ // Choose a phase between +- pi
+ Double_t value = LauAbsCoeffSet::getRandomiser()->Rndm() * LauConstants::twoPi -
+ LauConstants::pi;
+ phaseBar_->initValue( value );
+ phaseBar_->value( value );
+ }
}
void LauMagPhaseCPCoeffSet::finaliseValues()
{
- // retrieve the current values from the parameters
- Double_t mVal= mag_->value();
- Double_t pVal= phase_->value();
- Double_t mBarVal= magBar_->value();
- Double_t pBarVal= phaseBar_->value();
- Double_t genPhase = phase_->genValue();
- Double_t genPhaseBar = phaseBar_->genValue();
-
- // Check whether we have a negative magnitude.
- // If so make it positive and add pi to the phase.
- if (mVal < 0.0) {
- mVal *= -1.0;
- pVal += LauConstants::pi;
- }
- if (mBarVal < 0.0) {
- mBarVal *= -1.0;
- pBarVal += LauConstants::pi;
- }
-
- // Check now whether the phases lies in the right range (-pi to pi).
- Bool_t pWithinRange(kFALSE);
- Bool_t pBarWithinRange(kFALSE);
- while (pWithinRange == kFALSE && pBarWithinRange == kFALSE) {
- if (pVal > -LauConstants::pi && pVal < LauConstants::pi) {
- pWithinRange = kTRUE;
- } else {
- // Not within the specified range
- if (pVal > LauConstants::pi) {
- pVal -= LauConstants::twoPi;
- } else if (pVal < -LauConstants::pi) {
- pVal += LauConstants::twoPi;
- }
- }
-
- if (pBarVal > -LauConstants::pi && pBarVal < LauConstants::pi) {
- pBarWithinRange = kTRUE;
- } else {
- // Not within the specified range
- if (pBarVal > LauConstants::pi) {
- pBarVal -= LauConstants::twoPi;
- } else if (pBarVal < -LauConstants::pi) {
- pBarVal += LauConstants::twoPi;
- }
- }
- }
-
- // A further problem can occur when the generated phase is close to -pi or pi.
- // The phase can wrap over to the other end of the scale -
- // this leads to artificially large pulls so we wrap it back.
- Double_t diff = pVal - genPhase;
- if (diff > LauConstants::pi) {
- pVal -= LauConstants::twoPi;
- } else if (diff < -LauConstants::pi) {
- pVal += LauConstants::twoPi;
- }
-
- diff = pBarVal - genPhaseBar;
- if (diff > LauConstants::pi) {
- pBarVal -= LauConstants::twoPi;
- } else if (diff < -LauConstants::pi) {
- pBarVal += LauConstants::twoPi;
- }
-
- // finally store the new values in the parameters
- // and update the pulls
- mag_->value(mVal); mag_->updatePull();
- phase_->value(pVal); phase_->updatePull();
- magBar_->value(mBarVal); magBar_->updatePull();
- phaseBar_->value(pBarVal); phaseBar_->updatePull();
-
-
+ // retrieve the current values from the parameters
+ Double_t mVal = mag_->value();
+ Double_t pVal = phase_->value();
+ Double_t mBarVal = magBar_->value();
+ Double_t pBarVal = phaseBar_->value();
+ Double_t genPhase = phase_->genValue();
+ Double_t genPhaseBar = phaseBar_->genValue();
+
+ // Check whether we have a negative magnitude.
+ // If so make it positive and add pi to the phase.
+ if ( mVal < 0.0 ) {
+ mVal *= -1.0;
+ pVal += LauConstants::pi;
+ }
+ if ( mBarVal < 0.0 ) {
+ mBarVal *= -1.0;
+ pBarVal += LauConstants::pi;
+ }
+
+ // Check now whether the phases lies in the right range (-pi to pi).
+ Bool_t pWithinRange( kFALSE );
+ Bool_t pBarWithinRange( kFALSE );
+ while ( pWithinRange == kFALSE && pBarWithinRange == kFALSE ) {
+ if ( pVal > -LauConstants::pi && pVal < LauConstants::pi ) {
+ pWithinRange = kTRUE;
+ } else {
+ // Not within the specified range
+ if ( pVal > LauConstants::pi ) {
+ pVal -= LauConstants::twoPi;
+ } else if ( pVal < -LauConstants::pi ) {
+ pVal += LauConstants::twoPi;
+ }
+ }
+
+ if ( pBarVal > -LauConstants::pi && pBarVal < LauConstants::pi ) {
+ pBarWithinRange = kTRUE;
+ } else {
+ // Not within the specified range
+ if ( pBarVal > LauConstants::pi ) {
+ pBarVal -= LauConstants::twoPi;
+ } else if ( pBarVal < -LauConstants::pi ) {
+ pBarVal += LauConstants::twoPi;
+ }
+ }
+ }
+
+ // A further problem can occur when the generated phase is close to -pi or pi.
+ // The phase can wrap over to the other end of the scale -
+ // this leads to artificially large pulls so we wrap it back.
+ Double_t diff = pVal - genPhase;
+ if ( diff > LauConstants::pi ) {
+ pVal -= LauConstants::twoPi;
+ } else if ( diff < -LauConstants::pi ) {
+ pVal += LauConstants::twoPi;
+ }
+
+ diff = pBarVal - genPhaseBar;
+ if ( diff > LauConstants::pi ) {
+ pBarVal -= LauConstants::twoPi;
+ } else if ( diff < -LauConstants::pi ) {
+ pBarVal += LauConstants::twoPi;
+ }
+
+ // finally store the new values in the parameters
+ // and update the pulls
+ mag_->value( mVal );
+ mag_->updatePull();
+ phase_->value( pVal );
+ phase_->updatePull();
+ magBar_->value( mBarVal );
+ magBar_->updatePull();
+ phaseBar_->value( pBarVal );
+ phaseBar_->updatePull();
}
const LauComplex& LauMagPhaseCPCoeffSet::particleCoeff()
{
- particleCoeff_.setRealImagPart( mag_->unblindValue()*TMath::Cos(phase_->unblindValue()), mag_->unblindValue()*TMath::Sin(phase_->unblindValue()) );
- return particleCoeff_;
+ particleCoeff_.setRealImagPart( mag_->unblindValue() * TMath::Cos( phase_->unblindValue() ),
+ mag_->unblindValue() * TMath::Sin( phase_->unblindValue() ) );
+ return particleCoeff_;
}
const LauComplex& LauMagPhaseCPCoeffSet::antiparticleCoeff()
{
- antiparticleCoeff_.setRealImagPart( magBar_->unblindValue()*TMath::Cos(phaseBar_->unblindValue()), magBar_->unblindValue()*TMath::Sin(phaseBar_->unblindValue()) );
- return antiparticleCoeff_;
+ antiparticleCoeff_.setRealImagPart(
+ magBar_->unblindValue() * TMath::Cos( phaseBar_->unblindValue() ),
+ magBar_->unblindValue() * TMath::Sin( phaseBar_->unblindValue() ) );
+ return antiparticleCoeff_;
}
-void LauMagPhaseCPCoeffSet::setCoeffValues( const LauComplex& coeff, const LauComplex& coeffBar, Bool_t init )
+void LauMagPhaseCPCoeffSet::setCoeffValues( const LauComplex& coeff,
+ const LauComplex& coeffBar,
+ Bool_t init )
{
- Double_t magVal( coeff.abs() );
- Double_t phaseVal( coeff.arg() );
- Double_t magBarVal( coeffBar.abs() );
- Double_t phaseBarVal( coeffBar.arg() );
-
- mag_->value( magVal );
- phase_->value( phaseVal );
- magBar_->value( magBarVal );
- phaseBar_->value( phaseBarVal );
-
- if ( init ) {
- mag_->genValue( magVal );
- phase_->genValue( phaseVal );
- magBar_->genValue( magBarVal );
- phaseBar_->genValue( phaseBarVal );
-
- mag_->initValue( magVal );
- phase_->initValue( phaseVal );
- magBar_->initValue( magBarVal );
- phaseBar_->initValue( phaseBarVal );
- }
+ Double_t magVal( coeff.abs() );
+ Double_t phaseVal( coeff.arg() );
+ Double_t magBarVal( coeffBar.abs() );
+ Double_t phaseBarVal( coeffBar.arg() );
+
+ mag_->value( magVal );
+ phase_->value( phaseVal );
+ magBar_->value( magBarVal );
+ phaseBar_->value( phaseBarVal );
+
+ if ( init ) {
+ mag_->genValue( magVal );
+ phase_->genValue( phaseVal );
+ magBar_->genValue( magBarVal );
+ phaseBar_->genValue( phaseBarVal );
+
+ mag_->initValue( magVal );
+ phase_->initValue( phaseVal );
+ magBar_->initValue( magBarVal );
+ phaseBar_->initValue( phaseBarVal );
+ }
}
LauParameter LauMagPhaseCPCoeffSet::acp()
{
- // set the name
- TString parName(this->baseName()); parName += "_ACP";
- acp_.name(parName);
+ // set the name
+ TString parName( this->baseName() );
+ parName += "_ACP";
+ acp_.name( parName );
- // work out the ACP value
+ // work out the ACP value
- Double_t value(-99.0);
- value = (magBar_->value()*magBar_->value() - mag_->value()*mag_->value())/(magBar_->value()*magBar_->value() + mag_->value()*mag_->value());
+ Double_t value( -99.0 );
+ value = ( magBar_->value() * magBar_->value() - mag_->value() * mag_->value() ) /
+ ( magBar_->value() * magBar_->value() + mag_->value() * mag_->value() );
- // is it fixed?
- Bool_t fixed = magBar_->fixed() && mag_->fixed();
- acp_.fixed(fixed);
+ // is it fixed?
+ Bool_t fixed = magBar_->fixed() && mag_->fixed();
+ acp_.fixed( fixed );
- // we can't work out the error without the covariance matrix
- Double_t error(0.0);
+ // we can't work out the error without the covariance matrix
+ Double_t error( 0.0 );
- // set the value and error
- acp_.valueAndErrors(value,error);
+ // set the value and error
+ acp_.valueAndErrors( value, error );
- return acp_;
+ return acp_;
}
-LauAbsCoeffSet* LauMagPhaseCPCoeffSet::createClone(const TString& newName, CloneOption cloneOption, Double_t constFactor)
+LauAbsCoeffSet* LauMagPhaseCPCoeffSet::createClone( const TString& newName,
+ CloneOption cloneOption,
+ Double_t constFactor )
{
- LauAbsCoeffSet* clone(0);
- if ( cloneOption == All || cloneOption == TiePhase || cloneOption == TieMagnitude ) {
- clone = new LauMagPhaseCPCoeffSet( *this, cloneOption, constFactor );
- clone->name( newName );
- } else {
- std::cerr << "ERROR in LauMagPhaseCPCoeffSet::createClone : Invalid clone option" << std::endl;
- }
- return clone;
+ LauAbsCoeffSet* clone( 0 );
+ if ( cloneOption == All || cloneOption == TiePhase || cloneOption == TieMagnitude ) {
+ clone = new LauMagPhaseCPCoeffSet( *this, cloneOption, constFactor );
+ clone->name( newName );
+ } else {
+ std::cerr << "ERROR in LauMagPhaseCPCoeffSet::createClone : Invalid clone option"
+ << std::endl;
+ }
+ return clone;
}
-
diff --git a/src/LauMagPhaseCoeffSet.cc b/src/LauMagPhaseCoeffSet.cc
index 4636873..61c533d 100644
--- a/src/LauMagPhaseCoeffSet.cc
+++ b/src/LauMagPhaseCoeffSet.cc
@@ -1,223 +1,246 @@
/*
Copyright 2006 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauMagPhaseCoeffSet.cc
\brief File containing implementation of LauMagPhaseCoeffSet class.
*/
-#include <iostream>
-#include <fstream>
-#include <vector>
-
-#include "TMath.h"
-#include "TRandom.h"
+#include "LauMagPhaseCoeffSet.hh"
#include "LauComplex.hh"
#include "LauConstants.hh"
-#include "LauMagPhaseCoeffSet.hh"
#include "LauParameter.hh"
#include "LauPrint.hh"
+#include "TMath.h"
+#include "TRandom.h"
+#include <fstream>
+#include <iostream>
+#include <vector>
-LauMagPhaseCoeffSet::LauMagPhaseCoeffSet(const TString& compName, Double_t magnitude, Double_t phase, Bool_t magFixed, Bool_t phaseFixed) :
- LauAbsCoeffSet(compName),
- magnitude_(new LauParameter("A",magnitude,minMagnitude_,maxMagnitude_,magFixed)),
- phase_(new LauParameter("Delta",phase,minPhase_,maxPhase_,phaseFixed)),
- coeff_(magnitude*TMath::Cos(phase), magnitude*TMath::Sin(phase))
+LauMagPhaseCoeffSet::LauMagPhaseCoeffSet( const TString& compName,
+ Double_t magnitude,
+ Double_t phase,
+ Bool_t magFixed,
+ Bool_t phaseFixed ) :
+ LauAbsCoeffSet( compName ),
+ magnitude_( new LauParameter( "A", magnitude, minMagnitude_, maxMagnitude_, magFixed ) ),
+ phase_( new LauParameter( "Delta", phase, minPhase_, maxPhase_, phaseFixed ) ),
+ coeff_( magnitude * TMath::Cos( phase ), magnitude * TMath::Sin( phase ) )
{
}
-LauMagPhaseCoeffSet::LauMagPhaseCoeffSet(const LauMagPhaseCoeffSet& rhs, CloneOption cloneOption, Double_t constFactor) : LauAbsCoeffSet(rhs.name()),
- magnitude_(0),
- phase_(0),
- coeff_( rhs.coeff_ )
+LauMagPhaseCoeffSet::LauMagPhaseCoeffSet( const LauMagPhaseCoeffSet& rhs,
+ CloneOption cloneOption,
+ Double_t constFactor ) :
+ LauAbsCoeffSet( rhs.name() ),
+ magnitude_( 0 ),
+ phase_( 0 ),
+ coeff_( rhs.coeff_ )
{
- if ( cloneOption == All || cloneOption == TieMagnitude ) {
- magnitude_ = rhs.magnitude_->createClone(constFactor);
- } else {
- magnitude_ = new LauParameter("A", rhs.magnitude_->value(), minMagnitude_, maxMagnitude_, rhs.magnitude_->fixed());
- if ( rhs.magnitude_->blind() ) {
- const LauBlind* blinder = rhs.magnitude_->blinder();
- magnitude_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
- }
- }
-
- if ( cloneOption == All || cloneOption == TiePhase ) {
- phase_ = rhs.phase_->createClone(constFactor);
- } else {
- phase_ = new LauParameter("Delta", rhs.phase_->value(), minPhase_, maxPhase_, rhs.phase_->fixed());
- if ( rhs.phase_->blind() ) {
- const LauBlind* blinder = rhs.phase_->blinder();
- phase_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
- }
- }
+ if ( cloneOption == All || cloneOption == TieMagnitude ) {
+ magnitude_ = rhs.magnitude_->createClone( constFactor );
+ } else {
+ magnitude_ = new LauParameter( "A",
+ rhs.magnitude_->value(),
+ minMagnitude_,
+ maxMagnitude_,
+ rhs.magnitude_->fixed() );
+ if ( rhs.magnitude_->blind() ) {
+ const LauBlind* blinder = rhs.magnitude_->blinder();
+ magnitude_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
+ }
+ }
+
+ if ( cloneOption == All || cloneOption == TiePhase ) {
+ phase_ = rhs.phase_->createClone( constFactor );
+ } else {
+ phase_ =
+ new LauParameter( "Delta", rhs.phase_->value(), minPhase_, maxPhase_, rhs.phase_->fixed() );
+ if ( rhs.phase_->blind() ) {
+ const LauBlind* blinder = rhs.phase_->blinder();
+ phase_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
+ }
+ }
}
std::vector<LauParameter*> LauMagPhaseCoeffSet::getParameters()
{
- std::vector<LauParameter*> pars;
- pars.push_back(magnitude_);
- pars.push_back(phase_);
- return pars;
+ std::vector<LauParameter*> pars;
+ pars.push_back( magnitude_ );
+ pars.push_back( phase_ );
+ return pars;
}
void LauMagPhaseCoeffSet::printParValues() const
{
- std::cout<<"INFO in LauMagPhaseCoeffSet::printParValues : Component \""<<this->name()<<"\" has magnitude = "<<magnitude_->value()<<" and phase = "<<phase_->value()<<"."<<std::endl;
+ std::cout << "INFO in LauMagPhaseCoeffSet::printParValues : Component \"" << this->name()
+ << "\" has magnitude = " << magnitude_->value() << " and phase = " << phase_->value()
+ << "." << std::endl;
}
-void LauMagPhaseCoeffSet::printTableHeading(std::ostream& stream) const
+void LauMagPhaseCoeffSet::printTableHeading( std::ostream& stream ) const
{
- stream<<"\\begin{tabular}{|l|c|c|}"<<std::endl;
- stream<<"\\hline"<<std::endl;
- stream<<"Component & Magnitude & Phase \\\\"<<std::endl;
- stream<<"\\hline"<<std::endl;
+ stream << "\\begin{tabular}{|l|c|c|}" << std::endl;
+ stream << "\\hline" << std::endl;
+ stream << "Component & Magnitude & Phase \\\\" << std::endl;
+ stream << "\\hline" << std::endl;
}
-void LauMagPhaseCoeffSet::printTableRow(std::ostream& stream) const
+void LauMagPhaseCoeffSet::printTableRow( std::ostream& stream ) const
{
- LauPrint print;
- TString resName = this->name();
- resName = resName.ReplaceAll("_", "\\_");
- stream<<resName<<" & $";
- print.printFormat(stream, magnitude_->value());
- stream<<" \\pm ";
- print.printFormat(stream, magnitude_->error());
- stream<<"$ & $";
- print.printFormat(stream, phase_->value());
- stream<<" \\pm ";
- print.printFormat(stream, phase_->error());
- stream<<"$ \\\\"<<std::endl;
+ LauPrint print;
+ TString resName = this->name();
+ resName = resName.ReplaceAll( "_", "\\_" );
+ stream << resName << " & $";
+ print.printFormat( stream, magnitude_->value() );
+ stream << " \\pm ";
+ print.printFormat( stream, magnitude_->error() );
+ stream << "$ & $";
+ print.printFormat( stream, phase_->value() );
+ stream << " \\pm ";
+ print.printFormat( stream, phase_->error() );
+ stream << "$ \\\\" << std::endl;
}
void LauMagPhaseCoeffSet::randomiseInitValues()
{
- if (magnitude_->fixed() == kFALSE) {
- // Choose a magnitude between 0.0 and 2.0
- Double_t mag = LauAbsCoeffSet::getRandomiser()->Rndm()*2.0;
- magnitude_->initValue(mag); magnitude_->value(mag);
- }
- if (phase_->fixed() == kFALSE) {
- // Choose a phase between +- pi
- Double_t phase = LauAbsCoeffSet::getRandomiser()->Rndm()*LauConstants::twoPi - LauConstants::pi;
- phase_->initValue(phase); phase_->value(phase);
- }
+ if ( magnitude_->fixed() == kFALSE ) {
+ // Choose a magnitude between 0.0 and 2.0
+ Double_t mag = LauAbsCoeffSet::getRandomiser()->Rndm() * 2.0;
+ magnitude_->initValue( mag );
+ magnitude_->value( mag );
+ }
+ if ( phase_->fixed() == kFALSE ) {
+ // Choose a phase between +- pi
+ Double_t phase = LauAbsCoeffSet::getRandomiser()->Rndm() * LauConstants::twoPi -
+ LauConstants::pi;
+ phase_->initValue( phase );
+ phase_->value( phase );
+ }
}
void LauMagPhaseCoeffSet::finaliseValues()
{
- // retrieve the current values from the parameters
- Double_t mag = magnitude_->value();
- Double_t phase = phase_->value();
- Double_t genPhase = phase_->genValue();
-
- // Check whether we have a negative magnitude.
- // If so make it positive and add pi to the phase.
- if (mag < 0.0) {
- mag *= -1.0;
- phase += LauConstants::pi;
- }
-
- // Check now whether the phase lies in the right range (-pi to pi).
- Bool_t withinRange(kFALSE);
- while (withinRange == kFALSE) {
- if (phase > -LauConstants::pi && phase <= LauConstants::pi) {
- withinRange = kTRUE;
- } else {
- // Not within the specified range
- if (phase > LauConstants::pi) {
- phase -= LauConstants::twoPi;
- } else if (phase <= -LauConstants::pi) {
- phase += LauConstants::twoPi;
- }
- }
- }
-
- // A further problem can occur when the generated phase is close to -pi or pi.
- // The phase can wrap over to the other end of the scale -
- // this leads to artificially large pulls so we wrap it back.
- Double_t diff = phase - genPhase;
- if (diff > LauConstants::pi) {
- phase -= LauConstants::twoPi;
- } else if (diff < -LauConstants::pi) {
- phase += LauConstants::twoPi;
- }
-
- // finally store the new values in the parameters
- // and update the pulls
- magnitude_->value(mag); magnitude_->updatePull();
- phase_->value(phase); phase_->updatePull();
+ // retrieve the current values from the parameters
+ Double_t mag = magnitude_->value();
+ Double_t phase = phase_->value();
+ Double_t genPhase = phase_->genValue();
+
+ // Check whether we have a negative magnitude.
+ // If so make it positive and add pi to the phase.
+ if ( mag < 0.0 ) {
+ mag *= -1.0;
+ phase += LauConstants::pi;
+ }
+
+ // Check now whether the phase lies in the right range (-pi to pi).
+ Bool_t withinRange( kFALSE );
+ while ( withinRange == kFALSE ) {
+ if ( phase > -LauConstants::pi && phase <= LauConstants::pi ) {
+ withinRange = kTRUE;
+ } else {
+ // Not within the specified range
+ if ( phase > LauConstants::pi ) {
+ phase -= LauConstants::twoPi;
+ } else if ( phase <= -LauConstants::pi ) {
+ phase += LauConstants::twoPi;
+ }
+ }
+ }
+
+ // A further problem can occur when the generated phase is close to -pi or pi.
+ // The phase can wrap over to the other end of the scale -
+ // this leads to artificially large pulls so we wrap it back.
+ Double_t diff = phase - genPhase;
+ if ( diff > LauConstants::pi ) {
+ phase -= LauConstants::twoPi;
+ } else if ( diff < -LauConstants::pi ) {
+ phase += LauConstants::twoPi;
+ }
+
+ // finally store the new values in the parameters
+ // and update the pulls
+ magnitude_->value( mag );
+ magnitude_->updatePull();
+ phase_->value( phase );
+ phase_->updatePull();
}
const LauComplex& LauMagPhaseCoeffSet::particleCoeff()
{
- coeff_.setRealImagPart(magnitude_->unblindValue()*TMath::Cos(phase_->unblindValue()), magnitude_->unblindValue()*TMath::Sin(phase_->unblindValue()));
- return coeff_;
+ coeff_.setRealImagPart( magnitude_->unblindValue() * TMath::Cos( phase_->unblindValue() ),
+ magnitude_->unblindValue() * TMath::Sin( phase_->unblindValue() ) );
+ return coeff_;
}
const LauComplex& LauMagPhaseCoeffSet::antiparticleCoeff()
{
- return this->particleCoeff();
+ return this->particleCoeff();
}
-void LauMagPhaseCoeffSet::setCoeffValues( const LauComplex& coeff, const LauComplex& coeffBar, Bool_t init )
+void LauMagPhaseCoeffSet::setCoeffValues( const LauComplex& coeff,
+ const LauComplex& coeffBar,
+ Bool_t init )
{
- LauComplex average( coeff );
- average += coeffBar;
- average.rescale( 0.5 );
+ LauComplex average( coeff );
+ average += coeffBar;
+ average.rescale( 0.5 );
- Double_t magVal( average.abs() );
- Double_t phaseVal( average.arg() );
+ Double_t magVal( average.abs() );
+ Double_t phaseVal( average.arg() );
- magnitude_->value( magVal );
- phase_->value( phaseVal );
+ magnitude_->value( magVal );
+ phase_->value( phaseVal );
- if ( init ) {
- magnitude_->genValue( magVal );
- phase_->genValue( phaseVal );
+ if ( init ) {
+ magnitude_->genValue( magVal );
+ phase_->genValue( phaseVal );
- magnitude_->initValue( magVal );
- phase_->initValue( phaseVal );
- }
+ magnitude_->initValue( magVal );
+ phase_->initValue( phaseVal );
+ }
}
LauParameter LauMagPhaseCoeffSet::acp()
{
- TString parName(this->baseName()); parName += "_ACP";
- return LauParameter(parName,0.0);
+ TString parName( this->baseName() );
+ parName += "_ACP";
+ return LauParameter( parName, 0.0 );
}
-LauAbsCoeffSet* LauMagPhaseCoeffSet::createClone(const TString& newName, CloneOption cloneOption, Double_t constFactor)
+LauAbsCoeffSet* LauMagPhaseCoeffSet::createClone( const TString& newName,
+ CloneOption cloneOption,
+ Double_t constFactor )
{
- LauAbsCoeffSet* clone(0);
- if ( cloneOption == All || cloneOption == TiePhase || cloneOption == TieMagnitude ) {
- clone = new LauMagPhaseCoeffSet( *this, cloneOption, constFactor );
- clone->name( newName );
- } else {
- std::cerr << "ERROR in LauMagPhaseCoeffSet::createClone : Invalid clone option" << std::endl;
- }
- return clone;
+ LauAbsCoeffSet* clone( 0 );
+ if ( cloneOption == All || cloneOption == TiePhase || cloneOption == TieMagnitude ) {
+ clone = new LauMagPhaseCoeffSet( *this, cloneOption, constFactor );
+ clone->name( newName );
+ } else {
+ std::cerr << "ERROR in LauMagPhaseCoeffSet::createClone : Invalid clone option" << std::endl;
+ }
+ return clone;
}
-
diff --git a/src/LauMergeDataFiles.cc b/src/LauMergeDataFiles.cc
index ee4873d..1776ec5 100644
--- a/src/LauMergeDataFiles.cc
+++ b/src/LauMergeDataFiles.cc
@@ -1,309 +1,325 @@
/*
Copyright 2008 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauMergeDataFiles.cc
- \brief File containing implementation of LauMergeDataFiles class.
- */
+ \brief File containing implementation of LauMergeDataFiles class.
+*/
#include "LauMergeDataFiles.hh"
-#include <iostream>
-#include <map>
-
#include "TLeaf.h"
#include "TObjArray.h"
#include "TSystem.h"
+#include <iostream>
+#include <map>
-
-LauMergeDataFiles::LauMergeDataFiles(const TString& fileName1, const TString& fileName2, const TString& treeName) :
- fileName1_(fileName1),
- fileName2_(fileName2),
- treeName_(treeName),
- inputFile1_(0),
- inputFile2_(0),
- inputTree1_(0),
- inputTree2_(0),
- outputFile_(0),
- outputTree_(0)
+LauMergeDataFiles::LauMergeDataFiles( const TString& fileName1,
+ const TString& fileName2,
+ const TString& treeName ) :
+ fileName1_( fileName1 ),
+ fileName2_( fileName2 ),
+ treeName_( treeName ),
+ inputFile1_( 0 ),
+ inputFile2_( 0 ),
+ inputTree1_( 0 ),
+ inputTree2_( 0 ),
+ outputFile_( 0 ),
+ outputTree_( 0 )
{
}
LauMergeDataFiles::~LauMergeDataFiles()
{
- if (inputFile1_ && inputFile1_->IsOpen()) {
- inputFile1_->Close();
- }
- delete inputFile1_;
-
- if (inputFile2_ && inputFile2_->IsOpen()) {
- inputFile2_->Close();
- }
- delete inputFile2_;
-
- if (outputFile_ && outputFile_->IsOpen()) {
- outputFile_->Close();
- }
- delete outputFile_;
+ if ( inputFile1_ && inputFile1_->IsOpen() ) {
+ inputFile1_->Close();
+ }
+ delete inputFile1_;
+
+ if ( inputFile2_ && inputFile2_->IsOpen() ) {
+ inputFile2_->Close();
+ }
+ delete inputFile2_;
+
+ if ( outputFile_ && outputFile_->IsOpen() ) {
+ outputFile_->Close();
+ }
+ delete outputFile_;
}
void LauMergeDataFiles::openInputFiles()
{
- // open the two input ROOT files
- inputFile1_ = TFile::Open(fileName1_);
- if (!inputFile1_ || inputFile1_->IsZombie()) {
- std::cerr<<"Problem opening file: \""<<fileName1_<<"\", exiting..."<<std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- inputTree1_ = dynamic_cast<TTree*>( inputFile1_->Get(treeName_) );
- if (!inputTree1_) {
- std::cerr<<"Problem getting tree called "<<treeName_<<"from file: \""<<fileName1_<<"\", exiting..."<<std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- inputFile2_ = TFile::Open(fileName2_);
- if (!inputFile2_ || inputFile2_->IsZombie()) {
- std::cerr<<"Problem opening file: \""<<fileName2_<<"\", exiting..."<<std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- inputTree2_ = dynamic_cast<TTree*>( inputFile2_->Get(treeName_) );
- if (!inputTree2_) {
- std::cerr<<"Problem getting tree called "<<treeName_<<"from file: \""<<fileName2_<<"\", exiting..."<<std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
+ // open the two input ROOT files
+ inputFile1_ = TFile::Open( fileName1_ );
+ if ( ! inputFile1_ || inputFile1_->IsZombie() ) {
+ std::cerr << "Problem opening file: \"" << fileName1_ << "\", exiting..." << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ inputTree1_ = dynamic_cast<TTree*>( inputFile1_->Get( treeName_ ) );
+ if ( ! inputTree1_ ) {
+ std::cerr << "Problem getting tree called " << treeName_ << "from file: \"" << fileName1_
+ << "\", exiting..." << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ inputFile2_ = TFile::Open( fileName2_ );
+ if ( ! inputFile2_ || inputFile2_->IsZombie() ) {
+ std::cerr << "Problem opening file: \"" << fileName2_ << "\", exiting..." << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ inputTree2_ = dynamic_cast<TTree*>( inputFile2_->Get( treeName_ ) );
+ if ( ! inputTree2_ ) {
+ std::cerr << "Problem getting tree called " << treeName_ << "from file: \"" << fileName2_
+ << "\", exiting..." << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
}
void LauMergeDataFiles::setupInputTrees()
{
- TObjArray* leaves1 = inputTree1_->GetListOfLeaves();
- TObjArray* leaves2 = inputTree2_->GetListOfLeaves();
- Int_t nLeaves1 = leaves1->GetEntries();
- Int_t nLeaves2 = leaves2->GetEntries();
- if ( nLeaves1 != nLeaves2 ) {
- std::cerr<<"Different number of leaves in the two input trees, not continuing."<<std::endl;
- return;
- }
-
- std::cout<<"Setting branches for input trees \""<<treeName_<<"\"..."<<std::endl;
- inputTree1_->SetBranchAddress("iExpt",&iExpt_);
- inputTree1_->SetBranchAddress("iEvtWithinExpt",&iEvtWithinExpt_);
- inputTree2_->SetBranchAddress("iExpt",&iExpt_);
- inputTree2_->SetBranchAddress("iEvtWithinExpt",&iEvtWithinExpt_);
-
- for (Int_t iLeaf(0); iLeaf<nLeaves1; ++iLeaf) {
-
- TLeaf * leaf = dynamic_cast<TLeaf*>((*leaves1)[iLeaf]);
- TString type = leaf->GetTypeName();
- TString name = leaf->GetName();
- Int_t size = leaf->GetNdata();
-
- if ((name == "iExpt") || (name == "iEvtWithinExpt") || (size != 1)) {
- continue;
- }
-
- if ( type == "Double_t" ) {
- std::pair<LeafDoubleMap::iterator,bool> result = doubleVars_.insert(std::make_pair(name,0.0));
- LeafDoubleMap::iterator iter = result.first;
- bool ok = result.second;
- if (ok) {
- inputTree1_->SetBranchAddress(name,&(iter->second));
- inputTree2_->SetBranchAddress(name,&(iter->second));
- }
- } else if ( type == "Int_t" ) {
- std::pair<LeafIntegerMap::iterator,bool> result = integerVars_.insert(std::make_pair(name,0));
- LeafIntegerMap::iterator iter = result.first;
- bool ok = result.second;
- if (ok) {
- inputTree1_->SetBranchAddress(name,&(iter->second));
- inputTree2_->SetBranchAddress(name,&(iter->second));
- }
- }
- }
- std::cout<<"Set branch addresses for "<<doubleVars_.size()<<" Double_t branches.\n";
- std::cout<<"Set branch addresses for "<<integerVars_.size()<<" Int_t branches.\n"<<std::endl;
+ TObjArray* leaves1 = inputTree1_->GetListOfLeaves();
+ TObjArray* leaves2 = inputTree2_->GetListOfLeaves();
+ Int_t nLeaves1 = leaves1->GetEntries();
+ Int_t nLeaves2 = leaves2->GetEntries();
+ if ( nLeaves1 != nLeaves2 ) {
+ std::cerr << "Different number of leaves in the two input trees, not continuing."
+ << std::endl;
+ return;
+ }
+
+ std::cout << "Setting branches for input trees \"" << treeName_ << "\"..." << std::endl;
+ inputTree1_->SetBranchAddress( "iExpt", &iExpt_ );
+ inputTree1_->SetBranchAddress( "iEvtWithinExpt", &iEvtWithinExpt_ );
+ inputTree2_->SetBranchAddress( "iExpt", &iExpt_ );
+ inputTree2_->SetBranchAddress( "iEvtWithinExpt", &iEvtWithinExpt_ );
+
+ for ( Int_t iLeaf( 0 ); iLeaf < nLeaves1; ++iLeaf ) {
+
+ TLeaf* leaf = dynamic_cast<TLeaf*>( ( *leaves1 )[iLeaf] );
+ TString type = leaf->GetTypeName();
+ TString name = leaf->GetName();
+ Int_t size = leaf->GetNdata();
+
+ if ( ( name == "iExpt" ) || ( name == "iEvtWithinExpt" ) || ( size != 1 ) ) {
+ continue;
+ }
+
+ if ( type == "Double_t" ) {
+ std::pair<LeafDoubleMap::iterator, bool> result = doubleVars_.insert(
+ std::make_pair( name, 0.0 ) );
+ LeafDoubleMap::iterator iter = result.first;
+ bool ok = result.second;
+ if ( ok ) {
+ inputTree1_->SetBranchAddress( name, &( iter->second ) );
+ inputTree2_->SetBranchAddress( name, &( iter->second ) );
+ }
+ } else if ( type == "Int_t" ) {
+ std::pair<LeafIntegerMap::iterator, bool> result = integerVars_.insert(
+ std::make_pair( name, 0 ) );
+ LeafIntegerMap::iterator iter = result.first;
+ bool ok = result.second;
+ if ( ok ) {
+ inputTree1_->SetBranchAddress( name, &( iter->second ) );
+ inputTree2_->SetBranchAddress( name, &( iter->second ) );
+ }
+ }
+ }
+ std::cout << "Set branch addresses for " << doubleVars_.size() << " Double_t branches.\n";
+ std::cout << "Set branch addresses for " << integerVars_.size() << " Int_t branches.\n"
+ << std::endl;
}
void LauMergeDataFiles::setupOutputTree()
{
- std::cout<<"Creating branches for output tree \""<<outputTree_->GetName()<<"\"..."<<std::endl;
-
- outputTree_->Branch("iExpt",&iExpt_,"iExpt/I");
- outputTree_->Branch("iEvtWithinExpt",&iEvtWithinExpt_,"iEvtWithinExpt/I");
-
- for (LeafDoubleMap::iterator iter = doubleVars_.begin(); iter != doubleVars_.end(); ++iter) {
- TString name = iter->first;
- Double_t * address = &(iter->second);
- TString thirdBit = name;
- thirdBit += "/D";
-
- outputTree_->Branch(name,address,thirdBit);
- }
- for (LeafIntegerMap::iterator iter = integerVars_.begin(); iter != integerVars_.end(); ++iter) {
- TString name = iter->first;
- Int_t * address = &(iter->second);
- TString thirdBit = name;
- thirdBit += "/I";
-
- outputTree_->Branch(name,address,thirdBit);
- }
- std::cout<<"Created "<<doubleVars_.size()+integerVars_.size()<<" branches.\n"<<std::endl;
+ std::cout << "Creating branches for output tree \"" << outputTree_->GetName() << "\"..."
+ << std::endl;
+
+ outputTree_->Branch( "iExpt", &iExpt_, "iExpt/I" );
+ outputTree_->Branch( "iEvtWithinExpt", &iEvtWithinExpt_, "iEvtWithinExpt/I" );
+
+ for ( LeafDoubleMap::iterator iter = doubleVars_.begin(); iter != doubleVars_.end(); ++iter ) {
+ TString name = iter->first;
+ Double_t* address = &( iter->second );
+ TString thirdBit = name;
+ thirdBit += "/D";
+
+ outputTree_->Branch( name, address, thirdBit );
+ }
+ for ( LeafIntegerMap::iterator iter = integerVars_.begin(); iter != integerVars_.end(); ++iter ) {
+ TString name = iter->first;
+ Int_t* address = &( iter->second );
+ TString thirdBit = name;
+ thirdBit += "/I";
+
+ outputTree_->Branch( name, address, thirdBit );
+ }
+ std::cout << "Created " << doubleVars_.size() + integerVars_.size() << " branches.\n"
+ << std::endl;
}
-void LauMergeDataFiles::process(const TString& fileName)
+void LauMergeDataFiles::process( const TString& fileName )
{
- this->openInputFiles();
+ this->openInputFiles();
- this->setupInputTrees();
+ this->setupInputTrees();
- outputFile_ = TFile::Open(fileName,"recreate");
- outputTree_ = new TTree(treeName_,"");
- this->setupOutputTree();
+ outputFile_ = TFile::Open( fileName, "recreate" );
+ outputTree_ = new TTree( treeName_, "" );
+ this->setupOutputTree();
- // loop over the trees and combine the corresponding experiments
- std::cout<<"Starting to combine the trees..."<<std::endl;
+ // loop over the trees and combine the corresponding experiments
+ std::cout << "Starting to combine the trees..." << std::endl;
- // Find the first and last entries for each experiment in each tree
- this->findExperiments( inputTree1_, tree1Expts_ );
- this->findExperiments( inputTree2_, tree2Expts_ );
+ // Find the first and last entries for each experiment in each tree
+ this->findExperiments( inputTree1_, tree1Expts_ );
+ this->findExperiments( inputTree2_, tree2Expts_ );
- // Check that the experiments in the two trees match
- if ( !this->checkExperimentMaps() ) {
- return;
- }
+ // Check that the experiments in the two trees match
+ if ( ! this->checkExperimentMaps() ) {
+ return;
+ }
- // Loop through the experiments
- for ( ExptsMap::const_iterator iter1 = tree1Expts_.begin(); iter1 != tree1Expts_.end(); ++iter1 ) {
+ // Loop through the experiments
+ for ( ExptsMap::const_iterator iter1 = tree1Expts_.begin(); iter1 != tree1Expts_.end(); ++iter1 ) {
- // get the map element for tree2
- Int_t expt = iter1->first;
- ExptsMap::const_iterator iter2 = tree2Expts_.find( expt );
+ // get the map element for tree2
+ Int_t expt = iter1->first;
+ ExptsMap::const_iterator iter2 = tree2Expts_.find( expt );
- // determine the number of entries in tree1
- Int_t nEntriesInTree1 = iter1->second.second - iter1->second.first + 1;
+ // determine the number of entries in tree1
+ Int_t nEntriesInTree1 = iter1->second.second - iter1->second.first + 1;
- // read the entries from the trees, filling the output tree
- this->readExperiment( inputTree1_, iter1, 0 );
- this->readExperiment( inputTree2_, iter2, nEntriesInTree1 );
- }
+ // read the entries from the trees, filling the output tree
+ this->readExperiment( inputTree1_, iter1, 0 );
+ this->readExperiment( inputTree2_, iter2, nEntriesInTree1 );
+ }
- // Write the output file
- this->writeFile();
+ // Write the output file
+ this->writeFile();
}
-void LauMergeDataFiles::findExperiments(TTree* tree, ExptsMap& exptsMap)
+void LauMergeDataFiles::findExperiments( TTree* tree, ExptsMap& exptsMap )
{
- const Int_t nEntries = tree->GetEntries();
-
- // loop through the tree
- for ( Int_t iEntry(0); iEntry<nEntries; ++iEntry ) {
- // grab the entry
- tree->GetEntry(iEntry);
-
- // see if we already have an element in the map for the
- // current experiment
- ExptsMap::iterator iter = exptsMap.find(iExpt_);
- if ( iter == exptsMap.end() ) {
- // if not, we need to add an element that points to
- // this entry in the tree as the start entry
- exptsMap.insert( std::make_pair( iExpt_, std::make_pair( iEntry, -99 ) ) );
-
- // also we need to complete the map element for the
- // previous experiment with the previous tree entry
- // as the last entry
- ExptsMap::iterator previter = exptsMap.find(iExpt_-1);
- if ( previter != exptsMap.end() ) {
- previter->second.second = iEntry-1;
- }
- }
- }
- // need to complete the map element for the final experiment
- exptsMap[iExpt_].second = nEntries-1;
+ const Int_t nEntries = tree->GetEntries();
+
+ // loop through the tree
+ for ( Int_t iEntry( 0 ); iEntry < nEntries; ++iEntry ) {
+ // grab the entry
+ tree->GetEntry( iEntry );
+
+ // see if we already have an element in the map for the
+ // current experiment
+ ExptsMap::iterator iter = exptsMap.find( iExpt_ );
+ if ( iter == exptsMap.end() ) {
+ // if not, we need to add an element that points to
+ // this entry in the tree as the start entry
+ exptsMap.insert( std::make_pair( iExpt_, std::make_pair( iEntry, -99 ) ) );
+
+ // also we need to complete the map element for the
+ // previous experiment with the previous tree entry
+ // as the last entry
+ ExptsMap::iterator previter = exptsMap.find( iExpt_ - 1 );
+ if ( previter != exptsMap.end() ) {
+ previter->second.second = iEntry - 1;
+ }
+ }
+ }
+ // need to complete the map element for the final experiment
+ exptsMap[iExpt_].second = nEntries - 1;
}
Bool_t LauMergeDataFiles::checkExperimentMaps() const
{
- // first check that the two maps are the same size
- UInt_t size1 = tree1Expts_.size();
- UInt_t size2 = tree2Expts_.size();
- if ( size1 != size2 ) {
- std::cerr<<"ERROR in LauMergeDataFiles::checkExperimentMaps : Experiment maps are not the same size.\n";
- std::cerr<<" : Tree from "<<fileName1_<<" has "<<size1<<" experiments.";
- std::cerr<<" : Tree from "<<fileName2_<<" has "<<size2<<" experiments.";
- return kFALSE;
- }
-
- for ( ExptsMap::const_iterator iter1 = tree1Expts_.begin(); iter1 != tree1Expts_.end(); ++iter1 ) {
- Int_t expt = iter1->first;
- ExptsMap::const_iterator iter2 = tree2Expts_.find( expt );
- if ( iter2 == tree2Expts_.end() ) {
- std::cerr<<"ERROR in LauMergeDataFiles::checkExperimentMaps : Cannot find experiment "<<expt<<" in tree from "<<fileName2_<<std::endl;
- return kFALSE;
- }
- }
-
- return kTRUE;
+ // first check that the two maps are the same size
+ UInt_t size1 = tree1Expts_.size();
+ UInt_t size2 = tree2Expts_.size();
+ if ( size1 != size2 ) {
+ std::cerr << "ERROR in LauMergeDataFiles::checkExperimentMaps : Experiment maps are not the same size.\n";
+ std::cerr << " : Tree from " << fileName1_
+ << " has " << size1 << " experiments.";
+ std::cerr << " : Tree from " << fileName2_
+ << " has " << size2 << " experiments.";
+ return kFALSE;
+ }
+
+ for ( ExptsMap::const_iterator iter1 = tree1Expts_.begin(); iter1 != tree1Expts_.end(); ++iter1 ) {
+ Int_t expt = iter1->first;
+ ExptsMap::const_iterator iter2 = tree2Expts_.find( expt );
+ if ( iter2 == tree2Expts_.end() ) {
+ std::cerr << "ERROR in LauMergeDataFiles::checkExperimentMaps : Cannot find experiment "
+ << expt << " in tree from " << fileName2_ << std::endl;
+ return kFALSE;
+ }
+ }
+
+ return kTRUE;
}
-void LauMergeDataFiles::readExperiment(TTree* tree, const ExptsMap::const_iterator& expt, Int_t offset)
+void LauMergeDataFiles::readExperiment( TTree* tree, const ExptsMap::const_iterator& expt, Int_t offset )
{
- // find the first and last entry for this experiment from the map element
- const Int_t firstEntry = expt->second.first;
- const Int_t lastEntry = expt->second.second;
-
- // loop through all the entries
- for ( Int_t iEntry(firstEntry); iEntry<=lastEntry; ++iEntry ) {
- // get the entry from the tree
- tree->GetEntry( iEntry );
- // apply the offset to the "event within experiment" variable
- iEvtWithinExpt_ += offset;
- // fill the output tree
- outputTree_->Fill();
- }
+ // find the first and last entry for this experiment from the map element
+ const Int_t firstEntry = expt->second.first;
+ const Int_t lastEntry = expt->second.second;
+
+ // loop through all the entries
+ for ( Int_t iEntry( firstEntry ); iEntry <= lastEntry; ++iEntry ) {
+ // get the entry from the tree
+ tree->GetEntry( iEntry );
+ // apply the offset to the "event within experiment" variable
+ iEvtWithinExpt_ += offset;
+ // fill the output tree
+ outputTree_->Fill();
+ }
}
void LauMergeDataFiles::writeFile()
{
- std::cout<<"Building experiment:event index"<<std::endl;
- outputTree_->BuildIndex("iExpt","iEvtWithinExpt");
-
- std::cout<<"Writing data to outputfile "<<outputFile_->GetName()<<std::endl;
- outputTree_->SetDirectory(outputFile_);
- outputFile_->Write();
-
- // clean-up
- outputFile_->Close();
- delete outputFile_; outputFile_ = 0; outputTree_ = 0;
-
- inputFile1_->Close();
- delete inputFile1_; inputFile1_ = 0; inputTree1_ = 0;
-
- inputFile2_->Close();
- delete inputFile2_; inputFile2_ = 0; inputTree2_ = 0;
-
- doubleVars_.clear();
- integerVars_.clear();
- tree1Expts_.clear();
- tree2Expts_.clear();
+ std::cout << "Building experiment:event index" << std::endl;
+ outputTree_->BuildIndex( "iExpt", "iEvtWithinExpt" );
+
+ std::cout << "Writing data to outputfile " << outputFile_->GetName() << std::endl;
+ outputTree_->SetDirectory( outputFile_ );
+ outputFile_->Write();
+
+ // clean-up
+ outputFile_->Close();
+ delete outputFile_;
+ outputFile_ = 0;
+ outputTree_ = 0;
+
+ inputFile1_->Close();
+ delete inputFile1_;
+ inputFile1_ = 0;
+ inputTree1_ = 0;
+
+ inputFile2_->Close();
+ delete inputFile2_;
+ inputFile2_ = 0;
+ inputTree2_ = 0;
+
+ doubleVars_.clear();
+ integerVars_.clear();
+ tree1Expts_.clear();
+ tree2Expts_.clear();
}
-
diff --git a/src/LauMinuit.cc b/src/LauMinuit.cc
index cdf3825..7f63ce8 100644
--- a/src/LauMinuit.cc
+++ b/src/LauMinuit.cc
@@ -1,300 +1,309 @@
/*
Copyright 2013 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauMinuit.cc
\brief File containing implementation of LauMinuit methods.
*/
#include "LauMinuit.hh"
#include "LauFitObject.hh"
#include "LauFitter.hh"
-#include "LauParameter.hh"
#include "LauParamFixed.hh"
+#include "LauParameter.hh"
#include "TMatrixD.h"
#include "TVirtualFitter.h"
#include <algorithm>
#include <array>
#include <iostream>
// It's necessary to define an external function that specifies the address of the function
// that Minuit needs to minimise. Minuit doesn't know about any classes - therefore
// use gMinuit->SetFCN(external_function), gMinuit->SetObjectFit(this).
// Here, we use TVirtualFitter* fitter instead of gMinuit, defined below.
-// Then, within the external function, invoke an object from this class (LauAllModel),
+// Then, within the external function, invoke an object from this class (LauAllModel),
// and use the member functions to access the parameters/variables.
-extern void logLikeFun(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag);
-
+extern void logLikeFun( Int_t& npar, Double_t* gin, Double_t& f, Double_t* par, Int_t iflag );
-
-LauMinuit::LauMinuit( const UInt_t maxPar, const LauOutputLevel verbosity ) : LauAbsFitter(),
- maxPar_{maxPar},
- outputLevel_{verbosity}
+LauMinuit::LauMinuit( const UInt_t maxPar, const LauOutputLevel verbosity ) :
+ LauAbsFitter(),
+ maxPar_ { maxPar },
+ outputLevel_ { verbosity }
{
- TVirtualFitter::SetDefaultFitter( "Minuit" );
- minuit_ = TVirtualFitter::Fitter( nullptr, maxPar_ );
-
- // Set the printout level
- std::array<Double_t,1> argL { static_cast<Double_t>(outputLevel_) };
- minuit_->ExecuteCommand("SET PRINT", argL.data(), argL.size());
- if ( outputLevel_ == LauOutputLevel::None ) {
- minuit_->ExecuteCommand("SET NOWARNINGS", argL.data(), 0);
- }
+ TVirtualFitter::SetDefaultFitter( "Minuit" );
+ minuit_ = TVirtualFitter::Fitter( nullptr, maxPar_ );
+
+ // Set the printout level
+ std::array<Double_t, 1> argL { static_cast<Double_t>( outputLevel_ ) };
+ minuit_->ExecuteCommand( "SET PRINT", argL.data(), argL.size() );
+ if ( outputLevel_ == LauOutputLevel::None ) {
+ minuit_->ExecuteCommand( "SET NOWARNINGS", argL.data(), 0 );
+ }
}
void LauMinuit::initialise( LauFitObject* fitObj, const std::vector<LauParameter*>& parameters )
{
- // Check whether we're going to use asymmetric errors
- if ( outputLevel_ > LauOutputLevel::Quiet ) {
- if (useAsymmFitErrors_ == kTRUE) {
- std::cout << "INFO in LauMinuit::fit : We are going to calculate the asymmetric fit errors." << std::endl;
- std::cout << " : This will, in general, significantly increase the CPU time required for fitting." << std::endl;
- } else {
- std::cout << "INFO in LauMinuit::fit : Only parabolic errors will be calculated." << std::endl;
- }
- }
-
- // Store the parameters
- params_ = parameters;
-
- // Hook the external likelihood function to this LauFitter::fitter() and this class.
- minuit_->SetFCN( logLikeFun );
- minuit_->SetObjectFit( fitObj );
-
- // Clear any stored parameters etc... before using
- minuit_->Clear();
-
- nParams_ = params_.size();
- if ( outputLevel_ > LauOutputLevel::Quiet ) {
- std::cout << "INFO in LauMinuit::initialise : Setting fit parameters" << std::endl;
- std::cout << " : Total number of parameters = " << nParams_ << std::endl;
- }
-
- // Define the default relative error
- const Double_t defaultError(0.01);
-
- // Set-up the parameters
- for (UInt_t i = 0; i < nParams_; ++i) {
- TString name = params_[i]->name();
- Double_t initVal = params_[i]->initValue();
- Double_t initErr = params_[i]->error();
- // If we do not have a supplied estimate of the error, we should make a reasonable guess
- if ( initErr == 0.0 ) {
- if ( initVal == 0.0 ) {
- initErr = defaultError;
- } else if ( TMath::Abs(initErr/initVal) < 1e-6 ) {
- initErr = TMath::Abs(defaultError * initVal);
- }
- }
- Double_t minVal = params_[i]->minValue();
- Double_t maxVal = params_[i]->maxValue();
- Bool_t secondStage = params_[i]->secondStage();
- if (this->twoStageFit() && secondStage == kTRUE) {
- params_[i]->fixed(kTRUE);
- }
- Bool_t fixVar = params_[i]->fixed();
-
- if ( outputLevel_ > LauOutputLevel::Quiet ) {
- std::cout << " : Setting parameter " << i << " called " << name << " to have initial value " << initVal << ", error " << initErr << " and range " << minVal << " to " << maxVal << std::endl;
- }
- minuit_->SetParameter(i, name, initVal, initErr, minVal, maxVal);
-
- // Fix parameter if required
- if (fixVar == kTRUE) {
- if ( outputLevel_ > LauOutputLevel::Quiet ) {
- std::cout << " : Fixing parameter " << i << std::endl;
- }
- minuit_->FixParameter(i);
- }
- }
-
- LauParamFixed pred;
- nFreeParams_ = nParams_ - std::count_if(params_.begin(),params_.end(),pred);
-
- // Need to set the "SET ERR" command to +0.5 for +/-1 sigma errors
- // for maximum likelihood fit. Very important command, otherwise all
- // extracted errors will be too big, and pull distributions will be too narrow!
- // TODO - The alternative to this is to make FCN = -2log(L) rather than -log(L)
-
- std::array<Double_t,1> argL { 0.5 };
- fitStatus_.status = minuit_->ExecuteCommand("SET ERR", argL.data(), argL.size());
-
- //argL[0] = 0;
- //fitStatus_.status = minuit_->ExecuteCommand("SET STRATEGY", argL.data(), argL.size());
+ // Check whether we're going to use asymmetric errors
+ if ( outputLevel_ > LauOutputLevel::Quiet ) {
+ if ( useAsymmFitErrors_ == kTRUE ) {
+ std::cout << "INFO in LauMinuit::fit : We are going to calculate the asymmetric fit errors."
+ << std::endl;
+ std::cout << " : This will, in general, significantly increase the CPU time required for fitting."
+ << std::endl;
+ } else {
+ std::cout << "INFO in LauMinuit::fit : Only parabolic errors will be calculated."
+ << std::endl;
+ }
+ }
+
+ // Store the parameters
+ params_ = parameters;
+
+ // Hook the external likelihood function to this LauFitter::fitter() and this class.
+ minuit_->SetFCN( logLikeFun );
+ minuit_->SetObjectFit( fitObj );
+
+ // Clear any stored parameters etc... before using
+ minuit_->Clear();
+
+ nParams_ = params_.size();
+ if ( outputLevel_ > LauOutputLevel::Quiet ) {
+ std::cout << "INFO in LauMinuit::initialise : Setting fit parameters" << std::endl;
+ std::cout << " : Total number of parameters = " << nParams_
+ << std::endl;
+ }
+
+ // Define the default relative error
+ const Double_t defaultError( 0.01 );
+
+ // Set-up the parameters
+ for ( UInt_t i = 0; i < nParams_; ++i ) {
+ TString name = params_[i]->name();
+ Double_t initVal = params_[i]->initValue();
+ Double_t initErr = params_[i]->error();
+ // If we do not have a supplied estimate of the error, we should make a reasonable guess
+ if ( initErr == 0.0 ) {
+ if ( initVal == 0.0 ) {
+ initErr = defaultError;
+ } else if ( TMath::Abs( initErr / initVal ) < 1e-6 ) {
+ initErr = TMath::Abs( defaultError * initVal );
+ }
+ }
+ Double_t minVal = params_[i]->minValue();
+ Double_t maxVal = params_[i]->maxValue();
+ Bool_t secondStage = params_[i]->secondStage();
+ if ( this->twoStageFit() && secondStage == kTRUE ) {
+ params_[i]->fixed( kTRUE );
+ }
+ Bool_t fixVar = params_[i]->fixed();
+
+ if ( outputLevel_ > LauOutputLevel::Quiet ) {
+ std::cout << " : Setting parameter " << i << " called "
+ << name << " to have initial value " << initVal << ", error " << initErr
+ << " and range " << minVal << " to " << maxVal << std::endl;
+ }
+ minuit_->SetParameter( i, name, initVal, initErr, minVal, maxVal );
+
+ // Fix parameter if required
+ if ( fixVar == kTRUE ) {
+ if ( outputLevel_ > LauOutputLevel::Quiet ) {
+ std::cout << " : Fixing parameter " << i << std::endl;
+ }
+ minuit_->FixParameter( i );
+ }
+ }
+
+ LauParamFixed pred;
+ nFreeParams_ = nParams_ - std::count_if( params_.begin(), params_.end(), pred );
+
+ // Need to set the "SET ERR" command to +0.5 for +/-1 sigma errors
+ // for maximum likelihood fit. Very important command, otherwise all
+ // extracted errors will be too big, and pull distributions will be too narrow!
+ // TODO - The alternative to this is to make FCN = -2log(L) rather than -log(L)
+
+ std::array<Double_t, 1> argL { 0.5 };
+ fitStatus_.status = minuit_->ExecuteCommand( "SET ERR", argL.data(), argL.size() );
+
+ //argL[0] = 0;
+ //fitStatus_.status = minuit_->ExecuteCommand("SET STRATEGY", argL.data(), argL.size());
}
LauFitObject* LauMinuit::getFitObject()
{
- return (minuit_!=nullptr) ? dynamic_cast<LauFitObject*>( minuit_->GetObjectFit() ) : nullptr;
+ return ( minuit_ != nullptr ) ? dynamic_cast<LauFitObject*>( minuit_->GetObjectFit() ) : nullptr;
}
const LauAbsFitter::FitStatus& LauMinuit::minimise()
{
- std::array<Double_t,2> arglist {
- 1000.0*nParams_, // maximum iterations
- 0.05 // tolerance -> min EDM = 0.001*tolerance (0.05)
- };
- fitStatus_.status = minuit_->ExecuteCommand("MIGRAD", arglist.data(), arglist.size());
-
- // Dummy variables - need to feed them to the function
- // used for getting NLL, EDM and error matrix status
- Double_t errdef;
- Int_t nvpar, nparx;
-
- if (fitStatus_.status != 0) {
-
- if ( outputLevel_ > LauOutputLevel::None ) {
- std::cerr << "ERROR in LauMinuit::minimise : Error in minimising loglike." << std::endl;
- }
-
- } else {
-
- // Check that the error matrix is ok
- fitStatus_.status = minuit_->GetStats(fitStatus_.NLL, fitStatus_.EDM, errdef, nvpar, nparx);
- if ( outputLevel_ > LauOutputLevel::Quiet ) {
- std::cout << "INFO in LauMinuit::minimise : Error matrix status after MIGRAD is: " << fitStatus_.status << std::endl;
- }
- // 0= not calculated at all
- // 1= approximation only, not accurate
- // 2= full matrix, but forced positive-definite
- // 3= full accurate covariance matrix
-
- // Fit result was OK. Now get the more precise errors.
- fitStatus_.status = minuit_->ExecuteCommand("HESSE", arglist.data(), 1);
-
- if (fitStatus_.status != 0) {
-
- if ( outputLevel_ > LauOutputLevel::None ) {
- std::cerr << "ERROR in LauMinuit::minimise : Error in HESSE routine." << std::endl;
- }
-
- } else {
-
- // Check that the error matrix is ok
- fitStatus_.status = minuit_->GetStats(fitStatus_.NLL, fitStatus_.EDM, errdef, nvpar, nparx);
- if ( outputLevel_ > LauOutputLevel::Quiet ) {
- std::cout << "INFO in LauMinuit::minimise : Error matrix status after HESSE is: " << fitStatus_.status << std::endl;
- }
- // 0= not calculated at all
- // 1= approximation only, not accurate
- // 2= full matrix, but forced positive-definite
- // 3= full accurate covariance matrix
-
- // Symmetric errors and eror matrix were OK.
- // Get asymmetric errors if asked for.
- if (useAsymmFitErrors_ == kTRUE) {
- LauFitObject* fitObj = this->getFitObject();
- fitObj->withinAsymErrorCalc( kTRUE );
- fitStatus_.status = minuit_->ExecuteCommand("MINOS", arglist.data(), 1);
- fitObj->withinAsymErrorCalc( kFALSE );
- if (fitStatus_.status != 0) {
- std::cerr << "ERROR in LauMinuit::minimise : Error in MINOS routine." << std::endl;
- }
- }
- }
- }
-
- // Print results
- fitStatus_.status = minuit_->GetStats(fitStatus_.NLL, fitStatus_.EDM, errdef, nvpar, nparx);
- if ( outputLevel_ > LauOutputLevel::None ) {
- std::cout << "INFO in LauMinuit::minimise : Final error matrix status is: " << fitStatus_.status << std::endl;
- }
- // 0= not calculated at all
- // 1= approximation only, not accurate
- // 2= full matrix, but forced positive-definite
- // 3= full accurate covariance matrix
-
- if ( outputLevel_ > LauOutputLevel::None ) {
- minuit_->PrintResults(3, fitStatus_.NLL);
- }
-
- // Retrieve the covariance matrix from the fitter
- // For some reason the array returned is as if the matrix is of dimension nParams_ x nParams_
- // but only the elements within the sub-matrix nFreeParams_ x nFreeParams_ have values,
- // the "trailing" elements are zero, so we trim them off.
- Double_t* covMatrix = minuit_->GetCovarianceMatrix();
- covMatrix_.Clear();
- covMatrix_.ResizeTo( nParams_, nParams_ );
- covMatrix_.SetMatrixArray( covMatrix );
- covMatrix_.ResizeTo( nFreeParams_, nFreeParams_ );
-
- return fitStatus_;
+ std::array<Double_t, 2> arglist {
+ 1000.0 * nParams_, // maximum iterations
+ 0.05 // tolerance -> min EDM = 0.001*tolerance (0.05)
+ };
+ fitStatus_.status = minuit_->ExecuteCommand( "MIGRAD", arglist.data(), arglist.size() );
+
+ // Dummy variables - need to feed them to the function
+ // used for getting NLL, EDM and error matrix status
+ Double_t errdef;
+ Int_t nvpar, nparx;
+
+ if ( fitStatus_.status != 0 ) {
+
+ if ( outputLevel_ > LauOutputLevel::None ) {
+ std::cerr << "ERROR in LauMinuit::minimise : Error in minimising loglike." << std::endl;
+ }
+
+ } else {
+
+ // Check that the error matrix is ok
+ fitStatus_.status = minuit_->GetStats( fitStatus_.NLL, fitStatus_.EDM, errdef, nvpar, nparx );
+ if ( outputLevel_ > LauOutputLevel::Quiet ) {
+ std::cout << "INFO in LauMinuit::minimise : Error matrix status after MIGRAD is: "
+ << fitStatus_.status << std::endl;
+ }
+ // 0= not calculated at all
+ // 1= approximation only, not accurate
+ // 2= full matrix, but forced positive-definite
+ // 3= full accurate covariance matrix
+
+ // Fit result was OK. Now get the more precise errors.
+ fitStatus_.status = minuit_->ExecuteCommand( "HESSE", arglist.data(), 1 );
+
+ if ( fitStatus_.status != 0 ) {
+
+ if ( outputLevel_ > LauOutputLevel::None ) {
+ std::cerr << "ERROR in LauMinuit::minimise : Error in HESSE routine." << std::endl;
+ }
+
+ } else {
+
+ // Check that the error matrix is ok
+ fitStatus_.status =
+ minuit_->GetStats( fitStatus_.NLL, fitStatus_.EDM, errdef, nvpar, nparx );
+ if ( outputLevel_ > LauOutputLevel::Quiet ) {
+ std::cout << "INFO in LauMinuit::minimise : Error matrix status after HESSE is: "
+ << fitStatus_.status << std::endl;
+ }
+ // 0= not calculated at all
+ // 1= approximation only, not accurate
+ // 2= full matrix, but forced positive-definite
+ // 3= full accurate covariance matrix
+
+ // Symmetric errors and eror matrix were OK.
+ // Get asymmetric errors if asked for.
+ if ( useAsymmFitErrors_ == kTRUE ) {
+ LauFitObject* fitObj = this->getFitObject();
+ fitObj->withinAsymErrorCalc( kTRUE );
+ fitStatus_.status = minuit_->ExecuteCommand( "MINOS", arglist.data(), 1 );
+ fitObj->withinAsymErrorCalc( kFALSE );
+ if ( fitStatus_.status != 0 ) {
+ std::cerr << "ERROR in LauMinuit::minimise : Error in MINOS routine."
+ << std::endl;
+ }
+ }
+ }
+ }
+
+ // Print results
+ fitStatus_.status = minuit_->GetStats( fitStatus_.NLL, fitStatus_.EDM, errdef, nvpar, nparx );
+ if ( outputLevel_ > LauOutputLevel::None ) {
+ std::cout << "INFO in LauMinuit::minimise : Final error matrix status is: "
+ << fitStatus_.status << std::endl;
+ }
+ // 0= not calculated at all
+ // 1= approximation only, not accurate
+ // 2= full matrix, but forced positive-definite
+ // 3= full accurate covariance matrix
+
+ if ( outputLevel_ > LauOutputLevel::None ) {
+ minuit_->PrintResults( 3, fitStatus_.NLL );
+ }
+
+ // Retrieve the covariance matrix from the fitter
+ // For some reason the array returned is as if the matrix is of dimension nParams_ x nParams_
+ // but only the elements within the sub-matrix nFreeParams_ x nFreeParams_ have values,
+ // the "trailing" elements are zero, so we trim them off.
+ Double_t* covMatrix = minuit_->GetCovarianceMatrix();
+ covMatrix_.Clear();
+ covMatrix_.ResizeTo( nParams_, nParams_ );
+ covMatrix_.SetMatrixArray( covMatrix );
+ covMatrix_.ResizeTo( nFreeParams_, nFreeParams_ );
+
+ return fitStatus_;
}
void LauMinuit::fixSecondStageParameters()
{
- for (UInt_t i{0}; i < nParams_; ++i) {
- if ( params_[i]->secondStage() ) {
- params_[i]->fixed(kTRUE);
- minuit_->FixParameter(i);
- }
- }
- LauParamFixed pred;
- nFreeParams_ = nParams_ - std::count_if(params_.begin(),params_.end(),pred);
+ for ( UInt_t i { 0 }; i < nParams_; ++i ) {
+ if ( params_[i]->secondStage() ) {
+ params_[i]->fixed( kTRUE );
+ minuit_->FixParameter( i );
+ }
+ }
+ LauParamFixed pred;
+ nFreeParams_ = nParams_ - std::count_if( params_.begin(), params_.end(), pred );
}
void LauMinuit::releaseSecondStageParameters()
{
- for (UInt_t i{0}; i < nParams_; ++i) {
- if ( params_[i]->secondStage() ) {
- params_[i]->fixed(kFALSE);
- minuit_->ReleaseParameter(i);
- }
- }
- LauParamFixed pred;
- nFreeParams_ = nParams_ - std::count_if(params_.begin(),params_.end(),pred);
+ for ( UInt_t i { 0 }; i < nParams_; ++i ) {
+ if ( params_[i]->secondStage() ) {
+ params_[i]->fixed( kFALSE );
+ minuit_->ReleaseParameter( i );
+ }
+ }
+ LauParamFixed pred;
+ nFreeParams_ = nParams_ - std::count_if( params_.begin(), params_.end(), pred );
}
void LauMinuit::updateParameters()
{
- for (UInt_t i{0}; i < nParams_; ++i) {
- // Get the value and errors from MINUIT
- Double_t value { minuit_->GetParameter(i) };
- Double_t error{0.0};
- Double_t negError{0.0};
- Double_t posError{0.0};
- Double_t globalcc{0.0};
- minuit_->GetErrors(i, posError, negError, error, globalcc);
- params_[i]->valueAndErrors(value, error, negError, posError);
- params_[i]->globalCorrelationCoeff(globalcc);
- }
+ for ( UInt_t i { 0 }; i < nParams_; ++i ) {
+ // Get the value and errors from MINUIT
+ Double_t value { minuit_->GetParameter( i ) };
+ Double_t error { 0.0 };
+ Double_t negError { 0.0 };
+ Double_t posError { 0.0 };
+ Double_t globalcc { 0.0 };
+ minuit_->GetErrors( i, posError, negError, error, globalcc );
+ params_[i]->valueAndErrors( value, error, negError, posError );
+ params_[i]->globalCorrelationCoeff( globalcc );
+ }
}
// Definition of the fitting function for Minuit
-void logLikeFun(Int_t& npar, Double_t* /*first_derivatives*/, Double_t& f, Double_t* par, Int_t /*iflag*/)
+void logLikeFun( Int_t& npar, Double_t* /*first_derivatives*/, Double_t& f, Double_t* par, Int_t /*iflag*/ )
{
- // Routine that specifies the negative log-likelihood function for the fit.
- // Used by the MINUIT minimising code.
+ // Routine that specifies the negative log-likelihood function for the fit.
+ // Used by the MINUIT minimising code.
- LauFitObject* theModel = LauFitter::fitter().getFitObject();
+ LauFitObject* theModel = LauFitter::fitter().getFitObject();
- // Set the internal parameters for this model using parameters from Minuit (pars):
- theModel->setParsFromMinuit( par, npar );
+ // Set the internal parameters for this model using parameters from Minuit (pars):
+ theModel->setParsFromMinuit( par, npar );
- // Set the value of f to be the total negative log-likelihood for the data sample.
- f = theModel->getTotNegLogLikelihood();
+ // Set the value of f to be the total negative log-likelihood for the data sample.
+ f = theModel->getTotNegLogLikelihood();
}
-
diff --git a/src/LauModIndPartWaveMagPhase.cc b/src/LauModIndPartWaveMagPhase.cc
index 0168eae..660aac6 100644
--- a/src/LauModIndPartWaveMagPhase.cc
+++ b/src/LauModIndPartWaveMagPhase.cc
@@ -1,140 +1,157 @@
/*
Copyright 2015 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauModIndPartWaveMagPhase.cc
\brief File containing implementation of LauModIndPartWaveMagPhase class.
*/
-#include <cstdlib>
-#include <iostream>
+#include "LauModIndPartWaveMagPhase.hh"
#include "Lau1DCubicSpline.hh"
#include "LauConstants.hh"
#include "LauKinematics.hh"
-#include "LauModIndPartWaveMagPhase.hh"
#include "LauResonanceInfo.hh"
+#include <cstdlib>
+#include <iostream>
-
-LauModIndPartWaveMagPhase::LauModIndPartWaveMagPhase(LauResonanceInfo* resInfo, Int_t resPairAmpInt, const LauDaughters* daughters) :
- LauAbsModIndPartWave(resInfo, resPairAmpInt, daughters)
+LauModIndPartWaveMagPhase::LauModIndPartWaveMagPhase( LauResonanceInfo* resInfo,
+ Int_t resPairAmpInt,
+ const LauDaughters* daughters ) :
+ LauAbsModIndPartWave( resInfo, resPairAmpInt, daughters )
{
}
LauModIndPartWaveMagPhase::~LauModIndPartWaveMagPhase()
{
}
-void LauModIndPartWaveMagPhase::createAmpParameters(const UInt_t iKnot)
+void LauModIndPartWaveMagPhase::createAmpParameters( const UInt_t iKnot )
{
- const TString& parNameBase = this->getSanitisedName();
- const Bool_t secondStage = this->floatKnotsSecondStage();
-
- std::vector<LauParameter*>& magnitudePars = this->getAmp1Pars();
- std::vector<LauParameter*>& phasePars = this->getAmp2Pars();
-
- TString magName(parNameBase);
- magName += "_A";
- magName += iKnot;
-
- magnitudePars.push_back(this->getResInfo()->getExtraParameter( magName ));
- if( magnitudePars[iKnot] == 0) {
- magnitudePars[iKnot] = new LauParameter( magName, 1.0, 0.0, 10.0, kFALSE);
- magnitudePars[iKnot]->secondStage(secondStage);
- this->getResInfo()->addExtraParameter(magnitudePars[iKnot]);
- }
-
- TString phaseName(parNameBase);
- phaseName += "_d";
- phaseName += iKnot;
-
- phasePars.push_back(this->getResInfo()->getExtraParameter( phaseName ));
- if( phasePars[iKnot] == 0) {
- phasePars[iKnot] = new LauParameter( phaseName, 1.0, -6.0*LauConstants::pi, 6.0*LauConstants::pi, kFALSE);
- phasePars[iKnot]->secondStage(secondStage);
- this->getResInfo()->addExtraParameter(phasePars[iKnot]);
- }
+ const TString& parNameBase = this->getSanitisedName();
+ const Bool_t secondStage = this->floatKnotsSecondStage();
+
+ std::vector<LauParameter*>& magnitudePars = this->getAmp1Pars();
+ std::vector<LauParameter*>& phasePars = this->getAmp2Pars();
+
+ TString magName( parNameBase );
+ magName += "_A";
+ magName += iKnot;
+
+ magnitudePars.push_back( this->getResInfo()->getExtraParameter( magName ) );
+ if ( magnitudePars[iKnot] == 0 ) {
+ magnitudePars[iKnot] = new LauParameter( magName, 1.0, 0.0, 10.0, kFALSE );
+ magnitudePars[iKnot]->secondStage( secondStage );
+ this->getResInfo()->addExtraParameter( magnitudePars[iKnot] );
+ }
+
+ TString phaseName( parNameBase );
+ phaseName += "_d";
+ phaseName += iKnot;
+
+ phasePars.push_back( this->getResInfo()->getExtraParameter( phaseName ) );
+ if ( phasePars[iKnot] == 0 ) {
+ phasePars[iKnot] =
+ new LauParameter( phaseName, 1.0, -6.0 * LauConstants::pi, 6.0 * LauConstants::pi, kFALSE );
+ phasePars[iKnot]->secondStage( secondStage );
+ this->getResInfo()->addExtraParameter( phasePars[iKnot] );
+ }
}
-void LauModIndPartWaveMagPhase::setKnotAmp(const UInt_t knot, const Double_t magVal, const Double_t phaseVal, const Bool_t fixMagnitude, const Bool_t fixPhase)
+void LauModIndPartWaveMagPhase::setKnotAmp( const UInt_t knot,
+ const Double_t magVal,
+ const Double_t phaseVal,
+ const Bool_t fixMagnitude,
+ const Bool_t fixPhase )
{
- const UInt_t nknots = this->nKnots();
-
- if ( knot >= nknots ) {
- std::cerr << "WARNING in LauModIndPartWaveMagPhase::setKnotAmp : Index " << knot << " does not correspond to an existing knot in resonance " << this->getResonanceName() << std::endl;
- std::cerr << " : Index must be in range 0 to " << nknots-1 << std::endl;
- return;
- }
-
- const std::vector<Double_t>& masses = this->getMasses();
-
- std::vector<Double_t>& magnitudes = this->getAmp1Vals();
- std::vector<Double_t>& phases = this->getAmp2Vals();
-
- std::vector<LauParameter*>& magnitudePars = this->getAmp1Pars();
- std::vector<LauParameter*>& phasePars = this->getAmp2Pars();
-
- magnitudes[knot] = magVal;
- magnitudePars[knot]->value(magVal);
- magnitudePars[knot]->genValue(magVal);
- magnitudePars[knot]->initValue(magVal);
- magnitudePars[knot]->fixed(fixMagnitude);
- phases[knot] = phaseVal;
- phasePars[knot]->value(phaseVal);
- phasePars[knot]->genValue(phaseVal);
- phasePars[knot]->initValue(phaseVal);
- phasePars[knot]->fixed(fixPhase);
-
- if ( knot == 0 ) {
- std::cout << "INFO in LauModIndPartWaveMagPhase::setKnotAmp : Knot updated in resonance " << this->getResonanceName() << " at lower kinematic limit (" << masses[knot] << ")" << std::endl;
- } else if ( knot == nknots-1 ) {
- std::cout << "INFO in LauModIndPartWaveMagPhase::setKnotAmp : Knot updated in resonance " << this->getResonanceName() << " at upper kinematic limit (" << masses[knot] << ")" << std::endl;
- } else {
- std::cout << "INFO in LauModIndPartWaveMagPhase::setKnotAmp : Knot updated in resonance " << this->getResonanceName() << " at mass " << masses[knot] << std::endl;
- }
-
- if ( fixMagnitude ) {
- std::cout << " : Magnitude fixed to " << magVal << std::endl;
- } else {
- std::cout << " : Magnitude set to " << magVal << std::endl;
- }
-
- if ( fixPhase ) {
- std::cout << " : Phase fixed to " << phaseVal << std::endl;
- } else {
- std::cout << " : Phase set to " << phaseVal << std::endl;
- }
+ const UInt_t nknots = this->nKnots();
+
+ if ( knot >= nknots ) {
+ std::cerr << "WARNING in LauModIndPartWaveMagPhase::setKnotAmp : Index " << knot
+ << " does not correspond to an existing knot in resonance "
+ << this->getResonanceName() << std::endl;
+ std::cerr << " : Index must be in range 0 to "
+ << nknots - 1 << std::endl;
+ return;
+ }
+
+ const std::vector<Double_t>& masses = this->getMasses();
+
+ std::vector<Double_t>& magnitudes = this->getAmp1Vals();
+ std::vector<Double_t>& phases = this->getAmp2Vals();
+
+ std::vector<LauParameter*>& magnitudePars = this->getAmp1Pars();
+ std::vector<LauParameter*>& phasePars = this->getAmp2Pars();
+
+ magnitudes[knot] = magVal;
+ magnitudePars[knot]->value( magVal );
+ magnitudePars[knot]->genValue( magVal );
+ magnitudePars[knot]->initValue( magVal );
+ magnitudePars[knot]->fixed( fixMagnitude );
+ phases[knot] = phaseVal;
+ phasePars[knot]->value( phaseVal );
+ phasePars[knot]->genValue( phaseVal );
+ phasePars[knot]->initValue( phaseVal );
+ phasePars[knot]->fixed( fixPhase );
+
+ if ( knot == 0 ) {
+ std::cout << "INFO in LauModIndPartWaveMagPhase::setKnotAmp : Knot updated in resonance "
+ << this->getResonanceName() << " at lower kinematic limit (" << masses[knot]
+ << ")" << std::endl;
+ } else if ( knot == nknots - 1 ) {
+ std::cout << "INFO in LauModIndPartWaveMagPhase::setKnotAmp : Knot updated in resonance "
+ << this->getResonanceName() << " at upper kinematic limit (" << masses[knot]
+ << ")" << std::endl;
+ } else {
+ std::cout << "INFO in LauModIndPartWaveMagPhase::setKnotAmp : Knot updated in resonance "
+ << this->getResonanceName() << " at mass " << masses[knot] << std::endl;
+ }
+
+ if ( fixMagnitude ) {
+ std::cout << " : Magnitude fixed to " << magVal
+ << std::endl;
+ } else {
+ std::cout << " : Magnitude set to " << magVal
+ << std::endl;
+ }
+
+ if ( fixPhase ) {
+ std::cout << " : Phase fixed to " << phaseVal
+ << std::endl;
+ } else {
+ std::cout << " : Phase set to " << phaseVal
+ << std::endl;
+ }
}
-void LauModIndPartWaveMagPhase::evaluateAmplitude(const Double_t mass)
+void LauModIndPartWaveMagPhase::evaluateAmplitude( const Double_t mass )
{
- const Lau1DCubicSpline* splineMag = this->getSpline1();
- const Lau1DCubicSpline* splinePhase = this->getSpline2();
+ const Lau1DCubicSpline* splineMag = this->getSpline1();
+ const Lau1DCubicSpline* splinePhase = this->getSpline2();
- const Double_t mag = splineMag->evaluate(mass);
- const Double_t phase = splinePhase->evaluate(mass);
+ const Double_t mag = splineMag->evaluate( mass );
+ const Double_t phase = splinePhase->evaluate( mass );
- this->setAmp(mag*TMath::Cos(phase), mag*TMath::Sin(phase));
+ this->setAmp( mag * TMath::Cos( phase ), mag * TMath::Sin( phase ) );
}
-
diff --git a/src/LauModIndPartWaveRealImag.cc b/src/LauModIndPartWaveRealImag.cc
index 2d224e8..2e88883 100644
--- a/src/LauModIndPartWaveRealImag.cc
+++ b/src/LauModIndPartWaveRealImag.cc
@@ -1,140 +1,156 @@
/*
Copyright 2015 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauModIndPartWaveRealImag.cc
\brief File containing implementation of LauModIndPartWaveRealImag class.
*/
-#include <cstdlib>
-#include <iostream>
+#include "LauModIndPartWaveRealImag.hh"
#include "Lau1DCubicSpline.hh"
#include "LauConstants.hh"
#include "LauKinematics.hh"
-#include "LauModIndPartWaveRealImag.hh"
#include "LauResonanceInfo.hh"
+#include <cstdlib>
+#include <iostream>
-
-LauModIndPartWaveRealImag::LauModIndPartWaveRealImag(LauResonanceInfo* resInfo, Int_t resPairAmpInt, const LauDaughters* daughters) :
- LauAbsModIndPartWave(resInfo, resPairAmpInt, daughters)
+LauModIndPartWaveRealImag::LauModIndPartWaveRealImag( LauResonanceInfo* resInfo,
+ Int_t resPairAmpInt,
+ const LauDaughters* daughters ) :
+ LauAbsModIndPartWave( resInfo, resPairAmpInt, daughters )
{
}
LauModIndPartWaveRealImag::~LauModIndPartWaveRealImag()
{
}
-void LauModIndPartWaveRealImag::createAmpParameters(const UInt_t iKnot)
+void LauModIndPartWaveRealImag::createAmpParameters( const UInt_t iKnot )
{
- const TString& parNameBase = this->getSanitisedName();
- const Bool_t secondStage = this->floatKnotsSecondStage();
-
- std::vector<LauParameter*>& rePars = this->getAmp1Pars();
- std::vector<LauParameter*>& imPars = this->getAmp2Pars();
-
- TString reName(parNameBase);
- reName += "_Re";
- reName += iKnot;
-
- rePars.push_back(this->getResInfo()->getExtraParameter( reName ));
- if( rePars[iKnot] == 0) {
- rePars[iKnot] = new LauParameter( reName, 1.0, -10.0, 10.0, kFALSE);
- rePars[iKnot]->secondStage(secondStage);
- this->getResInfo()->addExtraParameter(rePars[iKnot]);
- }
-
- TString imName(parNameBase);
- imName += "_Im";
- imName += iKnot;
-
- imPars.push_back(this->getResInfo()->getExtraParameter( imName ));
- if( imPars[iKnot] == 0) {
- imPars[iKnot] = new LauParameter( imName, 1.0, -10.0, 10.0, kFALSE);
- imPars[iKnot]->secondStage(secondStage);
- this->getResInfo()->addExtraParameter(imPars[iKnot]);
- }
+ const TString& parNameBase = this->getSanitisedName();
+ const Bool_t secondStage = this->floatKnotsSecondStage();
+
+ std::vector<LauParameter*>& rePars = this->getAmp1Pars();
+ std::vector<LauParameter*>& imPars = this->getAmp2Pars();
+
+ TString reName( parNameBase );
+ reName += "_Re";
+ reName += iKnot;
+
+ rePars.push_back( this->getResInfo()->getExtraParameter( reName ) );
+ if ( rePars[iKnot] == 0 ) {
+ rePars[iKnot] = new LauParameter( reName, 1.0, -10.0, 10.0, kFALSE );
+ rePars[iKnot]->secondStage( secondStage );
+ this->getResInfo()->addExtraParameter( rePars[iKnot] );
+ }
+
+ TString imName( parNameBase );
+ imName += "_Im";
+ imName += iKnot;
+
+ imPars.push_back( this->getResInfo()->getExtraParameter( imName ) );
+ if ( imPars[iKnot] == 0 ) {
+ imPars[iKnot] = new LauParameter( imName, 1.0, -10.0, 10.0, kFALSE );
+ imPars[iKnot]->secondStage( secondStage );
+ this->getResInfo()->addExtraParameter( imPars[iKnot] );
+ }
}
-void LauModIndPartWaveRealImag::setKnotAmp(const UInt_t knot, const Double_t realVal, const Double_t imagVal, const Bool_t fixRealPart, const Bool_t fixImagPart)
+void LauModIndPartWaveRealImag::setKnotAmp( const UInt_t knot,
+ const Double_t realVal,
+ const Double_t imagVal,
+ const Bool_t fixRealPart,
+ const Bool_t fixImagPart )
{
- const UInt_t nknots = this->nKnots();
-
- if ( knot >= nknots ) {
- std::cerr << "WARNING in LauModIndPartWaveRealImag::setKnotAmp : Index " << knot << " does not correspond to an existing knot in resonance " << this->getResonanceName() << std::endl;
- std::cerr << " : Index must be in range 0 to " << nknots-1 << std::endl;
- return;
- }
-
- const std::vector<Double_t>& masses = this->getMasses();
-
- std::vector<Double_t>& realVals = this->getAmp1Vals();
- std::vector<Double_t>& imagVals = this->getAmp2Vals();
-
- std::vector<LauParameter*>& realPars = this->getAmp1Pars();
- std::vector<LauParameter*>& imagPars = this->getAmp2Pars();
-
- realVals[knot] = realVal;
- realPars[knot]->value(realVal);
- realPars[knot]->genValue(realVal);
- realPars[knot]->initValue(realVal);
- realPars[knot]->fixed(fixRealPart);
- imagVals[knot] = imagVal;
- imagPars[knot]->value(imagVal);
- imagPars[knot]->genValue(imagVal);
- imagPars[knot]->initValue(imagVal);
- imagPars[knot]->fixed(fixImagPart);
-
- if ( knot == 0 ) {
- std::cout << "INFO in LauModIndPartWaveRealImag::setKnotAmp : Knot updated in resonance " << this->getResonanceName() << " at lower kinematic limit (" << masses[knot] << ")" << std::endl;
- } else if ( knot == nknots-1 ) {
- std::cout << "INFO in LauModIndPartWaveRealImag::setKnotAmp : Knot updated in resonance " << this->getResonanceName() << " at upper kinematic limit (" << masses[knot] << ")" << std::endl;
- } else {
- std::cout << "INFO in LauModIndPartWaveRealImag::setKnotAmp : Knot updated in resonance " << this->getResonanceName() << " at mass " << masses[knot] << std::endl;
- }
-
- if ( fixRealPart ) {
- std::cout << " : Real part fixed to " << realVal << std::endl;
- } else {
- std::cout << " : Real part set to " << realVal << std::endl;
- }
-
- if ( fixImagPart ) {
- std::cout << " : Imaginary part fixed to " << imagVal << std::endl;
- } else {
- std::cout << " : Imaginary part set to " << imagVal << std::endl;
- }
+ const UInt_t nknots = this->nKnots();
+
+ if ( knot >= nknots ) {
+ std::cerr << "WARNING in LauModIndPartWaveRealImag::setKnotAmp : Index " << knot
+ << " does not correspond to an existing knot in resonance "
+ << this->getResonanceName() << std::endl;
+ std::cerr << " : Index must be in range 0 to "
+ << nknots - 1 << std::endl;
+ return;
+ }
+
+ const std::vector<Double_t>& masses = this->getMasses();
+
+ std::vector<Double_t>& realVals = this->getAmp1Vals();
+ std::vector<Double_t>& imagVals = this->getAmp2Vals();
+
+ std::vector<LauParameter*>& realPars = this->getAmp1Pars();
+ std::vector<LauParameter*>& imagPars = this->getAmp2Pars();
+
+ realVals[knot] = realVal;
+ realPars[knot]->value( realVal );
+ realPars[knot]->genValue( realVal );
+ realPars[knot]->initValue( realVal );
+ realPars[knot]->fixed( fixRealPart );
+ imagVals[knot] = imagVal;
+ imagPars[knot]->value( imagVal );
+ imagPars[knot]->genValue( imagVal );
+ imagPars[knot]->initValue( imagVal );
+ imagPars[knot]->fixed( fixImagPart );
+
+ if ( knot == 0 ) {
+ std::cout << "INFO in LauModIndPartWaveRealImag::setKnotAmp : Knot updated in resonance "
+ << this->getResonanceName() << " at lower kinematic limit (" << masses[knot]
+ << ")" << std::endl;
+ } else if ( knot == nknots - 1 ) {
+ std::cout << "INFO in LauModIndPartWaveRealImag::setKnotAmp : Knot updated in resonance "
+ << this->getResonanceName() << " at upper kinematic limit (" << masses[knot]
+ << ")" << std::endl;
+ } else {
+ std::cout << "INFO in LauModIndPartWaveRealImag::setKnotAmp : Knot updated in resonance "
+ << this->getResonanceName() << " at mass " << masses[knot] << std::endl;
+ }
+
+ if ( fixRealPart ) {
+ std::cout << " : Real part fixed to "
+ << realVal << std::endl;
+ } else {
+ std::cout << " : Real part set to " << realVal
+ << std::endl;
+ }
+
+ if ( fixImagPart ) {
+ std::cout << " : Imaginary part fixed to "
+ << imagVal << std::endl;
+ } else {
+ std::cout << " : Imaginary part set to "
+ << imagVal << std::endl;
+ }
}
-void LauModIndPartWaveRealImag::evaluateAmplitude(const Double_t mass)
+void LauModIndPartWaveRealImag::evaluateAmplitude( const Double_t mass )
{
- const Lau1DCubicSpline* splineReal = this->getSpline1();
- const Lau1DCubicSpline* splineImag = this->getSpline2();
+ const Lau1DCubicSpline* splineReal = this->getSpline1();
+ const Lau1DCubicSpline* splineImag = this->getSpline2();
- const Double_t re = splineReal->evaluate(mass);
- const Double_t im = splineImag->evaluate(mass);
+ const Double_t re = splineReal->evaluate( mass );
+ const Double_t im = splineImag->evaluate( mass );
- this->setAmp(re, im);
+ this->setAmp( re, im );
}
-
diff --git a/src/LauNRAmplitude.cc b/src/LauNRAmplitude.cc
index 3e906c8..fd9e8e6 100644
--- a/src/LauNRAmplitude.cc
+++ b/src/LauNRAmplitude.cc
@@ -1,283 +1,297 @@
/*
Copyright 2004 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauNRAmplitude.cc
\brief File containing implementation of LauNRAmplitude class.
*/
-#include <iostream>
+#include "LauNRAmplitude.hh"
#include "LauKinematics.hh"
-#include "LauNRAmplitude.hh"
#include "LauResonanceInfo.hh"
+#include <iostream>
-LauNRAmplitude::LauNRAmplitude(LauResonanceInfo* resInfo, const Int_t resPairAmpInt, const LauDaughters* daughters) :
- LauAbsResonance(resInfo, resPairAmpInt, daughters),
- d_(0),
- c1_(0),
- c2_(0),
- p1_(0),
- p2_(0)
+LauNRAmplitude::LauNRAmplitude( LauResonanceInfo* resInfo,
+ const Int_t resPairAmpInt,
+ const LauDaughters* daughters ) :
+ LauAbsResonance( resInfo, resPairAmpInt, daughters ),
+ d_( 0 ),
+ c1_( 0 ),
+ c2_( 0 ),
+ p1_( 0 ),
+ p2_( 0 )
{
- // Default values for parameters, taken from arXiv:0709.0075v1 [hep-ph]
- const Double_t dVal(1.3232e-3);
- const Double_t c1Val(0.65);
- const Double_t c2Val(0.55);
- const Double_t p1Val(18.0);
- const Double_t p2Val(15.0);
-
- const TString& parNameBase = this->getSanitisedName();
-
- TString dName(parNameBase);
- dName += "_d";
- d_ = resInfo->getExtraParameter( dName );
- if ( d_ == 0 ) {
- d_ = new LauParameter( dName, dVal, 0.0, 1.0, kTRUE );
- d_->secondStage(kTRUE);
- resInfo->addExtraParameter( d_ );
- }
-
- TString c1Name(parNameBase);
- c1Name += "_c1";
- c1_ = resInfo->getExtraParameter( c1Name );
- if ( c1_ == 0 ) {
- c1_ = new LauParameter( c1Name, c1Val, 0.0, 2.0, kTRUE );
- c1_->secondStage(kTRUE);
- resInfo->addExtraParameter( c1_ );
- }
-
- TString c2Name(parNameBase);
- c2Name += "_c2";
- c2_ = resInfo->getExtraParameter( c2Name );
- if ( c2_ == 0 ) {
- c2_ = new LauParameter( c2Name, c2Val, 0.0, 2.0, kTRUE );
- c2_->secondStage(kTRUE);
- resInfo->addExtraParameter( c2_ );
- }
-
- TString p1Name(parNameBase);
- p1Name += "_p1";
- p1_ = resInfo->getExtraParameter( p1Name );
- if ( p1_ == 0 ) {
- p1_ = new LauParameter( p1Name, p1Val, 0.0, 50.0, kTRUE );
- p1_->secondStage(kTRUE);
- resInfo->addExtraParameter( p1_ );
- }
-
- TString p2Name(parNameBase);
- p2Name += "_p2";
- p2_ = resInfo->getExtraParameter( p2Name );
- if ( p2_ == 0 ) {
- p2_ = new LauParameter( p2Name, p2Val, 0.0, 50.0, kTRUE );
- p2_->secondStage(kTRUE);
- resInfo->addExtraParameter( p2_ );
- }
+ // Default values for parameters, taken from arXiv:0709.0075v1 [hep-ph]
+ const Double_t dVal( 1.3232e-3 );
+ const Double_t c1Val( 0.65 );
+ const Double_t c2Val( 0.55 );
+ const Double_t p1Val( 18.0 );
+ const Double_t p2Val( 15.0 );
+
+ const TString& parNameBase = this->getSanitisedName();
+
+ TString dName( parNameBase );
+ dName += "_d";
+ d_ = resInfo->getExtraParameter( dName );
+ if ( d_ == 0 ) {
+ d_ = new LauParameter( dName, dVal, 0.0, 1.0, kTRUE );
+ d_->secondStage( kTRUE );
+ resInfo->addExtraParameter( d_ );
+ }
+
+ TString c1Name( parNameBase );
+ c1Name += "_c1";
+ c1_ = resInfo->getExtraParameter( c1Name );
+ if ( c1_ == 0 ) {
+ c1_ = new LauParameter( c1Name, c1Val, 0.0, 2.0, kTRUE );
+ c1_->secondStage( kTRUE );
+ resInfo->addExtraParameter( c1_ );
+ }
+
+ TString c2Name( parNameBase );
+ c2Name += "_c2";
+ c2_ = resInfo->getExtraParameter( c2Name );
+ if ( c2_ == 0 ) {
+ c2_ = new LauParameter( c2Name, c2Val, 0.0, 2.0, kTRUE );
+ c2_->secondStage( kTRUE );
+ resInfo->addExtraParameter( c2_ );
+ }
+
+ TString p1Name( parNameBase );
+ p1Name += "_p1";
+ p1_ = resInfo->getExtraParameter( p1Name );
+ if ( p1_ == 0 ) {
+ p1_ = new LauParameter( p1Name, p1Val, 0.0, 50.0, kTRUE );
+ p1_->secondStage( kTRUE );
+ resInfo->addExtraParameter( p1_ );
+ }
+
+ TString p2Name( parNameBase );
+ p2Name += "_p2";
+ p2_ = resInfo->getExtraParameter( p2Name );
+ if ( p2_ == 0 ) {
+ p2_ = new LauParameter( p2Name, p2Val, 0.0, 50.0, kTRUE );
+ p2_->secondStage( kTRUE );
+ resInfo->addExtraParameter( p2_ );
+ }
}
LauNRAmplitude::~LauNRAmplitude()
{
}
void LauNRAmplitude::initialise()
{
}
-LauComplex LauNRAmplitude::amplitude(const LauKinematics* kinematics)
+LauComplex LauNRAmplitude::amplitude( const LauKinematics* kinematics )
{
- // Get the information from the kinematics object
- const Double_t m13Sq = kinematics->getm13Sq();
- const Double_t m23Sq = kinematics->getm23Sq();
- const Double_t m13 = kinematics->getm13();
- const Double_t m23 = kinematics->getm23();
-
- // Calculate the magnitude
- Double_t magnitude = TMath::Sqrt( m13 * m23 *
- this->f(m23Sq, c1_->unblindValue(), p1_->unblindValue()) *
- this->f(m13Sq, c2_->unblindValue(), p2_->unblindValue()) *
- TMath::Exp( -1.0 * d_->unblindValue() * m13Sq*m13Sq * m23Sq*m23Sq )
- );
-
- // return the amplitude
- LauComplex resAmplitude(magnitude, 0.0);
- return resAmplitude;
+ // Get the information from the kinematics object
+ const Double_t m13Sq = kinematics->getm13Sq();
+ const Double_t m23Sq = kinematics->getm23Sq();
+ const Double_t m13 = kinematics->getm13();
+ const Double_t m23 = kinematics->getm23();
+
+ // Calculate the magnitude
+ Double_t magnitude = TMath::Sqrt(
+ m13 * m23 * this->f( m23Sq, c1_->unblindValue(), p1_->unblindValue() ) *
+ this->f( m13Sq, c2_->unblindValue(), p2_->unblindValue() ) *
+ TMath::Exp( -1.0 * d_->unblindValue() * m13Sq * m13Sq * m23Sq * m23Sq ) );
+
+ // return the amplitude
+ LauComplex resAmplitude( magnitude, 0.0 );
+ return resAmplitude;
}
-LauComplex LauNRAmplitude::resAmp(Double_t mass, Double_t spinTerm)
+LauComplex LauNRAmplitude::resAmp( Double_t mass, Double_t spinTerm )
{
- std::cerr << "ERROR in LauNRAmplitude::resAmp : This method shouldn't get called." << std::endl;
- std::cerr << " Returning zero amplitude for mass = " << mass << " and spinTerm = " << spinTerm << "." << std::endl;
- return LauComplex(0.0, 0.0);
+ std::cerr << "ERROR in LauNRAmplitude::resAmp : This method shouldn't get called." << std::endl;
+ std::cerr << " Returning zero amplitude for mass = " << mass
+ << " and spinTerm = " << spinTerm << "." << std::endl;
+ return LauComplex( 0.0, 0.0 );
}
-Double_t LauNRAmplitude::f(const Double_t s, const Double_t c, const Double_t p) const
+Double_t LauNRAmplitude::f( const Double_t s, const Double_t c, const Double_t p ) const
{
- return 1.0 / (1.0 + TMath::Exp( c * (s-p) ));
+ return 1.0 / ( 1.0 + TMath::Exp( c * ( s - p ) ) );
}
const std::vector<LauParameter*>& LauNRAmplitude::getFloatingParameters()
{
- this->clearFloatingParameters();
+ this->clearFloatingParameters();
- if ( ! this->fixdParameter() ) {
- this->addFloatingParameter( d_ );
- }
+ if ( ! this->fixdParameter() ) {
+ this->addFloatingParameter( d_ );
+ }
- if ( ! this->fixc1Parameter() ) {
- this->addFloatingParameter( c1_ );
- }
+ if ( ! this->fixc1Parameter() ) {
+ this->addFloatingParameter( c1_ );
+ }
- if ( ! this->fixc2Parameter() ) {
- this->addFloatingParameter( c2_ );
- }
+ if ( ! this->fixc2Parameter() ) {
+ this->addFloatingParameter( c2_ );
+ }
- if ( ! this->fixp1Parameter() ) {
- this->addFloatingParameter( p1_ );
- }
+ if ( ! this->fixp1Parameter() ) {
+ this->addFloatingParameter( p1_ );
+ }
- if ( ! this->fixp2Parameter() ) {
- this->addFloatingParameter( p2_ );
- }
+ if ( ! this->fixp2Parameter() ) {
+ this->addFloatingParameter( p2_ );
+ }
- return this->getParameters();
+ return this->getParameters();
}
-void LauNRAmplitude::setResonanceParameter(const TString& name, const Double_t value)
+void LauNRAmplitude::setResonanceParameter( const TString& name, const Double_t value )
{
- // Set various parameters for the NRAmplitude lineshape dynamics
- if (name == "d") {
- this->setdParameter(value);
- std::cout << "INFO in LauNRAmplitude::setResonanceParameter : Setting NRAmplitude d = " << this->getdParameter() << std::endl;
- } else if (name == "c1") {
- this->setc1Parameter(value);
- std::cout << "INFO in LauNRAmplitude::setResonanceParameter : Setting NRAmplitude c1 = " << this->getc1Parameter() << std::endl;
- } else if (name == "c2") {
- this->setc2Parameter(value);
- std::cout << "INFO in LauNRAmplitude::setResonanceParameter : Setting NRAmplitude c2 = " << this->getc2Parameter() << std::endl;
- } else if (name == "p1") {
- this->setp1Parameter(value);
- std::cout << "INFO in LauNRAmplitude::setResonanceParameter : Setting NRAmplitude p1 = " << this->getp1Parameter() << std::endl;
- } else if (name == "p2") {
- this->setp2Parameter(value);
- std::cout << "INFO in LauNRAmplitude::setResonanceParameter : Setting NRAmplitude p2 = " << this->getp2Parameter() << std::endl;
- } else {
- std::cerr << "WARNING in LauNRAmplitude::setResonanceParameter: Parameter name not reconised. No parameter changes made." << std::endl;
- }
+ // Set various parameters for the NRAmplitude lineshape dynamics
+ if ( name == "d" ) {
+ this->setdParameter( value );
+ std::cout << "INFO in LauNRAmplitude::setResonanceParameter : Setting NRAmplitude d = "
+ << this->getdParameter() << std::endl;
+ } else if ( name == "c1" ) {
+ this->setc1Parameter( value );
+ std::cout << "INFO in LauNRAmplitude::setResonanceParameter : Setting NRAmplitude c1 = "
+ << this->getc1Parameter() << std::endl;
+ } else if ( name == "c2" ) {
+ this->setc2Parameter( value );
+ std::cout << "INFO in LauNRAmplitude::setResonanceParameter : Setting NRAmplitude c2 = "
+ << this->getc2Parameter() << std::endl;
+ } else if ( name == "p1" ) {
+ this->setp1Parameter( value );
+ std::cout << "INFO in LauNRAmplitude::setResonanceParameter : Setting NRAmplitude p1 = "
+ << this->getp1Parameter() << std::endl;
+ } else if ( name == "p2" ) {
+ this->setp2Parameter( value );
+ std::cout << "INFO in LauNRAmplitude::setResonanceParameter : Setting NRAmplitude p2 = "
+ << this->getp2Parameter() << std::endl;
+ } else {
+ std::cerr << "WARNING in LauNRAmplitude::setResonanceParameter: Parameter name not reconised. No parameter changes made."
+ << std::endl;
+ }
}
-void LauNRAmplitude::floatResonanceParameter(const TString& name)
+void LauNRAmplitude::floatResonanceParameter( const TString& name )
{
- if (name == "d") {
- if ( d_->fixed() ) {
- d_->fixed( kFALSE );
- this->addFloatingParameter( d_ );
- } else {
- std::cerr << "WARNING in LauNRAmplitude::floatResonanceParameter: Parameter already floating. No parameter changes made." << std::endl;
- }
- } else if (name == "c1") {
- if ( c1_->fixed() ) {
- c1_->fixed( kFALSE );
- this->addFloatingParameter( c1_ );
- } else {
- std::cerr << "WARNING in LauNRAmplitude::floatResonanceParameter: Parameter already floating. No parameter changes made." << std::endl;
- }
- } else if (name == "c2") {
- if ( c2_->fixed() ) {
- c2_->fixed( kFALSE );
- this->addFloatingParameter( c2_ );
- } else {
- std::cerr << "WARNING in LauNRAmplitude::floatResonanceParameter: Parameter already floating. No parameter changes made." << std::endl;
- }
- } else if (name == "p1") {
- if ( p1_->fixed() ) {
- p1_->fixed( kFALSE );
- this->addFloatingParameter( p1_ );
- } else {
- std::cerr << "WARNING in LauNRAmplitude::floatResonanceParameter: Parameter already floating. No parameter changes made." << std::endl;
- }
- } else if (name == "p2") {
- if ( p2_->fixed() ) {
- p2_->fixed( kFALSE );
- this->addFloatingParameter( p2_ );
- } else {
- std::cerr << "WARNING in LauNRAmplitude::floatResonanceParameter: Parameter already floating. No parameter changes made." << std::endl;
- }
- } else {
- std::cerr << "WARNING in LauNRAmplitude::fixResonanceParameter: Parameter name not reconised. No parameter changes made." << std::endl;
- }
+ if ( name == "d" ) {
+ if ( d_->fixed() ) {
+ d_->fixed( kFALSE );
+ this->addFloatingParameter( d_ );
+ } else {
+ std::cerr << "WARNING in LauNRAmplitude::floatResonanceParameter: Parameter already floating. No parameter changes made."
+ << std::endl;
+ }
+ } else if ( name == "c1" ) {
+ if ( c1_->fixed() ) {
+ c1_->fixed( kFALSE );
+ this->addFloatingParameter( c1_ );
+ } else {
+ std::cerr << "WARNING in LauNRAmplitude::floatResonanceParameter: Parameter already floating. No parameter changes made."
+ << std::endl;
+ }
+ } else if ( name == "c2" ) {
+ if ( c2_->fixed() ) {
+ c2_->fixed( kFALSE );
+ this->addFloatingParameter( c2_ );
+ } else {
+ std::cerr << "WARNING in LauNRAmplitude::floatResonanceParameter: Parameter already floating. No parameter changes made."
+ << std::endl;
+ }
+ } else if ( name == "p1" ) {
+ if ( p1_->fixed() ) {
+ p1_->fixed( kFALSE );
+ this->addFloatingParameter( p1_ );
+ } else {
+ std::cerr << "WARNING in LauNRAmplitude::floatResonanceParameter: Parameter already floating. No parameter changes made."
+ << std::endl;
+ }
+ } else if ( name == "p2" ) {
+ if ( p2_->fixed() ) {
+ p2_->fixed( kFALSE );
+ this->addFloatingParameter( p2_ );
+ } else {
+ std::cerr << "WARNING in LauNRAmplitude::floatResonanceParameter: Parameter already floating. No parameter changes made."
+ << std::endl;
+ }
+ } else {
+ std::cerr << "WARNING in LauNRAmplitude::fixResonanceParameter: Parameter name not reconised. No parameter changes made."
+ << std::endl;
+ }
}
-LauParameter* LauNRAmplitude::getResonanceParameter(const TString& name)
+LauParameter* LauNRAmplitude::getResonanceParameter( const TString& name )
{
- if (name == "d") {
- return d_;
- } else if (name == "c1") {
- return c1_;
- } else if (name == "c2") {
- return c2_;
- } else if (name == "p1") {
- return p1_;
- } else if (name == "p2") {
- return p2_;
- } else {
- std::cerr << "WARNING in LauNRAmplitude::getResonanceParameter: Parameter name not reconised." << std::endl;
- return 0;
- }
+ if ( name == "d" ) {
+ return d_;
+ } else if ( name == "c1" ) {
+ return c1_;
+ } else if ( name == "c2" ) {
+ return c2_;
+ } else if ( name == "p1" ) {
+ return p1_;
+ } else if ( name == "p2" ) {
+ return p2_;
+ } else {
+ std::cerr << "WARNING in LauNRAmplitude::getResonanceParameter: Parameter name not reconised."
+ << std::endl;
+ return 0;
+ }
}
-void LauNRAmplitude::setdParameter(const Double_t d)
+void LauNRAmplitude::setdParameter( const Double_t d )
{
- d_->value( d );
- d_->genValue( d );
- d_->initValue( d );
+ d_->value( d );
+ d_->genValue( d );
+ d_->initValue( d );
}
-void LauNRAmplitude::setc1Parameter(const Double_t c1)
+void LauNRAmplitude::setc1Parameter( const Double_t c1 )
{
- c1_->value( c1 );
- c1_->genValue( c1 );
- c1_->initValue( c1 );
+ c1_->value( c1 );
+ c1_->genValue( c1 );
+ c1_->initValue( c1 );
}
-void LauNRAmplitude::setc2Parameter(const Double_t c2)
+void LauNRAmplitude::setc2Parameter( const Double_t c2 )
{
- c2_->value( c2 );
- c2_->genValue( c2 );
- c2_->initValue( c2 );
+ c2_->value( c2 );
+ c2_->genValue( c2 );
+ c2_->initValue( c2 );
}
-void LauNRAmplitude::setp1Parameter(const Double_t p1)
+void LauNRAmplitude::setp1Parameter( const Double_t p1 )
{
- p1_->value( p1 );
- p1_->genValue( p1 );
- p1_->initValue( p1 );
+ p1_->value( p1 );
+ p1_->genValue( p1 );
+ p1_->initValue( p1 );
}
-void LauNRAmplitude::setp2Parameter(const Double_t p2)
+void LauNRAmplitude::setp2Parameter( const Double_t p2 )
{
- p2_->value( p2 );
- p2_->genValue( p2 );
- p2_->initValue( p2 );
+ p2_->value( p2 );
+ p2_->genValue( p2 );
+ p2_->initValue( p2 );
}
-
diff --git a/src/LauNovosibirskPdf.cc b/src/LauNovosibirskPdf.cc
index 7923b57..dda840f 100644
--- a/src/LauNovosibirskPdf.cc
+++ b/src/LauNovosibirskPdf.cc
@@ -1,151 +1,150 @@
/*
Copyright 2008 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauNovosibirskPdf.cc
\brief File containing implementation of LauNovosibirskPdf class.
*/
#include <iostream>
-using std::cout;
using std::cerr;
+using std::cout;
using std::endl;
-#include "TMath.h"
-#include "TSystem.h"
-
-#include "LauNovosibirskPdf.hh"
#include "LauConstants.hh"
+#include "LauNovosibirskPdf.hh"
+#include "TMath.h"
+#include "TSystem.h"
-LauNovosibirskPdf::LauNovosibirskPdf(const TString& theVarName, const std::vector<LauAbsRValue*>& params, Double_t minAbscissa, Double_t maxAbscissa) :
- LauAbsPdf(theVarName, params, minAbscissa, maxAbscissa),
- mean_(0),
- sigma_(0),
- tail_(0)
+LauNovosibirskPdf::LauNovosibirskPdf( const TString& theVarName,
+ const std::vector<LauAbsRValue*>& params,
+ Double_t minAbscissa,
+ Double_t maxAbscissa ) :
+ LauAbsPdf( theVarName, params, minAbscissa, maxAbscissa ),
+ mean_( 0 ),
+ sigma_( 0 ),
+ tail_( 0 )
{
- // Constructor for the Novosibirsk PDF.
- //
- // The parameters in params are the mean, sigma and tail.
- // The last two arguments specify the range in which the PDF is defined, and the PDF
- // will be normalised w.r.t. these limits.
-
- mean_ = this->findParameter("mean");
- sigma_ = this->findParameter("sigma");
- tail_ = this->findParameter("tail");
-
- if ((this->nParameters() != 3) || (mean_ == 0) || (sigma_ == 0) || (tail_ == 0)) {
- cerr<<"ERROR in LauNovosibirskPdf constructor: LauNovosibirskPdf requires 3 parameters: \"mean\", \"sigma\"and \"tail\" "<<endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // Cache the normalisation factor
- this->calcNorm();
+ // Constructor for the Novosibirsk PDF.
+ //
+ // The parameters in params are the mean, sigma and tail.
+ // The last two arguments specify the range in which the PDF is defined, and the PDF
+ // will be normalised w.r.t. these limits.
+
+ mean_ = this->findParameter( "mean" );
+ sigma_ = this->findParameter( "sigma" );
+ tail_ = this->findParameter( "tail" );
+
+ if ( ( this->nParameters() != 3 ) || ( mean_ == 0 ) || ( sigma_ == 0 ) || ( tail_ == 0 ) ) {
+ cerr << "ERROR in LauNovosibirskPdf constructor: LauNovosibirskPdf requires 3 parameters: \"mean\", \"sigma\"and \"tail\" "
+ << endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // Cache the normalisation factor
+ this->calcNorm();
}
-LauNovosibirskPdf::~LauNovosibirskPdf()
+LauNovosibirskPdf::~LauNovosibirskPdf()
{
- // Destructor
+ // Destructor
}
-void LauNovosibirskPdf::calcLikelihoodInfo(const LauAbscissas& abscissas)
+void LauNovosibirskPdf::calcLikelihoodInfo( const LauAbscissas& abscissas )
{
- // Check that the given abscissa is within the allowed range
- if (!this->checkRange(abscissas)) {
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // Get our abscissa
- Double_t abscissa = abscissas[0];
-
- // Get the up to date parameter values
- Double_t mean = mean_->unblindValue();
- Double_t sigma = sigma_->unblindValue();
- Double_t tail = tail_->unblindValue();
-
- // Evaluate the Novosibirsk PDF value
-
-
- Double_t qa(0.0), qb(0.0), qx(0.0), qy(0.0);
- Double_t arg(0.0);
- Double_t value(0.0);
-
-
- if(TMath::Abs(tail) < 1.e-7)
- arg = 0.5*((abscissa - mean)/sigma)*((abscissa - mean)/sigma);
- else {
- qa = tail*TMath::Sqrt(LauConstants::log4);
- qb = TMath::SinH(qa)/qa;
- qx = (abscissa - mean)/sigma*qb;
- qy = 1.0+ tail*qx;
-
- //---- Cutting curve from right side
-
- if( qy > 1.E-7) {
- arg = 0.5*( (log(qy)/tail)*(log(qy)/tail) + tail*tail);
- }else{
- arg = 15.0;
- }
- }
-
- value = TMath::Exp(-arg);
-
- // if the parameters are floating then we
- // need to recalculate the normalisation
- if (!this->cachePDF() && !this->withinNormCalc() && !this->withinGeneration()) {
- this->calcNorm();
- }
- this->setUnNormPDFVal(value);
+ // Check that the given abscissa is within the allowed range
+ if ( ! this->checkRange( abscissas ) ) {
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // Get our abscissa
+ Double_t abscissa = abscissas[0];
+
+ // Get the up to date parameter values
+ Double_t mean = mean_->unblindValue();
+ Double_t sigma = sigma_->unblindValue();
+ Double_t tail = tail_->unblindValue();
+
+ // Evaluate the Novosibirsk PDF value
+
+ Double_t qa( 0.0 ), qb( 0.0 ), qx( 0.0 ), qy( 0.0 );
+ Double_t arg( 0.0 );
+ Double_t value( 0.0 );
+
+ if ( TMath::Abs( tail ) < 1.e-7 )
+ arg = 0.5 * ( ( abscissa - mean ) / sigma ) * ( ( abscissa - mean ) / sigma );
+ else {
+ qa = tail * TMath::Sqrt( LauConstants::log4 );
+ qb = TMath::SinH( qa ) / qa;
+ qx = ( abscissa - mean ) / sigma * qb;
+ qy = 1.0 + tail * qx;
+
+ //---- Cutting curve from right side
+
+ if ( qy > 1.E-7 ) {
+ arg = 0.5 * ( ( log( qy ) / tail ) * ( log( qy ) / tail ) + tail * tail );
+ } else {
+ arg = 15.0;
+ }
+ }
+
+ value = TMath::Exp( -arg );
+
+ // if the parameters are floating then we
+ // need to recalculate the normalisation
+ if ( ! this->cachePDF() && ! this->withinNormCalc() && ! this->withinGeneration() ) {
+ this->calcNorm();
+ }
+ this->setUnNormPDFVal( value );
}
void LauNovosibirskPdf::calcPDFHeight( const LauKinematics* /*kinematics*/ )
{
- if (this->heightUpToDate()) {
- return;
- }
+ if ( this->heightUpToDate() ) {
+ return;
+ }
- // Get the up to date parameter values
- Double_t mean = mean_->unblindValue();
+ // Get the up to date parameter values
+ Double_t mean = mean_->unblindValue();
- LauAbscissas maxPoint(1);
- maxPoint[0] = mean;
-
+ LauAbscissas maxPoint( 1 );
+ maxPoint[0] = mean;
- // Calculate the PDF height for the Bifurcated Gaussian function.
-
- if (mean < this->getMinAbscissa()) {
- maxPoint[0] = this->getMinAbscissa();
- } else if (mean > this->getMaxAbscissa()) {
- maxPoint[0] = this->getMaxAbscissa();
- }
+ // Calculate the PDF height for the Bifurcated Gaussian function.
- this->calcLikelihoodInfo(maxPoint);
- Double_t height = this->getUnNormLikelihood();
+ if ( mean < this->getMinAbscissa() ) {
+ maxPoint[0] = this->getMinAbscissa();
+ } else if ( mean > this->getMaxAbscissa() ) {
+ maxPoint[0] = this->getMaxAbscissa();
+ }
- // Multiply by a small factor to avoid problems from rounding errors
- height *= (1.0 + 1e-1);
+ this->calcLikelihoodInfo( maxPoint );
+ Double_t height = this->getUnNormLikelihood();
- this->setMaxHeight(height);
-}
+ // Multiply by a small factor to avoid problems from rounding errors
+ height *= ( 1.0 + 1e-1 );
+ this->setMaxHeight( height );
+}
diff --git a/src/LauParameter.cc b/src/LauParameter.cc
index e08ba12..c2404de 100644
--- a/src/LauParameter.cc
+++ b/src/LauParameter.cc
@@ -1,760 +1,780 @@
/*
Copyright 2006 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauParameter.cc
\brief File containing implementation of LauParameter class.
*/
#include <iostream>
#include <map>
-using std::cout;
using std::cerr;
+using std::cout;
using std::endl;
-#include "TRandom.h"
-
#include "LauParameter.hh"
#include "LauRandom.hh"
-
+#include "TRandom.h"
LauParameter::LauParameter() :
- name_(""),
- value_(0.0),
- error_(0.0),
- negError_(0.0),
- posError_(0.0),
- genValue_(0.0),
- initValue_(0.0),
- minValue_(0.0),
- maxValue_(0.0),
- fixed_(kTRUE),
- secondStage_(kFALSE),
- gaussConstraint_(kFALSE),
- constraintTrueMean_(0.0),
- constraintMean_(0.0),
- constraintWidth_(0.0),
- gcc_(0.0),
- bias_(0.0),
- pull_(0.0),
- clone_(kFALSE),
- parent_(0),
- blinder_(0)
-{
-}
-
-LauParameter::LauParameter(const TString& parName) :
- name_(parName),
- value_(0.0),
- error_(0.0),
- negError_(0.0),
- posError_(0.0),
- genValue_(0.0),
- initValue_(0.0),
- minValue_(0.0),
- maxValue_(0.0),
- fixed_(kTRUE),
- secondStage_(kFALSE),
- gaussConstraint_(kFALSE),
- constraintTrueMean_(0.0),
- constraintMean_(0.0),
- constraintWidth_(0.0),
- gcc_(0.0),
- bias_(0.0),
- pull_(0.0),
- clone_(kFALSE),
- parent_(0),
- blinder_(0)
-{
-}
-
-LauParameter::LauParameter(Double_t parValue) :
- name_(""),
- value_(parValue),
- error_(0.0),
- negError_(0.0),
- posError_(0.0),
- genValue_(parValue),
- initValue_(parValue),
- minValue_(parValue-1e-6),
- maxValue_(parValue+1e-6),
- fixed_(kTRUE),
- secondStage_(kFALSE),
- gaussConstraint_(kFALSE),
- constraintTrueMean_(0.0),
- constraintMean_(0.0),
- constraintWidth_(0.0),
- gcc_(0.0),
- bias_(0.0),
- pull_(0.0),
- clone_(kFALSE),
- parent_(0),
- blinder_(0)
-{
-}
-
-LauParameter::LauParameter(const TString& parName, Double_t parValue) :
- name_(parName),
- value_(parValue),
- error_(0.0),
- negError_(0.0),
- posError_(0.0),
- genValue_(parValue),
- initValue_(parValue),
- minValue_(parValue-1e-6),
- maxValue_(parValue+1e-6),
- fixed_(kTRUE),
- secondStage_(kFALSE),
- gaussConstraint_(kFALSE),
- constraintTrueMean_(0.0),
- constraintMean_(0.0),
- constraintWidth_(0.0),
- gcc_(0.0),
- bias_(0.0),
- pull_(0.0),
- clone_(kFALSE),
- parent_(0),
- blinder_(0)
-{
-}
-
-LauParameter::LauParameter(Double_t parValue, Double_t min, Double_t max) :
- name_(""),
- value_(parValue),
- error_(0.0),
- negError_(0.0),
- posError_(0.0),
- genValue_(parValue),
- initValue_(parValue),
- minValue_(min),
- maxValue_(max),
- fixed_(kTRUE),
- secondStage_(kFALSE),
- gaussConstraint_(kFALSE),
- constraintTrueMean_(0.0),
- constraintMean_(0.0),
- constraintWidth_(0.0),
- gcc_(0.0),
- bias_(0.0),
- pull_(0.0),
- clone_(kFALSE),
- parent_(0),
- blinder_(0)
-{
- this->checkRange();
-}
-
-LauParameter::LauParameter(Double_t parValue, Double_t parError, Double_t min, Double_t max) :
- name_(""),
- value_(parValue),
- error_(parError),
- negError_(0.0),
- posError_(0.0),
- genValue_(parValue),
- initValue_(parValue),
- minValue_(min),
- maxValue_(max),
- fixed_(kTRUE),
- secondStage_(kFALSE),
- gaussConstraint_(kFALSE),
- constraintTrueMean_(0.0),
- constraintMean_(0.0),
- constraintWidth_(0.0),
- gcc_(0.0),
- bias_(0.0),
- pull_(0.0),
- clone_(kFALSE),
- parent_(0),
- blinder_(0)
-{
- this->checkRange();
-}
-
-LauParameter::LauParameter(Double_t parValue, Double_t min, Double_t max, Bool_t parFixed) :
- name_(""),
- value_(parValue),
- error_(0.0),
- negError_(0.0),
- posError_(0.0),
- genValue_(parValue),
- initValue_(parValue),
- minValue_(min),
- maxValue_(max),
- fixed_(parFixed),
- secondStage_(kFALSE),
- gaussConstraint_(kFALSE),
- constraintTrueMean_(0.0),
- constraintMean_(0.0),
- constraintWidth_(0.0),
- gcc_(0.0),
- bias_(0.0),
- pull_(0.0),
- clone_(kFALSE),
- parent_(0),
- blinder_(0)
-{
- this->checkRange();
-}
-
-LauParameter::LauParameter(const TString& parName, Double_t parValue, Double_t min, Double_t max) :
- name_(parName),
- value_(parValue),
- error_(0.0),
- negError_(0.0),
- posError_(0.0),
- genValue_(parValue),
- initValue_(parValue),
- minValue_(min),
- maxValue_(max),
- fixed_(kTRUE),
- secondStage_(kFALSE),
- gaussConstraint_(kFALSE),
- constraintTrueMean_(0.0),
- constraintMean_(0.0),
- constraintWidth_(0.0),
- gcc_(0.0),
- bias_(0.0),
- pull_(0.0),
- clone_(kFALSE),
- parent_(0),
- blinder_(0)
-{
- this->checkRange();
-}
-
-LauParameter::LauParameter(const TString& parName, Double_t parValue, Double_t min, Double_t max, Bool_t parFixed) :
- name_(parName),
- value_(parValue),
- error_(0.0),
- negError_(0.0),
- posError_(0.0),
- genValue_(parValue),
- initValue_(parValue),
- minValue_(min),
- maxValue_(max),
- fixed_(parFixed),
- secondStage_(kFALSE),
- gaussConstraint_(kFALSE),
- constraintTrueMean_(0.0),
- constraintMean_(0.0),
- constraintWidth_(0.0),
- gcc_(0.0),
- bias_(0.0),
- pull_(0.0),
- clone_(kFALSE),
- parent_(0),
- blinder_(0)
-{
- this->checkRange();
-}
-
-LauParameter::LauParameter(const TString& parName, Double_t parValue, Double_t parError, Double_t min, Double_t max) :
- name_(parName),
- value_(parValue),
- error_(parError),
- negError_(0.0),
- posError_(0.0),
- genValue_(parValue),
- initValue_(parValue),
- minValue_(min),
- maxValue_(max),
- fixed_(kTRUE),
- secondStage_(kFALSE),
- gaussConstraint_(kFALSE),
- constraintTrueMean_(0.0),
- constraintMean_(0.0),
- constraintWidth_(0.0),
- gcc_(0.0),
- bias_(0.0),
- pull_(0.0),
- clone_(kFALSE),
- parent_(0),
- blinder_(0)
-{
- this->checkRange();
-}
-
-LauParameter::LauParameter(const LauParameter& rhs) : TObject(rhs), LauAbsRValue(rhs),
- name_(rhs.name_),
- value_(rhs.value_),
- error_(rhs.error_),
- negError_(rhs.negError_),
- posError_(rhs.posError_),
- genValue_(rhs.genValue_),
- initValue_(rhs.initValue_),
- minValue_(rhs.minValue_),
- maxValue_(rhs.maxValue_),
- fixed_(rhs.fixed_),
- secondStage_(rhs.secondStage_),
- gaussConstraint_(rhs.gaussConstraint_),
- constraintTrueMean_(rhs.constraintTrueMean_),
- constraintMean_(rhs.constraintMean_),
- constraintWidth_(rhs.constraintWidth_),
- gcc_(rhs.gcc_),
- bias_(rhs.bias_),
- pull_(rhs.pull_),
- clone_(rhs.clone_),
- parent_(rhs.parent_),
- clones_(rhs.clones_),
- blinder_((rhs.blinder_==0) ? 0 : new LauBlind(*(rhs.blinder_)))
-{
-}
-
-LauParameter& LauParameter::operator=(const LauParameter& rhs)
-{
- if (&rhs != this) {
- TObject::operator=(rhs);
- LauAbsRValue::operator=(rhs);
- name_ = rhs.name_;
- value_ = rhs.value_;
- error_ = rhs.error_;
- negError_ = rhs.negError_;
- posError_ = rhs.posError_;
- genValue_ = rhs.genValue_;
- initValue_ = rhs.initValue_;
- minValue_ = rhs.minValue_;
- maxValue_ = rhs.maxValue_;
- fixed_ = rhs.fixed_;
- secondStage_ = rhs.secondStage_;
- gaussConstraint_ = rhs.gaussConstraint_;
- constraintTrueMean_ = rhs.constraintTrueMean_;
- constraintMean_ = rhs.constraintMean_;
- constraintWidth_ = rhs.constraintWidth_;
- gcc_ = rhs.gcc_;
- bias_ = rhs.bias_;
- pull_ = rhs.pull_;
- clone_ = rhs.clone_;
- parent_ = rhs.parent_;
- clones_ = rhs.clones_;
- delete blinder_;
- blinder_ = (rhs.blinder_==0) ? 0 : new LauBlind(*(rhs.blinder_));
- }
- return *this;
+ name_( "" ),
+ value_( 0.0 ),
+ error_( 0.0 ),
+ negError_( 0.0 ),
+ posError_( 0.0 ),
+ genValue_( 0.0 ),
+ initValue_( 0.0 ),
+ minValue_( 0.0 ),
+ maxValue_( 0.0 ),
+ fixed_( kTRUE ),
+ secondStage_( kFALSE ),
+ gaussConstraint_( kFALSE ),
+ constraintTrueMean_( 0.0 ),
+ constraintMean_( 0.0 ),
+ constraintWidth_( 0.0 ),
+ gcc_( 0.0 ),
+ bias_( 0.0 ),
+ pull_( 0.0 ),
+ clone_( kFALSE ),
+ parent_( 0 ),
+ blinder_( 0 )
+{
+}
+
+LauParameter::LauParameter( const TString& parName ) :
+ name_( parName ),
+ value_( 0.0 ),
+ error_( 0.0 ),
+ negError_( 0.0 ),
+ posError_( 0.0 ),
+ genValue_( 0.0 ),
+ initValue_( 0.0 ),
+ minValue_( 0.0 ),
+ maxValue_( 0.0 ),
+ fixed_( kTRUE ),
+ secondStage_( kFALSE ),
+ gaussConstraint_( kFALSE ),
+ constraintTrueMean_( 0.0 ),
+ constraintMean_( 0.0 ),
+ constraintWidth_( 0.0 ),
+ gcc_( 0.0 ),
+ bias_( 0.0 ),
+ pull_( 0.0 ),
+ clone_( kFALSE ),
+ parent_( 0 ),
+ blinder_( 0 )
+{
+}
+
+LauParameter::LauParameter( Double_t parValue ) :
+ name_( "" ),
+ value_( parValue ),
+ error_( 0.0 ),
+ negError_( 0.0 ),
+ posError_( 0.0 ),
+ genValue_( parValue ),
+ initValue_( parValue ),
+ minValue_( parValue - 1e-6 ),
+ maxValue_( parValue + 1e-6 ),
+ fixed_( kTRUE ),
+ secondStage_( kFALSE ),
+ gaussConstraint_( kFALSE ),
+ constraintTrueMean_( 0.0 ),
+ constraintMean_( 0.0 ),
+ constraintWidth_( 0.0 ),
+ gcc_( 0.0 ),
+ bias_( 0.0 ),
+ pull_( 0.0 ),
+ clone_( kFALSE ),
+ parent_( 0 ),
+ blinder_( 0 )
+{
+}
+
+LauParameter::LauParameter( const TString& parName, Double_t parValue ) :
+ name_( parName ),
+ value_( parValue ),
+ error_( 0.0 ),
+ negError_( 0.0 ),
+ posError_( 0.0 ),
+ genValue_( parValue ),
+ initValue_( parValue ),
+ minValue_( parValue - 1e-6 ),
+ maxValue_( parValue + 1e-6 ),
+ fixed_( kTRUE ),
+ secondStage_( kFALSE ),
+ gaussConstraint_( kFALSE ),
+ constraintTrueMean_( 0.0 ),
+ constraintMean_( 0.0 ),
+ constraintWidth_( 0.0 ),
+ gcc_( 0.0 ),
+ bias_( 0.0 ),
+ pull_( 0.0 ),
+ clone_( kFALSE ),
+ parent_( 0 ),
+ blinder_( 0 )
+{
+}
+
+LauParameter::LauParameter( Double_t parValue, Double_t min, Double_t max ) :
+ name_( "" ),
+ value_( parValue ),
+ error_( 0.0 ),
+ negError_( 0.0 ),
+ posError_( 0.0 ),
+ genValue_( parValue ),
+ initValue_( parValue ),
+ minValue_( min ),
+ maxValue_( max ),
+ fixed_( kTRUE ),
+ secondStage_( kFALSE ),
+ gaussConstraint_( kFALSE ),
+ constraintTrueMean_( 0.0 ),
+ constraintMean_( 0.0 ),
+ constraintWidth_( 0.0 ),
+ gcc_( 0.0 ),
+ bias_( 0.0 ),
+ pull_( 0.0 ),
+ clone_( kFALSE ),
+ parent_( 0 ),
+ blinder_( 0 )
+{
+ this->checkRange();
+}
+
+LauParameter::LauParameter( Double_t parValue, Double_t parError, Double_t min, Double_t max ) :
+ name_( "" ),
+ value_( parValue ),
+ error_( parError ),
+ negError_( 0.0 ),
+ posError_( 0.0 ),
+ genValue_( parValue ),
+ initValue_( parValue ),
+ minValue_( min ),
+ maxValue_( max ),
+ fixed_( kTRUE ),
+ secondStage_( kFALSE ),
+ gaussConstraint_( kFALSE ),
+ constraintTrueMean_( 0.0 ),
+ constraintMean_( 0.0 ),
+ constraintWidth_( 0.0 ),
+ gcc_( 0.0 ),
+ bias_( 0.0 ),
+ pull_( 0.0 ),
+ clone_( kFALSE ),
+ parent_( 0 ),
+ blinder_( 0 )
+{
+ this->checkRange();
+}
+
+LauParameter::LauParameter( Double_t parValue, Double_t min, Double_t max, Bool_t parFixed ) :
+ name_( "" ),
+ value_( parValue ),
+ error_( 0.0 ),
+ negError_( 0.0 ),
+ posError_( 0.0 ),
+ genValue_( parValue ),
+ initValue_( parValue ),
+ minValue_( min ),
+ maxValue_( max ),
+ fixed_( parFixed ),
+ secondStage_( kFALSE ),
+ gaussConstraint_( kFALSE ),
+ constraintTrueMean_( 0.0 ),
+ constraintMean_( 0.0 ),
+ constraintWidth_( 0.0 ),
+ gcc_( 0.0 ),
+ bias_( 0.0 ),
+ pull_( 0.0 ),
+ clone_( kFALSE ),
+ parent_( 0 ),
+ blinder_( 0 )
+{
+ this->checkRange();
+}
+
+LauParameter::LauParameter( const TString& parName, Double_t parValue, Double_t min, Double_t max ) :
+ name_( parName ),
+ value_( parValue ),
+ error_( 0.0 ),
+ negError_( 0.0 ),
+ posError_( 0.0 ),
+ genValue_( parValue ),
+ initValue_( parValue ),
+ minValue_( min ),
+ maxValue_( max ),
+ fixed_( kTRUE ),
+ secondStage_( kFALSE ),
+ gaussConstraint_( kFALSE ),
+ constraintTrueMean_( 0.0 ),
+ constraintMean_( 0.0 ),
+ constraintWidth_( 0.0 ),
+ gcc_( 0.0 ),
+ bias_( 0.0 ),
+ pull_( 0.0 ),
+ clone_( kFALSE ),
+ parent_( 0 ),
+ blinder_( 0 )
+{
+ this->checkRange();
+}
+
+LauParameter::LauParameter( const TString& parName,
+ Double_t parValue,
+ Double_t min,
+ Double_t max,
+ Bool_t parFixed ) :
+ name_( parName ),
+ value_( parValue ),
+ error_( 0.0 ),
+ negError_( 0.0 ),
+ posError_( 0.0 ),
+ genValue_( parValue ),
+ initValue_( parValue ),
+ minValue_( min ),
+ maxValue_( max ),
+ fixed_( parFixed ),
+ secondStage_( kFALSE ),
+ gaussConstraint_( kFALSE ),
+ constraintTrueMean_( 0.0 ),
+ constraintMean_( 0.0 ),
+ constraintWidth_( 0.0 ),
+ gcc_( 0.0 ),
+ bias_( 0.0 ),
+ pull_( 0.0 ),
+ clone_( kFALSE ),
+ parent_( 0 ),
+ blinder_( 0 )
+{
+ this->checkRange();
+}
+
+LauParameter::LauParameter( const TString& parName,
+ Double_t parValue,
+ Double_t parError,
+ Double_t min,
+ Double_t max ) :
+ name_( parName ),
+ value_( parValue ),
+ error_( parError ),
+ negError_( 0.0 ),
+ posError_( 0.0 ),
+ genValue_( parValue ),
+ initValue_( parValue ),
+ minValue_( min ),
+ maxValue_( max ),
+ fixed_( kTRUE ),
+ secondStage_( kFALSE ),
+ gaussConstraint_( kFALSE ),
+ constraintTrueMean_( 0.0 ),
+ constraintMean_( 0.0 ),
+ constraintWidth_( 0.0 ),
+ gcc_( 0.0 ),
+ bias_( 0.0 ),
+ pull_( 0.0 ),
+ clone_( kFALSE ),
+ parent_( 0 ),
+ blinder_( 0 )
+{
+ this->checkRange();
+}
+
+LauParameter::LauParameter( const LauParameter& rhs ) :
+ TObject( rhs ),
+ LauAbsRValue( rhs ),
+ name_( rhs.name_ ),
+ value_( rhs.value_ ),
+ error_( rhs.error_ ),
+ negError_( rhs.negError_ ),
+ posError_( rhs.posError_ ),
+ genValue_( rhs.genValue_ ),
+ initValue_( rhs.initValue_ ),
+ minValue_( rhs.minValue_ ),
+ maxValue_( rhs.maxValue_ ),
+ fixed_( rhs.fixed_ ),
+ secondStage_( rhs.secondStage_ ),
+ gaussConstraint_( rhs.gaussConstraint_ ),
+ constraintTrueMean_( rhs.constraintTrueMean_ ),
+ constraintMean_( rhs.constraintMean_ ),
+ constraintWidth_( rhs.constraintWidth_ ),
+ gcc_( rhs.gcc_ ),
+ bias_( rhs.bias_ ),
+ pull_( rhs.pull_ ),
+ clone_( rhs.clone_ ),
+ parent_( rhs.parent_ ),
+ clones_( rhs.clones_ ),
+ blinder_( ( rhs.blinder_ == 0 ) ? 0 : new LauBlind( *( rhs.blinder_ ) ) )
+{
+}
+
+LauParameter& LauParameter::operator=( const LauParameter& rhs )
+{
+ if ( &rhs != this ) {
+ TObject::operator=( rhs );
+ LauAbsRValue::operator=( rhs );
+ name_ = rhs.name_;
+ value_ = rhs.value_;
+ error_ = rhs.error_;
+ negError_ = rhs.negError_;
+ posError_ = rhs.posError_;
+ genValue_ = rhs.genValue_;
+ initValue_ = rhs.initValue_;
+ minValue_ = rhs.minValue_;
+ maxValue_ = rhs.maxValue_;
+ fixed_ = rhs.fixed_;
+ secondStage_ = rhs.secondStage_;
+ gaussConstraint_ = rhs.gaussConstraint_;
+ constraintTrueMean_ = rhs.constraintTrueMean_;
+ constraintMean_ = rhs.constraintMean_;
+ constraintWidth_ = rhs.constraintWidth_;
+ gcc_ = rhs.gcc_;
+ bias_ = rhs.bias_;
+ pull_ = rhs.pull_;
+ clone_ = rhs.clone_;
+ parent_ = rhs.parent_;
+ clones_ = rhs.clones_;
+ delete blinder_;
+ blinder_ = ( rhs.blinder_ == 0 ) ? 0 : new LauBlind( *( rhs.blinder_ ) );
+ }
+ return *this;
}
LauParameter::~LauParameter()
{
- delete blinder_;
+ delete blinder_;
}
-std::vector<LauParameter*> LauParameter::getPars()
+std::vector<LauParameter*> LauParameter::getPars()
{
- std::vector<LauParameter*> list;
- list.push_back(this);
- return list;
+ std::vector<LauParameter*> list;
+ list.push_back( this );
+ return list;
}
-void LauParameter::value(Double_t newValue)
+void LauParameter::value( Double_t newValue )
{
- if (this->clone()) {
- parent_->value(newValue);
- } else {
- this->checkRange(newValue,this->minValue(),this->maxValue());
- this->updateClones(kTRUE);
- }
+ if ( this->clone() ) {
+ parent_->value( newValue );
+ } else {
+ this->checkRange( newValue, this->minValue(), this->maxValue() );
+ this->updateClones( kTRUE );
+ }
}
-void LauParameter::error(Double_t newError)
+void LauParameter::error( Double_t newError )
{
- if (this->clone()) {
- parent_->error(newError);
- } else {
- error_ = TMath::Abs(newError);
- this->updateClones(kFALSE);
- }
+ if ( this->clone() ) {
+ parent_->error( newError );
+ } else {
+ error_ = TMath::Abs( newError );
+ this->updateClones( kFALSE );
+ }
}
-void LauParameter::negError(Double_t newNegError)
+void LauParameter::negError( Double_t newNegError )
{
- if (this->clone()) {
- parent_->negError(newNegError);
- } else {
- negError_ = TMath::Abs(newNegError);
- this->updateClones(kFALSE);
- }
+ if ( this->clone() ) {
+ parent_->negError( newNegError );
+ } else {
+ negError_ = TMath::Abs( newNegError );
+ this->updateClones( kFALSE );
+ }
}
-void LauParameter::posError(Double_t newPosError)
+void LauParameter::posError( Double_t newPosError )
{
- if (this->clone()) {
- parent_->posError(newPosError);
- } else {
- posError_ = TMath::Abs(newPosError);
- this->updateClones(kFALSE);
- }
+ if ( this->clone() ) {
+ parent_->posError( newPosError );
+ } else {
+ posError_ = TMath::Abs( newPosError );
+ this->updateClones( kFALSE );
+ }
}
-void LauParameter::errors(Double_t newError, Double_t newNegError, Double_t newPosError)
+void LauParameter::errors( Double_t newError, Double_t newNegError, Double_t newPosError )
{
- if (this->clone()) {
- parent_->errors(newError,newNegError,newPosError);
- } else {
- error_ = TMath::Abs(newError);
- negError_ = TMath::Abs(newNegError);
- posError_ = TMath::Abs(newPosError);
- this->updateClones(kFALSE);
- }
+ if ( this->clone() ) {
+ parent_->errors( newError, newNegError, newPosError );
+ } else {
+ error_ = TMath::Abs( newError );
+ negError_ = TMath::Abs( newNegError );
+ posError_ = TMath::Abs( newPosError );
+ this->updateClones( kFALSE );
+ }
}
-void LauParameter::valueAndErrors(Double_t newValue, Double_t newError, Double_t newNegError, Double_t newPosError)
+void LauParameter::valueAndErrors( Double_t newValue,
+ Double_t newError,
+ Double_t newNegError,
+ Double_t newPosError )
{
- if (this->clone()) {
- parent_->valueAndErrors(newValue,newError,newNegError,newPosError);
- } else {
- this->checkRange(newValue,this->minValue(),this->maxValue());
- error_ = TMath::Abs(newError);
- negError_ = TMath::Abs(newNegError);
- posError_ = TMath::Abs(newPosError);
- this->updateClones(kFALSE);
- }
+ if ( this->clone() ) {
+ parent_->valueAndErrors( newValue, newError, newNegError, newPosError );
+ } else {
+ this->checkRange( newValue, this->minValue(), this->maxValue() );
+ error_ = TMath::Abs( newError );
+ negError_ = TMath::Abs( newNegError );
+ posError_ = TMath::Abs( newPosError );
+ this->updateClones( kFALSE );
+ }
}
-void LauParameter::globalCorrelationCoeff(Double_t newGCCValue)
+void LauParameter::globalCorrelationCoeff( Double_t newGCCValue )
{
- if (this->clone()) {
- parent_->globalCorrelationCoeff(newGCCValue);
- } else {
- gcc_ = newGCCValue;
- this->updateClones(kFALSE);
- }
+ if ( this->clone() ) {
+ parent_->globalCorrelationCoeff( newGCCValue );
+ } else {
+ gcc_ = newGCCValue;
+ this->updateClones( kFALSE );
+ }
}
-void LauParameter::genValue(Double_t newGenValue)
+void LauParameter::genValue( Double_t newGenValue )
{
- if (this->clone()) {
- parent_->genValue(newGenValue);
- } else {
- genValue_ = newGenValue;
- this->updateClones(kFALSE);
- }
+ if ( this->clone() ) {
+ parent_->genValue( newGenValue );
+ } else {
+ genValue_ = newGenValue;
+ this->updateClones( kFALSE );
+ }
}
-void LauParameter::initValue(Double_t newInitValue)
+void LauParameter::initValue( Double_t newInitValue )
{
- if (this->clone()) {
- parent_->initValue(newInitValue);
- } else {
- initValue_ = newInitValue;
- this->updateClones(kFALSE);
- }
+ if ( this->clone() ) {
+ parent_->initValue( newInitValue );
+ } else {
+ initValue_ = newInitValue;
+ this->updateClones( kFALSE );
+ }
}
-void LauParameter::minValue(Double_t newMinValue)
+void LauParameter::minValue( Double_t newMinValue )
{
- if (this->clone()) {
- parent_->minValue(newMinValue);
- } else {
- this->checkRange(this->value(),newMinValue,this->maxValue());
- this->updateClones(kFALSE);
- }
+ if ( this->clone() ) {
+ parent_->minValue( newMinValue );
+ } else {
+ this->checkRange( this->value(), newMinValue, this->maxValue() );
+ this->updateClones( kFALSE );
+ }
}
-void LauParameter::maxValue(Double_t newMaxValue)
+void LauParameter::maxValue( Double_t newMaxValue )
{
- if (this->clone()) {
- parent_->maxValue(newMaxValue);
- } else {
- this->checkRange(this->value(),this->minValue(),newMaxValue);
- this->updateClones(kFALSE);
- }
+ if ( this->clone() ) {
+ parent_->maxValue( newMaxValue );
+ } else {
+ this->checkRange( this->value(), this->minValue(), newMaxValue );
+ this->updateClones( kFALSE );
+ }
}
-void LauParameter::range(Double_t newMinValue, Double_t newMaxValue)
+void LauParameter::range( Double_t newMinValue, Double_t newMaxValue )
{
- if (this->clone()) {
- parent_->range(newMinValue,newMaxValue);
- } else {
- this->checkRange(this->value(),newMinValue,newMaxValue);
- this->updateClones(kFALSE);
- }
+ if ( this->clone() ) {
+ parent_->range( newMinValue, newMaxValue );
+ } else {
+ this->checkRange( this->value(), newMinValue, newMaxValue );
+ this->updateClones( kFALSE );
+ }
}
-void LauParameter::valueAndRange(Double_t newValue, Double_t newMinValue, Double_t newMaxValue)
+void LauParameter::valueAndRange( Double_t newValue, Double_t newMinValue, Double_t newMaxValue )
{
- if (this->clone()) {
- parent_->valueAndRange(newValue,newMinValue,newMaxValue);
- } else {
- this->checkRange(newValue,newMinValue,newMaxValue);
- this->updateClones(kFALSE);
- }
+ if ( this->clone() ) {
+ parent_->valueAndRange( newValue, newMinValue, newMaxValue );
+ } else {
+ this->checkRange( newValue, newMinValue, newMaxValue );
+ this->updateClones( kFALSE );
+ }
}
-void LauParameter::name(const TString& newName)
+void LauParameter::name( const TString& newName )
{
- // no need to update clones here
- // clones are allowed to have different names
- name_ = newName;
+ // no need to update clones here
+ // clones are allowed to have different names
+ name_ = newName;
}
-void LauParameter::fixed(Bool_t parFixed)
+void LauParameter::fixed( Bool_t parFixed )
{
- if (this->clone()) {
- parent_->fixed(parFixed);
- } else {
- fixed_ = parFixed;
- this->updateClones(kFALSE);
- }
+ if ( this->clone() ) {
+ parent_->fixed( parFixed );
+ } else {
+ fixed_ = parFixed;
+ this->updateClones( kFALSE );
+ }
}
-void LauParameter::secondStage(Bool_t secondStagePar)
+void LauParameter::secondStage( Bool_t secondStagePar )
{
- if (this->clone()) {
- parent_->secondStage(secondStagePar);
- } else {
- secondStage_ = secondStagePar;
- this->updateClones(kFALSE);
- }
+ if ( this->clone() ) {
+ parent_->secondStage( secondStagePar );
+ } else {
+ secondStage_ = secondStagePar;
+ this->updateClones( kFALSE );
+ }
}
-void LauParameter::addGaussianConstraint(Double_t newGaussMean, Double_t newGaussWidth)
+void LauParameter::addGaussianConstraint( Double_t newGaussMean, Double_t newGaussWidth )
{
- if (this->clone()) {
- parent_->addGaussianConstraint(newGaussMean,newGaussWidth);
- } else {
- gaussConstraint_ = kTRUE;
- constraintTrueMean_ = newGaussMean;
- constraintMean_ = newGaussMean;
- constraintWidth_ = newGaussWidth;
- this->updateClones(kFALSE);
- }
+ if ( this->clone() ) {
+ parent_->addGaussianConstraint( newGaussMean, newGaussWidth );
+ } else {
+ gaussConstraint_ = kTRUE;
+ constraintTrueMean_ = newGaussMean;
+ constraintMean_ = newGaussMean;
+ constraintWidth_ = newGaussWidth;
+ this->updateClones( kFALSE );
+ }
}
void LauParameter::removeGaussianConstraint()
{
- if (this->clone()) {
- parent_->removeGaussianConstraint();
- } else {
- gaussConstraint_ = kFALSE;
- this->updateClones(kFALSE);
- }
+ if ( this->clone() ) {
+ parent_->removeGaussianConstraint();
+ } else {
+ gaussConstraint_ = kFALSE;
+ this->updateClones( kFALSE );
+ }
}
void LauParameter::generateConstraintMean()
{
- if (this->clone()) {
- parent_->generateConstraintMean();
- } else {
- constraintMean_ = LauRandom::randomFun()->Gaus( constraintTrueMean_, constraintWidth_ );
- this->updateClones(kFALSE);
- }
+ if ( this->clone() ) {
+ parent_->generateConstraintMean();
+ } else {
+ constraintMean_ = LauRandom::randomFun()->Gaus( constraintTrueMean_, constraintWidth_ );
+ this->updateClones( kFALSE );
+ }
}
Double_t LauParameter::constraintPenalty() const
{
- const Double_t val { this->unblindValue() };
- const Double_t diff { val - constraintMean_ };
- const Double_t term { diff * diff };
+ const Double_t val { this->unblindValue() };
+ const Double_t diff { val - constraintMean_ };
+ const Double_t term { diff * diff };
- return term / ( 2.0 * constraintWidth_ * constraintWidth_ );
+ return term / ( 2.0 * constraintWidth_ * constraintWidth_ );
}
-void LauParameter::blindParameter(const TString& blindingString, const Double_t width)
+void LauParameter::blindParameter( const TString& blindingString, const Double_t width )
{
- if (this->clone()) {
- parent_->blindParameter(blindingString,width);
- return;
- }
+ if ( this->clone() ) {
+ parent_->blindParameter( blindingString, width );
+ return;
+ }
- if ( blinder_ != 0 ) {
- std::cerr << "WARNING in LauParameter::blindParameter : blinding has already been set up for this parameter" << std::endl;
- return;
- }
+ if ( blinder_ != 0 ) {
+ std::cerr << "WARNING in LauParameter::blindParameter : blinding has already been set up for this parameter"
+ << std::endl;
+ return;
+ }
- blinder_ = new LauBlind(blindingString,width);
+ blinder_ = new LauBlind( blindingString, width );
- for (std::map<LauParameter*,Double_t>::iterator iter = clones_.begin(); iter != clones_.end(); ++iter) {
- LauParameter* clonePar = iter->first;
- if ( clonePar->blinder_ != 0 ) {
- std::cerr << "WARNING in LauParameter::blindParameter : blinding has already been set up for a clone of this parameter - it will be replaced!" << std::endl;
- delete clonePar->blinder_;
- clonePar->blinder_ = 0;
- }
- clonePar->blinder_ = new LauBlind(*blinder_);
- }
+ for ( std::map<LauParameter*, Double_t>::iterator iter = clones_.begin(); iter != clones_.end();
+ ++iter ) {
+ LauParameter* clonePar = iter->first;
+ if ( clonePar->blinder_ != 0 ) {
+ std::cerr << "WARNING in LauParameter::blindParameter : blinding has already been set up for a clone of this parameter - it will be replaced!"
+ << std::endl;
+ delete clonePar->blinder_;
+ clonePar->blinder_ = 0;
+ }
+ clonePar->blinder_ = new LauBlind( *blinder_ );
+ }
}
void LauParameter::updatePull()
{
- if (this->clone()) {
- parent_->updatePull();
- return;
- }
-
- // calculate the bias
- bias_ = value_ - genValue_;
-
- // if we have errors calculated then calculate
- // the pull using the best error available
- if ((bias_ > 0.0) && (negError_ > 1e-10)) {
- pull_ = bias_ / negError_;
- } else if ((bias_ < 0.0) && (posError_ > 1e-10)) {
- pull_ = bias_ / posError_;
- } else if (error_ > 1e-10) {
- pull_ = bias_ / error_;
- } else {
- pull_ = 0.0;
- }
-
- this->updateClones(kFALSE);
-}
-
-void LauParameter::checkRange(Double_t val, Double_t minVal, Double_t maxVal)
-{
- // first check that min is less than max (or they are the same - this is allowed)
- if (minVal > maxVal) {
- cerr<<"ERROR in LauParameter::checkRange : minValue: "<<minVal<<" greater than maxValue: "<<maxVal<<endl;
- if (minValue_ > maxValue_) {
- minValue_ = maxValue_;
- cerr<<" : Setting both to "<<maxValue_<<"."<<endl;
- } else {
- cerr<<" : Not changing anything."<<endl;
- }
- return;
- }
-
- minValue_ = minVal;
- maxValue_ = maxVal;
-
- // now check that the value is still within the range
- if ((val < minVal) || (val > maxVal)) {
- if (name_ != "") {
- cerr<<"ERROR in LauParameter::checkRange : value: "<<val<<" not in allowed range ["<<minVal<<" , "<<maxVal<<"] for parameter \""<<name_<<"\"."<<endl;
- } else {
- cerr<<"ERROR in LauParameter::checkRange : value: "<<val<<" not in allowed range ["<<minVal<<" , "<<maxVal<<"]."<<endl;
- }
- if (val < minVal) {
- cerr<<" : Setting value to minValue: "<<minVal<<endl;
- val = minVal;
- } else {
- cerr<<" : Setting value to maxValue: "<<maxVal<<endl;
- val = maxVal;
- }
- }
- value_ = val;
-}
-
-LauParameter* LauParameter::createClone(Double_t constFactor)
-{
- // if we're a clone we mustn't be cloned ourselves
- // but instead return another clone of our parent
- // (this is so that the parent knows of all its clones)
- if (this->clone()) {
- LauParameter* clonePar = parent_->createClone(constFactor);
- clonePar->name(this->name());
- return clonePar;
- }
-
- // clone ourselves using the copy-constructor
- LauParameter* clonePar = new LauParameter(*this);
- Double_t newValue = clonePar->value() * constFactor;
- clonePar->value( newValue );
- clonePar->wipeClones();
- clonePar->clone(this);
- clones_.insert( std::make_pair( clonePar, constFactor ) );
- return clonePar;
-}
-
-LauParameter* LauParameter::createClone(const TString& newName, Double_t constFactor)
-{
- // self message to create the clone
- LauParameter* clonePar = this->createClone(constFactor);
- // set the new name
- clonePar->name(newName);
- // and return
- return clonePar;
-}
-
-void LauParameter::updateClones(Bool_t justValue)
-{
- // if we don't have any clones then there's nothing to do
- if ( clones_.empty() ) {
- return;
- }
-
- // we have to set the values directly rather than using member functions because otherwise we'd get into an infinite loop
- if (justValue) {
- for ( auto& [ clonePar, constFactor ] : clones_ ) {
- clonePar->value_ = constFactor * value_;
- }
- } else {
- for ( auto& [ clonePar, constFactor ] : clones_ ) {
- clonePar->value_ = constFactor * value_;
- clonePar->error_ = constFactor * error_;
- clonePar->negError_ = constFactor * negError_;
- clonePar->posError_ = constFactor * posError_;
- clonePar->genValue_ = constFactor * genValue_;
- clonePar->initValue_ = constFactor * initValue_;
- clonePar->minValue_ = constFactor * minValue_;
- clonePar->maxValue_ = constFactor * maxValue_;
- clonePar->fixed_ = fixed_;
- clonePar->secondStage_ = secondStage_;
- clonePar->gaussConstraint_ = gaussConstraint_;
- clonePar->constraintTrueMean_ = constraintTrueMean_;
- clonePar->constraintMean_ = constraintMean_;
- clonePar->constraintWidth_ = constraintWidth_;
- clonePar->gcc_ = gcc_;
- clonePar->bias_ = bias_;
- clonePar->pull_ = pull_;
- }
- }
+ if ( this->clone() ) {
+ parent_->updatePull();
+ return;
+ }
+
+ // calculate the bias
+ bias_ = value_ - genValue_;
+
+ // if we have errors calculated then calculate
+ // the pull using the best error available
+ if ( ( bias_ > 0.0 ) && ( negError_ > 1e-10 ) ) {
+ pull_ = bias_ / negError_;
+ } else if ( ( bias_ < 0.0 ) && ( posError_ > 1e-10 ) ) {
+ pull_ = bias_ / posError_;
+ } else if ( error_ > 1e-10 ) {
+ pull_ = bias_ / error_;
+ } else {
+ pull_ = 0.0;
+ }
+
+ this->updateClones( kFALSE );
+}
+
+void LauParameter::checkRange( Double_t val, Double_t minVal, Double_t maxVal )
+{
+ // first check that min is less than max (or they are the same - this is allowed)
+ if ( minVal > maxVal ) {
+ cerr << "ERROR in LauParameter::checkRange : minValue: " << minVal
+ << " greater than maxValue: " << maxVal << endl;
+ if ( minValue_ > maxValue_ ) {
+ minValue_ = maxValue_;
+ cerr << " : Setting both to " << maxValue_ << "."
+ << endl;
+ } else {
+ cerr << " : Not changing anything." << endl;
+ }
+ return;
+ }
+
+ minValue_ = minVal;
+ maxValue_ = maxVal;
+
+ // now check that the value is still within the range
+ if ( ( val < minVal ) || ( val > maxVal ) ) {
+ if ( name_ != "" ) {
+ cerr << "ERROR in LauParameter::checkRange : value: " << val << " not in allowed range ["
+ << minVal << " , " << maxVal << "] for parameter \"" << name_ << "\"." << endl;
+ } else {
+ cerr << "ERROR in LauParameter::checkRange : value: " << val
+ << " not in allowed range [" << minVal << " , " << maxVal << "]." << endl;
+ }
+ if ( val < minVal ) {
+ cerr << " : Setting value to minValue: " << minVal
+ << endl;
+ val = minVal;
+ } else {
+ cerr << " : Setting value to maxValue: " << maxVal
+ << endl;
+ val = maxVal;
+ }
+ }
+ value_ = val;
+}
+
+LauParameter* LauParameter::createClone( Double_t constFactor )
+{
+ // if we're a clone we mustn't be cloned ourselves
+ // but instead return another clone of our parent
+ // (this is so that the parent knows of all its clones)
+ if ( this->clone() ) {
+ LauParameter* clonePar = parent_->createClone( constFactor );
+ clonePar->name( this->name() );
+ return clonePar;
+ }
+
+ // clone ourselves using the copy-constructor
+ LauParameter* clonePar = new LauParameter( *this );
+ Double_t newValue = clonePar->value() * constFactor;
+ clonePar->value( newValue );
+ clonePar->wipeClones();
+ clonePar->clone( this );
+ clones_.insert( std::make_pair( clonePar, constFactor ) );
+ return clonePar;
+}
+
+LauParameter* LauParameter::createClone( const TString& newName, Double_t constFactor )
+{
+ // self message to create the clone
+ LauParameter* clonePar = this->createClone( constFactor );
+ // set the new name
+ clonePar->name( newName );
+ // and return
+ return clonePar;
+}
+
+void LauParameter::updateClones( Bool_t justValue )
+{
+ // if we don't have any clones then there's nothing to do
+ if ( clones_.empty() ) {
+ return;
+ }
+
+ // we have to set the values directly rather than using member functions because otherwise we'd get into an infinite loop
+ if ( justValue ) {
+ for ( auto& [clonePar, constFactor] : clones_ ) {
+ clonePar->value_ = constFactor * value_;
+ }
+ } else {
+ for ( auto& [clonePar, constFactor] : clones_ ) {
+ clonePar->value_ = constFactor * value_;
+ clonePar->error_ = constFactor * error_;
+ clonePar->negError_ = constFactor * negError_;
+ clonePar->posError_ = constFactor * posError_;
+ clonePar->genValue_ = constFactor * genValue_;
+ clonePar->initValue_ = constFactor * initValue_;
+ clonePar->minValue_ = constFactor * minValue_;
+ clonePar->maxValue_ = constFactor * maxValue_;
+ clonePar->fixed_ = fixed_;
+ clonePar->secondStage_ = secondStage_;
+ clonePar->gaussConstraint_ = gaussConstraint_;
+ clonePar->constraintTrueMean_ = constraintTrueMean_;
+ clonePar->constraintMean_ = constraintMean_;
+ clonePar->constraintWidth_ = constraintWidth_;
+ clonePar->gcc_ = gcc_;
+ clonePar->bias_ = bias_;
+ clonePar->pull_ = pull_;
+ }
+ }
}
void LauParameter::randomiseValue()
{
- this->randomiseValue(this->minValue(), this->maxValue());
+ this->randomiseValue( this->minValue(), this->maxValue() );
}
-void LauParameter::randomiseValue(Double_t minVal, Double_t maxVal)
+void LauParameter::randomiseValue( Double_t minVal, Double_t maxVal )
{
- // if we're fixed then do nothing
- if (this->fixed()) {
- return;
- }
+ // if we're fixed then do nothing
+ if ( this->fixed() ) {
+ return;
+ }
- // check supplied values are sensible
- if (maxVal < minVal) {
- cerr<<"ERROR in LauParameter::randomiseValue : Supplied maximum value smaller than minimum value."<<endl;
- return;
- }
- if (maxVal > this->maxValue()) {
- maxVal = this->maxValue();
- }
- if (minVal < this->minValue()) {
- minVal = this->minValue();
- }
+ // check supplied values are sensible
+ if ( maxVal < minVal ) {
+ cerr << "ERROR in LauParameter::randomiseValue : Supplied maximum value smaller than minimum value."
+ << endl;
+ return;
+ }
+ if ( maxVal > this->maxValue() ) {
+ maxVal = this->maxValue();
+ }
+ if ( minVal < this->minValue() ) {
+ minVal = this->minValue();
+ }
- // use the zero-seed random number generator to get values that are
- // uniformly distributed over the given range
- Double_t randNo = LauRandom::zeroSeedRandom()->Rndm();
- Double_t val = randNo*(maxVal - minVal) + minVal;
- this->initValue(val);
+ // use the zero-seed random number generator to get values that are
+ // uniformly distributed over the given range
+ Double_t randNo = LauRandom::zeroSeedRandom()->Rndm();
+ Double_t val = randNo * ( maxVal - minVal ) + minVal;
+ this->initValue( val );
}
// ostream operator
-std::ostream& operator << (std::ostream& stream, const LauParameter& par)
+std::ostream& operator<<( std::ostream& stream, const LauParameter& par )
{
- stream << par.value();
- return stream;
+ stream << par.value();
+ return stream;
}
-
diff --git a/src/LauParametricStepFuncPdf.cc b/src/LauParametricStepFuncPdf.cc
index 67862b6..9035117 100644
--- a/src/LauParametricStepFuncPdf.cc
+++ b/src/LauParametricStepFuncPdf.cc
@@ -1,229 +1,229 @@
/*
Copyright 2008 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauParametricStepFuncPdf.cc
\brief File containing implementation of LauParametricStepFuncPdf class.
*/
/*****************************************************************************
* Class based on RooFit/RooParametricStepFunction. *
* Original copyright given below. *
*****************************************************************************
* Authors: *
* WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
* DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
* *
* Copyright (c) 2000-2005, Regents of the University of California *
* and Stanford University. All rights reserved. *
* *
* Redistribution and use in source and binary forms, *
* with or without modification, are permitted according to the terms *
* listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
*****************************************************************************/
-
#include <iostream>
#include <vector>
-using std::cout;
using std::cerr;
+using std::cout;
using std::endl;
-#include "TMath.h"
-#include "TSystem.h"
-
#include "LauConstants.hh"
#include "LauParametricStepFuncPdf.hh"
+#include "TMath.h"
+#include "TSystem.h"
-
-LauParametricStepFuncPdf::LauParametricStepFuncPdf(const TString& theVarName, const std::vector<LauAbsRValue*>& params, const std::vector<Double_t>& limits, NormBin normalisationBin) :
- LauAbsPdf(theVarName, params, limits.front(), limits.back()),
- normBin_(normalisationBin),
- limits_(limits)
+LauParametricStepFuncPdf::LauParametricStepFuncPdf( const TString& theVarName,
+ const std::vector<LauAbsRValue*>& params,
+ const std::vector<Double_t>& limits,
+ NormBin normalisationBin ) :
+ LauAbsPdf( theVarName, params, limits.front(), limits.back() ),
+ normBin_( normalisationBin ),
+ limits_( limits )
{
- // Constructor for the PSF PDF.
- //
- // The parameters in params are the bin contents of all but the
- // normalisation bin, so has N_bins-1 entries.
- // The last argument specifies the limits of the bins and the range
- // as a whole, so has N_bins+1 entries.
-
- if (this->nParameters() != this->nBins()-1) {
- cerr<<"ERROR in LauParametricStepFuncPdf constructor: LauParametricStepFuncPdf requires N-1 parameters, where N is the number of bins."<<endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // Cache the normalisation factor
- this->calcNorm();
+ // Constructor for the PSF PDF.
+ //
+ // The parameters in params are the bin contents of all but the
+ // normalisation bin, so has N_bins-1 entries.
+ // The last argument specifies the limits of the bins and the range
+ // as a whole, so has N_bins+1 entries.
+
+ if ( this->nParameters() != this->nBins() - 1 ) {
+ cerr << "ERROR in LauParametricStepFuncPdf constructor: LauParametricStepFuncPdf requires N-1 parameters, where N is the number of bins."
+ << endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // Cache the normalisation factor
+ this->calcNorm();
}
-LauParametricStepFuncPdf::~LauParametricStepFuncPdf()
+LauParametricStepFuncPdf::~LauParametricStepFuncPdf()
{
- // Destructor
+ // Destructor
}
-void LauParametricStepFuncPdf::calcLikelihoodInfo(const LauAbscissas& abscissas)
+void LauParametricStepFuncPdf::calcLikelihoodInfo( const LauAbscissas& abscissas )
{
- // Check that the given abscissa is within the allowed range
- if (!this->checkRange(abscissas)) {
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // Get our abscissa
- Double_t abscissa = abscissas[0];
-
- // Get the parameters
- const std::vector<LauAbsRValue*>& pars = this->getParameters();
-
- // Calculate value
- Double_t value(0.0);
- const UInt_t numBins = this->nBins();
-
- if ( this->normBin() == Last ) {
- // the last bin is our normalisation bin
- for ( UInt_t i(1); i<=numBins; ++i ) {
- if ( abscissa < limits_[i] ) {
- // in bin i-1 (starting with bin 0)
- if ( i < numBins ) {
- // not in last bin
- value = pars[i-1]->unblindValue();
- break;
- } else {
- // in last bin
- Double_t sum(0.0);
- Double_t binSize(0.0);
- for ( UInt_t j(1); j<numBins; ++j ) {
- binSize = limits_[j] - limits_[j-1];
- sum += ( pars[j-1]->unblindValue() * binSize );
- }
- binSize = limits_[numBins] - limits_[numBins-1];
- value = ( 1.0 - sum ) / binSize;
- break;
- }
- }
- }
- } else {
- // the first bin is our normalisation bin
- for ( UInt_t i(1); i<=numBins; ++i ) {
- if ( abscissa < limits_[i] ) {
- // in bin i-1 (starting with bin 0)
- if ( i > 1 ) {
- // not in first bin
- value = pars[i-2]->unblindValue();
- break;
- } else {
- // in first bin
- Double_t sum(0.0);
- Double_t binSize(0.0);
- for ( UInt_t j(2); j<=numBins; ++j ) {
- binSize = limits_[j] - limits_[j-1];
- sum += ( pars[j-2]->unblindValue() * binSize );
- }
- binSize = limits_[1] - limits_[0];
- value = ( 1.0 - sum ) / binSize;
- break;
- }
- }
- }
- }
-
- this->setUnNormPDFVal(value);
-
- // if the parameters are floating then we
- // need to recalculate the normalisation
- if (!this->cachePDF() && !this->withinNormCalc() && !this->withinGeneration()) {
- this->calcNorm();
- }
+ // Check that the given abscissa is within the allowed range
+ if ( ! this->checkRange( abscissas ) ) {
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // Get our abscissa
+ Double_t abscissa = abscissas[0];
+
+ // Get the parameters
+ const std::vector<LauAbsRValue*>& pars = this->getParameters();
+
+ // Calculate value
+ Double_t value( 0.0 );
+ const UInt_t numBins = this->nBins();
+
+ if ( this->normBin() == Last ) {
+ // the last bin is our normalisation bin
+ for ( UInt_t i( 1 ); i <= numBins; ++i ) {
+ if ( abscissa < limits_[i] ) {
+ // in bin i-1 (starting with bin 0)
+ if ( i < numBins ) {
+ // not in last bin
+ value = pars[i - 1]->unblindValue();
+ break;
+ } else {
+ // in last bin
+ Double_t sum( 0.0 );
+ Double_t binSize( 0.0 );
+ for ( UInt_t j( 1 ); j < numBins; ++j ) {
+ binSize = limits_[j] - limits_[j - 1];
+ sum += ( pars[j - 1]->unblindValue() * binSize );
+ }
+ binSize = limits_[numBins] - limits_[numBins - 1];
+ value = ( 1.0 - sum ) / binSize;
+ break;
+ }
+ }
+ }
+ } else {
+ // the first bin is our normalisation bin
+ for ( UInt_t i( 1 ); i <= numBins; ++i ) {
+ if ( abscissa < limits_[i] ) {
+ // in bin i-1 (starting with bin 0)
+ if ( i > 1 ) {
+ // not in first bin
+ value = pars[i - 2]->unblindValue();
+ break;
+ } else {
+ // in first bin
+ Double_t sum( 0.0 );
+ Double_t binSize( 0.0 );
+ for ( UInt_t j( 2 ); j <= numBins; ++j ) {
+ binSize = limits_[j] - limits_[j - 1];
+ sum += ( pars[j - 2]->unblindValue() * binSize );
+ }
+ binSize = limits_[1] - limits_[0];
+ value = ( 1.0 - sum ) / binSize;
+ break;
+ }
+ }
+ }
+ }
+
+ this->setUnNormPDFVal( value );
+
+ // if the parameters are floating then we
+ // need to recalculate the normalisation
+ if ( ! this->cachePDF() && ! this->withinNormCalc() && ! this->withinGeneration() ) {
+ this->calcNorm();
+ }
}
-void LauParametricStepFuncPdf::calcNorm()
+void LauParametricStepFuncPdf::calcNorm()
{
- this->setNorm(1.0);
+ this->setNorm( 1.0 );
}
void LauParametricStepFuncPdf::calcPDFHeight( const LauKinematics* /*kinematics*/ )
{
- if (this->heightUpToDate()) {
- return;
- }
-
- // Get the parameters
- const std::vector<LauAbsRValue*>& pars = this->getParameters();
-
- // Find the PDF height
- Double_t height(0.0);
- Double_t value(0.0);
- const UInt_t numBins = this->nBins();
-
- if ( this->normBin() == Last ) {
- // the last bin is our normalisation bin
-
- // Check through all the parameterised bins
- for ( UInt_t i(0); i<numBins-1; ++i ) {
- value = pars[i]->unblindValue();
- if ( height < value ) {
- height = value;
- }
- }
-
- // Check the last bin
- Double_t sum(0.0);
- Double_t binSize(0.0);
- for ( UInt_t j(1); j<numBins; ++j ) {
- binSize = limits_[j] - limits_[j-1];
- sum += ( pars[j-1]->unblindValue() * binSize );
- }
- binSize = limits_[numBins] - limits_[numBins-1];
- value = ( 1.0 - sum ) / binSize;
- if ( height < value ) {
- height = value;
- }
- } else {
- // the first bin is our normalisation bin
-
- // Check through all the parameterised bins
- for ( UInt_t i(1); i<numBins; ++i ) {
- value = pars[i-1]->unblindValue();
- if ( height < value ) {
- height = value;
- }
- }
-
- // Check the first bin
- Double_t sum(0.0);
- Double_t binSize(0.0);
- for ( UInt_t j(2); j<=numBins; ++j ) {
- binSize = limits_[j] - limits_[j-1];
- sum += ( pars[j-2]->unblindValue() * binSize );
- }
- binSize = limits_[1] - limits_[0];
- value = ( 1.0 - sum ) / binSize;
- if ( height < value ) {
- height = value;
- }
- }
-
- this->setMaxHeight(height);
+ if ( this->heightUpToDate() ) {
+ return;
+ }
+
+ // Get the parameters
+ const std::vector<LauAbsRValue*>& pars = this->getParameters();
+
+ // Find the PDF height
+ Double_t height( 0.0 );
+ Double_t value( 0.0 );
+ const UInt_t numBins = this->nBins();
+
+ if ( this->normBin() == Last ) {
+ // the last bin is our normalisation bin
+
+ // Check through all the parameterised bins
+ for ( UInt_t i( 0 ); i < numBins - 1; ++i ) {
+ value = pars[i]->unblindValue();
+ if ( height < value ) {
+ height = value;
+ }
+ }
+
+ // Check the last bin
+ Double_t sum( 0.0 );
+ Double_t binSize( 0.0 );
+ for ( UInt_t j( 1 ); j < numBins; ++j ) {
+ binSize = limits_[j] - limits_[j - 1];
+ sum += ( pars[j - 1]->unblindValue() * binSize );
+ }
+ binSize = limits_[numBins] - limits_[numBins - 1];
+ value = ( 1.0 - sum ) / binSize;
+ if ( height < value ) {
+ height = value;
+ }
+ } else {
+ // the first bin is our normalisation bin
+
+ // Check through all the parameterised bins
+ for ( UInt_t i( 1 ); i < numBins; ++i ) {
+ value = pars[i - 1]->unblindValue();
+ if ( height < value ) {
+ height = value;
+ }
+ }
+
+ // Check the first bin
+ Double_t sum( 0.0 );
+ Double_t binSize( 0.0 );
+ for ( UInt_t j( 2 ); j <= numBins; ++j ) {
+ binSize = limits_[j] - limits_[j - 1];
+ sum += ( pars[j - 2]->unblindValue() * binSize );
+ }
+ binSize = limits_[1] - limits_[0];
+ value = ( 1.0 - sum ) / binSize;
+ if ( height < value ) {
+ height = value;
+ }
+ }
+
+ this->setMaxHeight( height );
}
-
diff --git a/src/LauParticlePDG.cc b/src/LauParticlePDG.cc
index 18d22f2..488e00d 100644
--- a/src/LauParticlePDG.cc
+++ b/src/LauParticlePDG.cc
@@ -1,148 +1,146 @@
/*
Copyright 2008 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauParticlePDG.cc
\brief File containing implementation of LauParticlePDG class.
*/
#include <iostream>
using std::cerr;
using std::endl;
-#include "TMath.h"
-#include "TParticlePDG.h"
-
#include "LauConstants.hh"
#include "LauDatabasePDG.hh"
#include "LauParticlePDG.hh"
+#include "TMath.h"
+#include "TParticlePDG.h"
-
-LauParticlePDG::LauParticlePDG(const TParticlePDG* particle) :
- theParticle_(particle),
- antiParticle_(0),
- mass_(0.0),
- kaon_(kFALSE),
- pion_(kFALSE),
- ks_(kFALSE),
- pi0_(kFALSE),
- D_(kFALSE),
- B_(kFALSE)
+LauParticlePDG::LauParticlePDG( const TParticlePDG* particle ) :
+ theParticle_( particle ),
+ antiParticle_( 0 ),
+ mass_( 0.0 ),
+ kaon_( kFALSE ),
+ pion_( kFALSE ),
+ ks_( kFALSE ),
+ pi0_( kFALSE ),
+ D_( kFALSE ),
+ B_( kFALSE )
{
- // store the mass and kaon? and pion?
- if ( TMath::Abs(this->code()) == 211 ) { // charged pion
- mass_ = LauConstants::mPi;
- pion_ = kTRUE;
- } else if ( this->code() == 111 ) { // neutral pion
- mass_ = LauConstants::mPi0;
- pion_ = kTRUE;
- pi0_ = kTRUE;
- } else if ( TMath::Abs(this->code()) == 321 ) { // charged kaon
- mass_ = LauConstants::mK;
- kaon_ = kTRUE;
- } else if ( this->code() == 130 || this->code() == 310 || TMath::Abs(this->code()) == 311 ) { // neutral kaon
- mass_ = LauConstants::mK0;
- kaon_ = kTRUE;
- if ( this->code() == 310 ) {
- ks_ = kTRUE;
- }
- } else if ( this->code() == 221 ) { // eta
- mass_ = LauConstants::mEta;
- } else if ( this->code() == 331 ) { // eta'
- mass_ = LauConstants::mEtaPrime;
- } else if ( TMath::Abs(this->code()) == 411 ) { // charged D
- mass_ = LauConstants::mD;
- D_ = kTRUE;
- } else if ( TMath::Abs(this->code()) == 421 ) { // neutral D
- mass_ = LauConstants::mD0;
- D_ = kTRUE;
- } else if ( TMath::Abs(this->code()) == 431) { // charged D_s
- mass_ = LauConstants::mDs;
- D_ = kTRUE;
- } else if ( TMath::Abs(this->code()) == 511 ) { // neutral B
- mass_ = LauConstants::mB0;
- B_ = kTRUE;
- } else if ( TMath::Abs(this->code()) == 521 ) { // charged B
- mass_ = LauConstants::mB;
- B_ = kTRUE;
- } else if ( TMath::Abs(this->code()) == 531 ) { // neutral B_s
- mass_ = LauConstants::mBs0;
- B_ = kTRUE;
- }
+ // store the mass and kaon? and pion?
+ if ( TMath::Abs( this->code() ) == 211 ) { // charged pion
+ mass_ = LauConstants::mPi;
+ pion_ = kTRUE;
+ } else if ( this->code() == 111 ) { // neutral pion
+ mass_ = LauConstants::mPi0;
+ pion_ = kTRUE;
+ pi0_ = kTRUE;
+ } else if ( TMath::Abs( this->code() ) == 321 ) { // charged kaon
+ mass_ = LauConstants::mK;
+ kaon_ = kTRUE;
+ } else if ( this->code() == 130 || this->code() == 310 ||
+ TMath::Abs( this->code() ) == 311 ) { // neutral kaon
+ mass_ = LauConstants::mK0;
+ kaon_ = kTRUE;
+ if ( this->code() == 310 ) {
+ ks_ = kTRUE;
+ }
+ } else if ( this->code() == 221 ) { // eta
+ mass_ = LauConstants::mEta;
+ } else if ( this->code() == 331 ) { // eta'
+ mass_ = LauConstants::mEtaPrime;
+ } else if ( TMath::Abs( this->code() ) == 411 ) { // charged D
+ mass_ = LauConstants::mD;
+ D_ = kTRUE;
+ } else if ( TMath::Abs( this->code() ) == 421 ) { // neutral D
+ mass_ = LauConstants::mD0;
+ D_ = kTRUE;
+ } else if ( TMath::Abs( this->code() ) == 431 ) { // charged D_s
+ mass_ = LauConstants::mDs;
+ D_ = kTRUE;
+ } else if ( TMath::Abs( this->code() ) == 511 ) { // neutral B
+ mass_ = LauConstants::mB0;
+ B_ = kTRUE;
+ } else if ( TMath::Abs( this->code() ) == 521 ) { // charged B
+ mass_ = LauConstants::mB;
+ B_ = kTRUE;
+ } else if ( TMath::Abs( this->code() ) == 531 ) { // neutral B_s
+ mass_ = LauConstants::mBs0;
+ B_ = kTRUE;
+ }
}
LauParticlePDG::~LauParticlePDG()
{
}
Int_t LauParticlePDG::code() const
{
- if (theParticle_ == 0) {
- cerr<<"ERROR in LauParticlePDG::code : Null pointer."<<endl;
- return -999;
- }
- return theParticle_->PdgCode();
+ if ( theParticle_ == 0 ) {
+ cerr << "ERROR in LauParticlePDG::code : Null pointer." << endl;
+ return -999;
+ }
+ return theParticle_->PdgCode();
}
Int_t LauParticlePDG::conjugateCode() const
{
- if (antiParticle_ == 0) {
- cerr<<"ERROR in LauParticlePDG::conjugateCode : Null pointer."<<endl;
- return -999;
- }
- return antiParticle_->code();
+ if ( antiParticle_ == 0 ) {
+ cerr << "ERROR in LauParticlePDG::conjugateCode : Null pointer." << endl;
+ return -999;
+ }
+ return antiParticle_->code();
}
Int_t LauParticlePDG::charge() const
{
- if (theParticle_ == 0) {
- cerr<<"ERROR in LauParticlePDG::charge : Null pointer."<<endl;
- return -999;
- }
- Double_t chargeTimesThree = theParticle_->Charge();
- Int_t theCharge = static_cast<Int_t>(chargeTimesThree/3.0);
- return theCharge;
+ if ( theParticle_ == 0 ) {
+ cerr << "ERROR in LauParticlePDG::charge : Null pointer." << endl;
+ return -999;
+ }
+ Double_t chargeTimesThree = theParticle_->Charge();
+ Int_t theCharge = static_cast<Int_t>( chargeTimesThree / 3.0 );
+ return theCharge;
}
TString LauParticlePDG::string() const
{
- if (theParticle_ == 0) {
- cerr<<"ERROR in LauParticlePDG::string : Null pointer."<<endl;
- return "";
- }
- return theParticle_->GetName();
+ if ( theParticle_ == 0 ) {
+ cerr << "ERROR in LauParticlePDG::string : Null pointer." << endl;
+ return "";
+ }
+ return theParticle_->GetName();
}
TString LauParticlePDG::stringAlphaNum() const
{
- TString name = this->string();
- name.ReplaceAll("*","st");
- name.ReplaceAll("_","");
- name.ReplaceAll("(","");
- name.ReplaceAll(")","");
- name.ReplaceAll("+","p");
- name.ReplaceAll("-","m");
- return name;
+ TString name = this->string();
+ name.ReplaceAll( "*", "st" );
+ name.ReplaceAll( "_", "" );
+ name.ReplaceAll( "(", "" );
+ name.ReplaceAll( ")", "" );
+ name.ReplaceAll( "+", "p" );
+ name.ReplaceAll( "-", "m" );
+ return name;
}
-
diff --git a/src/LauPolNR.cc b/src/LauPolNR.cc
index ea4453a..26f3212 100644
--- a/src/LauPolNR.cc
+++ b/src/LauPolNR.cc
@@ -1,95 +1,95 @@
/*
Copyright 2014 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauPolNR.cc
\brief File containing implementation of LauPolNR class.
*/
-#include <iostream>
-
-#include "TMath.h"
-
#include "LauPolNR.hh"
+
#include "LauDaughters.hh"
+#include "TMath.h"
+#include <iostream>
-LauPolNR::LauPolNR(LauResonanceInfo* resInfo, const Int_t resPairAmpInt, const LauDaughters* daughters) :
- LauAbsResonance(resInfo, resPairAmpInt, daughters),
- omega_(0.0),
- order_(0)
+LauPolNR::LauPolNR( LauResonanceInfo* resInfo,
+ const Int_t resPairAmpInt,
+ const LauDaughters* daughters ) :
+ LauAbsResonance( resInfo, resPairAmpInt, daughters ),
+ omega_( 0.0 ),
+ order_( 0 )
{
}
LauPolNR::~LauPolNR()
{
}
void LauPolNR::initialise()
{
- const LauDaughters* daughters = this->getDaughters();
- Int_t resPairAmpInt = this->getPairInt();
- if ( daughters->gotSymmetricalDP() && resPairAmpInt != 3 ) {
- std::cerr << "WARNING in LauPolNR::initialise : Dalitz plot is symmetric - this lineshape is not appropriate." << std::endl;
- }
-
- // Make the spin term purely the Legendre polynomial of the cos(helicity angle)
- this->setSpinType( LauAbsResonance::Legendre );
-
- Double_t omega = 0.5*(daughters->getMassParent()+(1.0/3.0)*(daughters->getMassDaug1()+daughters->getMassDaug2()+daughters->getMassDaug3()));
- this->setOmega( omega );
-
- TString name = this->getResonanceName();
- if (name.EndsWith("0",TString::kExact)){
- order_ = 0;
- }
- else if (name.EndsWith("1",TString::kExact)){
- order_ = 1;
- }
- else if (name.EndsWith("2",TString::kExact)){
- order_ = 2;
- }
- else if (name.EndsWith("3",TString::kExact)){
- order_ = 3;
- }
- else{
- std::cerr << "ERROR in LauPolNR::initialise : Resonance order unknown (known orders : 0, 1, 2 and 3)" << std::endl;
- std::cerr << " : Defaulting to 0." << std::endl;
- }
+ const LauDaughters* daughters = this->getDaughters();
+ Int_t resPairAmpInt = this->getPairInt();
+ if ( daughters->gotSymmetricalDP() && resPairAmpInt != 3 ) {
+ std::cerr << "WARNING in LauPolNR::initialise : Dalitz plot is symmetric - this lineshape is not appropriate."
+ << std::endl;
+ }
+
+ // Make the spin term purely the Legendre polynomial of the cos(helicity angle)
+ this->setSpinType( LauAbsResonance::Legendre );
+
+ Double_t omega = 0.5 * ( daughters->getMassParent() +
+ ( 1.0 / 3.0 ) * ( daughters->getMassDaug1() + daughters->getMassDaug2() +
+ daughters->getMassDaug3() ) );
+ this->setOmega( omega );
+
+ TString name = this->getResonanceName();
+ if ( name.EndsWith( "0", TString::kExact ) ) {
+ order_ = 0;
+ } else if ( name.EndsWith( "1", TString::kExact ) ) {
+ order_ = 1;
+ } else if ( name.EndsWith( "2", TString::kExact ) ) {
+ order_ = 2;
+ } else if ( name.EndsWith( "3", TString::kExact ) ) {
+ order_ = 3;
+ } else {
+ std::cerr << "ERROR in LauPolNR::initialise : Resonance order unknown (known orders : 0, 1, 2 and 3)"
+ << std::endl;
+ std::cerr << " : Defaulting to 0." << std::endl;
+ }
}
-LauComplex LauPolNR::resAmp(Double_t mass, Double_t spinTerm)
+LauComplex LauPolNR::resAmp( Double_t mass, Double_t spinTerm )
{
- Double_t magnitude( spinTerm );
+ Double_t magnitude( spinTerm );
- Double_t massDiff = mass - omega_;
- for ( UInt_t i(0); i < order_; ++i ) {
- magnitude *= massDiff;
- }
+ Double_t massDiff = mass - omega_;
+ for ( UInt_t i( 0 ); i < order_; ++i ) {
+ magnitude *= massDiff;
+ }
- LauComplex resAmplitude(magnitude, 0.0);
+ LauComplex resAmplitude( magnitude, 0.0 );
- return resAmplitude;
+ return resAmplitude;
}
-
diff --git a/src/LauPolarFormFactorNR.cc b/src/LauPolarFormFactorNR.cc
index 932209f..2f088e7 100644
--- a/src/LauPolarFormFactorNR.cc
+++ b/src/LauPolarFormFactorNR.cc
@@ -1,147 +1,148 @@
/*
Copyright 2018 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauPolarFormFactorNR.cc
\brief File containing implementation of LauPolarFormFactorNR class.
*/
-#include <iostream>
-
-#include "TMath.h"
+#include "LauPolarFormFactorNR.hh"
#include "LauConstants.hh"
-#include "LauPolarFormFactorNR.hh"
#include "LauDaughters.hh"
#include "LauParameter.hh"
#include "LauResonanceInfo.hh"
+#include "TMath.h"
+#include <iostream>
-LauPolarFormFactorNR::LauPolarFormFactorNR(LauResonanceInfo* resInfo, const LauAbsResonance::LauResonanceModel resType, const Int_t resPairAmpInt, const LauDaughters* daughters) :
- LauAbsResonance(resInfo, resPairAmpInt, daughters),
- lambda_(0),
- model_(resType)
+LauPolarFormFactorNR::LauPolarFormFactorNR( LauResonanceInfo* resInfo,
+ const LauAbsResonance::LauResonanceModel resType,
+ const Int_t resPairAmpInt,
+ const LauDaughters* daughters ) :
+ LauAbsResonance( resInfo, resPairAmpInt, daughters ),
+ lambda_( 0 ),
+ model_( resType )
{
- TString parName = this->getSanitisedName();
- parName += "_lambda";
- lambda_ = resInfo->getExtraParameter( parName );
- if ( lambda_ == 0 ) {
- lambda_ = new LauParameter( parName, 1.0, 0.0, 10.0, kTRUE );
- lambda_->secondStage(kTRUE);
- resInfo->addExtraParameter( lambda_ );
- }
+ TString parName = this->getSanitisedName();
+ parName += "_lambda";
+ lambda_ = resInfo->getExtraParameter( parName );
+ if ( lambda_ == 0 ) {
+ lambda_ = new LauParameter( parName, 1.0, 0.0, 10.0, kTRUE );
+ lambda_->secondStage( kTRUE );
+ resInfo->addExtraParameter( lambda_ );
+ }
}
LauPolarFormFactorNR::~LauPolarFormFactorNR()
{
-
}
void LauPolarFormFactorNR::initialise()
{
- const LauDaughters* daughters = this->getDaughters();
- Int_t resPairAmpInt = this->getPairInt();
- if ( daughters->gotSymmetricalDP() && resPairAmpInt != 3 ) {
- std::cerr << "WARNING in LauPolarFormFactorNR::initialise : Dalitz plot is symmetric - this lineshape is not appropriate." << std::endl;
- }
-
- if ( model_ != LauAbsResonance::PolarFFNR) {
- std::cerr << "WARNING in LauPolarFormFactorNR::initialise : Unknown model requested, defaulting to Polar Form Factor." << std::endl;
- model_ = LauAbsResonance::PolarFFNR;
- }
-
+ const LauDaughters* daughters = this->getDaughters();
+ Int_t resPairAmpInt = this->getPairInt();
+ if ( daughters->gotSymmetricalDP() && resPairAmpInt != 3 ) {
+ std::cerr << "WARNING in LauPolarFormFactorNR::initialise : Dalitz plot is symmetric - this lineshape is not appropriate."
+ << std::endl;
+ }
+
+ if ( model_ != LauAbsResonance::PolarFFNR ) {
+ std::cerr << "WARNING in LauPolarFormFactorNR::initialise : Unknown model requested, defaulting to Polar Form Factor."
+ << std::endl;
+ model_ = LauAbsResonance::PolarFFNR;
+ }
}
-LauComplex LauPolarFormFactorNR::resAmp(Double_t mass, Double_t)
+LauComplex LauPolarFormFactorNR::resAmp( Double_t mass, Double_t )
{
- Double_t magnitude(1.0);
+ Double_t magnitude( 1.0 );
- Double_t lambda = this->getLambda();
+ Double_t lambda = this->getLambda();
- magnitude = 1.0/(1.0 + mass*mass /(lambda*lambda));
+ magnitude = 1.0 / ( 1.0 + mass * mass / ( lambda * lambda ) );
- LauComplex resAmplitude(magnitude, 0.0);
+ LauComplex resAmplitude( magnitude, 0.0 );
- return resAmplitude;
+ return resAmplitude;
}
-
const std::vector<LauParameter*>& LauPolarFormFactorNR::getFloatingParameters()
{
- this->clearFloatingParameters();
+ this->clearFloatingParameters();
- if ( ! this->fixLambda() ) {
- this->addFloatingParameter( lambda_ );
- }
+ if ( ! this->fixLambda() ) {
+ this->addFloatingParameter( lambda_ );
+ }
- return this->getParameters();
+ return this->getParameters();
}
-void LauPolarFormFactorNR::setResonanceParameter(const TString& name, const Double_t value)
+void LauPolarFormFactorNR::setResonanceParameter( const TString& name, const Double_t value )
{
- // Set various parameters for the lineshape
- if (name == "lambda") {
- this->setLambda(value);
- std::cout << "INFO in LauPolarFormFactorNR::setResonanceParameter : Setting parameter lambda = " << this->getLambda() << std::endl;
- }
- else {
- std::cerr << "WARNING in LauPolarFormFactorNR::setResonanceParameter: Parameter name not reconised. No parameter changes made." << std::endl;
- }
+ // Set various parameters for the lineshape
+ if ( name == "lambda" ) {
+ this->setLambda( value );
+ std::cout << "INFO in LauPolarFormFactorNR::setResonanceParameter : Setting parameter lambda = "
+ << this->getLambda() << std::endl;
+ } else {
+ std::cerr << "WARNING in LauPolarFormFactorNR::setResonanceParameter: Parameter name not reconised. No parameter changes made."
+ << std::endl;
+ }
}
-void LauPolarFormFactorNR::floatResonanceParameter(const TString& name)
+void LauPolarFormFactorNR::floatResonanceParameter( const TString& name )
{
- if (name == "lambda") {
- if ( lambda_->fixed() ) {
- lambda_->fixed( kFALSE );
- this->addFloatingParameter( lambda_ );
- } else {
- std::cerr << "WARNING in LauPolarFormFactorNR::floatResonanceParameter: Parameter already floating. No parameter changes made." << std::endl;
- }
- }
- else {
- std::cerr << "WARNING in LauPolarFormFactorNR::fixResonanceParameter: Parameter name not reconised. No parameter changes made." << std::endl;
- }
+ if ( name == "lambda" ) {
+ if ( lambda_->fixed() ) {
+ lambda_->fixed( kFALSE );
+ this->addFloatingParameter( lambda_ );
+ } else {
+ std::cerr << "WARNING in LauPolarFormFactorNR::floatResonanceParameter: Parameter already floating. No parameter changes made."
+ << std::endl;
+ }
+ } else {
+ std::cerr << "WARNING in LauPolarFormFactorNR::fixResonanceParameter: Parameter name not reconised. No parameter changes made."
+ << std::endl;
+ }
}
-LauParameter* LauPolarFormFactorNR::getResonanceParameter(const TString& name)
+LauParameter* LauPolarFormFactorNR::getResonanceParameter( const TString& name )
{
- if (name == "lambda") {
- return lambda_;
- }
- else {
- std::cerr << "WARNING in LauPolarFormFactorNR::getResonanceParameter: Parameter name not reconised." << std::endl;
- return 0;
- }
+ if ( name == "lambda" ) {
+ return lambda_;
+ } else {
+ std::cerr << "WARNING in LauPolarFormFactorNR::getResonanceParameter: Parameter name not reconised."
+ << std::endl;
+ return 0;
+ }
}
-void LauPolarFormFactorNR::setLambda(const Double_t lambda)
+void LauPolarFormFactorNR::setLambda( const Double_t lambda )
{
- lambda_->value( lambda );
- lambda_->genValue( lambda );
- lambda_->initValue( lambda );
+ lambda_->value( lambda );
+ lambda_->genValue( lambda );
+ lambda_->initValue( lambda );
}
-
-
diff --git a/src/LauPolarFormFactorSymNR.cc b/src/LauPolarFormFactorSymNR.cc
index 0e4dc6e..27dafef 100644
--- a/src/LauPolarFormFactorSymNR.cc
+++ b/src/LauPolarFormFactorSymNR.cc
@@ -1,184 +1,192 @@
/*
Copyright 2018 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauPolarFormFactorSymNR.cc
\brief File containing implementation of LauPolarFormFactorSymNR class.
*/
-#include <iostream>
-
-#include "TMath.h"
+#include "LauPolarFormFactorSymNR.hh"
#include "LauConstants.hh"
-#include "LauPolarFormFactorSymNR.hh"
#include "LauDaughters.hh"
#include "LauParameter.hh"
#include "LauResonanceInfo.hh"
+#include "TMath.h"
+#include <iostream>
-LauPolarFormFactorSymNR::LauPolarFormFactorSymNR(LauResonanceInfo* resInfo, const LauAbsResonance::LauResonanceModel resType, const Int_t resPairAmpInt, const LauDaughters* daughters) :
- LauAbsResonance(resInfo, resPairAmpInt, daughters),
- lambda_(0),
- model_(resType)
+LauPolarFormFactorSymNR::LauPolarFormFactorSymNR( LauResonanceInfo* resInfo,
+ const LauAbsResonance::LauResonanceModel resType,
+ const Int_t resPairAmpInt,
+ const LauDaughters* daughters ) :
+ LauAbsResonance( resInfo, resPairAmpInt, daughters ),
+ lambda_( 0 ),
+ model_( resType )
{
- TString parName = this->getSanitisedName();
- parName += "_lambda";
- lambda_ = resInfo->getExtraParameter( parName );
- if ( lambda_ == 0 ) {
- lambda_ = new LauParameter( parName, 1.0, 0.0, 10.0, kTRUE );
- lambda_->secondStage(kTRUE);
- resInfo->addExtraParameter( lambda_ );
- }
+ TString parName = this->getSanitisedName();
+ parName += "_lambda";
+ lambda_ = resInfo->getExtraParameter( parName );
+ if ( lambda_ == 0 ) {
+ lambda_ = new LauParameter( parName, 1.0, 0.0, 10.0, kTRUE );
+ lambda_->secondStage( kTRUE );
+ resInfo->addExtraParameter( lambda_ );
+ }
}
LauPolarFormFactorSymNR::~LauPolarFormFactorSymNR()
{
}
void LauPolarFormFactorSymNR::initialise()
{
- const LauDaughters* daughters = this->getDaughters();
- if ( ! daughters->gotSymmetricalDP() ) {
- std::cerr << "WARNING in LauPolarFormFactorSymNR::initialise : Dalitz plot is symmetric - this lineshape is not appropriate." << std::endl;
- }
-
- Int_t resPairAmpInt = this->getPairInt();
- if ( resPairAmpInt == 3 ) {
- std::cerr << "WARNING in LauPolarFormFactorSymNR::initialise : This lineshape is intended to be on the symmetrised axes of the DP." << std::endl;
- }
-
- if ( (model_ != LauAbsResonance::PolarFFSymNR) && (model_ != LauAbsResonance::PolarFFSymNRNoInter)) {
- std::cerr << "WARNING in LauPolarFormFactorSymNR::initialise : Unknown model requested, defaulting to Polar Form Factor." << std::endl;
- model_ = LauAbsResonance::PolarFFSymNR;
- }
-
- if ( (model_ != LauAbsResonance::PolarFFSymNR) && (this->getSpin() != 0) ) {
- std::cerr << "WARNING in LauPolarFormFactorSymNR::initialise : Non-zero spin will be ignored for this model - perhaps you should use LauAbsResonance::PolarFFSymNRNoInter instead" << std::endl;
- }
-
- // NB we do not need to call setSpinType(LauAbsResonance::Legendre) here (as is done in LauPolarFormFactorNR) since override the amplitude method and explicitly use calcLegendrePoly
+ const LauDaughters* daughters = this->getDaughters();
+ if ( ! daughters->gotSymmetricalDP() ) {
+ std::cerr << "WARNING in LauPolarFormFactorSymNR::initialise : Dalitz plot is symmetric - this lineshape is not appropriate."
+ << std::endl;
+ }
+
+ Int_t resPairAmpInt = this->getPairInt();
+ if ( resPairAmpInt == 3 ) {
+ std::cerr << "WARNING in LauPolarFormFactorSymNR::initialise : This lineshape is intended to be on the symmetrised axes of the DP."
+ << std::endl;
+ }
+
+ if ( ( model_ != LauAbsResonance::PolarFFSymNR ) &&
+ ( model_ != LauAbsResonance::PolarFFSymNRNoInter ) ) {
+ std::cerr << "WARNING in LauPolarFormFactorSymNR::initialise : Unknown model requested, defaulting to Polar Form Factor."
+ << std::endl;
+ model_ = LauAbsResonance::PolarFFSymNR;
+ }
+
+ if ( ( model_ != LauAbsResonance::PolarFFSymNR ) && ( this->getSpin() != 0 ) ) {
+ std::cerr << "WARNING in LauPolarFormFactorSymNR::initialise : Non-zero spin will be ignored for this model - perhaps you should use LauAbsResonance::PolarFFSymNRNoInter instead"
+ << std::endl;
+ }
+
+ // NB we do not need to call setSpinType(LauAbsResonance::Legendre) here (as is done in LauPolarFormFactorNR) since override the amplitude method and explicitly use calcLegendrePoly
}
-
-LauComplex LauPolarFormFactorSymNR::resAmp(Double_t mass, Double_t spinTerm)
+LauComplex LauPolarFormFactorSymNR::resAmp( Double_t mass, Double_t spinTerm )
{
- std::cerr << "ERROR in LauPolarFormFactorSymNR : This method should never be called." << std::endl;
- std::cerr << " : Returning zero amplitude for mass = " << mass << " and spinTerm = " << spinTerm << "." << std::endl;
- return LauComplex(0.0, 0.0);
+ std::cerr << "ERROR in LauPolarFormFactorSymNR : This method should never be called."
+ << std::endl;
+ std::cerr << " : Returning zero amplitude for mass = " << mass
+ << " and spinTerm = " << spinTerm << "." << std::endl;
+ return LauComplex( 0.0, 0.0 );
}
-LauComplex LauPolarFormFactorSymNR::amplitude(const LauKinematics* kinematics)
+LauComplex LauPolarFormFactorSymNR::amplitude( const LauKinematics* kinematics )
{
- // This function returns the complex dynamical amplitude for a Polar Form Factor Non-Resonant distribution
-
- // Calculate for symmetric DPs, e.g. 3pi or 3K, by using shapeNo = 1 or 2
- // Have s<->t symmetry already done in Dynamics flip function.
- // For Kpipi or similar plots, one can use the separate terms
- // and consider them as two separate components with their own mag and phase.
- // For this shapeNo = 3 and shapeNo = 4 need to be used to create the two
- // individual amplitudes (with the same value of lambda).
+ // This function returns the complex dynamical amplitude for a Polar Form Factor Non-Resonant distribution
- // Calculate Mandelstam variables.
- // s = m_13^2, t = m_23^2
- const Double_t s = kinematics->getm13Sq();
- const Double_t t = kinematics->getm23Sq();
+ // Calculate for symmetric DPs, e.g. 3pi or 3K, by using shapeNo = 1 or 2
+ // Have s<->t symmetry already done in Dynamics flip function.
+ // For Kpipi or similar plots, one can use the separate terms
+ // and consider them as two separate components with their own mag and phase.
+ // For this shapeNo = 3 and shapeNo = 4 need to be used to create the two
+ // individual amplitudes (with the same value of lambda).
- Double_t magnitude(1.0);
+ // Calculate Mandelstam variables.
+ // s = m_13^2, t = m_23^2
+ const Double_t s = kinematics->getm13Sq();
+ const Double_t t = kinematics->getm23Sq();
- const Double_t lambda = this->getLambda();
+ Double_t magnitude( 1.0 );
- if ( model_ == LauAbsResonance::PolarFFSymNR ) {
+ const Double_t lambda = this->getLambda();
- magnitude = 1.0/(1.0 + s /(lambda*lambda)) + 1.0/(1.0 + t /(lambda*lambda));
+ if ( model_ == LauAbsResonance::PolarFFSymNR ) {
- } else if ( model_ == LauAbsResonance::PolarFFSymNRNoInter ) {
+ magnitude = 1.0 / ( 1.0 + s / ( lambda * lambda ) ) + 1.0 / ( 1.0 + t / ( lambda * lambda ) );
- magnitude = (s <= t) ? 1.0/(1.0 + s /(lambda*lambda)) : 1.0/(1.0 + t /(lambda*lambda));
- }
+ } else if ( model_ == LauAbsResonance::PolarFFSymNRNoInter ) {
- LauComplex resAmplitude(magnitude, 0.0);
+ magnitude = ( s <= t ) ? 1.0 / ( 1.0 + s / ( lambda * lambda ) )
+ : 1.0 / ( 1.0 + t / ( lambda * lambda ) );
+ }
- return resAmplitude;
+ LauComplex resAmplitude( magnitude, 0.0 );
+ return resAmplitude;
}
const std::vector<LauParameter*>& LauPolarFormFactorSymNR::getFloatingParameters()
{
- this->clearFloatingParameters();
+ this->clearFloatingParameters();
- if ( ! this->fixLambda() ) {
- this->addFloatingParameter( lambda_ );
- }
+ if ( ! this->fixLambda() ) {
+ this->addFloatingParameter( lambda_ );
+ }
- return this->getParameters();
+ return this->getParameters();
}
-void LauPolarFormFactorSymNR::setResonanceParameter(const TString& name, const Double_t value)
+void LauPolarFormFactorSymNR::setResonanceParameter( const TString& name, const Double_t value )
{
- // Set various parameters for the lineshape
- if (name == "lambda") {
- this->setLambda(value);
- std::cout << "INFO in LauPolarFormFactorSymNR::setResonanceParameter : Setting parameter lambda = " << this->getLambda() << std::endl;
- }
- else {
- std::cerr << "WARNING in LauPolarFormFactorSymNR::setResonanceParameter: Parameter name not reconised. No parameter changes made." << std::endl;
- }
+ // Set various parameters for the lineshape
+ if ( name == "lambda" ) {
+ this->setLambda( value );
+ std::cout << "INFO in LauPolarFormFactorSymNR::setResonanceParameter : Setting parameter lambda = "
+ << this->getLambda() << std::endl;
+ } else {
+ std::cerr << "WARNING in LauPolarFormFactorSymNR::setResonanceParameter: Parameter name not reconised. No parameter changes made."
+ << std::endl;
+ }
}
-void LauPolarFormFactorSymNR::floatResonanceParameter(const TString& name)
+void LauPolarFormFactorSymNR::floatResonanceParameter( const TString& name )
{
- if (name == "lambda") {
- if ( lambda_->fixed() ) {
- lambda_->fixed( kFALSE );
- this->addFloatingParameter( lambda_ );
- } else {
- std::cerr << "WARNING in LauPolarFormFactorSymNR::floatResonanceParameter: Parameter already floating. No parameter changes made." << std::endl;
- }
- }
- else {
- std::cerr << "WARNING in LauPolarFormFactorSymNR::fixResonanceParameter: Parameter name not reconised. No parameter changes made." << std::endl;
- }
+ if ( name == "lambda" ) {
+ if ( lambda_->fixed() ) {
+ lambda_->fixed( kFALSE );
+ this->addFloatingParameter( lambda_ );
+ } else {
+ std::cerr << "WARNING in LauPolarFormFactorSymNR::floatResonanceParameter: Parameter already floating. No parameter changes made."
+ << std::endl;
+ }
+ } else {
+ std::cerr << "WARNING in LauPolarFormFactorSymNR::fixResonanceParameter: Parameter name not reconised. No parameter changes made."
+ << std::endl;
+ }
}
-LauParameter* LauPolarFormFactorSymNR::getResonanceParameter(const TString& name)
+LauParameter* LauPolarFormFactorSymNR::getResonanceParameter( const TString& name )
{
- if (name == "lambda") {
- return lambda_;
- }
- else {
- std::cerr << "WARNING in LauPolarFormFactorSymNR::getResonanceParameter: Parameter name not reconised." << std::endl;
- return 0;
- }
+ if ( name == "lambda" ) {
+ return lambda_;
+ } else {
+ std::cerr << "WARNING in LauPolarFormFactorSymNR::getResonanceParameter: Parameter name not reconised."
+ << std::endl;
+ return 0;
+ }
}
-void LauPolarFormFactorSymNR::setLambda(const Double_t lambda)
+void LauPolarFormFactorSymNR::setLambda( const Double_t lambda )
{
- lambda_->value( lambda );
- lambda_->genValue( lambda );
- lambda_->initValue( lambda );
+ lambda_->value( lambda );
+ lambda_->genValue( lambda );
+ lambda_->initValue( lambda );
}
-
-
diff --git a/src/LauPolarGammaCPCoeffSet.cc b/src/LauPolarGammaCPCoeffSet.cc
index 19d3e91..f2c7708 100644
--- a/src/LauPolarGammaCPCoeffSet.cc
+++ b/src/LauPolarGammaCPCoeffSet.cc
@@ -1,767 +1,865 @@
/*
Copyright 2014 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauPolarGammaCPCoeffSet.cc
\brief File containing implementation of LauPolarGammaCPCoeffSet class.
*/
-#include <iostream>
-#include <fstream>
-#include <vector>
-
-#include "TMath.h"
-#include "TRandom.h"
-
#include "LauPolarGammaCPCoeffSet.hh"
+
#include "LauComplex.hh"
#include "LauConstants.hh"
#include "LauParameter.hh"
#include "LauPrint.hh"
-LauParameter* LauPolarGammaCPCoeffSet::gammaGlobal_ = 0;
-LauParameter* LauPolarGammaCPCoeffSet::rDGlobal_ = 0;
-LauParameter* LauPolarGammaCPCoeffSet::deltaDGlobal_ = 0;
+#include "TMath.h"
+#include "TRandom.h"
+#include <fstream>
+#include <iostream>
+#include <vector>
+LauParameter* LauPolarGammaCPCoeffSet::gammaGlobal_ = 0;
+LauParameter* LauPolarGammaCPCoeffSet::rDGlobal_ = 0;
+LauParameter* LauPolarGammaCPCoeffSet::deltaDGlobal_ = 0;
-LauPolarGammaCPCoeffSet::LauPolarGammaCPCoeffSet(const TString& compName, const DecayType decayType,
- const Double_t x, const Double_t y,
- const Double_t rB, const Double_t deltaB, const Double_t gamma,
- const Double_t rD, const Double_t deltaD,
- const Bool_t xFixed, const Bool_t yFixed,
- const Bool_t rBFixed, const Bool_t deltaBFixed, const Bool_t gammaFixed,
- const Bool_t rDFixed, const Bool_t deltaDFixed,
- const Bool_t rBSecondStage, const Bool_t deltaBSecondStage, const Bool_t gammaSecondStage,
- const Bool_t rDSecondStage, const Bool_t deltaDSecondStage,
- const Bool_t useGlobalGamma,
- const Bool_t useGlobalADSPars) :
- LauAbsCoeffSet(compName),
- decayType_(decayType),
- x_(0),
- y_(0),
- rB_(0),
- deltaB_(0),
- gamma_(0),
- rD_(0),
- deltaD_(0),
- useGlobalGamma_(useGlobalGamma),
- useGlobalADSPars_(useGlobalADSPars),
- nonCPPart_(x,y),
- cpPart_(0.0,0.0),
- cpAntiPart_(0.0,0.0),
- particleCoeff_(0.0,0.0),
- antiparticleCoeff_(0.0,0.0),
- acp_("ACP", 0.0, -1.0, 1.0)
+LauPolarGammaCPCoeffSet::LauPolarGammaCPCoeffSet( const TString& compName,
+ const DecayType decayType,
+ const Double_t x,
+ const Double_t y,
+ const Double_t rB,
+ const Double_t deltaB,
+ const Double_t gamma,
+ const Double_t rD,
+ const Double_t deltaD,
+ const Bool_t xFixed,
+ const Bool_t yFixed,
+ const Bool_t rBFixed,
+ const Bool_t deltaBFixed,
+ const Bool_t gammaFixed,
+ const Bool_t rDFixed,
+ const Bool_t deltaDFixed,
+ const Bool_t rBSecondStage,
+ const Bool_t deltaBSecondStage,
+ const Bool_t gammaSecondStage,
+ const Bool_t rDSecondStage,
+ const Bool_t deltaDSecondStage,
+ const Bool_t useGlobalGamma,
+ const Bool_t useGlobalADSPars ) :
+ LauAbsCoeffSet( compName ),
+ decayType_( decayType ),
+ x_( 0 ),
+ y_( 0 ),
+ rB_( 0 ),
+ deltaB_( 0 ),
+ gamma_( 0 ),
+ rD_( 0 ),
+ deltaD_( 0 ),
+ useGlobalGamma_( useGlobalGamma ),
+ useGlobalADSPars_( useGlobalADSPars ),
+ nonCPPart_( x, y ),
+ cpPart_( 0.0, 0.0 ),
+ cpAntiPart_( 0.0, 0.0 ),
+ particleCoeff_( 0.0, 0.0 ),
+ antiparticleCoeff_( 0.0, 0.0 ),
+ acp_( "ACP", 0.0, -1.0, 1.0 )
{
- // All of the possible D decay types need these two parameters
- x_ = new LauParameter("X", x, minRealImagPart_, maxRealImagPart_, xFixed);
- y_ = new LauParameter("Y", y, minRealImagPart_, maxRealImagPart_, yFixed);
-
- // if we're using a global gamma, create it if it doesn't already exist then set gamma_ to point to it
- // otherwise create our individual copy of gamma
- if (useGlobalGamma_) {
- if (!gammaGlobal_) {
- gammaGlobal_ = new LauParameter("gamma", gamma, minPhase_, maxPhase_, gammaFixed);
- gamma_ = gammaGlobal_;
- } else {
- gamma_ = gammaGlobal_->createClone();
- }
- } else {
- gamma_ = new LauParameter("gamma", gamma, minPhase_, maxPhase_, gammaFixed);
- }
- if (gammaSecondStage && !gammaFixed) {
- gamma_->secondStage(kTRUE);
- gamma_->initValue(0.0);
- }
-
- // which of the other parameter we need depends on the D-decay type
- if ( decayType_ == ADS_Favoured || decayType_ == ADS_Suppressed || decayType_ == GLW_CPOdd || decayType_ == GLW_CPEven ) {
- rB_ = new LauParameter("rB", rB, minMagnitude_, maxMagnitude_, rBFixed);
- deltaB_ = new LauParameter("deltaB", deltaB, minPhase_, maxPhase_, deltaBFixed);
- if (rBSecondStage && !rBFixed) {
- rB_->secondStage(kTRUE);
- rB_->initValue(0.0);
- }
- if (deltaBSecondStage && !deltaBFixed) {
- deltaB_->secondStage(kTRUE);
- deltaB_->initValue(0.0);
- }
- }
-
- if ( decayType_ == ADS_Favoured || decayType_ == ADS_Suppressed || decayType_ == ADS_Favoured_btouOnly ) {
- if (useGlobalADSPars_) {
- if ( !rDGlobal_ ) {
- rDGlobal_ = new LauParameter("rD", rD, minMagnitude_, maxMagnitude_, rDFixed);
- deltaDGlobal_ = new LauParameter("deltaD", deltaD, minPhase_, maxPhase_, deltaDFixed);
- rD_ = rDGlobal_;
- deltaD_ = deltaDGlobal_;
- } else {
- rD_ = rDGlobal_->createClone();
- deltaD_ = deltaDGlobal_->createClone();
- }
- } else {
- rD_ = new LauParameter("rD", rD, minMagnitude_, maxMagnitude_, rDFixed);
- deltaD_ = new LauParameter("deltaD", deltaD, minPhase_, maxPhase_, deltaDFixed);
- }
- if (rDSecondStage && !rDFixed) {
- rD_->secondStage(kTRUE);
- rD_->initValue(0.0);
- }
- if (deltaDSecondStage && !deltaDFixed) {
- deltaD_->secondStage(kTRUE);
- deltaD_->initValue(0.0);
- }
- }
+ // All of the possible D decay types need these two parameters
+ x_ = new LauParameter( "X", x, minRealImagPart_, maxRealImagPart_, xFixed );
+ y_ = new LauParameter( "Y", y, minRealImagPart_, maxRealImagPart_, yFixed );
+
+ // if we're using a global gamma, create it if it doesn't already exist then set gamma_ to point to it
+ // otherwise create our individual copy of gamma
+ if ( useGlobalGamma_ ) {
+ if ( ! gammaGlobal_ ) {
+ gammaGlobal_ = new LauParameter( "gamma", gamma, minPhase_, maxPhase_, gammaFixed );
+ gamma_ = gammaGlobal_;
+ } else {
+ gamma_ = gammaGlobal_->createClone();
+ }
+ } else {
+ gamma_ = new LauParameter( "gamma", gamma, minPhase_, maxPhase_, gammaFixed );
+ }
+ if ( gammaSecondStage && ! gammaFixed ) {
+ gamma_->secondStage( kTRUE );
+ gamma_->initValue( 0.0 );
+ }
+
+ // which of the other parameter we need depends on the D-decay type
+ if ( decayType_ == ADS_Favoured || decayType_ == ADS_Suppressed || decayType_ == GLW_CPOdd ||
+ decayType_ == GLW_CPEven ) {
+ rB_ = new LauParameter( "rB", rB, minMagnitude_, maxMagnitude_, rBFixed );
+ deltaB_ = new LauParameter( "deltaB", deltaB, minPhase_, maxPhase_, deltaBFixed );
+ if ( rBSecondStage && ! rBFixed ) {
+ rB_->secondStage( kTRUE );
+ rB_->initValue( 0.0 );
+ }
+ if ( deltaBSecondStage && ! deltaBFixed ) {
+ deltaB_->secondStage( kTRUE );
+ deltaB_->initValue( 0.0 );
+ }
+ }
+
+ if ( decayType_ == ADS_Favoured || decayType_ == ADS_Suppressed ||
+ decayType_ == ADS_Favoured_btouOnly ) {
+ if ( useGlobalADSPars_ ) {
+ if ( ! rDGlobal_ ) {
+ rDGlobal_ = new LauParameter( "rD", rD, minMagnitude_, maxMagnitude_, rDFixed );
+ deltaDGlobal_ = new LauParameter( "deltaD", deltaD, minPhase_, maxPhase_, deltaDFixed );
+ rD_ = rDGlobal_;
+ deltaD_ = deltaDGlobal_;
+ } else {
+ rD_ = rDGlobal_->createClone();
+ deltaD_ = deltaDGlobal_->createClone();
+ }
+ } else {
+ rD_ = new LauParameter( "rD", rD, minMagnitude_, maxMagnitude_, rDFixed );
+ deltaD_ = new LauParameter( "deltaD", deltaD, minPhase_, maxPhase_, deltaDFixed );
+ }
+ if ( rDSecondStage && ! rDFixed ) {
+ rD_->secondStage( kTRUE );
+ rD_->initValue( 0.0 );
+ }
+ if ( deltaDSecondStage && ! deltaDFixed ) {
+ deltaD_->secondStage( kTRUE );
+ deltaD_->initValue( 0.0 );
+ }
+ }
}
-LauPolarGammaCPCoeffSet::LauPolarGammaCPCoeffSet(const LauPolarGammaCPCoeffSet& rhs, CloneOption cloneOption, Double_t constFactor) : LauAbsCoeffSet(rhs.name()),
- decayType_( rhs.decayType_ ),
- x_(0),
- y_(0),
- rB_(0),
- deltaB_(0),
- gamma_(0),
- rD_(0),
- deltaD_(0),
- useGlobalGamma_( rhs.useGlobalGamma_ ),
- useGlobalADSPars_( rhs.useGlobalADSPars_ ),
- nonCPPart_( rhs.nonCPPart_ ),
- cpPart_( rhs.cpPart_ ),
- cpAntiPart_( rhs.cpAntiPart_ ),
- particleCoeff_( rhs.particleCoeff_ ),
- antiparticleCoeff_( rhs.antiparticleCoeff_ ),
- acp_( rhs.acp_ )
+LauPolarGammaCPCoeffSet::LauPolarGammaCPCoeffSet( const LauPolarGammaCPCoeffSet& rhs,
+ CloneOption cloneOption,
+ Double_t constFactor ) :
+ LauAbsCoeffSet( rhs.name() ),
+ decayType_( rhs.decayType_ ),
+ x_( 0 ),
+ y_( 0 ),
+ rB_( 0 ),
+ deltaB_( 0 ),
+ gamma_( 0 ),
+ rD_( 0 ),
+ deltaD_( 0 ),
+ useGlobalGamma_( rhs.useGlobalGamma_ ),
+ useGlobalADSPars_( rhs.useGlobalADSPars_ ),
+ nonCPPart_( rhs.nonCPPart_ ),
+ cpPart_( rhs.cpPart_ ),
+ cpAntiPart_( rhs.cpAntiPart_ ),
+ particleCoeff_( rhs.particleCoeff_ ),
+ antiparticleCoeff_( rhs.antiparticleCoeff_ ),
+ acp_( rhs.acp_ )
{
- if ( cloneOption == All || cloneOption == TieRealPart ) {
- x_ = rhs.x_->createClone(constFactor);
- } else {
- x_ = new LauParameter("X", rhs.x_->value(), minRealImagPart_, maxRealImagPart_, rhs.x_->fixed());
- if ( rhs.x_->blind() ) {
- const LauBlind* blinder = rhs.x_->blinder();
- x_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
- }
- }
-
- if ( cloneOption == All || cloneOption == TieImagPart ) {
- y_ = rhs.y_->createClone(constFactor);
- } else {
- y_ = new LauParameter("Y", rhs.y_->value(), minRealImagPart_, maxRealImagPart_, rhs.y_->fixed());
- if ( rhs.y_->blind() ) {
- const LauBlind* blinder = rhs.y_->blinder();
- y_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
- }
- }
-
- if ( cloneOption == All || cloneOption == TieCPPars ) {
- gamma_ = rhs.gamma_->createClone(constFactor);
- if ( decayType_ == ADS_Favoured || decayType_ == ADS_Suppressed || decayType_ == GLW_CPOdd || decayType_ == GLW_CPEven ) {
- rB_ = rhs.rB_->createClone(constFactor);
- deltaB_ = rhs.deltaB_->createClone(constFactor);
- }
- if ( decayType_ == ADS_Favoured || decayType_ == ADS_Suppressed || decayType_ == ADS_Favoured_btouOnly ) {
- rD_ = rhs.rD_->createClone(constFactor);
- deltaD_ = rhs.deltaD_->createClone(constFactor);
- }
- } else {
- if (useGlobalGamma_) {
- gamma_ = gammaGlobal_->createClone();
- } else {
- gamma_ = new LauParameter("gamma", rhs.gamma_->value(), minPhase_, maxPhase_, rhs.gamma_->fixed());
- if ( rhs.gamma_->blind() ) {
- const LauBlind* blinder = rhs.gamma_->blinder();
- gamma_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
- }
- if ( rhs.gamma_->secondStage() && !rhs.gamma_->fixed() ) {
- gamma_->secondStage(kTRUE);
- gamma_->initValue(0.0);
- }
- }
- if ( decayType_ == ADS_Favoured || decayType_ == ADS_Suppressed || decayType_ == GLW_CPOdd || decayType_ == GLW_CPEven ) {
- rB_ = new LauParameter("rB", rhs.rB_->value(), minMagnitude_, maxMagnitude_, rhs.rB_->fixed());
- if ( rhs.rB_->blind() ) {
- const LauBlind* blinder = rhs.rB_->blinder();
- rB_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
- }
- deltaB_ = new LauParameter("deltaB", rhs.deltaB_->value(), minPhase_, maxPhase_, rhs.deltaB_->fixed());
- if ( rhs.deltaB_->blind() ) {
- const LauBlind* blinder = rhs.deltaB_->blinder();
- deltaB_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
- }
- if ( rhs.rB_->secondStage() && !rhs.rB_->fixed() ) {
- rB_->secondStage(kTRUE);
- rB_->initValue(0.0);
- }
- if ( rhs.deltaB_->secondStage() && !rhs.deltaB_->fixed() ) {
- deltaB_->secondStage(kTRUE);
- deltaB_->initValue(0.0);
- }
- }
- if ( decayType_ == ADS_Favoured || decayType_ == ADS_Suppressed || decayType_ == ADS_Favoured_btouOnly ) {
- if ( useGlobalADSPars_ ) {
- rD_ = rDGlobal_->createClone();
- deltaD_ = deltaDGlobal_->createClone();
- } else {
- rD_ = new LauParameter("rD", rhs.rD_->value(), minMagnitude_, maxMagnitude_, rhs.rD_->fixed());
- if ( rhs.rD_->blind() ) {
- const LauBlind* blinder = rhs.rD_->blinder();
- rD_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
- }
- deltaD_ = new LauParameter("deltaD", rhs.deltaD_->value(), minPhase_, maxPhase_, rhs.deltaD_->fixed());
- if ( rhs.deltaD_->blind() ) {
- const LauBlind* blinder = rhs.deltaD_->blinder();
- deltaD_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
- }
- if ( rhs.rD_->secondStage() && !rhs.rD_->fixed() ) {
- rD_->secondStage(kTRUE);
- rD_->initValue(0.0);
- }
- if ( rhs.deltaD_->secondStage() && !rhs.deltaD_->fixed() ) {
- deltaD_->secondStage(kTRUE);
- deltaD_->initValue(0.0);
- }
- }
- }
- }
+ if ( cloneOption == All || cloneOption == TieRealPart ) {
+ x_ = rhs.x_->createClone( constFactor );
+ } else {
+ x_ = new LauParameter( "X",
+ rhs.x_->value(),
+ minRealImagPart_,
+ maxRealImagPart_,
+ rhs.x_->fixed() );
+ if ( rhs.x_->blind() ) {
+ const LauBlind* blinder = rhs.x_->blinder();
+ x_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
+ }
+ }
+
+ if ( cloneOption == All || cloneOption == TieImagPart ) {
+ y_ = rhs.y_->createClone( constFactor );
+ } else {
+ y_ = new LauParameter( "Y",
+ rhs.y_->value(),
+ minRealImagPart_,
+ maxRealImagPart_,
+ rhs.y_->fixed() );
+ if ( rhs.y_->blind() ) {
+ const LauBlind* blinder = rhs.y_->blinder();
+ y_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
+ }
+ }
+
+ if ( cloneOption == All || cloneOption == TieCPPars ) {
+ gamma_ = rhs.gamma_->createClone( constFactor );
+ if ( decayType_ == ADS_Favoured || decayType_ == ADS_Suppressed ||
+ decayType_ == GLW_CPOdd || decayType_ == GLW_CPEven ) {
+ rB_ = rhs.rB_->createClone( constFactor );
+ deltaB_ = rhs.deltaB_->createClone( constFactor );
+ }
+ if ( decayType_ == ADS_Favoured || decayType_ == ADS_Suppressed ||
+ decayType_ == ADS_Favoured_btouOnly ) {
+ rD_ = rhs.rD_->createClone( constFactor );
+ deltaD_ = rhs.deltaD_->createClone( constFactor );
+ }
+ } else {
+ if ( useGlobalGamma_ ) {
+ gamma_ = gammaGlobal_->createClone();
+ } else {
+ gamma_ = new LauParameter( "gamma",
+ rhs.gamma_->value(),
+ minPhase_,
+ maxPhase_,
+ rhs.gamma_->fixed() );
+ if ( rhs.gamma_->blind() ) {
+ const LauBlind* blinder = rhs.gamma_->blinder();
+ gamma_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
+ }
+ if ( rhs.gamma_->secondStage() && ! rhs.gamma_->fixed() ) {
+ gamma_->secondStage( kTRUE );
+ gamma_->initValue( 0.0 );
+ }
+ }
+ if ( decayType_ == ADS_Favoured || decayType_ == ADS_Suppressed ||
+ decayType_ == GLW_CPOdd || decayType_ == GLW_CPEven ) {
+ rB_ = new LauParameter( "rB",
+ rhs.rB_->value(),
+ minMagnitude_,
+ maxMagnitude_,
+ rhs.rB_->fixed() );
+ if ( rhs.rB_->blind() ) {
+ const LauBlind* blinder = rhs.rB_->blinder();
+ rB_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
+ }
+ deltaB_ = new LauParameter( "deltaB",
+ rhs.deltaB_->value(),
+ minPhase_,
+ maxPhase_,
+ rhs.deltaB_->fixed() );
+ if ( rhs.deltaB_->blind() ) {
+ const LauBlind* blinder = rhs.deltaB_->blinder();
+ deltaB_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
+ }
+ if ( rhs.rB_->secondStage() && ! rhs.rB_->fixed() ) {
+ rB_->secondStage( kTRUE );
+ rB_->initValue( 0.0 );
+ }
+ if ( rhs.deltaB_->secondStage() && ! rhs.deltaB_->fixed() ) {
+ deltaB_->secondStage( kTRUE );
+ deltaB_->initValue( 0.0 );
+ }
+ }
+ if ( decayType_ == ADS_Favoured || decayType_ == ADS_Suppressed ||
+ decayType_ == ADS_Favoured_btouOnly ) {
+ if ( useGlobalADSPars_ ) {
+ rD_ = rDGlobal_->createClone();
+ deltaD_ = deltaDGlobal_->createClone();
+ } else {
+ rD_ = new LauParameter( "rD",
+ rhs.rD_->value(),
+ minMagnitude_,
+ maxMagnitude_,
+ rhs.rD_->fixed() );
+ if ( rhs.rD_->blind() ) {
+ const LauBlind* blinder = rhs.rD_->blinder();
+ rD_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
+ }
+ deltaD_ = new LauParameter( "deltaD",
+ rhs.deltaD_->value(),
+ minPhase_,
+ maxPhase_,
+ rhs.deltaD_->fixed() );
+ if ( rhs.deltaD_->blind() ) {
+ const LauBlind* blinder = rhs.deltaD_->blinder();
+ deltaD_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
+ }
+ if ( rhs.rD_->secondStage() && ! rhs.rD_->fixed() ) {
+ rD_->secondStage( kTRUE );
+ rD_->initValue( 0.0 );
+ }
+ if ( rhs.deltaD_->secondStage() && ! rhs.deltaD_->fixed() ) {
+ deltaD_->secondStage( kTRUE );
+ deltaD_->initValue( 0.0 );
+ }
+ }
+ }
+ }
}
-void LauPolarGammaCPCoeffSet::adjustName(LauParameter* par, const TString& oldBaseName)
+void LauPolarGammaCPCoeffSet::adjustName( LauParameter* par, const TString& oldBaseName )
{
- if ( ( par == gamma_ && useGlobalGamma_ ) ||
- ( par == rD_ && useGlobalADSPars_ ) ||
- ( par == deltaD_ && useGlobalADSPars_ ) ) {
- // for global parameters we do not want to adjust their names
- return;
- } else {
- LauAbsCoeffSet::adjustName(par,oldBaseName);
- }
+ if ( ( par == gamma_ && useGlobalGamma_ ) || ( par == rD_ && useGlobalADSPars_ ) ||
+ ( par == deltaD_ && useGlobalADSPars_ ) ) {
+ // for global parameters we do not want to adjust their names
+ return;
+ } else {
+ LauAbsCoeffSet::adjustName( par, oldBaseName );
+ }
}
std::vector<LauParameter*> LauPolarGammaCPCoeffSet::getParameters()
{
- std::vector<LauParameter*> pars;
- pars.push_back(x_);
- pars.push_back(y_);
- if ( !gamma_->fixed() ) {
- pars.push_back(gamma_);
- }
- if ( decayType_ == ADS_Favoured || decayType_ == ADS_Suppressed || decayType_ == GLW_CPOdd || decayType_ == GLW_CPEven ) {
- if ( !rB_->fixed() ) {
- pars.push_back(rB_);
- }
- if ( !deltaB_->fixed() ) {
- pars.push_back(deltaB_);
- }
- }
- if ( decayType_ == ADS_Favoured || decayType_ == ADS_Suppressed || decayType_ == ADS_Favoured_btouOnly ) {
- if ( !rD_->fixed() ) {
- pars.push_back(rD_);
- }
- if ( !deltaD_->fixed() ) {
- pars.push_back(deltaD_);
- }
- }
- return pars;
+ std::vector<LauParameter*> pars;
+ pars.push_back( x_ );
+ pars.push_back( y_ );
+ if ( ! gamma_->fixed() ) {
+ pars.push_back( gamma_ );
+ }
+ if ( decayType_ == ADS_Favoured || decayType_ == ADS_Suppressed || decayType_ == GLW_CPOdd ||
+ decayType_ == GLW_CPEven ) {
+ if ( ! rB_->fixed() ) {
+ pars.push_back( rB_ );
+ }
+ if ( ! deltaB_->fixed() ) {
+ pars.push_back( deltaB_ );
+ }
+ }
+ if ( decayType_ == ADS_Favoured || decayType_ == ADS_Suppressed ||
+ decayType_ == ADS_Favoured_btouOnly ) {
+ if ( ! rD_->fixed() ) {
+ pars.push_back( rD_ );
+ }
+ if ( ! deltaD_->fixed() ) {
+ pars.push_back( deltaD_ );
+ }
+ }
+ return pars;
}
void LauPolarGammaCPCoeffSet::printParValues() const
{
- std::cout<<"INFO in LauPolarGammaCPCoeffSet::printParValues : Component \""<<this->name()<<"\" has ";
- std::cout<<"x = "<<x_->value()<<",\t";
- std::cout<<"y = "<<y_->value()<<",\t";
- if ( decayType_ == ADS_Favoured || decayType_ == ADS_Suppressed || decayType_ == GLW_CPOdd || decayType_ == GLW_CPEven ) {
- std::cout<<"rB = "<<rB_->value()<<",\t";
- std::cout<<"deltaB = "<<deltaB_->value()<<",\t";
- }
- if ( decayType_ == ADS_Favoured || decayType_ == ADS_Suppressed || decayType_ == ADS_Favoured_btouOnly ) {
- std::cout<<"rD = "<<rD_->value()<<",\t";
- std::cout<<"deltaD = "<<deltaD_->value()<<",\t";
- }
- std::cout<<"gamma = "<<gamma_->value()<<"."<<std::endl;
+ std::cout << "INFO in LauPolarGammaCPCoeffSet::printParValues : Component \"" << this->name()
+ << "\" has ";
+ std::cout << "x = " << x_->value() << ",\t";
+ std::cout << "y = " << y_->value() << ",\t";
+ if ( decayType_ == ADS_Favoured || decayType_ == ADS_Suppressed || decayType_ == GLW_CPOdd ||
+ decayType_ == GLW_CPEven ) {
+ std::cout << "rB = " << rB_->value() << ",\t";
+ std::cout << "deltaB = " << deltaB_->value() << ",\t";
+ }
+ if ( decayType_ == ADS_Favoured || decayType_ == ADS_Suppressed ||
+ decayType_ == ADS_Favoured_btouOnly ) {
+ std::cout << "rD = " << rD_->value() << ",\t";
+ std::cout << "deltaD = " << deltaD_->value() << ",\t";
+ }
+ std::cout << "gamma = " << gamma_->value() << "." << std::endl;
}
-void LauPolarGammaCPCoeffSet::printTableHeading(std::ostream& stream) const
+void LauPolarGammaCPCoeffSet::printTableHeading( std::ostream& stream ) const
{
- switch ( decayType_ ) {
- case GLW_CPOdd :
- stream<<"\\begin{tabular}{|l|c|c|c|c|c|}"<<std::endl;
- stream<<"\\hline"<<std::endl;
- stream<<"Component & Real Part & Imaginary Part & $r_B$ & $\\delta_B$ & $\\gamma$ \\\\"<<std::endl;
- break;
- case GLW_CPEven :
- stream<<"\\begin{tabular}{|l|c|c|c|c|c|}"<<std::endl;
- stream<<"\\hline"<<std::endl;
- stream<<"Component & Real Part & Imaginary Part & $r_B$ & $\\delta_B$ & $\\gamma$ \\\\"<<std::endl;
- break;
- case ADS_Favoured :
- stream<<"\\begin{tabular}{|l|c|c|c|c|c|c|c|}"<<std::endl;
- stream<<"\\hline"<<std::endl;
- stream<<"Component & Real Part & Imaginary Part & $r_B$ & $\\delta_B$ & $r_D$ & $\\delta_D$ & $\\gamma$ \\\\"<<std::endl;
- break;
- case ADS_Suppressed :
- stream<<"\\begin{tabular}{|l|c|c|c|c|c|c|c|}"<<std::endl;
- stream<<"\\hline"<<std::endl;
- stream<<"Component & Real Part & Imaginary Part & $r_B$ & $\\delta_B$ & $r_D$ & $\\delta_D$ & $\\gamma$ \\\\"<<std::endl;
- break;
- case GLW_CPOdd_btouOnly :
- stream<<"\\begin{tabular}{|l|c|c|c|}"<<std::endl;
- stream<<"\\hline"<<std::endl;
- stream<<"Component & Real Part & Imaginary Part & $\\gamma$ \\\\"<<std::endl;
- break;
- case GLW_CPEven_btouOnly :
- stream<<"\\begin{tabular}{|l|c|c|c|}"<<std::endl;
- stream<<"\\hline"<<std::endl;
- stream<<"Component & Real Part & Imaginary Part & $\\gamma$ \\\\"<<std::endl;
- break;
- case ADS_Favoured_btouOnly :
- stream<<"\\begin{tabular}{|l|c|c|c|c|c|}"<<std::endl;
- stream<<"\\hline"<<std::endl;
- stream<<"Component & Real Part & Imaginary Part & $r_D$ & $\\delta_D$ & $\\gamma$ \\\\"<<std::endl;
- break;
- case ADS_Suppressed_btouOnly :
- stream<<"\\begin{tabular}{|l|c|c|c|}"<<std::endl;
- stream<<"\\hline"<<std::endl;
- stream<<"Component & Real Part & Imaginary Part & $\\gamma$ \\\\"<<std::endl;
- break;
- }
- stream<<"\\hline"<<std::endl;
+ switch ( decayType_ ) {
+ case GLW_CPOdd :
+ stream << "\\begin{tabular}{|l|c|c|c|c|c|}" << std::endl;
+ stream << "\\hline" << std::endl;
+ stream << "Component & Real Part & Imaginary Part & $r_B$ & $\\delta_B$ & $\\gamma$ \\\\"
+ << std::endl;
+ break;
+ case GLW_CPEven :
+ stream << "\\begin{tabular}{|l|c|c|c|c|c|}" << std::endl;
+ stream << "\\hline" << std::endl;
+ stream << "Component & Real Part & Imaginary Part & $r_B$ & $\\delta_B$ & $\\gamma$ \\\\"
+ << std::endl;
+ break;
+ case ADS_Favoured :
+ stream << "\\begin{tabular}{|l|c|c|c|c|c|c|c|}" << std::endl;
+ stream << "\\hline" << std::endl;
+ stream << "Component & Real Part & Imaginary Part & $r_B$ & $\\delta_B$ & $r_D$ & $\\delta_D$ & $\\gamma$ \\\\"
+ << std::endl;
+ break;
+ case ADS_Suppressed :
+ stream << "\\begin{tabular}{|l|c|c|c|c|c|c|c|}" << std::endl;
+ stream << "\\hline" << std::endl;
+ stream << "Component & Real Part & Imaginary Part & $r_B$ & $\\delta_B$ & $r_D$ & $\\delta_D$ & $\\gamma$ \\\\"
+ << std::endl;
+ break;
+ case GLW_CPOdd_btouOnly :
+ stream << "\\begin{tabular}{|l|c|c|c|}" << std::endl;
+ stream << "\\hline" << std::endl;
+ stream << "Component & Real Part & Imaginary Part & $\\gamma$ \\\\" << std::endl;
+ break;
+ case GLW_CPEven_btouOnly :
+ stream << "\\begin{tabular}{|l|c|c|c|}" << std::endl;
+ stream << "\\hline" << std::endl;
+ stream << "Component & Real Part & Imaginary Part & $\\gamma$ \\\\" << std::endl;
+ break;
+ case ADS_Favoured_btouOnly :
+ stream << "\\begin{tabular}{|l|c|c|c|c|c|}" << std::endl;
+ stream << "\\hline" << std::endl;
+ stream << "Component & Real Part & Imaginary Part & $r_D$ & $\\delta_D$ & $\\gamma$ \\\\"
+ << std::endl;
+ break;
+ case ADS_Suppressed_btouOnly :
+ stream << "\\begin{tabular}{|l|c|c|c|}" << std::endl;
+ stream << "\\hline" << std::endl;
+ stream << "Component & Real Part & Imaginary Part & $\\gamma$ \\\\" << std::endl;
+ break;
+ }
+ stream << "\\hline" << std::endl;
}
-void LauPolarGammaCPCoeffSet::printTableRow(std::ostream& stream) const
+void LauPolarGammaCPCoeffSet::printTableRow( std::ostream& stream ) const
{
- LauPrint print;
- TString resName = this->name();
- resName = resName.ReplaceAll("_", "\\_");
- stream<<resName<<" & $";
- print.printFormat(stream, x_->value());
- stream<<" \\pm ";
- print.printFormat(stream, x_->error());
- stream<<"$ & $";
- print.printFormat(stream, y_->value());
- stream<<" \\pm ";
- print.printFormat(stream, y_->error());
- stream<<"$ & $";
- if ( decayType_ == ADS_Favoured || decayType_ == ADS_Suppressed || decayType_ == GLW_CPOdd || decayType_ == GLW_CPEven ) {
- print.printFormat(stream, rB_->value());
- stream<<" \\pm ";
- print.printFormat(stream, rB_->error());
- stream<<"$ & $";
- print.printFormat(stream, deltaB_->value());
- stream<<" \\pm ";
- print.printFormat(stream, deltaB_->error());
- stream<<"$ & $";
- }
- if ( decayType_ == ADS_Favoured || decayType_ == ADS_Suppressed || decayType_ == ADS_Favoured_btouOnly ) {
- print.printFormat(stream, rD_->value());
- stream<<" \\pm ";
- print.printFormat(stream, rD_->error());
- stream<<"$ & $";
- print.printFormat(stream, deltaD_->value());
- stream<<" \\pm ";
- print.printFormat(stream, deltaD_->error());
- stream<<"$ & $";
- }
- print.printFormat(stream, gamma_->value());
- stream<<" \\pm ";
- print.printFormat(stream, gamma_->error());
- stream<<"$ \\\\"<<std::endl;
+ LauPrint print;
+ TString resName = this->name();
+ resName = resName.ReplaceAll( "_", "\\_" );
+ stream << resName << " & $";
+ print.printFormat( stream, x_->value() );
+ stream << " \\pm ";
+ print.printFormat( stream, x_->error() );
+ stream << "$ & $";
+ print.printFormat( stream, y_->value() );
+ stream << " \\pm ";
+ print.printFormat( stream, y_->error() );
+ stream << "$ & $";
+ if ( decayType_ == ADS_Favoured || decayType_ == ADS_Suppressed || decayType_ == GLW_CPOdd ||
+ decayType_ == GLW_CPEven ) {
+ print.printFormat( stream, rB_->value() );
+ stream << " \\pm ";
+ print.printFormat( stream, rB_->error() );
+ stream << "$ & $";
+ print.printFormat( stream, deltaB_->value() );
+ stream << " \\pm ";
+ print.printFormat( stream, deltaB_->error() );
+ stream << "$ & $";
+ }
+ if ( decayType_ == ADS_Favoured || decayType_ == ADS_Suppressed ||
+ decayType_ == ADS_Favoured_btouOnly ) {
+ print.printFormat( stream, rD_->value() );
+ stream << " \\pm ";
+ print.printFormat( stream, rD_->error() );
+ stream << "$ & $";
+ print.printFormat( stream, deltaD_->value() );
+ stream << " \\pm ";
+ print.printFormat( stream, deltaD_->error() );
+ stream << "$ & $";
+ }
+ print.printFormat( stream, gamma_->value() );
+ stream << " \\pm ";
+ print.printFormat( stream, gamma_->error() );
+ stream << "$ \\\\" << std::endl;
}
void LauPolarGammaCPCoeffSet::randomiseInitValues()
{
- if (x_->fixed() == kFALSE) {
- // Choose a value for "X" between -3.0 and 3.0
- Double_t value = LauAbsCoeffSet::getRandomiser()->Rndm()*6.0 - 3.0;
- x_->initValue(value); x_->value(value);
- }
- if (y_->fixed() == kFALSE) {
- // Choose a value for "Y" between -3.0 and 3.0
- Double_t value = LauAbsCoeffSet::getRandomiser()->Rndm()*6.0 - 3.0;
- y_->initValue(value); y_->value(value);
- }
- if (gamma_->fixed() == kFALSE && gamma_->secondStage() == kFALSE) {
- // Choose a value for "gamma" between +-pi
- Double_t value = LauAbsCoeffSet::getRandomiser()->Rndm()*LauConstants::twoPi - LauConstants::pi;
- gamma_->initValue(value); gamma_->value(value);
- }
- if ( decayType_ == ADS_Favoured || decayType_ == ADS_Suppressed || decayType_ == GLW_CPOdd || decayType_ == GLW_CPEven ) {
- if (rB_->fixed() == kFALSE && rB_->secondStage() == kFALSE) {
- // Choose a value for "rB" between 0.0 and 2.0
- Double_t value = LauAbsCoeffSet::getRandomiser()->Rndm()*2.0;
- rB_->initValue(value); rB_->value(value);
- }
- if (deltaB_->fixed() == kFALSE && deltaB_->secondStage() == kFALSE) {
- // Choose a value for "deltaB" between +- pi
- Double_t value = LauAbsCoeffSet::getRandomiser()->Rndm()*LauConstants::twoPi - LauConstants::pi;
- deltaB_->initValue(value); deltaB_->value(value);
- }
- }
- if ( decayType_ == ADS_Favoured || decayType_ == ADS_Suppressed || decayType_ == ADS_Favoured_btouOnly ) {
- if (rD_->fixed() == kFALSE && rD_->secondStage() == kFALSE) {
- // Choose a value for "rD" between 0.0 and 2.0
- Double_t value = LauAbsCoeffSet::getRandomiser()->Rndm()*2.0;
- rD_->initValue(value); rD_->value(value);
- }
- if (deltaD_->fixed() == kFALSE && deltaD_->secondStage() == kFALSE) {
- // Choose a value for "deltaD" between +- pi
- Double_t value = LauAbsCoeffSet::getRandomiser()->Rndm()*LauConstants::twoPi - LauConstants::pi;
- deltaD_->initValue(value); deltaD_->value(value);
- }
- }
+ if ( x_->fixed() == kFALSE ) {
+ // Choose a value for "X" between -3.0 and 3.0
+ Double_t value = LauAbsCoeffSet::getRandomiser()->Rndm() * 6.0 - 3.0;
+ x_->initValue( value );
+ x_->value( value );
+ }
+ if ( y_->fixed() == kFALSE ) {
+ // Choose a value for "Y" between -3.0 and 3.0
+ Double_t value = LauAbsCoeffSet::getRandomiser()->Rndm() * 6.0 - 3.0;
+ y_->initValue( value );
+ y_->value( value );
+ }
+ if ( gamma_->fixed() == kFALSE && gamma_->secondStage() == kFALSE ) {
+ // Choose a value for "gamma" between +-pi
+ Double_t value = LauAbsCoeffSet::getRandomiser()->Rndm() * LauConstants::twoPi -
+ LauConstants::pi;
+ gamma_->initValue( value );
+ gamma_->value( value );
+ }
+ if ( decayType_ == ADS_Favoured || decayType_ == ADS_Suppressed || decayType_ == GLW_CPOdd ||
+ decayType_ == GLW_CPEven ) {
+ if ( rB_->fixed() == kFALSE && rB_->secondStage() == kFALSE ) {
+ // Choose a value for "rB" between 0.0 and 2.0
+ Double_t value = LauAbsCoeffSet::getRandomiser()->Rndm() * 2.0;
+ rB_->initValue( value );
+ rB_->value( value );
+ }
+ if ( deltaB_->fixed() == kFALSE && deltaB_->secondStage() == kFALSE ) {
+ // Choose a value for "deltaB" between +- pi
+ Double_t value = LauAbsCoeffSet::getRandomiser()->Rndm() * LauConstants::twoPi -
+ LauConstants::pi;
+ deltaB_->initValue( value );
+ deltaB_->value( value );
+ }
+ }
+ if ( decayType_ == ADS_Favoured || decayType_ == ADS_Suppressed ||
+ decayType_ == ADS_Favoured_btouOnly ) {
+ if ( rD_->fixed() == kFALSE && rD_->secondStage() == kFALSE ) {
+ // Choose a value for "rD" between 0.0 and 2.0
+ Double_t value = LauAbsCoeffSet::getRandomiser()->Rndm() * 2.0;
+ rD_->initValue( value );
+ rD_->value( value );
+ }
+ if ( deltaD_->fixed() == kFALSE && deltaD_->secondStage() == kFALSE ) {
+ // Choose a value for "deltaD" between +- pi
+ Double_t value = LauAbsCoeffSet::getRandomiser()->Rndm() * LauConstants::twoPi -
+ LauConstants::pi;
+ deltaD_->initValue( value );
+ deltaD_->value( value );
+ }
+ }
}
void LauPolarGammaCPCoeffSet::finaliseValues()
{
- // retrieve the current values from the parameters
- Double_t gammaVal = gamma_->value();
- Double_t rBVal = 0.0;
- Double_t deltaBVal = 0.0;
- Double_t genDeltaB = 0.0;
- Double_t rDVal = 0.0;
- Double_t deltaDVal = 0.0;
- Double_t genDeltaD = 0.0;
- if ( decayType_ == ADS_Favoured || decayType_ == ADS_Suppressed || decayType_ == GLW_CPOdd || decayType_ == GLW_CPEven ) {
- rBVal = rB_->value();
- deltaBVal = deltaB_->value();
- genDeltaB = deltaB_->genValue();
- }
- if ( decayType_ == ADS_Favoured || decayType_ == ADS_Suppressed || decayType_ == ADS_Favoured_btouOnly ) {
- rDVal = rD_->value();
- deltaDVal = deltaD_->value();
- genDeltaD = deltaD_->genValue();
- }
-
-
- // Check whether we have a negative magnitude.
- // If so make it positive and add pi to the phases.
- if (rBVal < 0.0) {
- rBVal *= -1.0;
- deltaBVal += LauConstants::pi;
- }
- if (rDVal < 0.0) {
- rDVal *= -1.0;
- deltaDVal += LauConstants::pi;
- }
-
- // Check now whether the phases lie in the right range (-pi to pi).
- Bool_t deltaBWithinRange(kFALSE);
- Bool_t deltaDWithinRange(kFALSE);
- Bool_t gammaWithinRange(kFALSE);
- while ( deltaBWithinRange == kFALSE ) {
- if (deltaBVal > -LauConstants::pi && deltaBVal <= LauConstants::pi) {
- deltaBWithinRange = kTRUE;
- } else {
- // Not within the specified range
- if (deltaBVal > LauConstants::pi) {
- deltaBVal -= LauConstants::twoPi;
- } else if (deltaBVal <= -LauConstants::pi) {
- deltaBVal += LauConstants::twoPi;
- }
- }
- }
-
- while ( deltaDWithinRange == kFALSE ) {
- if (deltaDVal > -LauConstants::pi && deltaDVal <= LauConstants::pi) {
- deltaDWithinRange = kTRUE;
- } else {
- // Not within the specified range
- if (deltaDVal > LauConstants::pi) {
- deltaDVal -= LauConstants::twoPi;
- } else if (deltaDVal <= -LauConstants::pi) {
- deltaDVal += LauConstants::twoPi;
- }
- }
- }
-
- while ( gammaWithinRange == kFALSE ) {
- if (gammaVal > -LauConstants::pi && gammaVal <= LauConstants::pi) {
- gammaWithinRange = kTRUE;
- } else {
- // Not within the specified range
- if (gammaVal > LauConstants::pi) {
- gammaVal -= LauConstants::twoPi;
- } else if (gammaVal <= -LauConstants::pi) {
- gammaVal += LauConstants::twoPi;
- }
- }
- }
-
- // To resolve the two-fold ambiguity in gamma and deltaB we require gamma to be in the range 0-pi
- if ( decayType_ == ADS_Favoured || decayType_ == ADS_Suppressed || decayType_ == GLW_CPOdd || decayType_ == GLW_CPEven ) {
- if (gammaVal < 0.0) {
- if (deltaBVal <= 0.0) {
- gammaVal += LauConstants::pi;
- deltaBVal += LauConstants::pi;
- } else {
- gammaVal += LauConstants::pi;
- deltaBVal -= LauConstants::pi;
- }
- }
- }
-
- // A further problem can occur when the generated phase is close to -pi or pi.
- // The phase can wrap over to the other end of the scale -
- // this leads to artificially large pulls so we wrap it back.
- Double_t diff = deltaBVal - genDeltaB;
- if (diff > LauConstants::pi) {
- deltaBVal -= LauConstants::twoPi;
- } else if (diff < -LauConstants::pi) {
- deltaBVal += LauConstants::twoPi;
- }
-
- diff = deltaDVal - genDeltaD;
- if (diff > LauConstants::pi) {
- deltaDVal -= LauConstants::twoPi;
- } else if (diff < -LauConstants::pi) {
- deltaDVal += LauConstants::twoPi;
- }
-
- // finally store the new values in the parameters
- // and update the pulls
- gamma_->value(gammaVal);
- gamma_->updatePull();
- if ( decayType_ == ADS_Favoured || decayType_ == ADS_Suppressed || decayType_ == GLW_CPOdd || decayType_ == GLW_CPEven ) {
- rB_->value(rBVal);
- rB_->updatePull();
- deltaB_->value(deltaBVal);
- deltaB_->updatePull();
- }
- if ( decayType_ == ADS_Favoured || decayType_ == ADS_Suppressed || decayType_ == ADS_Favoured_btouOnly ) {
- rD_->value(rDVal);
- rD_->updatePull();
- deltaD_->value(deltaDVal);
- deltaD_->updatePull();
- }
+ // retrieve the current values from the parameters
+ Double_t gammaVal = gamma_->value();
+ Double_t rBVal = 0.0;
+ Double_t deltaBVal = 0.0;
+ Double_t genDeltaB = 0.0;
+ Double_t rDVal = 0.0;
+ Double_t deltaDVal = 0.0;
+ Double_t genDeltaD = 0.0;
+ if ( decayType_ == ADS_Favoured || decayType_ == ADS_Suppressed || decayType_ == GLW_CPOdd ||
+ decayType_ == GLW_CPEven ) {
+ rBVal = rB_->value();
+ deltaBVal = deltaB_->value();
+ genDeltaB = deltaB_->genValue();
+ }
+ if ( decayType_ == ADS_Favoured || decayType_ == ADS_Suppressed ||
+ decayType_ == ADS_Favoured_btouOnly ) {
+ rDVal = rD_->value();
+ deltaDVal = deltaD_->value();
+ genDeltaD = deltaD_->genValue();
+ }
+
+ // Check whether we have a negative magnitude.
+ // If so make it positive and add pi to the phases.
+ if ( rBVal < 0.0 ) {
+ rBVal *= -1.0;
+ deltaBVal += LauConstants::pi;
+ }
+ if ( rDVal < 0.0 ) {
+ rDVal *= -1.0;
+ deltaDVal += LauConstants::pi;
+ }
+
+ // Check now whether the phases lie in the right range (-pi to pi).
+ Bool_t deltaBWithinRange( kFALSE );
+ Bool_t deltaDWithinRange( kFALSE );
+ Bool_t gammaWithinRange( kFALSE );
+ while ( deltaBWithinRange == kFALSE ) {
+ if ( deltaBVal > -LauConstants::pi && deltaBVal <= LauConstants::pi ) {
+ deltaBWithinRange = kTRUE;
+ } else {
+ // Not within the specified range
+ if ( deltaBVal > LauConstants::pi ) {
+ deltaBVal -= LauConstants::twoPi;
+ } else if ( deltaBVal <= -LauConstants::pi ) {
+ deltaBVal += LauConstants::twoPi;
+ }
+ }
+ }
+
+ while ( deltaDWithinRange == kFALSE ) {
+ if ( deltaDVal > -LauConstants::pi && deltaDVal <= LauConstants::pi ) {
+ deltaDWithinRange = kTRUE;
+ } else {
+ // Not within the specified range
+ if ( deltaDVal > LauConstants::pi ) {
+ deltaDVal -= LauConstants::twoPi;
+ } else if ( deltaDVal <= -LauConstants::pi ) {
+ deltaDVal += LauConstants::twoPi;
+ }
+ }
+ }
+
+ while ( gammaWithinRange == kFALSE ) {
+ if ( gammaVal > -LauConstants::pi && gammaVal <= LauConstants::pi ) {
+ gammaWithinRange = kTRUE;
+ } else {
+ // Not within the specified range
+ if ( gammaVal > LauConstants::pi ) {
+ gammaVal -= LauConstants::twoPi;
+ } else if ( gammaVal <= -LauConstants::pi ) {
+ gammaVal += LauConstants::twoPi;
+ }
+ }
+ }
+
+ // To resolve the two-fold ambiguity in gamma and deltaB we require gamma to be in the range 0-pi
+ if ( decayType_ == ADS_Favoured || decayType_ == ADS_Suppressed || decayType_ == GLW_CPOdd ||
+ decayType_ == GLW_CPEven ) {
+ if ( gammaVal < 0.0 ) {
+ if ( deltaBVal <= 0.0 ) {
+ gammaVal += LauConstants::pi;
+ deltaBVal += LauConstants::pi;
+ } else {
+ gammaVal += LauConstants::pi;
+ deltaBVal -= LauConstants::pi;
+ }
+ }
+ }
+
+ // A further problem can occur when the generated phase is close to -pi or pi.
+ // The phase can wrap over to the other end of the scale -
+ // this leads to artificially large pulls so we wrap it back.
+ Double_t diff = deltaBVal - genDeltaB;
+ if ( diff > LauConstants::pi ) {
+ deltaBVal -= LauConstants::twoPi;
+ } else if ( diff < -LauConstants::pi ) {
+ deltaBVal += LauConstants::twoPi;
+ }
+
+ diff = deltaDVal - genDeltaD;
+ if ( diff > LauConstants::pi ) {
+ deltaDVal -= LauConstants::twoPi;
+ } else if ( diff < -LauConstants::pi ) {
+ deltaDVal += LauConstants::twoPi;
+ }
+
+ // finally store the new values in the parameters
+ // and update the pulls
+ gamma_->value( gammaVal );
+ gamma_->updatePull();
+ if ( decayType_ == ADS_Favoured || decayType_ == ADS_Suppressed || decayType_ == GLW_CPOdd ||
+ decayType_ == GLW_CPEven ) {
+ rB_->value( rBVal );
+ rB_->updatePull();
+ deltaB_->value( deltaBVal );
+ deltaB_->updatePull();
+ }
+ if ( decayType_ == ADS_Favoured || decayType_ == ADS_Suppressed ||
+ decayType_ == ADS_Favoured_btouOnly ) {
+ rD_->value( rDVal );
+ rD_->updatePull();
+ deltaD_->value( deltaDVal );
+ deltaD_->updatePull();
+ }
}
const LauComplex& LauPolarGammaCPCoeffSet::particleCoeff()
{
- this->updateAmplitudes();
- return particleCoeff_;
+ this->updateAmplitudes();
+ return particleCoeff_;
}
const LauComplex& LauPolarGammaCPCoeffSet::antiparticleCoeff()
{
- this->updateAmplitudes();
- return antiparticleCoeff_;
+ this->updateAmplitudes();
+ return antiparticleCoeff_;
}
void LauPolarGammaCPCoeffSet::updateAmplitudes()
{
- nonCPPart_.setRealImagPart( x_->unblindValue(), y_->unblindValue() );
-
- const Double_t gammaVal = gamma_->unblindValue();
-
- switch ( decayType_ ) {
-
- case GLW_CPOdd :
- {
- const Double_t rBVal = rB_->unblindValue();
- const Double_t deltaBVal = deltaB_->unblindValue();
- cpPart_.setRealImagPart( 1.0 - rBVal*TMath::Cos(deltaBVal + gammaVal), -rBVal*TMath::Sin(deltaBVal + gammaVal) );
- cpAntiPart_.setRealImagPart( 1.0 - rBVal*TMath::Cos(deltaBVal - gammaVal), -rBVal*TMath::Sin(deltaBVal - gammaVal) );
- break;
- }
-
- case GLW_CPEven :
- {
- const Double_t rBVal = rB_->unblindValue();
- const Double_t deltaBVal = deltaB_->unblindValue();
- cpPart_.setRealImagPart( 1.0 + rBVal*TMath::Cos(deltaBVal + gammaVal), rBVal*TMath::Sin(deltaBVal + gammaVal) );
- cpAntiPart_.setRealImagPart( 1.0 + rBVal*TMath::Cos(deltaBVal - gammaVal), rBVal*TMath::Sin(deltaBVal - gammaVal) );
- break;
- }
-
- case ADS_Favoured :
- {
- const Double_t rBVal = rB_->unblindValue();
- const Double_t deltaBVal = deltaB_->unblindValue();
- const Double_t rDVal = rD_->unblindValue();
- const Double_t deltaDVal = deltaD_->unblindValue();
- cpPart_.setRealImagPart( 1.0 + rBVal*rDVal*TMath::Cos(deltaBVal - deltaDVal + gammaVal), rBVal*rDVal*TMath::Sin(deltaBVal - deltaDVal + gammaVal) );
- cpAntiPart_.setRealImagPart( 1.0 + rBVal*rDVal*TMath::Cos(deltaBVal - deltaDVal - gammaVal), rBVal*rDVal*TMath::Sin(deltaBVal - deltaDVal - gammaVal) );
- break;
- }
-
- case ADS_Suppressed :
- {
- const Double_t rBVal = rB_->unblindValue();
- const Double_t deltaBVal = deltaB_->unblindValue();
- const Double_t rDVal = rD_->unblindValue();
- const Double_t deltaDVal = deltaD_->unblindValue();
- cpPart_.setRealImagPart( rDVal*TMath::Cos(-deltaDVal) + rBVal*TMath::Cos(deltaBVal + gammaVal), rDVal*TMath::Sin(-deltaDVal) + rBVal*TMath::Sin(deltaBVal + gammaVal) );
- cpAntiPart_.setRealImagPart( rDVal*TMath::Cos(-deltaDVal) + rBVal*TMath::Cos(deltaBVal - gammaVal), rDVal*TMath::Sin(-deltaDVal) + rBVal*TMath::Sin(deltaBVal - gammaVal) );
- break;
- }
-
- case GLW_CPOdd_btouOnly :
- nonCPPart_.rescale(-1.0);
- cpPart_.setRealImagPart( 1.0 * TMath::Cos( gammaVal ), 1.0 * TMath::Sin( gammaVal ) );
- cpAntiPart_.setRealImagPart( 1.0 * TMath::Cos( -gammaVal ), 1.0 * TMath::Sin( -gammaVal ) );
- break;
-
- case GLW_CPEven_btouOnly :
- cpPart_.setRealImagPart( 1.0 * TMath::Cos( gammaVal ), 1.0 * TMath::Sin( gammaVal ) );
- cpAntiPart_.setRealImagPart( 1.0 * TMath::Cos( -gammaVal ), 1.0 * TMath::Sin( -gammaVal ) );
- break;
-
- case ADS_Favoured_btouOnly :
- {
- const Double_t rDVal = rD_->unblindValue();
- const Double_t deltaDVal = deltaD_->unblindValue();
- cpPart_.setRealImagPart( rDVal * TMath::Cos( -deltaDVal + gammaVal ), rDVal * TMath::Sin( -deltaDVal + gammaVal ) );
- cpAntiPart_.setRealImagPart( rDVal * TMath::Cos( -deltaDVal - gammaVal ), rDVal * TMath::Sin( -deltaDVal - gammaVal ) );
- break;
- }
-
- case ADS_Suppressed_btouOnly :
- cpPart_.setRealImagPart( 1.0 * TMath::Cos( gammaVal ), 1.0 * TMath::Sin( gammaVal ) );
- cpAntiPart_.setRealImagPart( 1.0 * TMath::Cos( -gammaVal ), 1.0 * TMath::Sin( -gammaVal ) );
- break;
-
- }
-
- particleCoeff_ = nonCPPart_ * cpPart_;
- antiparticleCoeff_ = nonCPPart_ * cpAntiPart_;
+ nonCPPart_.setRealImagPart( x_->unblindValue(), y_->unblindValue() );
+
+ const Double_t gammaVal = gamma_->unblindValue();
+
+ switch ( decayType_ ) {
+
+ case GLW_CPOdd : {
+ const Double_t rBVal = rB_->unblindValue();
+ const Double_t deltaBVal = deltaB_->unblindValue();
+ cpPart_.setRealImagPart( 1.0 - rBVal * TMath::Cos( deltaBVal + gammaVal ),
+ -rBVal * TMath::Sin( deltaBVal + gammaVal ) );
+ cpAntiPart_.setRealImagPart( 1.0 - rBVal * TMath::Cos( deltaBVal - gammaVal ),
+ -rBVal * TMath::Sin( deltaBVal - gammaVal ) );
+ break;
+ }
+
+ case GLW_CPEven : {
+ const Double_t rBVal = rB_->unblindValue();
+ const Double_t deltaBVal = deltaB_->unblindValue();
+ cpPart_.setRealImagPart( 1.0 + rBVal * TMath::Cos( deltaBVal + gammaVal ),
+ rBVal * TMath::Sin( deltaBVal + gammaVal ) );
+ cpAntiPart_.setRealImagPart( 1.0 + rBVal * TMath::Cos( deltaBVal - gammaVal ),
+ rBVal * TMath::Sin( deltaBVal - gammaVal ) );
+ break;
+ }
+
+ case ADS_Favoured : {
+ const Double_t rBVal = rB_->unblindValue();
+ const Double_t deltaBVal = deltaB_->unblindValue();
+ const Double_t rDVal = rD_->unblindValue();
+ const Double_t deltaDVal = deltaD_->unblindValue();
+ cpPart_.setRealImagPart( 1.0 + rBVal * rDVal *
+ TMath::Cos( deltaBVal - deltaDVal + gammaVal ),
+ rBVal * rDVal * TMath::Sin( deltaBVal - deltaDVal + gammaVal ) );
+ cpAntiPart_.setRealImagPart(
+ 1.0 + rBVal * rDVal * TMath::Cos( deltaBVal - deltaDVal - gammaVal ),
+ rBVal * rDVal * TMath::Sin( deltaBVal - deltaDVal - gammaVal ) );
+ break;
+ }
+
+ case ADS_Suppressed : {
+ const Double_t rBVal = rB_->unblindValue();
+ const Double_t deltaBVal = deltaB_->unblindValue();
+ const Double_t rDVal = rD_->unblindValue();
+ const Double_t deltaDVal = deltaD_->unblindValue();
+ cpPart_.setRealImagPart(
+ rDVal * TMath::Cos( -deltaDVal ) + rBVal * TMath::Cos( deltaBVal + gammaVal ),
+ rDVal * TMath::Sin( -deltaDVal ) + rBVal * TMath::Sin( deltaBVal + gammaVal ) );
+ cpAntiPart_.setRealImagPart(
+ rDVal * TMath::Cos( -deltaDVal ) + rBVal * TMath::Cos( deltaBVal - gammaVal ),
+ rDVal * TMath::Sin( -deltaDVal ) + rBVal * TMath::Sin( deltaBVal - gammaVal ) );
+ break;
+ }
+
+ case GLW_CPOdd_btouOnly :
+ nonCPPart_.rescale( -1.0 );
+ cpPart_.setRealImagPart( 1.0 * TMath::Cos( gammaVal ), 1.0 * TMath::Sin( gammaVal ) );
+ cpAntiPart_.setRealImagPart( 1.0 * TMath::Cos( -gammaVal ),
+ 1.0 * TMath::Sin( -gammaVal ) );
+ break;
+
+ case GLW_CPEven_btouOnly :
+ cpPart_.setRealImagPart( 1.0 * TMath::Cos( gammaVal ), 1.0 * TMath::Sin( gammaVal ) );
+ cpAntiPart_.setRealImagPart( 1.0 * TMath::Cos( -gammaVal ),
+ 1.0 * TMath::Sin( -gammaVal ) );
+ break;
+
+ case ADS_Favoured_btouOnly : {
+ const Double_t rDVal = rD_->unblindValue();
+ const Double_t deltaDVal = deltaD_->unblindValue();
+ cpPart_.setRealImagPart( rDVal * TMath::Cos( -deltaDVal + gammaVal ),
+ rDVal * TMath::Sin( -deltaDVal + gammaVal ) );
+ cpAntiPart_.setRealImagPart( rDVal * TMath::Cos( -deltaDVal - gammaVal ),
+ rDVal * TMath::Sin( -deltaDVal - gammaVal ) );
+ break;
+ }
+
+ case ADS_Suppressed_btouOnly :
+ cpPart_.setRealImagPart( 1.0 * TMath::Cos( gammaVal ), 1.0 * TMath::Sin( gammaVal ) );
+ cpAntiPart_.setRealImagPart( 1.0 * TMath::Cos( -gammaVal ),
+ 1.0 * TMath::Sin( -gammaVal ) );
+ break;
+ }
+
+ particleCoeff_ = nonCPPart_ * cpPart_;
+ antiparticleCoeff_ = nonCPPart_ * cpAntiPart_;
}
void LauPolarGammaCPCoeffSet::setCoeffValues( const LauComplex&, const LauComplex&, Bool_t )
{
- std::cerr << "ERROR in LauPolarGammaCPCoeffSet::setCoeffValues : Method not supported by this class - too many parameters" << std::endl;
+ std::cerr << "ERROR in LauPolarGammaCPCoeffSet::setCoeffValues : Method not supported by this class - too many parameters"
+ << std::endl;
}
LauParameter LauPolarGammaCPCoeffSet::acp()
{
- // set the name
- TString parName(this->baseName()); parName += "_ACP";
- acp_.name(parName);
-
- // work out the ACP value
- LauComplex nonCPPart( x_->value(), y_->value() );
- LauComplex cpPart;
- LauComplex cpAntiPart;
-
- const Double_t gammaVal = gamma_->value();
-
- switch ( decayType_ ) {
-
- case GLW_CPOdd :
- {
- const Double_t rBVal = rB_->value();
- const Double_t deltaBVal = deltaB_->value();
- cpPart.setRealImagPart( 1.0 - rBVal*TMath::Cos(deltaBVal + gammaVal), -rBVal*TMath::Sin(deltaBVal + gammaVal) );
- cpAntiPart.setRealImagPart( 1.0 - rBVal*TMath::Cos(deltaBVal - gammaVal), -rBVal*TMath::Sin(deltaBVal - gammaVal) );
- break;
- }
-
- case GLW_CPEven :
- {
- const Double_t rBVal = rB_->value();
- const Double_t deltaBVal = deltaB_->value();
- cpPart.setRealImagPart( 1.0 + rBVal*TMath::Cos(deltaBVal + gammaVal), rBVal*TMath::Sin(deltaBVal + gammaVal) );
- cpAntiPart.setRealImagPart( 1.0 + rBVal*TMath::Cos(deltaBVal - gammaVal), rBVal*TMath::Sin(deltaBVal - gammaVal) );
- break;
- }
-
- case ADS_Favoured :
- {
- const Double_t rBVal = rB_->value();
- const Double_t deltaBVal = deltaB_->value();
- const Double_t rDVal = rD_->value();
- const Double_t deltaDVal = deltaD_->value();
- cpPart.setRealImagPart( 1.0 + rBVal*rDVal*TMath::Cos(deltaBVal - deltaDVal + gammaVal), rBVal*rDVal*TMath::Sin(deltaBVal - deltaDVal + gammaVal) );
- cpAntiPart.setRealImagPart( 1.0 + rBVal*rDVal*TMath::Cos(deltaBVal - deltaDVal - gammaVal), rBVal*rDVal*TMath::Sin(deltaBVal - deltaDVal - gammaVal) );
- break;
- }
-
- case ADS_Suppressed :
- {
- const Double_t rBVal = rB_->value();
- const Double_t deltaBVal = deltaB_->value();
- const Double_t rDVal = rD_->value();
- const Double_t deltaDVal = deltaD_->value();
- cpPart.setRealImagPart( rDVal*TMath::Cos(-deltaDVal) + rBVal*TMath::Cos(deltaBVal + gammaVal), rDVal*TMath::Sin(-deltaDVal) + rBVal*TMath::Sin(deltaBVal + gammaVal) );
- cpAntiPart.setRealImagPart( rDVal*TMath::Cos(-deltaDVal) + rBVal*TMath::Cos(deltaBVal - gammaVal), rDVal*TMath::Sin(-deltaDVal) + rBVal*TMath::Sin(deltaBVal - gammaVal) );
- break;
- }
-
- case GLW_CPOdd_btouOnly :
- nonCPPart.rescale(-1.0);
- cpPart.setRealImagPart( 1.0 * TMath::Cos( gammaVal ), 1.0 * TMath::Sin( gammaVal ) );
- cpAntiPart.setRealImagPart( 1.0 * TMath::Cos( -gammaVal ), 1.0 * TMath::Sin( -gammaVal ) );
- break;
-
- case GLW_CPEven_btouOnly :
- cpPart.setRealImagPart( 1.0 * TMath::Cos( gammaVal ), 1.0 * TMath::Sin( gammaVal ) );
- cpAntiPart.setRealImagPart( 1.0 * TMath::Cos( -gammaVal ), 1.0 * TMath::Sin( -gammaVal ) );
- break;
-
- case ADS_Favoured_btouOnly :
- {
- const Double_t rDVal = rD_->value();
- const Double_t deltaDVal = deltaD_->value();
- cpPart.setRealImagPart( rDVal * TMath::Cos( -deltaDVal + gammaVal ), rDVal * TMath::Sin( -deltaDVal + gammaVal ) );
- cpAntiPart.setRealImagPart( rDVal * TMath::Cos( -deltaDVal - gammaVal ), rDVal * TMath::Sin( -deltaDVal - gammaVal ) );
- break;
- }
-
- case ADS_Suppressed_btouOnly :
- cpPart.setRealImagPart( 1.0 * TMath::Cos( gammaVal ), 1.0 * TMath::Sin( gammaVal ) );
- cpAntiPart.setRealImagPart( 1.0 * TMath::Cos( -gammaVal ), 1.0 * TMath::Sin( -gammaVal ) );
- break;
-
-
- }
-
- const LauComplex partCoeff = nonCPPart * cpPart;
- const LauComplex antiCoeff = nonCPPart * cpAntiPart;
-
- const Double_t numer = antiCoeff.abs2() - partCoeff.abs2();
- const Double_t denom = antiCoeff.abs2() + partCoeff.abs2();
- const Double_t value = numer/denom;
-
- // is it fixed?
- const Bool_t fixed = gamma_->fixed();
- acp_.fixed(fixed);
-
- // we can't work out the error without the covariance matrix
- const Double_t error(0.0);
-
- // set the value and error
- acp_.valueAndErrors(value,error);
-
- return acp_;
+ // set the name
+ TString parName( this->baseName() );
+ parName += "_ACP";
+ acp_.name( parName );
+
+ // work out the ACP value
+ LauComplex nonCPPart( x_->value(), y_->value() );
+ LauComplex cpPart;
+ LauComplex cpAntiPart;
+
+ const Double_t gammaVal = gamma_->value();
+
+ switch ( decayType_ ) {
+
+ case GLW_CPOdd : {
+ const Double_t rBVal = rB_->value();
+ const Double_t deltaBVal = deltaB_->value();
+ cpPart.setRealImagPart( 1.0 - rBVal * TMath::Cos( deltaBVal + gammaVal ),
+ -rBVal * TMath::Sin( deltaBVal + gammaVal ) );
+ cpAntiPart.setRealImagPart( 1.0 - rBVal * TMath::Cos( deltaBVal - gammaVal ),
+ -rBVal * TMath::Sin( deltaBVal - gammaVal ) );
+ break;
+ }
+
+ case GLW_CPEven : {
+ const Double_t rBVal = rB_->value();
+ const Double_t deltaBVal = deltaB_->value();
+ cpPart.setRealImagPart( 1.0 + rBVal * TMath::Cos( deltaBVal + gammaVal ),
+ rBVal * TMath::Sin( deltaBVal + gammaVal ) );
+ cpAntiPart.setRealImagPart( 1.0 + rBVal * TMath::Cos( deltaBVal - gammaVal ),
+ rBVal * TMath::Sin( deltaBVal - gammaVal ) );
+ break;
+ }
+
+ case ADS_Favoured : {
+ const Double_t rBVal = rB_->value();
+ const Double_t deltaBVal = deltaB_->value();
+ const Double_t rDVal = rD_->value();
+ const Double_t deltaDVal = deltaD_->value();
+ cpPart.setRealImagPart( 1.0 + rBVal * rDVal *
+ TMath::Cos( deltaBVal - deltaDVal + gammaVal ),
+ rBVal * rDVal * TMath::Sin( deltaBVal - deltaDVal + gammaVal ) );
+ cpAntiPart.setRealImagPart(
+ 1.0 + rBVal * rDVal * TMath::Cos( deltaBVal - deltaDVal - gammaVal ),
+ rBVal * rDVal * TMath::Sin( deltaBVal - deltaDVal - gammaVal ) );
+ break;
+ }
+
+ case ADS_Suppressed : {
+ const Double_t rBVal = rB_->value();
+ const Double_t deltaBVal = deltaB_->value();
+ const Double_t rDVal = rD_->value();
+ const Double_t deltaDVal = deltaD_->value();
+ cpPart.setRealImagPart(
+ rDVal * TMath::Cos( -deltaDVal ) + rBVal * TMath::Cos( deltaBVal + gammaVal ),
+ rDVal * TMath::Sin( -deltaDVal ) + rBVal * TMath::Sin( deltaBVal + gammaVal ) );
+ cpAntiPart.setRealImagPart(
+ rDVal * TMath::Cos( -deltaDVal ) + rBVal * TMath::Cos( deltaBVal - gammaVal ),
+ rDVal * TMath::Sin( -deltaDVal ) + rBVal * TMath::Sin( deltaBVal - gammaVal ) );
+ break;
+ }
+
+ case GLW_CPOdd_btouOnly :
+ nonCPPart.rescale( -1.0 );
+ cpPart.setRealImagPart( 1.0 * TMath::Cos( gammaVal ), 1.0 * TMath::Sin( gammaVal ) );
+ cpAntiPart.setRealImagPart( 1.0 * TMath::Cos( -gammaVal ), 1.0 * TMath::Sin( -gammaVal ) );
+ break;
+
+ case GLW_CPEven_btouOnly :
+ cpPart.setRealImagPart( 1.0 * TMath::Cos( gammaVal ), 1.0 * TMath::Sin( gammaVal ) );
+ cpAntiPart.setRealImagPart( 1.0 * TMath::Cos( -gammaVal ), 1.0 * TMath::Sin( -gammaVal ) );
+ break;
+
+ case ADS_Favoured_btouOnly : {
+ const Double_t rDVal = rD_->value();
+ const Double_t deltaDVal = deltaD_->value();
+ cpPart.setRealImagPart( rDVal * TMath::Cos( -deltaDVal + gammaVal ),
+ rDVal * TMath::Sin( -deltaDVal + gammaVal ) );
+ cpAntiPart.setRealImagPart( rDVal * TMath::Cos( -deltaDVal - gammaVal ),
+ rDVal * TMath::Sin( -deltaDVal - gammaVal ) );
+ break;
+ }
+
+ case ADS_Suppressed_btouOnly :
+ cpPart.setRealImagPart( 1.0 * TMath::Cos( gammaVal ), 1.0 * TMath::Sin( gammaVal ) );
+ cpAntiPart.setRealImagPart( 1.0 * TMath::Cos( -gammaVal ), 1.0 * TMath::Sin( -gammaVal ) );
+ break;
+ }
+
+ const LauComplex partCoeff = nonCPPart * cpPart;
+ const LauComplex antiCoeff = nonCPPart * cpAntiPart;
+
+ const Double_t numer = antiCoeff.abs2() - partCoeff.abs2();
+ const Double_t denom = antiCoeff.abs2() + partCoeff.abs2();
+ const Double_t value = numer / denom;
+
+ // is it fixed?
+ const Bool_t fixed = gamma_->fixed();
+ acp_.fixed( fixed );
+
+ // we can't work out the error without the covariance matrix
+ const Double_t error( 0.0 );
+
+ // set the value and error
+ acp_.valueAndErrors( value, error );
+
+ return acp_;
}
-LauAbsCoeffSet* LauPolarGammaCPCoeffSet::createClone(const TString& newName, CloneOption cloneOption, Double_t constFactor)
+LauAbsCoeffSet* LauPolarGammaCPCoeffSet::createClone( const TString& newName,
+ CloneOption cloneOption,
+ Double_t constFactor )
{
- LauAbsCoeffSet* clone(0);
- if ( cloneOption == All || cloneOption == TieRealPart || cloneOption == TieImagPart || cloneOption == TieCPPars ) {
- clone = new LauPolarGammaCPCoeffSet( *this, cloneOption, constFactor );
- clone->name( newName );
- } else {
- std::cerr << "ERROR in LauPolarGammaCPCoeffSet::createClone : Invalid clone option" << std::endl;
- }
- return clone;
+ LauAbsCoeffSet* clone( 0 );
+ if ( cloneOption == All || cloneOption == TieRealPart || cloneOption == TieImagPart ||
+ cloneOption == TieCPPars ) {
+ clone = new LauPolarGammaCPCoeffSet( *this, cloneOption, constFactor );
+ clone->name( newName );
+ } else {
+ std::cerr << "ERROR in LauPolarGammaCPCoeffSet::createClone : Invalid clone option"
+ << std::endl;
+ }
+ return clone;
}
-
diff --git a/src/LauPoleRes.cc b/src/LauPoleRes.cc
index 8525415..b891ee5 100644
--- a/src/LauPoleRes.cc
+++ b/src/LauPoleRes.cc
@@ -1,76 +1,75 @@
/*
Copyright 2018 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauPoleRes.cc
\brief File containing implementation of LauPoleRes class.
*/
#include "LauPoleRes.hh"
-
-
-LauPoleRes::LauPoleRes(LauResonanceInfo* resInfo, const Int_t resPairAmpInt, const LauDaughters* daughters) :
- LauAbsResonance(resInfo, resPairAmpInt, daughters)
+LauPoleRes::LauPoleRes( LauResonanceInfo* resInfo,
+ const Int_t resPairAmpInt,
+ const LauDaughters* daughters ) :
+ LauAbsResonance( resInfo, resPairAmpInt, daughters )
{
}
LauPoleRes::~LauPoleRes()
{
}
void LauPoleRes::initialise()
{
}
-LauComplex LauPoleRes::resAmp(Double_t mass, Double_t spinTerm)
+LauComplex LauPoleRes::resAmp( Double_t mass, Double_t spinTerm )
{
- // This function returns the complex dynamical amplitude for a pole. 1/((mpole*mpole)-m*m)
- // mpole==(m0-iw0)==(rePole-i*imPole), to use the already defined mass and width of the resonance
+ // This function returns the complex dynamical amplitude for a pole. 1/((mpole*mpole)-m*m)
+ // mpole==(m0-iw0)==(rePole-i*imPole), to use the already defined mass and width of the resonance
- Double_t rePole = this->getMass();
- Double_t imPole = this->getWidth();
- Double_t reTerm = rePole*rePole -imPole*imPole -mass*mass;
- Double_t imTerm = 2.0*rePole*imPole;
+ Double_t rePole = this->getMass();
+ Double_t imPole = this->getWidth();
+ Double_t reTerm = rePole * rePole - imPole * imPole - mass * mass;
+ Double_t imTerm = 2.0 * rePole * imPole;
- LauComplex resAmplitude(reTerm, imTerm);
+ LauComplex resAmplitude( reTerm, imTerm );
- resAmplitude.rescale(1./(reTerm*reTerm + imTerm*imTerm));
+ resAmplitude.rescale( 1. / ( reTerm * reTerm + imTerm * imTerm ) );
- return resAmplitude.scale(spinTerm);
+ return resAmplitude.scale( spinTerm );
}
const std::vector<LauParameter*>& LauPoleRes::getFloatingParameters()
{
- this->clearFloatingParameters();
+ this->clearFloatingParameters();
- if ( ! this->fixMass() ) {
- this->addFloatingParameter( this->getMassPar() );
- }
- if ( ! this->fixWidth() ) {
- this->addFloatingParameter( this->getWidthPar() );
- }
+ if ( ! this->fixMass() ) {
+ this->addFloatingParameter( this->getMassPar() );
+ }
+ if ( ! this->fixWidth() ) {
+ this->addFloatingParameter( this->getWidthPar() );
+ }
- return this->getParameters();
+ return this->getParameters();
}
-
diff --git a/src/LauPrint.cc b/src/LauPrint.cc
index 31f5e15..d781592 100644
--- a/src/LauPrint.cc
+++ b/src/LauPrint.cc
@@ -1,64 +1,62 @@
/*
Copyright 2004 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauPrint.cc
\brief File containing implementation of LauPrint class.
*/
-#include <iostream>
-
-#include "TMath.h"
-
#include "LauPrint.hh"
+#include "TMath.h"
+#include <iostream>
LauPrint::LauPrint()
{
}
LauPrint::~LauPrint()
{
}
-void LauPrint::printFormat(std::ostream& stream, Double_t value) const
+void LauPrint::printFormat( std::ostream& stream, Double_t value ) const
{
- // Print double value to a specified level of precision
- char* string = new char[100];
-
- if (TMath::Abs(value) < 1e-30) {
- sprintf(string, "%5.3f", 0.0);
- } else if (TMath::Abs(value) < 0.01) {
- sprintf(string, "%5.3e", value);
- } else if (TMath::Abs(value) < 0.1) {
- sprintf(string, "%5.3f", value);
- } else {
- sprintf(string, "%5.3f", value);
- }
-
- stream<<string;
-
- delete[] string; string = 0;
+ // Print double value to a specified level of precision
+ char* string = new char[100];
+
+ if ( TMath::Abs( value ) < 1e-30 ) {
+ sprintf( string, "%5.3f", 0.0 );
+ } else if ( TMath::Abs( value ) < 0.01 ) {
+ sprintf( string, "%5.3e", value );
+ } else if ( TMath::Abs( value ) < 0.1 ) {
+ sprintf( string, "%5.3f", value );
+ } else {
+ sprintf( string, "%5.3f", value );
+ }
+
+ stream << string;
+
+ delete[] string;
+ string = 0;
}
-
diff --git a/src/LauRandom.cc b/src/LauRandom.cc
index 212f443..42150ad 100644
--- a/src/LauRandom.cc
+++ b/src/LauRandom.cc
@@ -1,60 +1,62 @@
/*
Copyright 2005 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauRandom.cc
\brief File containing implementation of LauRandom methods.
*/
-
#include "LauRandom.hh"
#include "TRandom3.h"
TRandom* LauRandom::randomFun()
{
- // Returns a pointer to a singleton random-number generator implementation.
- // Creates the object the first time it is called.
-
- static TRandom* theGenerator = 0;
- if (theGenerator == 0) {theGenerator = new TRandom3(65539);}
- return theGenerator;
+ // Returns a pointer to a singleton random-number generator implementation.
+ // Creates the object the first time it is called.
+
+ static TRandom* theGenerator = 0;
+ if ( theGenerator == 0 ) {
+ theGenerator = new TRandom3( 65539 );
+ }
+ return theGenerator;
}
TRandom* LauRandom::zeroSeedRandom()
{
- // Returns a pointer to a singleton random-number generator implementation.
- // Creates the object the first time it is called.
-
- static TRandom* theGenerator = 0;
- if (theGenerator == 0) {theGenerator = new TRandom3(0);}
- // Use TRandom3(0) to set seed from machine clock time (within +-1 sec).
- return theGenerator;
+ // Returns a pointer to a singleton random-number generator implementation.
+ // Creates the object the first time it is called.
+
+ static TRandom* theGenerator = 0;
+ if ( theGenerator == 0 ) {
+ theGenerator = new TRandom3( 0 );
+ }
+ // Use TRandom3(0) to set seed from machine clock time (within +-1 sec).
+ return theGenerator;
}
-void LauRandom::setSeed(UInt_t seed)
+void LauRandom::setSeed( UInt_t seed )
{
- TRandom* theGenerator = randomFun();
- theGenerator->SetSeed(seed);
+ TRandom* theGenerator = randomFun();
+ theGenerator->SetSeed( seed );
}
-
diff --git a/src/LauRealImagCPCoeffSet.cc b/src/LauRealImagCPCoeffSet.cc
index 6c878a5..17d654d 100644
--- a/src/LauRealImagCPCoeffSet.cc
+++ b/src/LauRealImagCPCoeffSet.cc
@@ -1,257 +1,293 @@
/*
Copyright 2014 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauRealImagCPCoeffSet.cc
\brief File containing implementation of LauRealImagCPCoeffSet class.
*/
-#include <iostream>
-#include <fstream>
-#include <vector>
-
-#include "TMath.h"
-#include "TRandom.h"
-
#include "LauRealImagCPCoeffSet.hh"
+
#include "LauComplex.hh"
#include "LauConstants.hh"
#include "LauParameter.hh"
#include "LauPrint.hh"
+#include "TMath.h"
+#include "TRandom.h"
+#include <fstream>
+#include <iostream>
+#include <vector>
-LauRealImagCPCoeffSet::LauRealImagCPCoeffSet(const TString& compName, Double_t x, Double_t y, Double_t xbar, Double_t ybar,
- Bool_t xFixed, Bool_t yFixed, Bool_t xbarFixed, Bool_t ybarFixed) :
- LauAbsCoeffSet(compName),
- x_(new LauParameter("X", x, minRealImagPart_, maxRealImagPart_, xFixed)),
- y_(new LauParameter("Y", y, minRealImagPart_, maxRealImagPart_, yFixed)),
- xbar_(new LauParameter("Xbar", xbar, minRealImagPart_, maxRealImagPart_, xbarFixed)),
- ybar_(new LauParameter("Ybar", ybar, minRealImagPart_, maxRealImagPart_, ybarFixed)),
- particleCoeff_(x,y),
- antiparticleCoeff_(xbar,ybar),
- acp_("ACP", 0.0, -1.0, 1.0, kTRUE)
+LauRealImagCPCoeffSet::LauRealImagCPCoeffSet( const TString& compName,
+ Double_t x,
+ Double_t y,
+ Double_t xbar,
+ Double_t ybar,
+ Bool_t xFixed,
+ Bool_t yFixed,
+ Bool_t xbarFixed,
+ Bool_t ybarFixed ) :
+ LauAbsCoeffSet( compName ),
+ x_( new LauParameter( "X", x, minRealImagPart_, maxRealImagPart_, xFixed ) ),
+ y_( new LauParameter( "Y", y, minRealImagPart_, maxRealImagPart_, yFixed ) ),
+ xbar_( new LauParameter( "Xbar", xbar, minRealImagPart_, maxRealImagPart_, xbarFixed ) ),
+ ybar_( new LauParameter( "Ybar", ybar, minRealImagPart_, maxRealImagPart_, ybarFixed ) ),
+ particleCoeff_( x, y ),
+ antiparticleCoeff_( xbar, ybar ),
+ acp_( "ACP", 0.0, -1.0, 1.0, kTRUE )
{
}
-LauRealImagCPCoeffSet::LauRealImagCPCoeffSet(const LauRealImagCPCoeffSet& rhs, CloneOption cloneOption, Double_t constFactor) : LauAbsCoeffSet(rhs.name()),
- x_(0),
- y_(0),
- xbar_(0),
- ybar_(0),
- particleCoeff_( rhs.particleCoeff_ ),
- antiparticleCoeff_( rhs.antiparticleCoeff_ ),
- acp_( rhs.acp_ )
+LauRealImagCPCoeffSet::LauRealImagCPCoeffSet( const LauRealImagCPCoeffSet& rhs,
+ CloneOption cloneOption,
+ Double_t constFactor ) :
+ LauAbsCoeffSet( rhs.name() ),
+ x_( 0 ),
+ y_( 0 ),
+ xbar_( 0 ),
+ ybar_( 0 ),
+ particleCoeff_( rhs.particleCoeff_ ),
+ antiparticleCoeff_( rhs.antiparticleCoeff_ ),
+ acp_( rhs.acp_ )
{
- if ( cloneOption == All || cloneOption == TieRealPart ) {
- x_ = rhs.x_->createClone(constFactor);
- xbar_ = rhs.xbar_->createClone(constFactor);
- } else {
- x_ = new LauParameter("X", rhs.x_->value(), minRealImagPart_, maxRealImagPart_, rhs.x_->fixed());
- if ( rhs.x_->blind() ) {
- const LauBlind* blinder = rhs.x_->blinder();
- x_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
- }
- xbar_ = new LauParameter("Xbar", rhs.xbar_->value(), minRealImagPart_, maxRealImagPart_, rhs.xbar_->fixed());
- if ( rhs.xbar_->blind() ) {
- const LauBlind* blinder = rhs.xbar_->blinder();
- xbar_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
- }
- }
-
- if ( cloneOption == All || cloneOption == TieImagPart ) {
- y_ = rhs.y_->createClone(constFactor);
- ybar_ = rhs.ybar_->createClone(constFactor);
- } else {
- y_ = new LauParameter("Y", rhs.y_->value(), minRealImagPart_, maxRealImagPart_, rhs.y_->fixed());
- if ( rhs.y_->blind() ) {
- const LauBlind* blinder = rhs.y_->blinder();
- y_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
- }
- ybar_ = new LauParameter("Ybar", rhs.ybar_->value(), minRealImagPart_, maxRealImagPart_, rhs.ybar_->fixed());
- if ( rhs.ybar_->blind() ) {
- const LauBlind* blinder = rhs.ybar_->blinder();
- ybar_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
- }
- }
+ if ( cloneOption == All || cloneOption == TieRealPart ) {
+ x_ = rhs.x_->createClone( constFactor );
+ xbar_ = rhs.xbar_->createClone( constFactor );
+ } else {
+ x_ = new LauParameter( "X",
+ rhs.x_->value(),
+ minRealImagPart_,
+ maxRealImagPart_,
+ rhs.x_->fixed() );
+ if ( rhs.x_->blind() ) {
+ const LauBlind* blinder = rhs.x_->blinder();
+ x_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
+ }
+ xbar_ = new LauParameter( "Xbar",
+ rhs.xbar_->value(),
+ minRealImagPart_,
+ maxRealImagPart_,
+ rhs.xbar_->fixed() );
+ if ( rhs.xbar_->blind() ) {
+ const LauBlind* blinder = rhs.xbar_->blinder();
+ xbar_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
+ }
+ }
+
+ if ( cloneOption == All || cloneOption == TieImagPart ) {
+ y_ = rhs.y_->createClone( constFactor );
+ ybar_ = rhs.ybar_->createClone( constFactor );
+ } else {
+ y_ = new LauParameter( "Y",
+ rhs.y_->value(),
+ minRealImagPart_,
+ maxRealImagPart_,
+ rhs.y_->fixed() );
+ if ( rhs.y_->blind() ) {
+ const LauBlind* blinder = rhs.y_->blinder();
+ y_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
+ }
+ ybar_ = new LauParameter( "Ybar",
+ rhs.ybar_->value(),
+ minRealImagPart_,
+ maxRealImagPart_,
+ rhs.ybar_->fixed() );
+ if ( rhs.ybar_->blind() ) {
+ const LauBlind* blinder = rhs.ybar_->blinder();
+ ybar_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
+ }
+ }
}
std::vector<LauParameter*> LauRealImagCPCoeffSet::getParameters()
{
- std::vector<LauParameter*> pars;
- pars.push_back(x_);
- pars.push_back(y_);
- pars.push_back(xbar_);
- pars.push_back(ybar_);
- return pars;
+ std::vector<LauParameter*> pars;
+ pars.push_back( x_ );
+ pars.push_back( y_ );
+ pars.push_back( xbar_ );
+ pars.push_back( ybar_ );
+ return pars;
}
void LauRealImagCPCoeffSet::printParValues() const
{
- std::cout << "INFO in LauRealImagCPCoeffSet::printParValues : Component \"" << this->name() << "\" has ";
- std::cout << "x = " << x_->value() << ",\t";
- std::cout << "y = " << y_->value() << ",\t";
- std::cout << "xbar = " << xbar_->value() << ",\t";
- std::cout << "ybar = " << ybar_->value() << "." << std::endl;
+ std::cout << "INFO in LauRealImagCPCoeffSet::printParValues : Component \"" << this->name()
+ << "\" has ";
+ std::cout << "x = " << x_->value() << ",\t";
+ std::cout << "y = " << y_->value() << ",\t";
+ std::cout << "xbar = " << xbar_->value() << ",\t";
+ std::cout << "ybar = " << ybar_->value() << "." << std::endl;
}
-void LauRealImagCPCoeffSet::printTableHeading(std::ostream& stream) const
+void LauRealImagCPCoeffSet::printTableHeading( std::ostream& stream ) const
{
- stream<<"\\begin{tabular}{|l|c|c|c|c|}"<<std::endl;
- stream<<"\\hline"<<std::endl;
- stream<<"Component & Particle Real Part & Particle Imaginary Part & Antiparticle Real Part & Antiparticle Imaginary Part \\\\"<<std::endl;
- stream<<"\\hline"<<std::endl;
+ stream << "\\begin{tabular}{|l|c|c|c|c|}" << std::endl;
+ stream << "\\hline" << std::endl;
+ stream << "Component & Particle Real Part & Particle Imaginary Part & Antiparticle Real Part & Antiparticle Imaginary Part \\\\"
+ << std::endl;
+ stream << "\\hline" << std::endl;
}
-void LauRealImagCPCoeffSet::printTableRow(std::ostream& stream) const
+void LauRealImagCPCoeffSet::printTableRow( std::ostream& stream ) const
{
- LauPrint print;
- TString resName = this->name();
- resName = resName.ReplaceAll("_", "\\_");
- stream<<resName<<" & $";
- print.printFormat(stream, x_->value());
- stream<<" \\pm ";
- print.printFormat(stream, x_->error());
- stream<<"$ & $";
- print.printFormat(stream, y_->value());
- stream<<" \\pm ";
- print.printFormat(stream, y_->error());
- stream<<"$ & $";
- print.printFormat(stream, xbar_->value());
- stream<<" \\pm ";
- print.printFormat(stream, xbar_->error());
- stream<<"$ & $";
- print.printFormat(stream, ybar_->value());
- stream<<" \\pm ";
- print.printFormat(stream, ybar_->error());
- stream<<"$ \\\\"<<std::endl;
+ LauPrint print;
+ TString resName = this->name();
+ resName = resName.ReplaceAll( "_", "\\_" );
+ stream << resName << " & $";
+ print.printFormat( stream, x_->value() );
+ stream << " \\pm ";
+ print.printFormat( stream, x_->error() );
+ stream << "$ & $";
+ print.printFormat( stream, y_->value() );
+ stream << " \\pm ";
+ print.printFormat( stream, y_->error() );
+ stream << "$ & $";
+ print.printFormat( stream, xbar_->value() );
+ stream << " \\pm ";
+ print.printFormat( stream, xbar_->error() );
+ stream << "$ & $";
+ print.printFormat( stream, ybar_->value() );
+ stream << " \\pm ";
+ print.printFormat( stream, ybar_->error() );
+ stream << "$ \\\\" << std::endl;
}
void LauRealImagCPCoeffSet::randomiseInitValues()
{
- if (x_->fixed() == kFALSE) {
- // Choose a value for "X" between -3.0 and 3.0
- Double_t value = LauAbsCoeffSet::getRandomiser()->Rndm()*6.0 - 3.0;
- x_->initValue(value); x_->value(value);
- }
- if (y_->fixed() == kFALSE) {
- // Choose a value for "Y" between -3.0 and 3.0
- Double_t value = LauAbsCoeffSet::getRandomiser()->Rndm()*6.0 - 3.0;
- y_->initValue(value); y_->value(value);
- }
- if (xbar_->fixed() == kFALSE) {
- // Choose a value for "Xbar" between -3.0 and 3.0
- Double_t value = LauAbsCoeffSet::getRandomiser()->Rndm()*6.0 - 3.0;
- xbar_->initValue(value); xbar_->value(value);
- }
- if (ybar_->fixed() == kFALSE) {
- // Choose a value for "Ybar" between -3.0 and 3.0
- Double_t value = LauAbsCoeffSet::getRandomiser()->Rndm()*6.0 - 3.0;
- ybar_->initValue(value); ybar_->value(value);
- }
+ if ( x_->fixed() == kFALSE ) {
+ // Choose a value for "X" between -3.0 and 3.0
+ Double_t value = LauAbsCoeffSet::getRandomiser()->Rndm() * 6.0 - 3.0;
+ x_->initValue( value );
+ x_->value( value );
+ }
+ if ( y_->fixed() == kFALSE ) {
+ // Choose a value for "Y" between -3.0 and 3.0
+ Double_t value = LauAbsCoeffSet::getRandomiser()->Rndm() * 6.0 - 3.0;
+ y_->initValue( value );
+ y_->value( value );
+ }
+ if ( xbar_->fixed() == kFALSE ) {
+ // Choose a value for "Xbar" between -3.0 and 3.0
+ Double_t value = LauAbsCoeffSet::getRandomiser()->Rndm() * 6.0 - 3.0;
+ xbar_->initValue( value );
+ xbar_->value( value );
+ }
+ if ( ybar_->fixed() == kFALSE ) {
+ // Choose a value for "Ybar" between -3.0 and 3.0
+ Double_t value = LauAbsCoeffSet::getRandomiser()->Rndm() * 6.0 - 3.0;
+ ybar_->initValue( value );
+ ybar_->value( value );
+ }
}
void LauRealImagCPCoeffSet::finaliseValues()
{
- // update the pulls
- x_->updatePull();
- y_->updatePull();
- xbar_->updatePull();
- ybar_->updatePull();
+ // update the pulls
+ x_->updatePull();
+ y_->updatePull();
+ xbar_->updatePull();
+ ybar_->updatePull();
}
const LauComplex& LauRealImagCPCoeffSet::particleCoeff()
{
- particleCoeff_.setRealImagPart( x_->unblindValue(), y_->unblindValue() );
- return particleCoeff_;
+ particleCoeff_.setRealImagPart( x_->unblindValue(), y_->unblindValue() );
+ return particleCoeff_;
}
const LauComplex& LauRealImagCPCoeffSet::antiparticleCoeff()
{
- antiparticleCoeff_.setRealImagPart( xbar_->unblindValue(), ybar_->unblindValue() );
- return antiparticleCoeff_;
+ antiparticleCoeff_.setRealImagPart( xbar_->unblindValue(), ybar_->unblindValue() );
+ return antiparticleCoeff_;
}
-void LauRealImagCPCoeffSet::setCoeffValues( const LauComplex& coeff, const LauComplex& coeffBar, Bool_t init )
+void LauRealImagCPCoeffSet::setCoeffValues( const LauComplex& coeff,
+ const LauComplex& coeffBar,
+ Bool_t init )
{
- Double_t xVal( coeff.re() );
- Double_t yVal( coeff.im() );
- Double_t xBarVal( coeffBar.re() );
- Double_t yBarVal( coeffBar.im() );
-
- x_->value( xVal );
- y_->value( yVal );
- xbar_->value( xBarVal );
- ybar_->value( yBarVal );
-
- if ( init ) {
- x_->genValue( xVal );
- y_->genValue( yVal );
- xbar_->genValue( xBarVal );
- ybar_->genValue( yBarVal );
-
- x_->initValue( xVal );
- y_->initValue( yVal );
- xbar_->initValue( xBarVal );
- ybar_->initValue( yBarVal );
- }
+ Double_t xVal( coeff.re() );
+ Double_t yVal( coeff.im() );
+ Double_t xBarVal( coeffBar.re() );
+ Double_t yBarVal( coeffBar.im() );
+
+ x_->value( xVal );
+ y_->value( yVal );
+ xbar_->value( xBarVal );
+ ybar_->value( yBarVal );
+
+ if ( init ) {
+ x_->genValue( xVal );
+ y_->genValue( yVal );
+ xbar_->genValue( xBarVal );
+ ybar_->genValue( yBarVal );
+
+ x_->initValue( xVal );
+ y_->initValue( yVal );
+ xbar_->initValue( xBarVal );
+ ybar_->initValue( yBarVal );
+ }
}
LauParameter LauRealImagCPCoeffSet::acp()
{
- // set the name
- TString parName(this->baseName()); parName += "_ACP";
- acp_.name(parName);
+ // set the name
+ TString parName( this->baseName() );
+ parName += "_ACP";
+ acp_.name( parName );
- // work out the ACP value
- Double_t csq = x_->value()*x_->value() + y_->value()*y_->value();
- Double_t cbarsq = xbar_->value()*xbar_->value() + ybar_->value()*ybar_->value();
- Double_t numer = cbarsq - csq;
- Double_t denom = cbarsq + csq;
- Double_t value = numer/denom;
+ // work out the ACP value
+ Double_t csq = x_->value() * x_->value() + y_->value() * y_->value();
+ Double_t cbarsq = xbar_->value() * xbar_->value() + ybar_->value() * ybar_->value();
+ Double_t numer = cbarsq - csq;
+ Double_t denom = cbarsq + csq;
+ Double_t value = numer / denom;
- // is it fixed?
- Bool_t fixed = x_->fixed() && y_->fixed() && xbar_->fixed() && ybar_->fixed();
- acp_.fixed(fixed);
+ // is it fixed?
+ Bool_t fixed = x_->fixed() && y_->fixed() && xbar_->fixed() && ybar_->fixed();
+ acp_.fixed( fixed );
- // we can't work out the error without the covariance matrix
- Double_t error(0.0);
+ // we can't work out the error without the covariance matrix
+ Double_t error( 0.0 );
- // set the value and error
- acp_.valueAndErrors(value,error);
+ // set the value and error
+ acp_.valueAndErrors( value, error );
- return acp_;
+ return acp_;
}
-LauAbsCoeffSet* LauRealImagCPCoeffSet::createClone(const TString& newName, CloneOption cloneOption, Double_t constFactor)
+LauAbsCoeffSet* LauRealImagCPCoeffSet::createClone( const TString& newName,
+ CloneOption cloneOption,
+ Double_t constFactor )
{
- LauAbsCoeffSet* clone(0);
- if ( cloneOption == All || cloneOption == TieRealPart || cloneOption == TieImagPart ) {
- clone = new LauRealImagCPCoeffSet( *this, cloneOption, constFactor );
- clone->name( newName );
- } else {
- std::cerr << "ERROR in LauRealImagCPCoeffSet::createClone : Invalid clone option" << std::endl;
- }
- return clone;
+ LauAbsCoeffSet* clone( 0 );
+ if ( cloneOption == All || cloneOption == TieRealPart || cloneOption == TieImagPart ) {
+ clone = new LauRealImagCPCoeffSet( *this, cloneOption, constFactor );
+ clone->name( newName );
+ } else {
+ std::cerr << "ERROR in LauRealImagCPCoeffSet::createClone : Invalid clone option"
+ << std::endl;
+ }
+ return clone;
}
-
diff --git a/src/LauRealImagCoeffSet.cc b/src/LauRealImagCoeffSet.cc
index c10bbfc..1015f92 100644
--- a/src/LauRealImagCoeffSet.cc
+++ b/src/LauRealImagCoeffSet.cc
@@ -1,184 +1,206 @@
/*
Copyright 2006 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauRealImagCoeffSet.cc
\brief File containing implementation of LauRealImagCoeffSet class.
*/
-#include <iostream>
-#include <fstream>
-#include <vector>
-
-#include "TMath.h"
-#include "TRandom.h"
+#include "LauRealImagCoeffSet.hh"
#include "LauComplex.hh"
#include "LauConstants.hh"
-#include "LauRealImagCoeffSet.hh"
#include "LauParameter.hh"
#include "LauPrint.hh"
+#include "TMath.h"
+#include "TRandom.h"
+#include <fstream>
+#include <iostream>
+#include <vector>
-LauRealImagCoeffSet::LauRealImagCoeffSet(const TString& compName, Double_t x, Double_t y, Bool_t xFixed, Bool_t yFixed) :
- LauAbsCoeffSet(compName),
- x_(new LauParameter("X",x,minRealImagPart_,maxRealImagPart_,xFixed)),
- y_(new LauParameter("Y",y,minRealImagPart_,maxRealImagPart_,yFixed)),
- coeff_(x,y)
+LauRealImagCoeffSet::LauRealImagCoeffSet( const TString& compName,
+ Double_t x,
+ Double_t y,
+ Bool_t xFixed,
+ Bool_t yFixed ) :
+ LauAbsCoeffSet( compName ),
+ x_( new LauParameter( "X", x, minRealImagPart_, maxRealImagPart_, xFixed ) ),
+ y_( new LauParameter( "Y", y, minRealImagPart_, maxRealImagPart_, yFixed ) ),
+ coeff_( x, y )
{
}
-LauRealImagCoeffSet::LauRealImagCoeffSet(const LauRealImagCoeffSet& rhs, CloneOption cloneOption, Double_t constFactor) : LauAbsCoeffSet(rhs.name()),
- x_(0),
- y_(0),
- coeff_( rhs.coeff_ )
+LauRealImagCoeffSet::LauRealImagCoeffSet( const LauRealImagCoeffSet& rhs,
+ CloneOption cloneOption,
+ Double_t constFactor ) :
+ LauAbsCoeffSet( rhs.name() ),
+ x_( 0 ),
+ y_( 0 ),
+ coeff_( rhs.coeff_ )
{
- if ( cloneOption == All || cloneOption == TieRealPart ) {
- x_ = rhs.x_->createClone(constFactor);
- } else {
- x_ = new LauParameter("X", rhs.x_->value(), minRealImagPart_, maxRealImagPart_, rhs.x_->fixed());
- if ( rhs.x_->blind() ) {
- const LauBlind* blinder = rhs.x_->blinder();
- x_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
- }
- }
-
- if ( cloneOption == All || cloneOption == TieImagPart ) {
- y_ = rhs.y_->createClone(constFactor);
- } else {
- y_ = new LauParameter("Y", rhs.y_->value(), minRealImagPart_, maxRealImagPart_, rhs.y_->fixed());
- if ( rhs.y_->blind() ) {
- const LauBlind* blinder = rhs.y_->blinder();
- y_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
- }
- }
+ if ( cloneOption == All || cloneOption == TieRealPart ) {
+ x_ = rhs.x_->createClone( constFactor );
+ } else {
+ x_ = new LauParameter( "X",
+ rhs.x_->value(),
+ minRealImagPart_,
+ maxRealImagPart_,
+ rhs.x_->fixed() );
+ if ( rhs.x_->blind() ) {
+ const LauBlind* blinder = rhs.x_->blinder();
+ x_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
+ }
+ }
+
+ if ( cloneOption == All || cloneOption == TieImagPart ) {
+ y_ = rhs.y_->createClone( constFactor );
+ } else {
+ y_ = new LauParameter( "Y",
+ rhs.y_->value(),
+ minRealImagPart_,
+ maxRealImagPart_,
+ rhs.y_->fixed() );
+ if ( rhs.y_->blind() ) {
+ const LauBlind* blinder = rhs.y_->blinder();
+ y_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
+ }
+ }
}
std::vector<LauParameter*> LauRealImagCoeffSet::getParameters()
{
- std::vector<LauParameter*> pars;
- pars.push_back(x_);
- pars.push_back(y_);
- return pars;
+ std::vector<LauParameter*> pars;
+ pars.push_back( x_ );
+ pars.push_back( y_ );
+ return pars;
}
void LauRealImagCoeffSet::printParValues() const
{
- std::cout<<"INFO in LauRealImagCoeffSet::printParValues : Component \""<<this->name()<<"\" has real part = "<<x_->value()<<" and imaginary part = "<<y_->value()<<"."<<std::endl;
+ std::cout << "INFO in LauRealImagCoeffSet::printParValues : Component \"" << this->name()
+ << "\" has real part = " << x_->value() << " and imaginary part = " << y_->value()
+ << "." << std::endl;
}
-void LauRealImagCoeffSet::printTableHeading(std::ostream& stream) const
+void LauRealImagCoeffSet::printTableHeading( std::ostream& stream ) const
{
- stream<<"\\begin{tabular}{|l|c|c|}"<<std::endl;
- stream<<"\\hline"<<std::endl;
- stream<<"Component & Real Part & Imaginary Part \\\\"<<std::endl;
- stream<<"\\hline"<<std::endl;
+ stream << "\\begin{tabular}{|l|c|c|}" << std::endl;
+ stream << "\\hline" << std::endl;
+ stream << "Component & Real Part & Imaginary Part \\\\" << std::endl;
+ stream << "\\hline" << std::endl;
}
-void LauRealImagCoeffSet::printTableRow(std::ostream& stream) const
+void LauRealImagCoeffSet::printTableRow( std::ostream& stream ) const
{
- LauPrint print;
- TString resName = this->name();
- resName = resName.ReplaceAll("_", "\\_");
- stream<<resName<<" & $";
- print.printFormat(stream, x_->value());
- stream<<" \\pm ";
- print.printFormat(stream, x_->error());
- stream<<"$ & $";
- print.printFormat(stream, y_->value());
- stream<<" \\pm ";
- print.printFormat(stream, y_->error());
- stream<<"$ \\\\"<<std::endl;
+ LauPrint print;
+ TString resName = this->name();
+ resName = resName.ReplaceAll( "_", "\\_" );
+ stream << resName << " & $";
+ print.printFormat( stream, x_->value() );
+ stream << " \\pm ";
+ print.printFormat( stream, x_->error() );
+ stream << "$ & $";
+ print.printFormat( stream, y_->value() );
+ stream << " \\pm ";
+ print.printFormat( stream, y_->error() );
+ stream << "$ \\\\" << std::endl;
}
void LauRealImagCoeffSet::randomiseInitValues()
{
- if (x_->fixed() == kFALSE) {
- // Choose a value between -10.0 and 10.0
- Double_t value = LauAbsCoeffSet::getRandomiser()->Rndm()*20.0 - 10.0;
- x_->initValue(value); x_->value(value);
- }
- if (y_->fixed() == kFALSE) {
- // Choose a value between -10.0 and 10.0
- Double_t value = LauAbsCoeffSet::getRandomiser()->Rndm()*20.0 - 10.0;
- y_->initValue(value); y_->value(value);
- }
+ if ( x_->fixed() == kFALSE ) {
+ // Choose a value between -10.0 and 10.0
+ Double_t value = LauAbsCoeffSet::getRandomiser()->Rndm() * 20.0 - 10.0;
+ x_->initValue( value );
+ x_->value( value );
+ }
+ if ( y_->fixed() == kFALSE ) {
+ // Choose a value between -10.0 and 10.0
+ Double_t value = LauAbsCoeffSet::getRandomiser()->Rndm() * 20.0 - 10.0;
+ y_->initValue( value );
+ y_->value( value );
+ }
}
void LauRealImagCoeffSet::finaliseValues()
{
- x_->updatePull();
- y_->updatePull();
+ x_->updatePull();
+ y_->updatePull();
}
const LauComplex& LauRealImagCoeffSet::particleCoeff()
{
- coeff_.setRealImagPart(x_->unblindValue(), y_->unblindValue());
- return coeff_;
+ coeff_.setRealImagPart( x_->unblindValue(), y_->unblindValue() );
+ return coeff_;
}
const LauComplex& LauRealImagCoeffSet::antiparticleCoeff()
{
- return this->particleCoeff();
+ return this->particleCoeff();
}
-void LauRealImagCoeffSet::setCoeffValues( const LauComplex& coeff, const LauComplex& coeffBar, Bool_t init )
+void LauRealImagCoeffSet::setCoeffValues( const LauComplex& coeff,
+ const LauComplex& coeffBar,
+ Bool_t init )
{
- LauComplex average( coeff );
- average += coeffBar;
- average.rescale( 0.5 );
+ LauComplex average( coeff );
+ average += coeffBar;
+ average.rescale( 0.5 );
- Double_t xVal( average.re() );
- Double_t yVal( average.im() );
+ Double_t xVal( average.re() );
+ Double_t yVal( average.im() );
- x_->value( xVal );
- y_->value( yVal );
+ x_->value( xVal );
+ y_->value( yVal );
- if ( init ) {
- x_->genValue( xVal );
- y_->genValue( yVal );
+ if ( init ) {
+ x_->genValue( xVal );
+ y_->genValue( yVal );
- x_->initValue( xVal );
- y_->initValue( yVal );
- }
+ x_->initValue( xVal );
+ y_->initValue( yVal );
+ }
}
LauParameter LauRealImagCoeffSet::acp()
{
- TString parName(this->baseName()); parName += "_ACP";
- return LauParameter(parName,0.0);
+ TString parName( this->baseName() );
+ parName += "_ACP";
+ return LauParameter( parName, 0.0 );
}
-LauAbsCoeffSet* LauRealImagCoeffSet::createClone(const TString& newName, CloneOption cloneOption, Double_t constFactor)
+LauAbsCoeffSet* LauRealImagCoeffSet::createClone( const TString& newName,
+ CloneOption cloneOption,
+ Double_t constFactor )
{
- LauAbsCoeffSet* clone(0);
- if ( cloneOption == All || cloneOption == TieRealPart || cloneOption == TieImagPart ) {
- clone = new LauRealImagCoeffSet( *this, cloneOption, constFactor );
- clone->name( newName );
- } else {
- std::cerr << "ERROR in LauRealImagCoeffSet::createClone : Invalid clone option" << std::endl;
- }
- return clone;
+ LauAbsCoeffSet* clone( 0 );
+ if ( cloneOption == All || cloneOption == TieRealPart || cloneOption == TieImagPart ) {
+ clone = new LauRealImagCoeffSet( *this, cloneOption, constFactor );
+ clone->name( newName );
+ } else {
+ std::cerr << "ERROR in LauRealImagCoeffSet::createClone : Invalid clone option" << std::endl;
+ }
+ return clone;
}
-
diff --git a/src/LauRealImagGammaCPCoeffSet.cc b/src/LauRealImagGammaCPCoeffSet.cc
index 1345e22..40eee66 100644
--- a/src/LauRealImagGammaCPCoeffSet.cc
+++ b/src/LauRealImagGammaCPCoeffSet.cc
@@ -1,295 +1,354 @@
/*
Copyright 2014 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauRealImagGammaCPCoeffSet.cc
\brief File containing implementation of LauRealImagGammaCPCoeffSet class.
*/
-#include <iostream>
-#include <fstream>
-#include <vector>
-
-#include "TMath.h"
-#include "TRandom.h"
-
#include "LauRealImagGammaCPCoeffSet.hh"
+
#include "LauComplex.hh"
#include "LauConstants.hh"
#include "LauParameter.hh"
#include "LauPrint.hh"
+#include "TMath.h"
+#include "TRandom.h"
+#include <fstream>
+#include <iostream>
+#include <vector>
-LauRealImagGammaCPCoeffSet::LauRealImagGammaCPCoeffSet(const TString& compName, const Double_t x, const Double_t y, const Double_t xCP, const Double_t yCP, const Double_t xbarCP, const Double_t ybarCP,
- const Bool_t xFixed, const Bool_t yFixed, const Bool_t xCPFixed, const Bool_t yCPFixed, const Bool_t xbarCPFixed, const Bool_t ybarCPFixed) :
- LauAbsCoeffSet(compName),
- x_(new LauParameter("X", x, minRealImagPart_, maxRealImagPart_, xFixed)),
- y_(new LauParameter("Y", y, minRealImagPart_, maxRealImagPart_, yFixed)),
- xCP_(new LauParameter("XCP", xCP, minRealImagPart_, maxRealImagPart_, xCPFixed)),
- yCP_(new LauParameter("YCP", yCP, minRealImagPart_, maxRealImagPart_, yCPFixed)),
- xbarCP_(new LauParameter("XbarCP", xbarCP, minRealImagPart_, maxRealImagPart_, xbarCPFixed)),
- ybarCP_(new LauParameter("YbarCP", ybarCP, minRealImagPart_, maxRealImagPart_, ybarCPFixed)),
- nonCPPart_( x, y),
- cpPart_( 1+xCP, yCP ),
- cpAntiPart_( 1+xbarCP, ybarCP ),
- particleCoeff_( nonCPPart_ * cpPart_ ),
- antiparticleCoeff_( nonCPPart_ * cpAntiPart_ ),
- acp_("ACP", (antiparticleCoeff_.abs2()-particleCoeff_.abs2())/(antiparticleCoeff_.abs2()+particleCoeff_.abs2()), -1.0, 1.0, xCPFixed&&yCPFixed&&xbarCPFixed&&ybarCPFixed)
+LauRealImagGammaCPCoeffSet::LauRealImagGammaCPCoeffSet( const TString& compName,
+ const Double_t x,
+ const Double_t y,
+ const Double_t xCP,
+ const Double_t yCP,
+ const Double_t xbarCP,
+ const Double_t ybarCP,
+ const Bool_t xFixed,
+ const Bool_t yFixed,
+ const Bool_t xCPFixed,
+ const Bool_t yCPFixed,
+ const Bool_t xbarCPFixed,
+ const Bool_t ybarCPFixed ) :
+ LauAbsCoeffSet( compName ),
+ x_( new LauParameter( "X", x, minRealImagPart_, maxRealImagPart_, xFixed ) ),
+ y_( new LauParameter( "Y", y, minRealImagPart_, maxRealImagPart_, yFixed ) ),
+ xCP_( new LauParameter( "XCP", xCP, minRealImagPart_, maxRealImagPart_, xCPFixed ) ),
+ yCP_( new LauParameter( "YCP", yCP, minRealImagPart_, maxRealImagPart_, yCPFixed ) ),
+ xbarCP_( new LauParameter( "XbarCP", xbarCP, minRealImagPart_, maxRealImagPart_, xbarCPFixed ) ),
+ ybarCP_( new LauParameter( "YbarCP", ybarCP, minRealImagPart_, maxRealImagPart_, ybarCPFixed ) ),
+ nonCPPart_( x, y ),
+ cpPart_( 1 + xCP, yCP ),
+ cpAntiPart_( 1 + xbarCP, ybarCP ),
+ particleCoeff_( nonCPPart_ * cpPart_ ),
+ antiparticleCoeff_( nonCPPart_ * cpAntiPart_ ),
+ acp_( "ACP",
+ ( antiparticleCoeff_.abs2() - particleCoeff_.abs2() ) /
+ ( antiparticleCoeff_.abs2() + particleCoeff_.abs2() ),
+ -1.0,
+ 1.0,
+ xCPFixed && yCPFixed && xbarCPFixed && ybarCPFixed )
{
}
-LauRealImagGammaCPCoeffSet::LauRealImagGammaCPCoeffSet(const LauRealImagGammaCPCoeffSet& rhs, CloneOption cloneOption, Double_t constFactor) : LauAbsCoeffSet(rhs.name()),
- x_(0),
- y_(0),
- xCP_(0),
- yCP_(0),
- xbarCP_(0),
- ybarCP_(0),
- nonCPPart_( rhs.nonCPPart_ ),
- cpPart_( rhs.cpPart_ ),
- cpAntiPart_( rhs.cpAntiPart_ ),
- particleCoeff_( rhs.particleCoeff_ ),
- antiparticleCoeff_( rhs.antiparticleCoeff_ ),
- acp_( rhs.acp_ )
+LauRealImagGammaCPCoeffSet::LauRealImagGammaCPCoeffSet( const LauRealImagGammaCPCoeffSet& rhs,
+ CloneOption cloneOption,
+ Double_t constFactor ) :
+ LauAbsCoeffSet( rhs.name() ),
+ x_( 0 ),
+ y_( 0 ),
+ xCP_( 0 ),
+ yCP_( 0 ),
+ xbarCP_( 0 ),
+ ybarCP_( 0 ),
+ nonCPPart_( rhs.nonCPPart_ ),
+ cpPart_( rhs.cpPart_ ),
+ cpAntiPart_( rhs.cpAntiPart_ ),
+ particleCoeff_( rhs.particleCoeff_ ),
+ antiparticleCoeff_( rhs.antiparticleCoeff_ ),
+ acp_( rhs.acp_ )
{
- if ( cloneOption == All || cloneOption == TieRealPart ) {
- x_ = rhs.x_->createClone(constFactor);
- } else {
- x_ = new LauParameter("X", rhs.x_->value(), minRealImagPart_, maxRealImagPart_, rhs.x_->fixed());
- if ( rhs.x_->blind() ) {
- const LauBlind* blinder = rhs.x_->blinder();
- x_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
- }
- }
-
- if ( cloneOption == All || cloneOption == TieImagPart ) {
- y_ = rhs.y_->createClone(constFactor);
- } else {
- y_ = new LauParameter("Y", rhs.y_->value(), minRealImagPart_, maxRealImagPart_, rhs.y_->fixed());
- if ( rhs.y_->blind() ) {
- const LauBlind* blinder = rhs.y_->blinder();
- y_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
- }
- }
-
- if ( cloneOption == All || cloneOption == TieCPPars ) {
- xCP_ = rhs.xCP_->createClone(constFactor);
- yCP_ = rhs.yCP_->createClone(constFactor);
- xbarCP_ = rhs.xbarCP_->createClone(constFactor);
- ybarCP_ = rhs.ybarCP_->createClone(constFactor);
- } else {
- xCP_ = new LauParameter("XCP", rhs.xCP_->value(), minRealImagPart_, maxRealImagPart_, rhs.xCP_->fixed());
- if ( rhs.xCP_->blind() ) {
- const LauBlind* blinder = rhs.xCP_->blinder();
- xCP_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
- }
- yCP_ = new LauParameter("YCP", rhs.yCP_->value(), minRealImagPart_, maxRealImagPart_, rhs.yCP_->fixed());
- if ( rhs.yCP_->blind() ) {
- const LauBlind* blinder = rhs.yCP_->blinder();
- yCP_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
- }
- xbarCP_ = new LauParameter("XbarCP", rhs.xbarCP_->value(), minRealImagPart_, maxRealImagPart_, rhs.xbarCP_->fixed());
- if ( rhs.xbarCP_->blind() ) {
- const LauBlind* blinder = rhs.xbarCP_->blinder();
- xbarCP_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
- }
- ybarCP_ = new LauParameter("YbarCP", rhs.ybarCP_->value(), minRealImagPart_, maxRealImagPart_, rhs.ybarCP_->fixed());
- if ( rhs.ybarCP_->blind() ) {
- const LauBlind* blinder = rhs.ybarCP_->blinder();
- ybarCP_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
- }
- }
+ if ( cloneOption == All || cloneOption == TieRealPart ) {
+ x_ = rhs.x_->createClone( constFactor );
+ } else {
+ x_ = new LauParameter( "X",
+ rhs.x_->value(),
+ minRealImagPart_,
+ maxRealImagPart_,
+ rhs.x_->fixed() );
+ if ( rhs.x_->blind() ) {
+ const LauBlind* blinder = rhs.x_->blinder();
+ x_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
+ }
+ }
+
+ if ( cloneOption == All || cloneOption == TieImagPart ) {
+ y_ = rhs.y_->createClone( constFactor );
+ } else {
+ y_ = new LauParameter( "Y",
+ rhs.y_->value(),
+ minRealImagPart_,
+ maxRealImagPart_,
+ rhs.y_->fixed() );
+ if ( rhs.y_->blind() ) {
+ const LauBlind* blinder = rhs.y_->blinder();
+ y_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
+ }
+ }
+
+ if ( cloneOption == All || cloneOption == TieCPPars ) {
+ xCP_ = rhs.xCP_->createClone( constFactor );
+ yCP_ = rhs.yCP_->createClone( constFactor );
+ xbarCP_ = rhs.xbarCP_->createClone( constFactor );
+ ybarCP_ = rhs.ybarCP_->createClone( constFactor );
+ } else {
+ xCP_ = new LauParameter( "XCP",
+ rhs.xCP_->value(),
+ minRealImagPart_,
+ maxRealImagPart_,
+ rhs.xCP_->fixed() );
+ if ( rhs.xCP_->blind() ) {
+ const LauBlind* blinder = rhs.xCP_->blinder();
+ xCP_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
+ }
+ yCP_ = new LauParameter( "YCP",
+ rhs.yCP_->value(),
+ minRealImagPart_,
+ maxRealImagPart_,
+ rhs.yCP_->fixed() );
+ if ( rhs.yCP_->blind() ) {
+ const LauBlind* blinder = rhs.yCP_->blinder();
+ yCP_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
+ }
+ xbarCP_ = new LauParameter( "XbarCP",
+ rhs.xbarCP_->value(),
+ minRealImagPart_,
+ maxRealImagPart_,
+ rhs.xbarCP_->fixed() );
+ if ( rhs.xbarCP_->blind() ) {
+ const LauBlind* blinder = rhs.xbarCP_->blinder();
+ xbarCP_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
+ }
+ ybarCP_ = new LauParameter( "YbarCP",
+ rhs.ybarCP_->value(),
+ minRealImagPart_,
+ maxRealImagPart_,
+ rhs.ybarCP_->fixed() );
+ if ( rhs.ybarCP_->blind() ) {
+ const LauBlind* blinder = rhs.ybarCP_->blinder();
+ ybarCP_->blindParameter( blinder->blindingString(), blinder->blindingWidth() );
+ }
+ }
}
std::vector<LauParameter*> LauRealImagGammaCPCoeffSet::getParameters()
{
- std::vector<LauParameter*> pars;
- pars.push_back(x_);
- pars.push_back(y_);
- if(!xCP_->fixed()) pars.push_back(xCP_);
- if(!yCP_->fixed()) pars.push_back(yCP_);
- if(!xbarCP_->fixed()) pars.push_back(xbarCP_);
- if(!ybarCP_->fixed()) pars.push_back(ybarCP_);
- return pars;
+ std::vector<LauParameter*> pars;
+ pars.push_back( x_ );
+ pars.push_back( y_ );
+ if ( ! xCP_->fixed() )
+ pars.push_back( xCP_ );
+ if ( ! yCP_->fixed() )
+ pars.push_back( yCP_ );
+ if ( ! xbarCP_->fixed() )
+ pars.push_back( xbarCP_ );
+ if ( ! ybarCP_->fixed() )
+ pars.push_back( ybarCP_ );
+ return pars;
}
void LauRealImagGammaCPCoeffSet::printParValues() const
{
- std::cout << "INFO in LauRealImagGammaCPCoeffSet::printParValues : Component \"" << this->name() << "\" has ";
- std::cout << "x = " << x_->value() << ",\t";
- std::cout << "y = " << y_->value() << ",\t";
- std::cout << "xCP = " << xCP_->value() << ",\t";
- std::cout << "yCP = " << yCP_->value() << ",\t";
- std::cout << "xbarCP = " << xbarCP_->value() << ",\t";
- std::cout << "ybarCP = " << ybarCP_->value() << "." << std::endl;
+ std::cout << "INFO in LauRealImagGammaCPCoeffSet::printParValues : Component \"" << this->name()
+ << "\" has ";
+ std::cout << "x = " << x_->value() << ",\t";
+ std::cout << "y = " << y_->value() << ",\t";
+ std::cout << "xCP = " << xCP_->value() << ",\t";
+ std::cout << "yCP = " << yCP_->value() << ",\t";
+ std::cout << "xbarCP = " << xbarCP_->value() << ",\t";
+ std::cout << "ybarCP = " << ybarCP_->value() << "." << std::endl;
}
-void LauRealImagGammaCPCoeffSet::printTableHeading(std::ostream& stream) const
+void LauRealImagGammaCPCoeffSet::printTableHeading( std::ostream& stream ) const
{
- stream<<"\\begin{tabular}{|l|c|c|c|c|c|c|}"<<std::endl;
- stream<<"\\hline"<<std::endl;
- stream<<"Component & Real Part & Imaginary Part & Particle CP Real Part & Particle CP Imaginary Part & Antiparticle CP Real Part & Antiparticle CP Imaginary Part \\\\"<<std::endl;
- stream<<"\\hline"<<std::endl;
+ stream << "\\begin{tabular}{|l|c|c|c|c|c|c|}" << std::endl;
+ stream << "\\hline" << std::endl;
+ stream << "Component & Real Part & Imaginary Part & Particle CP Real Part & Particle CP Imaginary Part & Antiparticle CP Real Part & Antiparticle CP Imaginary Part \\\\"
+ << std::endl;
+ stream << "\\hline" << std::endl;
}
-void LauRealImagGammaCPCoeffSet::printTableRow(std::ostream& stream) const
+void LauRealImagGammaCPCoeffSet::printTableRow( std::ostream& stream ) const
{
- LauPrint print;
- TString resName = this->name();
- resName = resName.ReplaceAll("_", "\\_");
- stream<<resName<<" & $";
- print.printFormat(stream, x_->value());
- stream<<" \\pm ";
- print.printFormat(stream, x_->error());
- stream<<"$ & $";
- print.printFormat(stream, y_->value());
- stream<<" \\pm ";
- print.printFormat(stream, y_->error());
- stream<<"$ & $";
- print.printFormat(stream, xCP_->value());
- stream<<" \\pm ";
- print.printFormat(stream, xCP_->error());
- stream<<"$ & $";
- print.printFormat(stream, yCP_->value());
- stream<<" \\pm ";
- print.printFormat(stream, yCP_->error());
- stream<<"$ & $";
- print.printFormat(stream, xbarCP_->value());
- stream<<" \\pm ";
- print.printFormat(stream, xbarCP_->error());
- stream<<"$ & $";
- print.printFormat(stream, ybarCP_->value());
- stream<<" \\pm ";
- print.printFormat(stream, ybarCP_->error());
- stream<<"$ \\\\"<<std::endl;
+ LauPrint print;
+ TString resName = this->name();
+ resName = resName.ReplaceAll( "_", "\\_" );
+ stream << resName << " & $";
+ print.printFormat( stream, x_->value() );
+ stream << " \\pm ";
+ print.printFormat( stream, x_->error() );
+ stream << "$ & $";
+ print.printFormat( stream, y_->value() );
+ stream << " \\pm ";
+ print.printFormat( stream, y_->error() );
+ stream << "$ & $";
+ print.printFormat( stream, xCP_->value() );
+ stream << " \\pm ";
+ print.printFormat( stream, xCP_->error() );
+ stream << "$ & $";
+ print.printFormat( stream, yCP_->value() );
+ stream << " \\pm ";
+ print.printFormat( stream, yCP_->error() );
+ stream << "$ & $";
+ print.printFormat( stream, xbarCP_->value() );
+ stream << " \\pm ";
+ print.printFormat( stream, xbarCP_->error() );
+ stream << "$ & $";
+ print.printFormat( stream, ybarCP_->value() );
+ stream << " \\pm ";
+ print.printFormat( stream, ybarCP_->error() );
+ stream << "$ \\\\" << std::endl;
}
void LauRealImagGammaCPCoeffSet::randomiseInitValues()
{
- if (x_->fixed() == kFALSE) {
- // Choose a value for "X" between -3.0 and 3.0
- Double_t value = LauAbsCoeffSet::getRandomiser()->Rndm()*6.0 - 3.0;
- x_->initValue(value); x_->value(value);
- }
- if (y_->fixed() == kFALSE) {
- // Choose a value for "Y" between -3.0 and 3.0
- Double_t value = LauAbsCoeffSet::getRandomiser()->Rndm()*6.0 - 3.0;
- y_->initValue(value); y_->value(value);
- }
- if (xCP_->fixed() == kFALSE) {
- // Choose a value for "XCP" between -3.0 and 3.0
- Double_t value = LauAbsCoeffSet::getRandomiser()->Rndm()*6.0 - 3.0;
- xCP_->initValue(value); xCP_->value(value);
- }
- if (yCP_->fixed() == kFALSE) {
- // Choose a value for "YCP" between -3.0 and 3.0
- Double_t value = LauAbsCoeffSet::getRandomiser()->Rndm()*6.0 - 3.0;
- yCP_->initValue(value); yCP_->value(value);
- }
- if (xbarCP_->fixed() == kFALSE) {
- // Choose a value for "XbarCP" between -3.0 and 3.0
- Double_t value = LauAbsCoeffSet::getRandomiser()->Rndm()*6.0 - 3.0;
- xbarCP_->initValue(value); xbarCP_->value(value);
- }
- if (ybarCP_->fixed() == kFALSE) {
- // Choose a value for "YbarCP" between -3.0 and 3.0
- Double_t value = LauAbsCoeffSet::getRandomiser()->Rndm()*6.0 - 3.0;
- ybarCP_->initValue(value); ybarCP_->value(value);
- }
+ if ( x_->fixed() == kFALSE ) {
+ // Choose a value for "X" between -3.0 and 3.0
+ Double_t value = LauAbsCoeffSet::getRandomiser()->Rndm() * 6.0 - 3.0;
+ x_->initValue( value );
+ x_->value( value );
+ }
+ if ( y_->fixed() == kFALSE ) {
+ // Choose a value for "Y" between -3.0 and 3.0
+ Double_t value = LauAbsCoeffSet::getRandomiser()->Rndm() * 6.0 - 3.0;
+ y_->initValue( value );
+ y_->value( value );
+ }
+ if ( xCP_->fixed() == kFALSE ) {
+ // Choose a value for "XCP" between -3.0 and 3.0
+ Double_t value = LauAbsCoeffSet::getRandomiser()->Rndm() * 6.0 - 3.0;
+ xCP_->initValue( value );
+ xCP_->value( value );
+ }
+ if ( yCP_->fixed() == kFALSE ) {
+ // Choose a value for "YCP" between -3.0 and 3.0
+ Double_t value = LauAbsCoeffSet::getRandomiser()->Rndm() * 6.0 - 3.0;
+ yCP_->initValue( value );
+ yCP_->value( value );
+ }
+ if ( xbarCP_->fixed() == kFALSE ) {
+ // Choose a value for "XbarCP" between -3.0 and 3.0
+ Double_t value = LauAbsCoeffSet::getRandomiser()->Rndm() * 6.0 - 3.0;
+ xbarCP_->initValue( value );
+ xbarCP_->value( value );
+ }
+ if ( ybarCP_->fixed() == kFALSE ) {
+ // Choose a value for "YbarCP" between -3.0 and 3.0
+ Double_t value = LauAbsCoeffSet::getRandomiser()->Rndm() * 6.0 - 3.0;
+ ybarCP_->initValue( value );
+ ybarCP_->value( value );
+ }
}
void LauRealImagGammaCPCoeffSet::finaliseValues()
{
- // update the pulls
- x_->updatePull();
- y_->updatePull();
- xCP_->updatePull();
- yCP_->updatePull();
- xbarCP_->updatePull();
- ybarCP_->updatePull();
+ // update the pulls
+ x_->updatePull();
+ y_->updatePull();
+ xCP_->updatePull();
+ yCP_->updatePull();
+ xbarCP_->updatePull();
+ ybarCP_->updatePull();
}
const LauComplex& LauRealImagGammaCPCoeffSet::particleCoeff()
{
- nonCPPart_.setRealImagPart( x_->unblindValue(), y_->unblindValue() );
- cpPart_.setRealImagPart( 1.0+xCP_->unblindValue(), yCP_->unblindValue() );
- particleCoeff_ = nonCPPart_ * cpPart_;
- return particleCoeff_;
+ nonCPPart_.setRealImagPart( x_->unblindValue(), y_->unblindValue() );
+ cpPart_.setRealImagPart( 1.0 + xCP_->unblindValue(), yCP_->unblindValue() );
+ particleCoeff_ = nonCPPart_ * cpPart_;
+ return particleCoeff_;
}
const LauComplex& LauRealImagGammaCPCoeffSet::antiparticleCoeff()
{
- nonCPPart_.setRealImagPart( x_->unblindValue(), y_->unblindValue() );
- cpAntiPart_.setRealImagPart( 1.0+xbarCP_->unblindValue(), ybarCP_->unblindValue() );
- antiparticleCoeff_ = nonCPPart_ * cpAntiPart_;
- return antiparticleCoeff_;
+ nonCPPart_.setRealImagPart( x_->unblindValue(), y_->unblindValue() );
+ cpAntiPart_.setRealImagPart( 1.0 + xbarCP_->unblindValue(), ybarCP_->unblindValue() );
+ antiparticleCoeff_ = nonCPPart_ * cpAntiPart_;
+ return antiparticleCoeff_;
}
void LauRealImagGammaCPCoeffSet::setCoeffValues( const LauComplex&, const LauComplex&, Bool_t )
{
- std::cerr << "ERROR in LauCartesianGammaCPCoeffSet::setCoeffValues : Method not supported by this class - too many parameters" << std::endl;
+ std::cerr << "ERROR in LauCartesianGammaCPCoeffSet::setCoeffValues : Method not supported by this class - too many parameters"
+ << std::endl;
}
LauParameter LauRealImagGammaCPCoeffSet::acp()
{
- // set the name
- TString parName(this->baseName()); parName += "_ACP";
- acp_.name(parName);
+ // set the name
+ TString parName( this->baseName() );
+ parName += "_ACP";
+ acp_.name( parName );
- // work out the ACP value
- const LauComplex nonCPPart( x_->value(), y_->value() );
- const LauComplex cpPart( 1.0+xCP_->value(), yCP_->value() );
- const LauComplex cpAntiPart( 1.0+xbarCP_->value(), ybarCP_->value() );
- const LauComplex partCoeff = nonCPPart * cpPart;
- const LauComplex antiCoeff = nonCPPart * cpAntiPart;
+ // work out the ACP value
+ const LauComplex nonCPPart( x_->value(), y_->value() );
+ const LauComplex cpPart( 1.0 + xCP_->value(), yCP_->value() );
+ const LauComplex cpAntiPart( 1.0 + xbarCP_->value(), ybarCP_->value() );
+ const LauComplex partCoeff = nonCPPart * cpPart;
+ const LauComplex antiCoeff = nonCPPart * cpAntiPart;
- const Double_t numer = antiCoeff.abs2() - partCoeff.abs2();
- const Double_t denom = antiCoeff.abs2() + partCoeff.abs2();
- const Double_t value = numer/denom;
+ const Double_t numer = antiCoeff.abs2() - partCoeff.abs2();
+ const Double_t denom = antiCoeff.abs2() + partCoeff.abs2();
+ const Double_t value = numer / denom;
- // is it fixed?
- const Bool_t fixed = xCP_->fixed() && yCP_->fixed() && xbarCP_->fixed() && ybarCP_->fixed();
- acp_.fixed(fixed);
+ // is it fixed?
+ const Bool_t fixed = xCP_->fixed() && yCP_->fixed() && xbarCP_->fixed() && ybarCP_->fixed();
+ acp_.fixed( fixed );
- // we can't work out the error without the covariance matrix
- const Double_t error(0.0);
+ // we can't work out the error without the covariance matrix
+ const Double_t error( 0.0 );
- // set the value and error
- acp_.valueAndErrors(value,error);
+ // set the value and error
+ acp_.valueAndErrors( value, error );
- return acp_;
+ return acp_;
}
-LauAbsCoeffSet* LauRealImagGammaCPCoeffSet::createClone(const TString& newName, CloneOption cloneOption, Double_t constFactor)
+LauAbsCoeffSet* LauRealImagGammaCPCoeffSet::createClone( const TString& newName,
+ CloneOption cloneOption,
+ Double_t constFactor )
{
- LauAbsCoeffSet* clone(0);
- if ( cloneOption == All || cloneOption == TieRealPart || cloneOption == TieImagPart || cloneOption == TieCPPars ) {
- clone = new LauRealImagGammaCPCoeffSet( *this, cloneOption, constFactor );
- clone->name( newName );
- } else {
- std::cerr << "ERROR in LauRealImagGammaCPCoeffSet::createClone : Invalid clone option" << std::endl;
- }
- return clone;
+ LauAbsCoeffSet* clone( 0 );
+ if ( cloneOption == All || cloneOption == TieRealPart || cloneOption == TieImagPart ||
+ cloneOption == TieCPPars ) {
+ clone = new LauRealImagGammaCPCoeffSet( *this, cloneOption, constFactor );
+ clone->name( newName );
+ } else {
+ std::cerr << "ERROR in LauRealImagGammaCPCoeffSet::createClone : Invalid clone option"
+ << std::endl;
+ }
+ return clone;
}
-
diff --git a/src/LauRelBreitWignerRes.cc b/src/LauRelBreitWignerRes.cc
index 17e057f..e8d7dc5 100644
--- a/src/LauRelBreitWignerRes.cc
+++ b/src/LauRelBreitWignerRes.cc
@@ -1,252 +1,251 @@
/*
Copyright 2004 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauRelBreitWignerRes.cc
\brief File containing implementation of LauRelBreitWignerRes class.
*/
-#include <iostream>
-
-#include "LauConstants.hh"
#include "LauRelBreitWignerRes.hh"
+#include "LauConstants.hh"
+#include <iostream>
-LauRelBreitWignerRes::LauRelBreitWignerRes(LauResonanceInfo* resInfo, const Int_t resPairAmpInt, const LauDaughters* daughters) :
- LauAbsResonance(resInfo, resPairAmpInt, daughters),
- q0_(0.0),
- resMass_(0.0),
- resMassSq_(0.0),
- resWidth_(0.0),
- resRadius_(0.0),
- parRadius_(0.0),
- mDaugSum_(0.0),
- mDaugSumSq_(0.0),
- mDaugDiff_(0.0),
- mDaugDiffSq_(0.0),
- mParentSq_(0.0),
- mBachSq_(0.0),
- FR0_(1.0)
+LauRelBreitWignerRes::LauRelBreitWignerRes( LauResonanceInfo* resInfo,
+ const Int_t resPairAmpInt,
+ const LauDaughters* daughters ) :
+ LauAbsResonance( resInfo, resPairAmpInt, daughters ),
+ q0_( 0.0 ),
+ resMass_( 0.0 ),
+ resMassSq_( 0.0 ),
+ resWidth_( 0.0 ),
+ resRadius_( 0.0 ),
+ parRadius_( 0.0 ),
+ mDaugSum_( 0.0 ),
+ mDaugSumSq_( 0.0 ),
+ mDaugDiff_( 0.0 ),
+ mDaugDiffSq_( 0.0 ),
+ mParentSq_( 0.0 ),
+ mBachSq_( 0.0 ),
+ FR0_( 1.0 )
{
}
LauRelBreitWignerRes::~LauRelBreitWignerRes()
{
}
void LauRelBreitWignerRes::initialise()
{
- // Set-up various constants. This must be called again if the mass/width/spin
- // of a resonance changes...
-
- resMass_ = this->getMass();
- resWidth_ = this->getWidth();
- resRadius_ = this->getResRadius();
- parRadius_ = this->getParRadius();
-
- Double_t massDaug1 = this->getMassDaug1();
- Double_t massDaug2 = this->getMassDaug2();
- Double_t massBachelor = this->getMassBachelor();
- Double_t massParent = this->getMassParent();
-
- // Create the mass squares, sums, differences etc.
- resMassSq_ = resMass_*resMass_;
- mDaugSum_ = massDaug1 + massDaug2;
- mDaugSumSq_ = mDaugSum_*mDaugSum_;
- mDaugDiff_ = massDaug1 - massDaug2;
- mDaugDiffSq_ = mDaugDiff_*mDaugDiff_;
- mParentSq_ = massParent*massParent;
- mBachSq_ = massBachelor*massBachelor;
-
- // Create an effective resonance pole mass to protect against resonances
- // that are below threshold
- Double_t effResMass = resMass_;
- Double_t effResMassSq = resMassSq_;
- if ( resMassSq_ - mDaugSumSq_ < 0.0 ) {
- Double_t minMass = mDaugSum_;
- Double_t maxMass = massParent - massBachelor;
- Double_t tanhTerm = std::tanh( (resMass_ - ((minMass + maxMass)/2))/(maxMass-minMass));
- effResMass = minMass + (maxMass-minMass)*(1+tanhTerm)/2;
- effResMassSq = effResMass*effResMass;
- }
-
- // Decay momentum of either daughter in the resonance rest frame
- // when resonance mass = rest-mass value, m_0 (PDG value)
- Double_t term1 = effResMassSq - mDaugSumSq_;
- Double_t term2 = effResMassSq - mDaugDiffSq_;
- Double_t term12 = term1*term2;
- if (term12 > 0.0) {
- q0_ = TMath::Sqrt(term12)/(2.0*effResMass);
- } else {
- q0_ = 0.0;
- }
-
- // Calculate the resonance Blatt-Weisskopf form factor for the case when m = m_0
- FR0_ = 1.0;
- if ( this->getSpin() > 0 ) {
- const LauBlattWeisskopfFactor* resBWFactor = this->getResBWFactor();
- if ( resBWFactor != nullptr ) {
- FR0_ = resBWFactor->calcFormFactor(q0_);
- }
- }
+ // Set-up various constants. This must be called again if the mass/width/spin
+ // of a resonance changes...
+
+ resMass_ = this->getMass();
+ resWidth_ = this->getWidth();
+ resRadius_ = this->getResRadius();
+ parRadius_ = this->getParRadius();
+
+ Double_t massDaug1 = this->getMassDaug1();
+ Double_t massDaug2 = this->getMassDaug2();
+ Double_t massBachelor = this->getMassBachelor();
+ Double_t massParent = this->getMassParent();
+
+ // Create the mass squares, sums, differences etc.
+ resMassSq_ = resMass_ * resMass_;
+ mDaugSum_ = massDaug1 + massDaug2;
+ mDaugSumSq_ = mDaugSum_ * mDaugSum_;
+ mDaugDiff_ = massDaug1 - massDaug2;
+ mDaugDiffSq_ = mDaugDiff_ * mDaugDiff_;
+ mParentSq_ = massParent * massParent;
+ mBachSq_ = massBachelor * massBachelor;
+
+ // Create an effective resonance pole mass to protect against resonances
+ // that are below threshold
+ Double_t effResMass = resMass_;
+ Double_t effResMassSq = resMassSq_;
+ if ( resMassSq_ - mDaugSumSq_ < 0.0 ) {
+ Double_t minMass = mDaugSum_;
+ Double_t maxMass = massParent - massBachelor;
+ Double_t tanhTerm = std::tanh( ( resMass_ - ( ( minMass + maxMass ) / 2 ) ) /
+ ( maxMass - minMass ) );
+ effResMass = minMass + ( maxMass - minMass ) * ( 1 + tanhTerm ) / 2;
+ effResMassSq = effResMass * effResMass;
+ }
+
+ // Decay momentum of either daughter in the resonance rest frame
+ // when resonance mass = rest-mass value, m_0 (PDG value)
+ Double_t term1 = effResMassSq - mDaugSumSq_;
+ Double_t term2 = effResMassSq - mDaugDiffSq_;
+ Double_t term12 = term1 * term2;
+ if ( term12 > 0.0 ) {
+ q0_ = TMath::Sqrt( term12 ) / ( 2.0 * effResMass );
+ } else {
+ q0_ = 0.0;
+ }
+
+ // Calculate the resonance Blatt-Weisskopf form factor for the case when m = m_0
+ FR0_ = 1.0;
+ if ( this->getSpin() > 0 ) {
+ const LauBlattWeisskopfFactor* resBWFactor = this->getResBWFactor();
+ if ( resBWFactor != nullptr ) {
+ FR0_ = resBWFactor->calcFormFactor( q0_ );
+ }
+ }
}
-LauComplex LauRelBreitWignerRes::resAmp(Double_t mass, Double_t spinTerm)
+LauComplex LauRelBreitWignerRes::resAmp( Double_t mass, Double_t spinTerm )
{
- // This function returns the complex dynamical amplitude for a Breit-Wigner resonance,
- // given the invariant mass and cos(helicity) values.
-
- LauComplex resAmplitude(0.0, 0.0);
-
- if (mass < 1e-10) {
- std::cerr << "WARNING in LauRelBreitWignerRes::amplitude : mass < 1e-10." << std::endl;
- return LauComplex(0.0, 0.0);
- } else if (q0_ < 1e-30) {
- return LauComplex(0.0, 0.0);
- }
-
- // Calculate the width of the resonance (as a function of mass)
- // First, calculate the various form factors.
- // NB
- // q is the momentum of either daughter in the resonance rest-frame,
- // p is the momentum of the bachelor in the resonance rest-frame,
- // pstar is the momentum of the bachelor in the parent rest-frame.
- // These quantities have been calculate in LauAbsResonance::amplitude(...)
-
- const Double_t resMass = this->getMass();
- const Double_t resWidth = this->getWidth();
- const Double_t resRadius = this->getResRadius();
- const Double_t parRadius = this->getParRadius();
-
- // If the mass is floating and its value has changed we need to
- // recalculate everything that assumes that value
- // Similarly for the BW radii
- if ( ( (!this->fixMass()) && resMass != resMass_ ) ||
- ( (!this->fixResRadius()) && resRadius != resRadius_ ) ||
- ( (!this->fixParRadius()) && parRadius != parRadius_ ) ) {
-
- this->initialise();
- }
-
- const Int_t resSpin = this->getSpin();
- const Double_t q = this->getQ();
- const Double_t p = this->getP();
- const Double_t pstar = this->getPstar();
-
- // Get barrier scaling factors
- Double_t fFactorR(1.0);
- Double_t fFactorB(1.0);
- if ( resSpin > 0 ) {
- const LauBlattWeisskopfFactor* resBWFactor = this->getResBWFactor();
- if ( resBWFactor != nullptr ) {
- fFactorR = resBWFactor->calcFormFactor(q);
- }
-
- const LauBlattWeisskopfFactor* parBWFactor = this->getParBWFactor();
- if ( parBWFactor != nullptr ) {
- switch ( parBWFactor->getRestFrame() ) {
- case LauBlattWeisskopfFactor::ResonanceFrame:
- fFactorB = parBWFactor->calcFormFactor(p);
- break;
- case LauBlattWeisskopfFactor::ParentFrame:
- fFactorB = parBWFactor->calcFormFactor(pstar);
- break;
- case LauBlattWeisskopfFactor::Covariant:
- {
- Double_t covFactor = this->getCovFactor();
- if ( resSpin > 2 ) {
- covFactor = TMath::Power( covFactor, 1.0/resSpin );
- } else if ( resSpin == 2 ) {
- covFactor = TMath::Sqrt( covFactor );
- }
- fFactorB = parBWFactor->calcFormFactor(pstar*covFactor);
- break;
- }
- }
- }
- }
-
- // If ignoreMomenta is set, set the total width simply as the pole width, and do
- // not include any momentum-dependent barrier factors (set them to unity)
- Double_t totWidth(resWidth);
-
- if (!this->ignoreMomenta()) {
-
- const Double_t qRatio = q/q0_;
- Double_t qTerm(0.0);
- if (resSpin == 0) {
- qTerm = qRatio;
- } else if (resSpin == 1) {
- qTerm = qRatio*qRatio*qRatio;
- } else if (resSpin == 2) {
- qTerm = qRatio*qRatio*qRatio*qRatio*qRatio;
- } else {
- qTerm = TMath::Power(qRatio, 2.0*resSpin + 1.0);
- }
-
- const Double_t fFactorRRatio = fFactorR/FR0_;
-
- totWidth = resWidth*qTerm*(resMass/mass)*fFactorRRatio*fFactorRRatio;
-
- }
-
- const Double_t massSq = mass*mass;
- const Double_t massSqTerm = resMassSq_ - massSq;
-
- // Compute the complex amplitude
- resAmplitude = LauComplex(massSqTerm, resMass*totWidth);
-
- // Scale by the denominator factor, as well as the spin term
- Double_t scale = spinTerm/(massSqTerm*massSqTerm + resMassSq_*totWidth*totWidth);
-
- // Include Blatt-Weisskopf barrier factors
- if (!this->ignoreBarrierScaling()) {
- scale *= fFactorR * fFactorB;
- }
-
- resAmplitude.rescale(scale);
-
- return resAmplitude;
+ // This function returns the complex dynamical amplitude for a Breit-Wigner resonance,
+ // given the invariant mass and cos(helicity) values.
+
+ LauComplex resAmplitude( 0.0, 0.0 );
+
+ if ( mass < 1e-10 ) {
+ std::cerr << "WARNING in LauRelBreitWignerRes::amplitude : mass < 1e-10." << std::endl;
+ return LauComplex( 0.0, 0.0 );
+ } else if ( q0_ < 1e-30 ) {
+ return LauComplex( 0.0, 0.0 );
+ }
+
+ // Calculate the width of the resonance (as a function of mass)
+ // First, calculate the various form factors.
+ // NB
+ // q is the momentum of either daughter in the resonance rest-frame,
+ // p is the momentum of the bachelor in the resonance rest-frame,
+ // pstar is the momentum of the bachelor in the parent rest-frame.
+ // These quantities have been calculate in LauAbsResonance::amplitude(...)
+
+ const Double_t resMass = this->getMass();
+ const Double_t resWidth = this->getWidth();
+ const Double_t resRadius = this->getResRadius();
+ const Double_t parRadius = this->getParRadius();
+
+ // If the mass is floating and its value has changed we need to
+ // recalculate everything that assumes that value
+ // Similarly for the BW radii
+ if ( ( ( ! this->fixMass() ) && resMass != resMass_ ) ||
+ ( ( ! this->fixResRadius() ) && resRadius != resRadius_ ) ||
+ ( ( ! this->fixParRadius() ) && parRadius != parRadius_ ) ) {
+
+ this->initialise();
+ }
+
+ const Int_t resSpin = this->getSpin();
+ const Double_t q = this->getQ();
+ const Double_t p = this->getP();
+ const Double_t pstar = this->getPstar();
+
+ // Get barrier scaling factors
+ Double_t fFactorR( 1.0 );
+ Double_t fFactorB( 1.0 );
+ if ( resSpin > 0 ) {
+ const LauBlattWeisskopfFactor* resBWFactor = this->getResBWFactor();
+ if ( resBWFactor != nullptr ) {
+ fFactorR = resBWFactor->calcFormFactor( q );
+ }
+
+ const LauBlattWeisskopfFactor* parBWFactor = this->getParBWFactor();
+ if ( parBWFactor != nullptr ) {
+ switch ( parBWFactor->getRestFrame() ) {
+ case LauBlattWeisskopfFactor::ResonanceFrame :
+ fFactorB = parBWFactor->calcFormFactor( p );
+ break;
+ case LauBlattWeisskopfFactor::ParentFrame :
+ fFactorB = parBWFactor->calcFormFactor( pstar );
+ break;
+ case LauBlattWeisskopfFactor::Covariant : {
+ Double_t covFactor = this->getCovFactor();
+ if ( resSpin > 2 ) {
+ covFactor = TMath::Power( covFactor, 1.0 / resSpin );
+ } else if ( resSpin == 2 ) {
+ covFactor = TMath::Sqrt( covFactor );
+ }
+ fFactorB = parBWFactor->calcFormFactor( pstar * covFactor );
+ break;
+ }
+ }
+ }
+ }
+
+ // If ignoreMomenta is set, set the total width simply as the pole width, and do
+ // not include any momentum-dependent barrier factors (set them to unity)
+ Double_t totWidth( resWidth );
+
+ if ( ! this->ignoreMomenta() ) {
+
+ const Double_t qRatio = q / q0_;
+ Double_t qTerm( 0.0 );
+ if ( resSpin == 0 ) {
+ qTerm = qRatio;
+ } else if ( resSpin == 1 ) {
+ qTerm = qRatio * qRatio * qRatio;
+ } else if ( resSpin == 2 ) {
+ qTerm = qRatio * qRatio * qRatio * qRatio * qRatio;
+ } else {
+ qTerm = TMath::Power( qRatio, 2.0 * resSpin + 1.0 );
+ }
+
+ const Double_t fFactorRRatio = fFactorR / FR0_;
+
+ totWidth = resWidth * qTerm * ( resMass / mass ) * fFactorRRatio * fFactorRRatio;
+ }
+
+ const Double_t massSq = mass * mass;
+ const Double_t massSqTerm = resMassSq_ - massSq;
+
+ // Compute the complex amplitude
+ resAmplitude = LauComplex( massSqTerm, resMass * totWidth );
+
+ // Scale by the denominator factor, as well as the spin term
+ Double_t scale = spinTerm / ( massSqTerm * massSqTerm + resMassSq_ * totWidth * totWidth );
+
+ // Include Blatt-Weisskopf barrier factors
+ if ( ! this->ignoreBarrierScaling() ) {
+ scale *= fFactorR * fFactorB;
+ }
+
+ resAmplitude.rescale( scale );
+
+ return resAmplitude;
}
const std::vector<LauParameter*>& LauRelBreitWignerRes::getFloatingParameters()
{
- this->clearFloatingParameters();
-
- if ( ! this->fixMass() ) {
- this->addFloatingParameter( this->getMassPar() );
- }
- if ( ! this->fixWidth() ) {
- this->addFloatingParameter( this->getWidthPar() );
- }
- if ( ! this->fixResRadius() ) {
- this->addFloatingParameter( this->getResBWFactor()->getRadiusParameter() );
- }
- if ( ! this->fixParRadius() ) {
- this->addFloatingParameter( this->getParBWFactor()->getRadiusParameter() );
- }
-
- return this->getParameters();
+ this->clearFloatingParameters();
+
+ if ( ! this->fixMass() ) {
+ this->addFloatingParameter( this->getMassPar() );
+ }
+ if ( ! this->fixWidth() ) {
+ this->addFloatingParameter( this->getWidthPar() );
+ }
+ if ( ! this->fixResRadius() ) {
+ this->addFloatingParameter( this->getResBWFactor()->getRadiusParameter() );
+ }
+ if ( ! this->fixParRadius() ) {
+ this->addFloatingParameter( this->getParBWFactor()->getRadiusParameter() );
+ }
+
+ return this->getParameters();
}
-
diff --git a/src/LauRescattering2Res.cc b/src/LauRescattering2Res.cc
index 396a45c..24faad4 100644
--- a/src/LauRescattering2Res.cc
+++ b/src/LauRescattering2Res.cc
@@ -1,671 +1,740 @@
/*
Copyright 2018 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauRescattering2Res.cc
\brief File containing implementation of LauRescattering2Res class.
*/
-#include <iostream>
+#include "LauRescattering2Res.hh"
#include "LauConstants.hh"
-#include "LauRescattering2Res.hh"
#include "LauResonanceInfo.hh"
+#include <iostream>
-LauRescattering2Res::LauRescattering2Res(LauResonanceInfo* resInfo, const Int_t resPairAmpInt, const LauDaughters* daughters) :
- LauAbsResonance(resInfo, resPairAmpInt, daughters),
- B1_(0),B2_(0),B3_(0),
- C1_(0),C2_(0),C3_(0),C4_(0),C5_(0),
- D0_(0),D1_(0),D2_(0),D3_(0),
- F1_(0),F2_(0),F3_(0),F4_(0)
+LauRescattering2Res::LauRescattering2Res( LauResonanceInfo* resInfo,
+ const Int_t resPairAmpInt,
+ const LauDaughters* daughters ) :
+ LauAbsResonance( resInfo, resPairAmpInt, daughters ),
+ B1_( 0 ),
+ B2_( 0 ),
+ B3_( 0 ),
+ C1_( 0 ),
+ C2_( 0 ),
+ C3_( 0 ),
+ C4_( 0 ),
+ C5_( 0 ),
+ D0_( 0 ),
+ D1_( 0 ),
+ D2_( 0 ),
+ D3_( 0 ),
+ F1_( 0 ),
+ F2_( 0 ),
+ F3_( 0 ),
+ F4_( 0 )
{
- // Default values for parameters, taken from
- const Double_t B1Val(23.6);
- const Double_t B2Val(29.4);
- const Double_t B3Val(0.6);
- const Double_t C1Val(34.39);
- const Double_t C2Val(4.4);
- const Double_t C3Val(-32.9);
- const Double_t C4Val(-16.);
- const Double_t C5Val(7.4);
- const Double_t D0Val(0.59);
- const Double_t D1Val(-0.38);
- const Double_t D2Val(0.12);
- const Double_t D3Val(-0.09);
- const Double_t F1Val(-0.043);
- const Double_t F2Val(-0.008);
- const Double_t F3Val(-0.28);
- const Double_t F4Val(0.026);
- const TString& parNameBase = this->getSanitisedName();
-
- TString B1Name(parNameBase);
- B1Name += "_B1";
- B1_ = resInfo->getExtraParameter( B1Name );
- if ( B1_ == 0 ) {
- B1_ = new LauParameter( B1Name, B1Val, -100.,100., kTRUE );
- B1_->secondStage(kTRUE);
- resInfo->addExtraParameter( B1_ );
- }
- TString B2Name(parNameBase);
- B2Name += "_B2";
- B2_ = resInfo->getExtraParameter( B2Name );
- if ( B2_ == 0 ) {
- B2_ = new LauParameter( B2Name, B2Val, -100.,100., kTRUE );
- B2_->secondStage(kTRUE);
- resInfo->addExtraParameter( B2_ );
- }
- TString B3Name(parNameBase);
- B3Name += "_B3";
- B3_ = resInfo->getExtraParameter( B3Name );
- if ( B3_ == 0 ) {
- B3_ = new LauParameter( B3Name, B3Val, -100.,100., kTRUE );
- B3_->secondStage(kTRUE);
- resInfo->addExtraParameter( B3_ );
- }
-
- TString C1Name(parNameBase);
- C1Name += "_C1";
- C1_ = resInfo->getExtraParameter( C1Name );
- if ( C1_ == 0 ) {
- C1_ = new LauParameter( C1Name, C1Val, -100.,100., kTRUE );
- C1_->secondStage(kTRUE);
- resInfo->addExtraParameter( C1_ );
- }
- TString C2Name(parNameBase);
- C2Name += "_C2";
- C2_ = resInfo->getExtraParameter( C2Name );
- if ( C2_ == 0 ) {
- C2_ = new LauParameter( C2Name, C2Val, -100.,100., kTRUE );
- C2_->secondStage(kTRUE);
- resInfo->addExtraParameter( C2_ );
- }
- TString C3Name(parNameBase);
- C3Name += "_C3";
- C3_ = resInfo->getExtraParameter( C3Name );
- if ( C3_ == 0 ) {
- C3_ = new LauParameter( C3Name, C3Val, -100.,100., kTRUE );
- C3_->secondStage(kTRUE);
- resInfo->addExtraParameter( C3_ );
- }
- TString C4Name(parNameBase);
- C4Name += "_C4";
- C4_ = resInfo->getExtraParameter( C4Name );
- if ( C4_ == 0 ) {
- C4_ = new LauParameter( C4Name, C4Val, -100.,100., kTRUE );
- C4_->secondStage(kTRUE);
- resInfo->addExtraParameter( C4_ );
- }
- TString C5Name(parNameBase);
- C5Name += "_C5";
- C5_ = resInfo->getExtraParameter( C5Name );
- if ( C5_ == 0 ) {
- C5_ = new LauParameter( C5Name, C5Val, -100.,100., kTRUE );
- C5_->secondStage(kTRUE);
- resInfo->addExtraParameter( C5_ );
- }
-
- TString D0Name(parNameBase);
- D0Name += "_D0";
- D0_ = resInfo->getExtraParameter( D0Name );
- if ( D0_ == 0 ) {
- D0_ = new LauParameter( D0Name, D0Val, -100.,100., kTRUE );
- D0_->secondStage(kTRUE);
- resInfo->addExtraParameter( D0_ );
- }
- TString D1Name(parNameBase);
- D1Name += "_D1";
- D1_ = resInfo->getExtraParameter( D1Name );
- if ( D1_ == 0 ) {
- D1_ = new LauParameter( D1Name, D1Val, -100.,100., kTRUE );
- D1_->secondStage(kTRUE);
- resInfo->addExtraParameter( D1_ );
- }
- TString D2Name(parNameBase);
- D2Name += "_D2";
- D2_ = resInfo->getExtraParameter( D2Name );
- if ( D2_ == 0 ) {
- D2_ = new LauParameter( D2Name, D2Val,-100.,100., kTRUE );
- D2_->secondStage(kTRUE);
- resInfo->addExtraParameter( D2_ );
- }
- TString D3Name(parNameBase);
- D3Name += "_D3";
- D3_ = resInfo->getExtraParameter( D3Name );
- if ( D3_ == 0 ) {
- D3_ = new LauParameter( D3Name, D3Val, -100.,100., kTRUE );
- D3_->secondStage(kTRUE);
- resInfo->addExtraParameter( D3_ );
- }
- TString F1Name(parNameBase);
- F1Name += "_F1";
- F1_ = resInfo->getExtraParameter( F1Name );
- if ( F1_ == 0 ) {
- F1_ = new LauParameter( F1Name, F1Val, -100.,100., kTRUE );
- F1_->secondStage(kTRUE);
- resInfo->addExtraParameter( F1_ );
- }
- TString F2Name(parNameBase);
- F2Name += "_F2";
- F2_ = resInfo->getExtraParameter( F2Name );
- if ( F2_ == 0 ) {
- F2_ = new LauParameter( F2Name, F2Val, -100.,100., kTRUE );
- F2_->secondStage(kTRUE);
- resInfo->addExtraParameter( F2_ );
- }
- TString F3Name(parNameBase);
- F3Name += "_F3";
- F3_ = resInfo->getExtraParameter( F3Name );
- if ( F3_ == 0 ) {
- F3_ = new LauParameter( F3Name, F3Val, -100.,100., kTRUE );
- F3_->secondStage(kTRUE);
- resInfo->addExtraParameter( F3_ );
- }
- TString F4Name(parNameBase);
- F4Name += "_F4";
- F4_ = resInfo->getExtraParameter( F4Name );
- if ( F4_ == 0 ) {
- F4_ = new LauParameter( F4Name, F4Val, -100.,100., kTRUE );
- F4_->secondStage(kTRUE);
- resInfo->addExtraParameter( F4_ );
- }
+ // Default values for parameters, taken from
+ const Double_t B1Val( 23.6 );
+ const Double_t B2Val( 29.4 );
+ const Double_t B3Val( 0.6 );
+ const Double_t C1Val( 34.39 );
+ const Double_t C2Val( 4.4 );
+ const Double_t C3Val( -32.9 );
+ const Double_t C4Val( -16. );
+ const Double_t C5Val( 7.4 );
+ const Double_t D0Val( 0.59 );
+ const Double_t D1Val( -0.38 );
+ const Double_t D2Val( 0.12 );
+ const Double_t D3Val( -0.09 );
+ const Double_t F1Val( -0.043 );
+ const Double_t F2Val( -0.008 );
+ const Double_t F3Val( -0.28 );
+ const Double_t F4Val( 0.026 );
+ const TString& parNameBase = this->getSanitisedName();
+
+ TString B1Name( parNameBase );
+ B1Name += "_B1";
+ B1_ = resInfo->getExtraParameter( B1Name );
+ if ( B1_ == 0 ) {
+ B1_ = new LauParameter( B1Name, B1Val, -100., 100., kTRUE );
+ B1_->secondStage( kTRUE );
+ resInfo->addExtraParameter( B1_ );
+ }
+ TString B2Name( parNameBase );
+ B2Name += "_B2";
+ B2_ = resInfo->getExtraParameter( B2Name );
+ if ( B2_ == 0 ) {
+ B2_ = new LauParameter( B2Name, B2Val, -100., 100., kTRUE );
+ B2_->secondStage( kTRUE );
+ resInfo->addExtraParameter( B2_ );
+ }
+ TString B3Name( parNameBase );
+ B3Name += "_B3";
+ B3_ = resInfo->getExtraParameter( B3Name );
+ if ( B3_ == 0 ) {
+ B3_ = new LauParameter( B3Name, B3Val, -100., 100., kTRUE );
+ B3_->secondStage( kTRUE );
+ resInfo->addExtraParameter( B3_ );
+ }
+
+ TString C1Name( parNameBase );
+ C1Name += "_C1";
+ C1_ = resInfo->getExtraParameter( C1Name );
+ if ( C1_ == 0 ) {
+ C1_ = new LauParameter( C1Name, C1Val, -100., 100., kTRUE );
+ C1_->secondStage( kTRUE );
+ resInfo->addExtraParameter( C1_ );
+ }
+ TString C2Name( parNameBase );
+ C2Name += "_C2";
+ C2_ = resInfo->getExtraParameter( C2Name );
+ if ( C2_ == 0 ) {
+ C2_ = new LauParameter( C2Name, C2Val, -100., 100., kTRUE );
+ C2_->secondStage( kTRUE );
+ resInfo->addExtraParameter( C2_ );
+ }
+ TString C3Name( parNameBase );
+ C3Name += "_C3";
+ C3_ = resInfo->getExtraParameter( C3Name );
+ if ( C3_ == 0 ) {
+ C3_ = new LauParameter( C3Name, C3Val, -100., 100., kTRUE );
+ C3_->secondStage( kTRUE );
+ resInfo->addExtraParameter( C3_ );
+ }
+ TString C4Name( parNameBase );
+ C4Name += "_C4";
+ C4_ = resInfo->getExtraParameter( C4Name );
+ if ( C4_ == 0 ) {
+ C4_ = new LauParameter( C4Name, C4Val, -100., 100., kTRUE );
+ C4_->secondStage( kTRUE );
+ resInfo->addExtraParameter( C4_ );
+ }
+ TString C5Name( parNameBase );
+ C5Name += "_C5";
+ C5_ = resInfo->getExtraParameter( C5Name );
+ if ( C5_ == 0 ) {
+ C5_ = new LauParameter( C5Name, C5Val, -100., 100., kTRUE );
+ C5_->secondStage( kTRUE );
+ resInfo->addExtraParameter( C5_ );
+ }
+
+ TString D0Name( parNameBase );
+ D0Name += "_D0";
+ D0_ = resInfo->getExtraParameter( D0Name );
+ if ( D0_ == 0 ) {
+ D0_ = new LauParameter( D0Name, D0Val, -100., 100., kTRUE );
+ D0_->secondStage( kTRUE );
+ resInfo->addExtraParameter( D0_ );
+ }
+ TString D1Name( parNameBase );
+ D1Name += "_D1";
+ D1_ = resInfo->getExtraParameter( D1Name );
+ if ( D1_ == 0 ) {
+ D1_ = new LauParameter( D1Name, D1Val, -100., 100., kTRUE );
+ D1_->secondStage( kTRUE );
+ resInfo->addExtraParameter( D1_ );
+ }
+ TString D2Name( parNameBase );
+ D2Name += "_D2";
+ D2_ = resInfo->getExtraParameter( D2Name );
+ if ( D2_ == 0 ) {
+ D2_ = new LauParameter( D2Name, D2Val, -100., 100., kTRUE );
+ D2_->secondStage( kTRUE );
+ resInfo->addExtraParameter( D2_ );
+ }
+ TString D3Name( parNameBase );
+ D3Name += "_D3";
+ D3_ = resInfo->getExtraParameter( D3Name );
+ if ( D3_ == 0 ) {
+ D3_ = new LauParameter( D3Name, D3Val, -100., 100., kTRUE );
+ D3_->secondStage( kTRUE );
+ resInfo->addExtraParameter( D3_ );
+ }
+ TString F1Name( parNameBase );
+ F1Name += "_F1";
+ F1_ = resInfo->getExtraParameter( F1Name );
+ if ( F1_ == 0 ) {
+ F1_ = new LauParameter( F1Name, F1Val, -100., 100., kTRUE );
+ F1_->secondStage( kTRUE );
+ resInfo->addExtraParameter( F1_ );
+ }
+ TString F2Name( parNameBase );
+ F2Name += "_F2";
+ F2_ = resInfo->getExtraParameter( F2Name );
+ if ( F2_ == 0 ) {
+ F2_ = new LauParameter( F2Name, F2Val, -100., 100., kTRUE );
+ F2_->secondStage( kTRUE );
+ resInfo->addExtraParameter( F2_ );
+ }
+ TString F3Name( parNameBase );
+ F3Name += "_F3";
+ F3_ = resInfo->getExtraParameter( F3Name );
+ if ( F3_ == 0 ) {
+ F3_ = new LauParameter( F3Name, F3Val, -100., 100., kTRUE );
+ F3_->secondStage( kTRUE );
+ resInfo->addExtraParameter( F3_ );
+ }
+ TString F4Name( parNameBase );
+ F4Name += "_F4";
+ F4_ = resInfo->getExtraParameter( F4Name );
+ if ( F4_ == 0 ) {
+ F4_ = new LauParameter( F4Name, F4Val, -100., 100., kTRUE );
+ F4_->secondStage( kTRUE );
+ resInfo->addExtraParameter( F4_ );
+ }
}
LauRescattering2Res::~LauRescattering2Res()
{
- delete B1_;delete B2_;delete B3_;
- delete C1_;delete C2_;delete C3_;delete C4_;delete C5_;
- delete D0_;delete D1_;delete D2_;delete D3_;
- delete F1_;delete F2_;delete F3_;delete F4_;
+ delete B1_;
+ delete B2_;
+ delete B3_;
+ delete C1_;
+ delete C2_;
+ delete C3_;
+ delete C4_;
+ delete C5_;
+ delete D0_;
+ delete D1_;
+ delete D2_;
+ delete D3_;
+ delete F1_;
+ delete F2_;
+ delete F3_;
+ delete F4_;
}
void LauRescattering2Res::initialise()
{
- sqr_tmin[1] = 2.00*LauConstants::mK;
- sqr_tmin[2] = 1.47;
- sqr_tmax[1] = 1.47;
- sqr_tmax[2] = 2.00;
-
- B0_ = 226.5*TMath::Pi()/180.0 + B1_->value() - B2_->value() + B3_->value();
- C0_ = phi00(sqr_tmax[1]*sqr_tmax[1], 1) + C1_->value() - C2_->value() + C3_->value() - C4_->value() + C5_->value();
- F0_ = g00(sqr_tmax[1]*sqr_tmax[1], 1) + F1_->value() - F2_->value() + F3_->value() - F4_->value();
-
- std::cout << "##### B = " << this->B1_->value()<<", "<< this->B2_->value()<<", "<< this->B3_->value()<<std::endl;
- std::cout << "##### C = " << this->C1_->value()<<", "<< this->C2_->value()<<", "<< this->C3_->value()<<", "<< this->C4_->value()<<", "<< this->C5_->value()<<std::endl;
- std::cout << "##### D = " << this->D0_->value() <<", "<< this->D1_->value()<<", "<< this->D2_->value()<<", "<< this->D3_->value()<< std::endl;
- std::cout << "##### F = " << this->F1_->value()<<", "<< this->F2_->value()<<", "<< this->F3_->value()<<", "<< this->F4_->value()<<std::endl;
-
-
+ sqr_tmin[1] = 2.00 * LauConstants::mK;
+ sqr_tmin[2] = 1.47;
+ sqr_tmax[1] = 1.47;
+ sqr_tmax[2] = 2.00;
+
+ B0_ = 226.5 * TMath::Pi() / 180.0 + B1_->value() - B2_->value() + B3_->value();
+ C0_ = phi00( sqr_tmax[1] * sqr_tmax[1], 1 ) + C1_->value() - C2_->value() + C3_->value() -
+ C4_->value() + C5_->value();
+ F0_ = g00( sqr_tmax[1] * sqr_tmax[1], 1 ) + F1_->value() - F2_->value() + F3_->value() -
+ F4_->value();
+
+ std::cout << "##### B = " << this->B1_->value() << ", " << this->B2_->value() << ", "
+ << this->B3_->value() << std::endl;
+ std::cout << "##### C = " << this->C1_->value() << ", " << this->C2_->value() << ", "
+ << this->C3_->value() << ", " << this->C4_->value() << ", " << this->C5_->value()
+ << std::endl;
+ std::cout << "##### D = " << this->D0_->value() << ", " << this->D1_->value() << ", "
+ << this->D2_->value() << ", " << this->D3_->value() << std::endl;
+ std::cout << "##### F = " << this->F1_->value() << ", " << this->F2_->value() << ", "
+ << this->F3_->value() << ", " << this->F4_->value() << std::endl;
}
-LauComplex LauRescattering2Res::resAmp(Double_t mass, Double_t)
+LauComplex LauRescattering2Res::resAmp( Double_t mass, Double_t )
{
- Int_t i = 0;
- if (mass < sqr_tmax[1]) i = 1;
- if (mass > sqr_tmax[1] && mass < sqr_tmax[2]) i = 2;
- if (i == 0) {
- std::cout << " ERROR MASS = " << mass <<" out of limmits mI, mII" << std::endl;
- return LauComplex(0,0);
- }
-
- Double_t sqr_t = mass;
- Double_t mag = this->g00(sqr_t, i);
- Double_t phase = this->phi00(sqr_t, i);
-
- return LauComplex(mag*TMath::Cos(phase), mag*TMath::Sin(phase));
+ Int_t i = 0;
+ if ( mass < sqr_tmax[1] )
+ i = 1;
+ if ( mass > sqr_tmax[1] && mass < sqr_tmax[2] )
+ i = 2;
+ if ( i == 0 ) {
+ std::cout << " ERROR MASS = " << mass << " out of limmits mI, mII" << std::endl;
+ return LauComplex( 0, 0 );
+ }
+
+ Double_t sqr_t = mass;
+ Double_t mag = this->g00( sqr_t, i );
+ Double_t phase = this->phi00( sqr_t, i );
+
+ return LauComplex( mag * TMath::Cos( phase ), mag * TMath::Sin( phase ) );
}
-Double_t LauRescattering2Res::pn(const Double_t x_, const Double_t n) const
-{
- if (n==0) return 1.0;
- if (n==1) return x_;
- return 2*x_*pn(x_,n-1) - pn(x_,n-2);
+Double_t LauRescattering2Res::pn( const Double_t x_, const Double_t n ) const
+{
+ if ( n == 0 )
+ return 1.0;
+ if ( n == 1 )
+ return x_;
+ return 2 * x_ * pn( x_, n - 1 ) - pn( x_, n - 2 );
}
-
-Double_t LauRescattering2Res::x(const Double_t sqr_t, const Int_t i) const
-{
- return 2.0*(sqr_t-sqr_tmin[i])/(sqr_tmax[i]-sqr_tmin[i]) -1.0;
+Double_t LauRescattering2Res::x( const Double_t sqr_t, const Int_t i ) const
+{
+ return 2.0 * ( sqr_t - sqr_tmin[i] ) / ( sqr_tmax[i] - sqr_tmin[i] ) - 1.0;
}
-Double_t LauRescattering2Res::phi00(const Double_t sqr_t, const Int_t i) const
-{
- Double_t x_t = x(sqr_t, i);
+Double_t LauRescattering2Res::phi00( const Double_t sqr_t, const Int_t i ) const
+{
+ Double_t x_t = x( sqr_t, i );
- if (i==1) return B0_*this->pn(x_t,0)+
- B1_->value()*this->pn(x_t,1)+
- B2_->value()*this->pn(x_t,2)+
- B3_->value()*this->pn(x_t,3);
+ if ( i == 1 )
+ return B0_ * this->pn( x_t, 0 ) + B1_->value() * this->pn( x_t, 1 ) +
+ B2_->value() * this->pn( x_t, 2 ) + B3_->value() * this->pn( x_t, 3 );
- if (i==2) return C0_*this->pn(x_t,0)+
- C1_->value()*this->pn(x_t,1)+
- C2_->value()*this->pn(x_t,2)+
- C3_->value()*this->pn(x_t,3)+
- C4_->value()*this->pn(x_t,4)+
- C5_->value()*this->pn(x_t,5);
+ if ( i == 2 )
+ return C0_ * this->pn( x_t, 0 ) + C1_->value() * this->pn( x_t, 1 ) +
+ C2_->value() * this->pn( x_t, 2 ) + C3_->value() * this->pn( x_t, 3 ) +
+ C4_->value() * this->pn( x_t, 4 ) + C5_->value() * this->pn( x_t, 5 );
- return 0;
+ return 0;
}
-Double_t LauRescattering2Res::g00(const Double_t sqr_t, const Int_t i) const
-{
- Double_t x_t = x(sqr_t, i);
-
- if (i==1) return D0_->value()*this->pn(x_t,0)+
- D1_->value()*this->pn(x_t,1)+
- D2_->value()*this->pn(x_t,2)+
- D3_->value()*this->pn(x_t,3);
+Double_t LauRescattering2Res::g00( const Double_t sqr_t, const Int_t i ) const
+{
+ Double_t x_t = x( sqr_t, i );
+ if ( i == 1 )
+ return D0_->value() * this->pn( x_t, 0 ) + D1_->value() * this->pn( x_t, 1 ) +
+ D2_->value() * this->pn( x_t, 2 ) + D3_->value() * this->pn( x_t, 3 );
- if (i==2) return F0_*this->pn(x_t,0)+
- F1_->value()*this->pn(x_t,1)+
- F2_->value()*this->pn(x_t,2)+
- F3_->value()*this->pn(x_t,3)+
- F4_->value()*this->pn(x_t,4);
+ if ( i == 2 )
+ return F0_ * this->pn( x_t, 0 ) + F1_->value() * this->pn( x_t, 1 ) +
+ F2_->value() * this->pn( x_t, 2 ) + F3_->value() * this->pn( x_t, 3 ) +
+ F4_->value() * this->pn( x_t, 4 );
- return 0;
+ return 0;
}
-
// TODO up to here!
const std::vector<LauParameter*>& LauRescattering2Res::getFloatingParameters()
{
- this->clearFloatingParameters();
-
- if ( ! this->fixB1Parameter() ) {
- this->addFloatingParameter( B1_ );
- }
- if ( ! this->fixB2Parameter() ) {
- this->addFloatingParameter( B2_ );
- }
- if ( ! this->fixB3Parameter() ) {
- this->addFloatingParameter( B3_ );
- }
-
- if ( ! this->fixC1Parameter() ) {
- this->addFloatingParameter( C1_ );
- }
- if ( ! this->fixC2Parameter() ) {
- this->addFloatingParameter( C2_ );
- }
- if ( ! this->fixC3Parameter() ) {
- this->addFloatingParameter( C3_ );
- }
- if ( ! this->fixC4Parameter() ) {
- this->addFloatingParameter( C4_ );
- }
- if ( ! this->fixC5Parameter() ) {
- this->addFloatingParameter( C5_ );
- }
-
- if ( ! this->fixD0Parameter() ) {
- this->addFloatingParameter( D0_ );
- }
- if ( ! this->fixD1Parameter() ) {
- this->addFloatingParameter( D1_ );
- }
- if ( ! this->fixD2Parameter() ) {
- this->addFloatingParameter( D2_ );
- }
- if ( ! this->fixD3Parameter() ) {
- this->addFloatingParameter( D3_ );
- }
-
- if ( ! this->fixF1Parameter() ) {
- this->addFloatingParameter( F1_ );
- }
-
- if ( ! this->fixF2Parameter() ) {
- this->addFloatingParameter( F2_ );
- }
-
- if ( ! this->fixF3Parameter() ) {
- this->addFloatingParameter( F3_ );
- }
-
- if ( ! this->fixF4Parameter() ) {
- this->addFloatingParameter( F4_ );
- }
-
-
- return this->getParameters();
+ this->clearFloatingParameters();
+
+ if ( ! this->fixB1Parameter() ) {
+ this->addFloatingParameter( B1_ );
+ }
+ if ( ! this->fixB2Parameter() ) {
+ this->addFloatingParameter( B2_ );
+ }
+ if ( ! this->fixB3Parameter() ) {
+ this->addFloatingParameter( B3_ );
+ }
+
+ if ( ! this->fixC1Parameter() ) {
+ this->addFloatingParameter( C1_ );
+ }
+ if ( ! this->fixC2Parameter() ) {
+ this->addFloatingParameter( C2_ );
+ }
+ if ( ! this->fixC3Parameter() ) {
+ this->addFloatingParameter( C3_ );
+ }
+ if ( ! this->fixC4Parameter() ) {
+ this->addFloatingParameter( C4_ );
+ }
+ if ( ! this->fixC5Parameter() ) {
+ this->addFloatingParameter( C5_ );
+ }
+
+ if ( ! this->fixD0Parameter() ) {
+ this->addFloatingParameter( D0_ );
+ }
+ if ( ! this->fixD1Parameter() ) {
+ this->addFloatingParameter( D1_ );
+ }
+ if ( ! this->fixD2Parameter() ) {
+ this->addFloatingParameter( D2_ );
+ }
+ if ( ! this->fixD3Parameter() ) {
+ this->addFloatingParameter( D3_ );
+ }
+
+ if ( ! this->fixF1Parameter() ) {
+ this->addFloatingParameter( F1_ );
+ }
+
+ if ( ! this->fixF2Parameter() ) {
+ this->addFloatingParameter( F2_ );
+ }
+
+ if ( ! this->fixF3Parameter() ) {
+ this->addFloatingParameter( F3_ );
+ }
+
+ if ( ! this->fixF4Parameter() ) {
+ this->addFloatingParameter( F4_ );
+ }
+
+ return this->getParameters();
}
-void LauRescattering2Res::setResonanceParameter(const TString& name, const Double_t value)
+void LauRescattering2Res::setResonanceParameter( const TString& name, const Double_t value )
{
- // Set various parameters for the NRAmplitude lineshape dynamics
- if (name == "B1") {
- this->setB1Parameter(value);
- std::cout << "INFO in LauRescattering2Res::setResonanceParameter : Setting NRAmplitude B1 = " << this->getB1Parameter() << std::endl;
- } else if (name == "B2") {
- this->setB2Parameter(value);
- std::cout << "INFO in LauRescattering2Res::setResonanceParameter : Setting NRAmplitude B2 = " << this->getB2Parameter() << std::endl;
- } else if (name == "B3") {
- this->setB3Parameter(value);
- std::cout << "INFO in LauRescattering2Res::setResonanceParameter : Setting NRAmplitude B3 = " << this->getB3Parameter() << std::endl;
- } else if (name == "C1") {
- this->setC1Parameter(value);
- std::cout << "INFO in LauRescattering2Res::setResonanceParameter : Setting NRAmplitude C1 = " << this->getC1Parameter() << std::endl;
- } else if (name == "C2") {
- this->setC2Parameter(value);
- std::cout << "INFO in LauRescattering2Res::setResonanceParameter : Setting NRAmplitude C2 = " << this->getC2Parameter() << std::endl;
- } else if (name == "C3") {
- this->setC3Parameter(value);
- std::cout << "INFO in LauRescattering2Res::setResonanceParameter : Setting NRAmplitude C3 = " << this->getC3Parameter() << std::endl;
- } else if (name == "C4") {
- this->setC4Parameter(value);
- std::cout << "INFO in LauRescattering2Res::setResonanceParameter : Setting NRAmplitude C4 = " << this->getC4Parameter() << std::endl;
- } else if (name == "C5") {
- this->setC5Parameter(value);
- std::cout << "INFO in LauRescattering2Res::setResonanceParameter : Setting NRAmplitude C5 = " << this->getC5Parameter() << std::endl;
- } else if (name == "D0") {
- this->setD0Parameter(value);
- std::cout << "INFO in LauRescattering2Res::setResonanceParameter : Setting NRAmplitude D0 = " << this->getD0Parameter() << std::endl;
- } else if (name == "D1") {
- this->setD1Parameter(value);
- std::cout << "INFO in LauRescattering2Res::setResonanceParameter : Setting NRAmplitude D1 = " << this->getD1Parameter() << std::endl;
- } else if (name == "D2") {
- this->setD2Parameter(value);
- std::cout << "INFO in LauRescattering2Res::setResonanceParameter : Setting NRAmplitude D2 = " << this->getD2Parameter() << std::endl;
- } else if (name == "D3") {
- this->setD3Parameter(value);
- std::cout << "INFO in LauRescattering2Res::setResonanceParameter : Setting NRAmplitude D3 = " << this->getD3Parameter() << std::endl;
- } else if (name == "F1") {
- this->setF1Parameter(value);
- std::cout << "INFO in LauRescattering2Res::setResonanceParameter : Setting NRAmplitude F1 = " << this->getF1Parameter() << std::endl;
- } else if (name == "F2") {
- this->setF2Parameter(value);
- std::cout << "INFO in LauRescattering2Res::setResonanceParameter : Setting NRAmplitude F2 = " << this->getF2Parameter() << std::endl;
- } else if (name == "F3") {
- this->setF3Parameter(value);
- std::cout << "INFO in LauRescattering2Res::setResonanceParameter : Setting NRAmplitude F3 = " << this->getF3Parameter() << std::endl;
- } else if (name == "F4") {
- this->setF4Parameter(value);
- std::cout << "INFO in LauRescattering2Res::setResonanceParameter : Setting NRAmplitude F4 = " << this->getF4Parameter() << std::endl;
- } else {
- std::cerr << "WARNING in LauRescattering2Res::setResonanceParameter: Parameter name not reconised. No parameter changes made." << std::endl;
- }
+ // Set various parameters for the NRAmplitude lineshape dynamics
+ if ( name == "B1" ) {
+ this->setB1Parameter( value );
+ std::cout << "INFO in LauRescattering2Res::setResonanceParameter : Setting NRAmplitude B1 = "
+ << this->getB1Parameter() << std::endl;
+ } else if ( name == "B2" ) {
+ this->setB2Parameter( value );
+ std::cout << "INFO in LauRescattering2Res::setResonanceParameter : Setting NRAmplitude B2 = "
+ << this->getB2Parameter() << std::endl;
+ } else if ( name == "B3" ) {
+ this->setB3Parameter( value );
+ std::cout << "INFO in LauRescattering2Res::setResonanceParameter : Setting NRAmplitude B3 = "
+ << this->getB3Parameter() << std::endl;
+ } else if ( name == "C1" ) {
+ this->setC1Parameter( value );
+ std::cout << "INFO in LauRescattering2Res::setResonanceParameter : Setting NRAmplitude C1 = "
+ << this->getC1Parameter() << std::endl;
+ } else if ( name == "C2" ) {
+ this->setC2Parameter( value );
+ std::cout << "INFO in LauRescattering2Res::setResonanceParameter : Setting NRAmplitude C2 = "
+ << this->getC2Parameter() << std::endl;
+ } else if ( name == "C3" ) {
+ this->setC3Parameter( value );
+ std::cout << "INFO in LauRescattering2Res::setResonanceParameter : Setting NRAmplitude C3 = "
+ << this->getC3Parameter() << std::endl;
+ } else if ( name == "C4" ) {
+ this->setC4Parameter( value );
+ std::cout << "INFO in LauRescattering2Res::setResonanceParameter : Setting NRAmplitude C4 = "
+ << this->getC4Parameter() << std::endl;
+ } else if ( name == "C5" ) {
+ this->setC5Parameter( value );
+ std::cout << "INFO in LauRescattering2Res::setResonanceParameter : Setting NRAmplitude C5 = "
+ << this->getC5Parameter() << std::endl;
+ } else if ( name == "D0" ) {
+ this->setD0Parameter( value );
+ std::cout << "INFO in LauRescattering2Res::setResonanceParameter : Setting NRAmplitude D0 = "
+ << this->getD0Parameter() << std::endl;
+ } else if ( name == "D1" ) {
+ this->setD1Parameter( value );
+ std::cout << "INFO in LauRescattering2Res::setResonanceParameter : Setting NRAmplitude D1 = "
+ << this->getD1Parameter() << std::endl;
+ } else if ( name == "D2" ) {
+ this->setD2Parameter( value );
+ std::cout << "INFO in LauRescattering2Res::setResonanceParameter : Setting NRAmplitude D2 = "
+ << this->getD2Parameter() << std::endl;
+ } else if ( name == "D3" ) {
+ this->setD3Parameter( value );
+ std::cout << "INFO in LauRescattering2Res::setResonanceParameter : Setting NRAmplitude D3 = "
+ << this->getD3Parameter() << std::endl;
+ } else if ( name == "F1" ) {
+ this->setF1Parameter( value );
+ std::cout << "INFO in LauRescattering2Res::setResonanceParameter : Setting NRAmplitude F1 = "
+ << this->getF1Parameter() << std::endl;
+ } else if ( name == "F2" ) {
+ this->setF2Parameter( value );
+ std::cout << "INFO in LauRescattering2Res::setResonanceParameter : Setting NRAmplitude F2 = "
+ << this->getF2Parameter() << std::endl;
+ } else if ( name == "F3" ) {
+ this->setF3Parameter( value );
+ std::cout << "INFO in LauRescattering2Res::setResonanceParameter : Setting NRAmplitude F3 = "
+ << this->getF3Parameter() << std::endl;
+ } else if ( name == "F4" ) {
+ this->setF4Parameter( value );
+ std::cout << "INFO in LauRescattering2Res::setResonanceParameter : Setting NRAmplitude F4 = "
+ << this->getF4Parameter() << std::endl;
+ } else {
+ std::cerr << "WARNING in LauRescattering2Res::setResonanceParameter: Parameter name not reconised. No parameter changes made."
+ << std::endl;
+ }
}
-void LauRescattering2Res::floatResonanceParameter(const TString& name)
+void LauRescattering2Res::floatResonanceParameter( const TString& name )
{
- if (name == "B1") {
- if ( B1_->fixed() ) {
- B1_->fixed( kFALSE );
- this->addFloatingParameter( B1_ );
- } else {
- std::cerr << "WARNING in LauRescattering2Res::floatResonanceParameter: Parameter already floating. No parameter changes made." << std::endl;
- }
- } else if (name == "B2") {
- if ( B2_->fixed() ) {
- B2_->fixed( kFALSE );
- this->addFloatingParameter( B2_ );
- } else {
- std::cerr << "WARNING in LauRescattering2Res::floatResonanceParameter: Parameter already floating. No parameter changes made." << std::endl;
- }
- } else if (name == "B3") {
- if ( B3_->fixed() ) {
- B3_->fixed( kFALSE );
- this->addFloatingParameter( B3_ );
- } else {
- std::cerr << "WARNING in LauRescattering2Res::floatResonanceParameter: Parameter already floating. No parameter changes made." << std::endl;
- }
- } else if (name == "C1") {
- if ( C1_->fixed() ) {
- C1_->fixed( kFALSE );
- this->addFloatingParameter( C1_ );
- } else {
- std::cerr << "WARNING in LauRescattering2Res::floatResonanceParameter: Parameter already floating. No parameter changes made." << std::endl;
- }
- } else if (name == "C2") {
- if ( C2_->fixed() ) {
- C2_->fixed( kFALSE );
- this->addFloatingParameter( C2_ );
- } else {
- std::cerr << "WARNING in LauRescattering2Res::floatResonanceParameter: Parameter already floating. No parameter changes made." << std::endl;
- }
- } else if (name == "C3") {
- if ( C3_->fixed() ) {
- C3_->fixed( kFALSE );
- this->addFloatingParameter( C3_ );
- } else {
- std::cerr << "WARNING in LauRescattering2Res::floatResonanceParameter: Parameter already floating. No parameter changes made." << std::endl;
- }
- } else if (name == "C4") {
- if ( C4_->fixed() ) {
- C4_->fixed( kFALSE );
- this->addFloatingParameter( C4_ );
- } else {
- std::cerr << "WARNING in LauRescattering2Res::floatResonanceParameter: Parameter already floating. No parameter changes made." << std::endl;
- }
- } else if (name == "C5") {
- if ( C5_->fixed() ) {
- C5_->fixed( kFALSE );
- this->addFloatingParameter( C5_ );
- } else {
- std::cerr << "WARNING in LauRescattering2Res::floatResonanceParameter: Parameter already floating. No parameter changes made." << std::endl;
- }
- } else if (name == "D0") {
- if ( D0_->fixed() ) {
- D0_->fixed( kFALSE );
- this->addFloatingParameter( D0_ );
- } else {
- std::cerr << "WARNING in LauRescattering2Res::floatResonanceParameter: Parameter already floating. No parameter changes made." << std::endl;
- }
- } else if (name == "D1") {
- if ( D1_->fixed() ) {
- D1_->fixed( kFALSE );
- this->addFloatingParameter( D1_ );
- } else {
- std::cerr << "WARNING in LauRescattering2Res::floatResonanceParameter: Parameter already floating. No parameter changes made." << std::endl;
- }
- } else if (name == "D2") {
- if ( D2_->fixed() ) {
- D2_->fixed( kFALSE );
- this->addFloatingParameter( D2_ );
- } else {
- std::cerr << "WARNING in LauRescattering2Res::floatResonanceParameter: Parameter already floating. No parameter changes made." << std::endl;
- }
- } else if (name == "D3") {
- if ( D3_->fixed() ) {
- D3_->fixed( kFALSE );
- this->addFloatingParameter( D3_ );
- } else {
- std::cerr << "WARNING in LauRescattering2Res::floatResonanceParameter: Parameter already floating. No parameter changes made." << std::endl;
- }
- } else if (name == "F1") {
- if ( F1_->fixed() ) {
- F1_->fixed( kFALSE );
- this->addFloatingParameter( F1_ );
- } else {
- std::cerr << "WARNING in LauRescattering2Res::floatResonanceParameter: Parameter already floating. No parameter changes made." << std::endl;
- }
- } else if (name == "F2") {
- if ( F2_->fixed() ) {
- F2_->fixed( kFALSE );
- this->addFloatingParameter( F2_ );
- } else {
- std::cerr << "WARNING in LauRescattering2Res::floatResonanceParameter: Parameter already floating. No parameter changes made." << std::endl;
- }
- } else if (name == "F3") {
- if ( F3_->fixed() ) {
- F3_->fixed( kFALSE );
- this->addFloatingParameter( F3_ );
- } else {
- std::cerr << "WARNING in LauRescattering2Res::floatResonanceParameter: Parameter already floating. No parameter changes made." << std::endl;
- }
- } else if (name == "4F") {
- if ( F4_->fixed() ) {
- F4_->fixed( kFALSE );
- this->addFloatingParameter( F4_ );
- } else {
- std::cerr << "WARNING in LauRescattering2Res::floatResonanceParameter: Parameter already floating. No parameter changes made." << std::endl;
- }
- } else {
- std::cerr << "WARNING in LauRescattering2Res::fixResonanceParameter: Parameter name not reconised. No parameter changes made." << std::endl;
- }
+ if ( name == "B1" ) {
+ if ( B1_->fixed() ) {
+ B1_->fixed( kFALSE );
+ this->addFloatingParameter( B1_ );
+ } else {
+ std::cerr << "WARNING in LauRescattering2Res::floatResonanceParameter: Parameter already floating. No parameter changes made."
+ << std::endl;
+ }
+ } else if ( name == "B2" ) {
+ if ( B2_->fixed() ) {
+ B2_->fixed( kFALSE );
+ this->addFloatingParameter( B2_ );
+ } else {
+ std::cerr << "WARNING in LauRescattering2Res::floatResonanceParameter: Parameter already floating. No parameter changes made."
+ << std::endl;
+ }
+ } else if ( name == "B3" ) {
+ if ( B3_->fixed() ) {
+ B3_->fixed( kFALSE );
+ this->addFloatingParameter( B3_ );
+ } else {
+ std::cerr << "WARNING in LauRescattering2Res::floatResonanceParameter: Parameter already floating. No parameter changes made."
+ << std::endl;
+ }
+ } else if ( name == "C1" ) {
+ if ( C1_->fixed() ) {
+ C1_->fixed( kFALSE );
+ this->addFloatingParameter( C1_ );
+ } else {
+ std::cerr << "WARNING in LauRescattering2Res::floatResonanceParameter: Parameter already floating. No parameter changes made."
+ << std::endl;
+ }
+ } else if ( name == "C2" ) {
+ if ( C2_->fixed() ) {
+ C2_->fixed( kFALSE );
+ this->addFloatingParameter( C2_ );
+ } else {
+ std::cerr << "WARNING in LauRescattering2Res::floatResonanceParameter: Parameter already floating. No parameter changes made."
+ << std::endl;
+ }
+ } else if ( name == "C3" ) {
+ if ( C3_->fixed() ) {
+ C3_->fixed( kFALSE );
+ this->addFloatingParameter( C3_ );
+ } else {
+ std::cerr << "WARNING in LauRescattering2Res::floatResonanceParameter: Parameter already floating. No parameter changes made."
+ << std::endl;
+ }
+ } else if ( name == "C4" ) {
+ if ( C4_->fixed() ) {
+ C4_->fixed( kFALSE );
+ this->addFloatingParameter( C4_ );
+ } else {
+ std::cerr << "WARNING in LauRescattering2Res::floatResonanceParameter: Parameter already floating. No parameter changes made."
+ << std::endl;
+ }
+ } else if ( name == "C5" ) {
+ if ( C5_->fixed() ) {
+ C5_->fixed( kFALSE );
+ this->addFloatingParameter( C5_ );
+ } else {
+ std::cerr << "WARNING in LauRescattering2Res::floatResonanceParameter: Parameter already floating. No parameter changes made."
+ << std::endl;
+ }
+ } else if ( name == "D0" ) {
+ if ( D0_->fixed() ) {
+ D0_->fixed( kFALSE );
+ this->addFloatingParameter( D0_ );
+ } else {
+ std::cerr << "WARNING in LauRescattering2Res::floatResonanceParameter: Parameter already floating. No parameter changes made."
+ << std::endl;
+ }
+ } else if ( name == "D1" ) {
+ if ( D1_->fixed() ) {
+ D1_->fixed( kFALSE );
+ this->addFloatingParameter( D1_ );
+ } else {
+ std::cerr << "WARNING in LauRescattering2Res::floatResonanceParameter: Parameter already floating. No parameter changes made."
+ << std::endl;
+ }
+ } else if ( name == "D2" ) {
+ if ( D2_->fixed() ) {
+ D2_->fixed( kFALSE );
+ this->addFloatingParameter( D2_ );
+ } else {
+ std::cerr << "WARNING in LauRescattering2Res::floatResonanceParameter: Parameter already floating. No parameter changes made."
+ << std::endl;
+ }
+ } else if ( name == "D3" ) {
+ if ( D3_->fixed() ) {
+ D3_->fixed( kFALSE );
+ this->addFloatingParameter( D3_ );
+ } else {
+ std::cerr << "WARNING in LauRescattering2Res::floatResonanceParameter: Parameter already floating. No parameter changes made."
+ << std::endl;
+ }
+ } else if ( name == "F1" ) {
+ if ( F1_->fixed() ) {
+ F1_->fixed( kFALSE );
+ this->addFloatingParameter( F1_ );
+ } else {
+ std::cerr << "WARNING in LauRescattering2Res::floatResonanceParameter: Parameter already floating. No parameter changes made."
+ << std::endl;
+ }
+ } else if ( name == "F2" ) {
+ if ( F2_->fixed() ) {
+ F2_->fixed( kFALSE );
+ this->addFloatingParameter( F2_ );
+ } else {
+ std::cerr << "WARNING in LauRescattering2Res::floatResonanceParameter: Parameter already floating. No parameter changes made."
+ << std::endl;
+ }
+ } else if ( name == "F3" ) {
+ if ( F3_->fixed() ) {
+ F3_->fixed( kFALSE );
+ this->addFloatingParameter( F3_ );
+ } else {
+ std::cerr << "WARNING in LauRescattering2Res::floatResonanceParameter: Parameter already floating. No parameter changes made."
+ << std::endl;
+ }
+ } else if ( name == "4F" ) {
+ if ( F4_->fixed() ) {
+ F4_->fixed( kFALSE );
+ this->addFloatingParameter( F4_ );
+ } else {
+ std::cerr << "WARNING in LauRescattering2Res::floatResonanceParameter: Parameter already floating. No parameter changes made."
+ << std::endl;
+ }
+ } else {
+ std::cerr << "WARNING in LauRescattering2Res::fixResonanceParameter: Parameter name not reconised. No parameter changes made."
+ << std::endl;
+ }
}
-LauParameter* LauRescattering2Res::getResonanceParameter(const TString& name)
+LauParameter* LauRescattering2Res::getResonanceParameter( const TString& name )
{
- if (name == "B1") {
- return B1_;
- } else if (name == "B2") {
- return B2_;
- } else if (name == "B3") {
- return B3_;
- } else if (name == "C1") {
- return C1_;
- } else if (name == "C2") {
- return C2_;
- } else if (name == "C3") {
- return C3_;
- } else if (name == "C4") {
- return C4_;
- } else if (name == "C5") {
- return C5_;
- } else if (name == "D0") {
- return D0_;
- } else if (name == "D1") {
- return D1_;
- } else if (name == "D2") {
- return D2_;
- } else if (name == "D3") {
- return D3_;
- } else if (name == "F1") {
- return F1_;
- } else if (name == "F2") {
- return F2_;
- } else if (name == "F3") {
- return F3_;
- } else if (name == "F4") {
- return F4_;
- } else {
- std::cerr << "WARNING in LauRescattering2Res::getResonanceParameter: Parameter name not reconised." << std::endl;
- return 0;
- }
+ if ( name == "B1" ) {
+ return B1_;
+ } else if ( name == "B2" ) {
+ return B2_;
+ } else if ( name == "B3" ) {
+ return B3_;
+ } else if ( name == "C1" ) {
+ return C1_;
+ } else if ( name == "C2" ) {
+ return C2_;
+ } else if ( name == "C3" ) {
+ return C3_;
+ } else if ( name == "C4" ) {
+ return C4_;
+ } else if ( name == "C5" ) {
+ return C5_;
+ } else if ( name == "D0" ) {
+ return D0_;
+ } else if ( name == "D1" ) {
+ return D1_;
+ } else if ( name == "D2" ) {
+ return D2_;
+ } else if ( name == "D3" ) {
+ return D3_;
+ } else if ( name == "F1" ) {
+ return F1_;
+ } else if ( name == "F2" ) {
+ return F2_;
+ } else if ( name == "F3" ) {
+ return F3_;
+ } else if ( name == "F4" ) {
+ return F4_;
+ } else {
+ std::cerr << "WARNING in LauRescattering2Res::getResonanceParameter: Parameter name not reconised."
+ << std::endl;
+ return 0;
+ }
}
-void LauRescattering2Res::setB1Parameter(const Double_t B1)
+void LauRescattering2Res::setB1Parameter( const Double_t B1 )
{
- B1_->value( B1 );
- B1_->genValue( B1 );
- B1_->initValue( B1 );
+ B1_->value( B1 );
+ B1_->genValue( B1 );
+ B1_->initValue( B1 );
}
-void LauRescattering2Res::setB2Parameter(const Double_t B2)
+
+void LauRescattering2Res::setB2Parameter( const Double_t B2 )
{
- B2_->value( B2 );
- B2_->genValue( B2 );
- B2_->initValue( B2 );
+ B2_->value( B2 );
+ B2_->genValue( B2 );
+ B2_->initValue( B2 );
}
-void LauRescattering2Res::setB3Parameter(const Double_t B3)
+
+void LauRescattering2Res::setB3Parameter( const Double_t B3 )
{
- B3_->value( B3 );
- B3_->genValue( B3 );
- B3_->initValue( B3 );
+ B3_->value( B3 );
+ B3_->genValue( B3 );
+ B3_->initValue( B3 );
}
-void LauRescattering2Res::setC1Parameter(const Double_t C1)
+void LauRescattering2Res::setC1Parameter( const Double_t C1 )
{
- C1_->value( C1 );
- C1_->genValue( C1 );
- C1_->initValue( C1 );
+ C1_->value( C1 );
+ C1_->genValue( C1 );
+ C1_->initValue( C1 );
}
-void LauRescattering2Res::setC2Parameter(const Double_t C2)
+
+void LauRescattering2Res::setC2Parameter( const Double_t C2 )
{
- C2_->value( C2 );
- C2_->genValue( C2 );
- C2_->initValue( C2 );
+ C2_->value( C2 );
+ C2_->genValue( C2 );
+ C2_->initValue( C2 );
}
-void LauRescattering2Res::setC3Parameter(const Double_t C3)
+
+void LauRescattering2Res::setC3Parameter( const Double_t C3 )
{
- C3_->value( C3 );
- C3_->genValue( C3 );
- C3_->initValue( C3 );
+ C3_->value( C3 );
+ C3_->genValue( C3 );
+ C3_->initValue( C3 );
}
-void LauRescattering2Res::setC4Parameter(const Double_t C4)
+
+void LauRescattering2Res::setC4Parameter( const Double_t C4 )
{
- C4_->value( C4 );
- C4_->genValue( C4 );
- C4_->initValue( C4 );
+ C4_->value( C4 );
+ C4_->genValue( C4 );
+ C4_->initValue( C4 );
}
-void LauRescattering2Res::setC5Parameter(const Double_t C5)
+
+void LauRescattering2Res::setC5Parameter( const Double_t C5 )
{
- C5_->value( C5 );
- C5_->genValue( C5 );
- C5_->initValue( C5 );
+ C5_->value( C5 );
+ C5_->genValue( C5 );
+ C5_->initValue( C5 );
}
-
-void LauRescattering2Res::setD0Parameter(const Double_t D0)
+void LauRescattering2Res::setD0Parameter( const Double_t D0 )
{
- D0_->value( D0 );
- D0_->genValue( D0 );
- D0_->initValue( D0 );
+ D0_->value( D0 );
+ D0_->genValue( D0 );
+ D0_->initValue( D0 );
}
-void LauRescattering2Res::setD1Parameter(const Double_t D1)
+
+void LauRescattering2Res::setD1Parameter( const Double_t D1 )
{
- D1_->value( D1 );
- D1_->genValue( D1 );
- D1_->initValue( D1 );
+ D1_->value( D1 );
+ D1_->genValue( D1 );
+ D1_->initValue( D1 );
}
-void LauRescattering2Res::setD2Parameter(const Double_t D2)
+
+void LauRescattering2Res::setD2Parameter( const Double_t D2 )
{
- D2_->value( D2 );
- D2_->genValue( D2 );
- D2_->initValue( D2 );
+ D2_->value( D2 );
+ D2_->genValue( D2 );
+ D2_->initValue( D2 );
}
-void LauRescattering2Res::setD3Parameter(const Double_t D3)
+
+void LauRescattering2Res::setD3Parameter( const Double_t D3 )
{
- D3_->value( D3 );
- D3_->genValue( D3 );
- D3_->initValue( D3 );
+ D3_->value( D3 );
+ D3_->genValue( D3 );
+ D3_->initValue( D3 );
}
-void LauRescattering2Res::setF1Parameter(const Double_t F1)
+
+void LauRescattering2Res::setF1Parameter( const Double_t F1 )
{
- F1_->value( F1 );
- F1_->genValue( F1 );
- F1_->initValue( F1 );
+ F1_->value( F1 );
+ F1_->genValue( F1 );
+ F1_->initValue( F1 );
}
-void LauRescattering2Res::setF2Parameter(const Double_t F2)
+void LauRescattering2Res::setF2Parameter( const Double_t F2 )
{
- F2_->value( F2 );
- F2_->genValue( F2 );
- F2_->initValue( F2 );
+ F2_->value( F2 );
+ F2_->genValue( F2 );
+ F2_->initValue( F2 );
}
-void LauRescattering2Res::setF3Parameter(const Double_t F3)
+void LauRescattering2Res::setF3Parameter( const Double_t F3 )
{
- F3_->value( F3 );
- F3_->genValue( F3 );
- F3_->initValue( F3 );
+ F3_->value( F3 );
+ F3_->genValue( F3 );
+ F3_->initValue( F3 );
}
-void LauRescattering2Res::setF4Parameter(const Double_t F4)
+void LauRescattering2Res::setF4Parameter( const Double_t F4 )
{
- F4_->value( F4 );
- F4_->genValue( F4 );
- F4_->initValue( F4 );
+ F4_->value( F4 );
+ F4_->genValue( F4 );
+ F4_->initValue( F4 );
}
-
diff --git a/src/LauRescatteringRes.cc b/src/LauRescatteringRes.cc
index bc503ee..f688192 100644
--- a/src/LauRescatteringRes.cc
+++ b/src/LauRescatteringRes.cc
@@ -1,453 +1,465 @@
/*
Copyright 2018 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauRescatteringRes.cc
\brief File containing implementation of LauRescatteringRes class.
*/
-#include <iostream>
-
-#include "TMath.h"
+#include "LauRescatteringRes.hh"
-#include "TSystem.h"
#include "LauConstants.hh"
-#include "LauRescatteringRes.hh"
#include "LauDaughters.hh"
#include "LauParameter.hh"
#include "LauResonanceInfo.hh"
+#include "TMath.h"
+#include "TSystem.h"
+#include <iostream>
-LauRescatteringRes::LauRescatteringRes(LauResonanceInfo* resInfo, const LauAbsResonance::LauResonanceModel resType,
- const Int_t resPairAmpInt, const LauDaughters* daughters) :
- LauAbsResonance(resInfo, resPairAmpInt, daughters),
- lambdaPiPi_(0),
- lambdaKK_(0),
- Mf_(0),
- Ms_(0),
- Mprime_(0),
- Eps1_(0),
- Eps2_(0),
- C0_(0),
- model_(resType)
+LauRescatteringRes::LauRescatteringRes( LauResonanceInfo* resInfo,
+ const LauAbsResonance::LauResonanceModel resType,
+ const Int_t resPairAmpInt,
+ const LauDaughters* daughters ) :
+ LauAbsResonance( resInfo, resPairAmpInt, daughters ),
+ lambdaPiPi_( 0 ),
+ lambdaKK_( 0 ),
+ Mf_( 0 ),
+ Ms_( 0 ),
+ Mprime_( 0 ),
+ Eps1_( 0 ),
+ Eps2_( 0 ),
+ C0_( 0 ),
+ model_( resType )
{
- TString parNameBase = this->getSanitisedName();
- TString lambdaPiPiName(parNameBase);
- lambdaPiPiName += "_lambdaPiPi";
- lambdaPiPi_ = resInfo->getExtraParameter( lambdaPiPiName );
- if ( lambdaPiPi_ == 0 ) {
- lambdaPiPi_ = new LauParameter( lambdaPiPiName, 1.0, 0.0, 10.0, kTRUE );
- lambdaPiPi_->secondStage(kTRUE);
- resInfo->addExtraParameter( lambdaPiPi_ );
- }
- TString lambdaKKName(parNameBase);
- lambdaKKName += "_lambdaKK";
- lambdaKK_ = resInfo->getExtraParameter( lambdaKKName );
- if ( lambdaKK_ == 0 ) {
- lambdaKK_ = new LauParameter( lambdaKKName, 2.8, 0.0, 10.0, kTRUE );
- lambdaKK_->secondStage(kTRUE);
- resInfo->addExtraParameter( lambdaKK_ );
- }
- TString MfName(parNameBase);
- MfName += "_Mf";
- Mf_ = resInfo->getExtraParameter( MfName );
- if ( Mf_ == 0 ) {
- Mf_ = new LauParameter( MfName, 1.32, 0.0, 10.0, kTRUE );
- Mf_->secondStage(kTRUE);
- resInfo->addExtraParameter( Mf_ );
- }
- TString MsName(parNameBase);
- MsName += "_Ms";
- Ms_ = resInfo->getExtraParameter( MsName );
- if ( Ms_ == 0 ) {
- Ms_ = new LauParameter( MsName, 0.92, 0.0, 10.0, kTRUE );
- Ms_->secondStage(kTRUE);
- resInfo->addExtraParameter( Ms_ );
- }
- TString MprimeName(parNameBase);
- MprimeName += "_Mprime";
- Mprime_ = resInfo->getExtraParameter( MprimeName );
- if ( Mprime_ == 0 ) {
- Mprime_ = new LauParameter( MprimeName, 1.5, 0.0, 10.0, kTRUE );
- Mprime_->secondStage(kTRUE);
- resInfo->addExtraParameter( Mprime_ );
- }
-
- TString Eps1Name(parNameBase);
- Eps1Name += "_Eps1";
- Eps1_ = resInfo->getExtraParameter( Eps1Name );
- if ( Eps1_ == 0 ) {
- Eps1_ = new LauParameter( Eps1Name, 2.4, 0.0, 10.0, kTRUE );
- Eps1_->secondStage(kTRUE);
- resInfo->addExtraParameter( Eps1_ );
- }
-
- TString Eps2Name(parNameBase);
- Eps2Name += "_Eps2";
- Eps2_ = resInfo->getExtraParameter( Eps2Name );
- if ( Eps2_ == 0 ) {
- Eps2_ = new LauParameter( Eps2Name, -5.5, -10.0, 10.0, kTRUE );
- Eps2_->secondStage(kTRUE);
- resInfo->addExtraParameter( Eps2_ );
- }
-
- TString C0Name(parNameBase);
- C0Name += "_C0";
- C0_ = resInfo->getExtraParameter( C0Name );
- if ( C0_ == 0 ) {
- C0_ = new LauParameter( C0Name, 1.3, 0.0, 10.0, kTRUE );
- C0_->secondStage(kTRUE);
- resInfo->addExtraParameter( C0_ );
- }
+ TString parNameBase = this->getSanitisedName();
+ TString lambdaPiPiName( parNameBase );
+ lambdaPiPiName += "_lambdaPiPi";
+ lambdaPiPi_ = resInfo->getExtraParameter( lambdaPiPiName );
+ if ( lambdaPiPi_ == 0 ) {
+ lambdaPiPi_ = new LauParameter( lambdaPiPiName, 1.0, 0.0, 10.0, kTRUE );
+ lambdaPiPi_->secondStage( kTRUE );
+ resInfo->addExtraParameter( lambdaPiPi_ );
+ }
+ TString lambdaKKName( parNameBase );
+ lambdaKKName += "_lambdaKK";
+ lambdaKK_ = resInfo->getExtraParameter( lambdaKKName );
+ if ( lambdaKK_ == 0 ) {
+ lambdaKK_ = new LauParameter( lambdaKKName, 2.8, 0.0, 10.0, kTRUE );
+ lambdaKK_->secondStage( kTRUE );
+ resInfo->addExtraParameter( lambdaKK_ );
+ }
+ TString MfName( parNameBase );
+ MfName += "_Mf";
+ Mf_ = resInfo->getExtraParameter( MfName );
+ if ( Mf_ == 0 ) {
+ Mf_ = new LauParameter( MfName, 1.32, 0.0, 10.0, kTRUE );
+ Mf_->secondStage( kTRUE );
+ resInfo->addExtraParameter( Mf_ );
+ }
+ TString MsName( parNameBase );
+ MsName += "_Ms";
+ Ms_ = resInfo->getExtraParameter( MsName );
+ if ( Ms_ == 0 ) {
+ Ms_ = new LauParameter( MsName, 0.92, 0.0, 10.0, kTRUE );
+ Ms_->secondStage( kTRUE );
+ resInfo->addExtraParameter( Ms_ );
+ }
+ TString MprimeName( parNameBase );
+ MprimeName += "_Mprime";
+ Mprime_ = resInfo->getExtraParameter( MprimeName );
+ if ( Mprime_ == 0 ) {
+ Mprime_ = new LauParameter( MprimeName, 1.5, 0.0, 10.0, kTRUE );
+ Mprime_->secondStage( kTRUE );
+ resInfo->addExtraParameter( Mprime_ );
+ }
+
+ TString Eps1Name( parNameBase );
+ Eps1Name += "_Eps1";
+ Eps1_ = resInfo->getExtraParameter( Eps1Name );
+ if ( Eps1_ == 0 ) {
+ Eps1_ = new LauParameter( Eps1Name, 2.4, 0.0, 10.0, kTRUE );
+ Eps1_->secondStage( kTRUE );
+ resInfo->addExtraParameter( Eps1_ );
+ }
+
+ TString Eps2Name( parNameBase );
+ Eps2Name += "_Eps2";
+ Eps2_ = resInfo->getExtraParameter( Eps2Name );
+ if ( Eps2_ == 0 ) {
+ Eps2_ = new LauParameter( Eps2Name, -5.5, -10.0, 10.0, kTRUE );
+ Eps2_->secondStage( kTRUE );
+ resInfo->addExtraParameter( Eps2_ );
+ }
+
+ TString C0Name( parNameBase );
+ C0Name += "_C0";
+ C0_ = resInfo->getExtraParameter( C0Name );
+ if ( C0_ == 0 ) {
+ C0_ = new LauParameter( C0Name, 1.3, 0.0, 10.0, kTRUE );
+ C0_->secondStage( kTRUE );
+ resInfo->addExtraParameter( C0_ );
+ }
}
LauRescatteringRes::~LauRescatteringRes()
{
}
void LauRescatteringRes::initialise()
{
- const LauDaughters* daughters = this->getDaughters();
- Int_t resPairAmpInt = this->getPairInt();
- if ( daughters->gotSymmetricalDP() && resPairAmpInt != 3 ) {
- std::cerr << "WARNING in LauRescatteringRes::initialise : Dalitz plot is symmetric - this lineshape is not appropriate." << std::endl;
- std::cerr << "WARNING I think that this warning is not appropiate because Laura Simetrize at LauIsobarModel level." << std::endl;
- }
-
- if ( (model_ != LauAbsResonance::Rescattering) && (model_ != LauAbsResonance::RescatteringNoInter)) {
- std::cerr << "WARNING in LauRescatteringRes::initialise : Unknown model requested, defaulting to exponential." << std::endl;
- model_ = LauAbsResonance::Rescattering;
- }
-
- if ( (model_ != LauAbsResonance::RescatteringNoInter) && (this->getSpin() != 0) ) {
- std::cerr << "WARNING in LauRescatteringRes::initialise : Non-zero spin will be ignored for this model - perhaps you should use LauAbsResonance::BelleSymNRNoInter instead" << std::endl;
- }
+ const LauDaughters* daughters = this->getDaughters();
+ Int_t resPairAmpInt = this->getPairInt();
+ if ( daughters->gotSymmetricalDP() && resPairAmpInt != 3 ) {
+ std::cerr << "WARNING in LauRescatteringRes::initialise : Dalitz plot is symmetric - this lineshape is not appropriate."
+ << std::endl;
+ std::cerr << "WARNING I think that this warning is not appropiate because Laura Simetrize at LauIsobarModel level."
+ << std::endl;
+ }
+
+ if ( ( model_ != LauAbsResonance::Rescattering ) &&
+ ( model_ != LauAbsResonance::RescatteringNoInter ) ) {
+ std::cerr << "WARNING in LauRescatteringRes::initialise : Unknown model requested, defaulting to exponential."
+ << std::endl;
+ model_ = LauAbsResonance::Rescattering;
+ }
+
+ if ( ( model_ != LauAbsResonance::RescatteringNoInter ) && ( this->getSpin() != 0 ) ) {
+ std::cerr << "WARNING in LauRescatteringRes::initialise : Non-zero spin will be ignored for this model - perhaps you should use LauAbsResonance::BelleSymNRNoInter instead"
+ << std::endl;
+ }
}
-
-LauComplex LauRescatteringRes::amplitude(const LauKinematics* kinematics)
+LauComplex LauRescatteringRes::amplitude( const LauKinematics* kinematics )
{
- // This function returns the complex dynamical amplitude for a Reescatering distribution o original
- // pelaez paper parameters Eq 2.15a [Pelaez et Yndúrain: arXiv:hep-ph/0411334v2 Mar 2005]
- Double_t Mprime = this->getMprime();
- Double_t Mf = this->getMf();
- Double_t Ms = this->getMs();
- Double_t eps1 = this->getEps1();
- Double_t eps2 = this->getEps2();
- Double_t c0 = this->getC0();
- Double_t lambPiPi = this->getLambdaPiPi();
- Double_t lambKK = this->getLambdaKK();
-
- Double_t mk = LauConstants::mK;
-
- // Calculate Mandelstam variables: s = m_13^2, t = m_23^2, u = m_12^2.
- Double_t s = 0;
- Double_t t = 0;
- Int_t resPairAmpInt = getPairInt();
-
- if (resPairAmpInt == 1) {
- s = kinematics->getm23Sq();
- t = kinematics->getm12Sq();
- } else if (resPairAmpInt == 2) {
- s = kinematics->getm13Sq();
- t = kinematics->getm23Sq();
- } else if (resPairAmpInt == 3) {
- s = kinematics->getm12Sq();
- t = kinematics->getm13Sq();
- } else {
- std::cerr << "ERROR in LauAbsResonance::amplitude : Nonsense setup of resPairAmp array." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // Calculate amplitude for s variable.
- Double_t mass_s = TMath::Sqrt(s);
- Double_t k2Square_s = (s - 4.0*mk*mk)/4.0;
- Double_t k2Abs_s=0;
- if (k2Square_s > 0) k2Abs_s = TMath::Sqrt(k2Square_s);
- else k2Abs_s = TMath::Sqrt(-1.0*k2Square_s);
- Double_t cotdelta0_s = c0*(s - Ms*Ms)*(Mf*Mf - s)*k2Abs_s/(Mf*Mf*mass_s*k2Square_s); // Eq 2.15a
- Double_t delta0_s = TMath::ATan(1.0/cotdelta0_s);
- Double_t eta0_s = 1.0 - (eps1*k2Abs_s/mass_s + eps2*k2Square_s/s)*(Mprime*Mprime-s)/s; // Eq 2.15a
-
- if ((mass_s < 2.0*mk)||(mass_s > Mprime )) eta0_s = 1;
- Double_t mag_s = TMath::Sqrt( 1-eta0_s*eta0_s);
-
- Double_t tauRe_s = mag_s*TMath::Cos(2.0*delta0_s);
- Double_t tauIm_s = mag_s*TMath::Sin(2.0*delta0_s);
-
- Double_t NR1_s = 1.0/(1.0+s/(lambPiPi*lambPiPi));
- Double_t NR2_s = 1.0/(1.0+s/(lambKK*lambKK));
-
- //LauComplex resAmplitude(-tauIm_s*NR1_s*NR2_s - tauIm_t*NR1_t*NR2_t, tauRe_s*NR1_s*NR2_s + tauRe_t*NR1_t*NR2_t );
- if ((model_ == LauAbsResonance::RescatteringNoInter)&&(t<=s))
- {
- NR1_s=0.0; NR2_s=0.0; tauRe_s=0.0; tauIm_s=0.0;
- }
-
- LauComplex resAmplitude(-tauIm_s*NR1_s*NR2_s ,tauRe_s*NR1_s*NR2_s);
-
- return resAmplitude;
+ // This function returns the complex dynamical amplitude for a Reescatering distribution o original
+ // pelaez paper parameters Eq 2.15a [Pelaez et Yndúrain: arXiv:hep-ph/0411334v2 Mar 2005]
+ Double_t Mprime = this->getMprime();
+ Double_t Mf = this->getMf();
+ Double_t Ms = this->getMs();
+ Double_t eps1 = this->getEps1();
+ Double_t eps2 = this->getEps2();
+ Double_t c0 = this->getC0();
+ Double_t lambPiPi = this->getLambdaPiPi();
+ Double_t lambKK = this->getLambdaKK();
+
+ Double_t mk = LauConstants::mK;
+
+ // Calculate Mandelstam variables: s = m_13^2, t = m_23^2, u = m_12^2.
+ Double_t s = 0;
+ Double_t t = 0;
+ Int_t resPairAmpInt = getPairInt();
+
+ if ( resPairAmpInt == 1 ) {
+ s = kinematics->getm23Sq();
+ t = kinematics->getm12Sq();
+ } else if ( resPairAmpInt == 2 ) {
+ s = kinematics->getm13Sq();
+ t = kinematics->getm23Sq();
+ } else if ( resPairAmpInt == 3 ) {
+ s = kinematics->getm12Sq();
+ t = kinematics->getm13Sq();
+ } else {
+ std::cerr << "ERROR in LauAbsResonance::amplitude : Nonsense setup of resPairAmp array."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // Calculate amplitude for s variable.
+ Double_t mass_s = TMath::Sqrt( s );
+ Double_t k2Square_s = ( s - 4.0 * mk * mk ) / 4.0;
+ Double_t k2Abs_s = 0;
+ if ( k2Square_s > 0 )
+ k2Abs_s = TMath::Sqrt( k2Square_s );
+ else
+ k2Abs_s = TMath::Sqrt( -1.0 * k2Square_s );
+ Double_t cotdelta0_s = c0 * ( s - Ms * Ms ) * ( Mf * Mf - s ) * k2Abs_s /
+ ( Mf * Mf * mass_s * k2Square_s ); // Eq 2.15a
+ Double_t delta0_s = TMath::ATan( 1.0 / cotdelta0_s );
+ Double_t eta0_s = 1.0 - ( eps1 * k2Abs_s / mass_s + eps2 * k2Square_s / s ) *
+ ( Mprime * Mprime - s ) / s; // Eq 2.15a
+
+ if ( ( mass_s < 2.0 * mk ) || ( mass_s > Mprime ) )
+ eta0_s = 1;
+ Double_t mag_s = TMath::Sqrt( 1 - eta0_s * eta0_s );
+
+ Double_t tauRe_s = mag_s * TMath::Cos( 2.0 * delta0_s );
+ Double_t tauIm_s = mag_s * TMath::Sin( 2.0 * delta0_s );
+
+ Double_t NR1_s = 1.0 / ( 1.0 + s / ( lambPiPi * lambPiPi ) );
+ Double_t NR2_s = 1.0 / ( 1.0 + s / ( lambKK * lambKK ) );
+
+ //LauComplex resAmplitude(-tauIm_s*NR1_s*NR2_s - tauIm_t*NR1_t*NR2_t, tauRe_s*NR1_s*NR2_s + tauRe_t*NR1_t*NR2_t );
+ if ( ( model_ == LauAbsResonance::RescatteringNoInter ) && ( t <= s ) ) {
+ NR1_s = 0.0;
+ NR2_s = 0.0;
+ tauRe_s = 0.0;
+ tauIm_s = 0.0;
+ }
+
+ LauComplex resAmplitude( -tauIm_s * NR1_s * NR2_s, tauRe_s * NR1_s * NR2_s );
+
+ return resAmplitude;
}
-LauComplex LauRescatteringRes::resAmp(Double_t mass, Double_t spinTerm)
+LauComplex LauRescatteringRes::resAmp( Double_t mass, Double_t spinTerm )
{
- std::cerr << "ERROR in LauRescatteringRes : This method should never be called." << std::endl;
- std::cerr << " : Returning zero amplitude for mass = " << mass << " and spinTerm = " << spinTerm << "." << std::endl;
- return LauComplex(0.0, 0.0);
+ std::cerr << "ERROR in LauRescatteringRes : This method should never be called." << std::endl;
+ std::cerr << " : Returning zero amplitude for mass = " << mass
+ << " and spinTerm = " << spinTerm << "." << std::endl;
+ return LauComplex( 0.0, 0.0 );
}
-
const std::vector<LauParameter*>& LauRescatteringRes::getFloatingParameters()
{
- this->clearFloatingParameters();
-
- if ( ! this->fixLambdaPiPi() ) {
- this->addFloatingParameter( lambdaPiPi_ );
- }
- if ( ! this->fixLambdaKK() ) {
- this->addFloatingParameter( lambdaKK_ );
- }
- if ( ! this->fixMf() ) {
- this->addFloatingParameter( Mf_ );
- }
- if ( ! this->fixMs() ) {
- this->addFloatingParameter( Ms_ );
- }
- if ( ! this->fixMprime() ) {
- this->addFloatingParameter( Mprime_ );
- }
- if ( ! this->fixEps1() ) {
- this->addFloatingParameter( Eps1_ );
- }
- if ( ! this->fixEps2() ) {
- this->addFloatingParameter( Eps2_ );
- }
- if ( ! this->fixC0() ) {
- this->addFloatingParameter( C0_ );
- }
-
- return this->getParameters();
+ this->clearFloatingParameters();
+
+ if ( ! this->fixLambdaPiPi() ) {
+ this->addFloatingParameter( lambdaPiPi_ );
+ }
+ if ( ! this->fixLambdaKK() ) {
+ this->addFloatingParameter( lambdaKK_ );
+ }
+ if ( ! this->fixMf() ) {
+ this->addFloatingParameter( Mf_ );
+ }
+ if ( ! this->fixMs() ) {
+ this->addFloatingParameter( Ms_ );
+ }
+ if ( ! this->fixMprime() ) {
+ this->addFloatingParameter( Mprime_ );
+ }
+ if ( ! this->fixEps1() ) {
+ this->addFloatingParameter( Eps1_ );
+ }
+ if ( ! this->fixEps2() ) {
+ this->addFloatingParameter( Eps2_ );
+ }
+ if ( ! this->fixC0() ) {
+ this->addFloatingParameter( C0_ );
+ }
+
+ return this->getParameters();
}
-void LauRescatteringRes::setResonanceParameter(const TString& name, const Double_t value)
+void LauRescatteringRes::setResonanceParameter( const TString& name, const Double_t value )
{
- // Set various parameters for the lineshape
- if (name == "lambdaPiPi") {
- this->setLambdaPiPi(value);
- std::cout << "INFO in LauRescatteringRes::setResonanceParameter : Setting parameter lambdaPiPi = " << this->getLambdaPiPi() << std::endl;
- }
- else if (name == "lambdaKK") {
- this->setLambdaKK(value);
- std::cout << "INFO in LauRescatteringRes::setResonanceParameter : Setting parameter lambdaKK = " << this->getLambdaKK() << std::endl;
- }
- else if (name == "Mf") {
- this->setMf(value);
- std::cout << "INFO in LauRescatteringRes::setResonanceParameter : Setting parameter Mf = " << this->getMf() << std::endl;
- }
- else if (name == "Ms") {
- this->setMs(value);
- std::cout << "INFO in LauRescatteringRes::setResonanceParameter : Setting parameter Ms = " << this->getMs() << std::endl;
- }
- else if (name == "Mprime") {
- this->setMprime(value);
- std::cout << "INFO in LauRescatteringRes::setResonanceParameter : Setting parameter Mprime = " << this->getMprime() << std::endl;
- }
- else if (name == "Eps1") {
- this->setEps1(value);
- std::cout << "INFO in LauRescatteringRes::setResonanceParameter : Setting parameter eps1 = " << this->getEps1() << std::endl;
- }
- else if (name == "Eps2") {
- this->setEps2(value);
- std::cout << "INFO in LauRescatteringRes::setResonanceParameter : Setting parameter eps2 = " << this->getEps2() << std::endl;
- }
- else if (name == "C0") {
- this->setC0(value);
- std::cout << "INFO in LauRescatteringRes::setResonanceParameter : Setting parameter eps2 = " << this->getC0() << std::endl;
- }
- else {
- std::cerr << "WARNING in LauRescatteringRes::setResonanceParameter: Parameter name not reconised. No parameter changes made." << std::endl;
- }
+ // Set various parameters for the lineshape
+ if ( name == "lambdaPiPi" ) {
+ this->setLambdaPiPi( value );
+ std::cout << "INFO in LauRescatteringRes::setResonanceParameter : Setting parameter lambdaPiPi = "
+ << this->getLambdaPiPi() << std::endl;
+ } else if ( name == "lambdaKK" ) {
+ this->setLambdaKK( value );
+ std::cout << "INFO in LauRescatteringRes::setResonanceParameter : Setting parameter lambdaKK = "
+ << this->getLambdaKK() << std::endl;
+ } else if ( name == "Mf" ) {
+ this->setMf( value );
+ std::cout << "INFO in LauRescatteringRes::setResonanceParameter : Setting parameter Mf = "
+ << this->getMf() << std::endl;
+ } else if ( name == "Ms" ) {
+ this->setMs( value );
+ std::cout << "INFO in LauRescatteringRes::setResonanceParameter : Setting parameter Ms = "
+ << this->getMs() << std::endl;
+ } else if ( name == "Mprime" ) {
+ this->setMprime( value );
+ std::cout << "INFO in LauRescatteringRes::setResonanceParameter : Setting parameter Mprime = "
+ << this->getMprime() << std::endl;
+ } else if ( name == "Eps1" ) {
+ this->setEps1( value );
+ std::cout << "INFO in LauRescatteringRes::setResonanceParameter : Setting parameter eps1 = "
+ << this->getEps1() << std::endl;
+ } else if ( name == "Eps2" ) {
+ this->setEps2( value );
+ std::cout << "INFO in LauRescatteringRes::setResonanceParameter : Setting parameter eps2 = "
+ << this->getEps2() << std::endl;
+ } else if ( name == "C0" ) {
+ this->setC0( value );
+ std::cout << "INFO in LauRescatteringRes::setResonanceParameter : Setting parameter eps2 = "
+ << this->getC0() << std::endl;
+ } else {
+ std::cerr << "WARNING in LauRescatteringRes::setResonanceParameter: Parameter name not reconised. No parameter changes made."
+ << std::endl;
+ }
}
-void LauRescatteringRes::floatResonanceParameter(const TString& name)
+void LauRescatteringRes::floatResonanceParameter( const TString& name )
{
- if (name == "lambdaPiPi") {
- if ( lambdaPiPi_->fixed() ) {
- lambdaPiPi_->fixed( kFALSE );
- this->addFloatingParameter( lambdaPiPi_ );
- } else {
- std::cerr << "WARNING in LauRescatteringRes::floatResonanceParameter: Parameter already floating. No parameter changes made." << std::endl;
- }
- }
- else if (name == "lambdaKK") {
- if ( lambdaKK_->fixed() ) {
- lambdaKK_->fixed( kFALSE );
- this->addFloatingParameter( lambdaKK_ );
- } else {
- std::cerr << "WARNING in LauRescatteringRes::floatResonanceParameter: Parameter already floating. No parameter changes made." << std::endl;
- }
- }
- else if (name == "Mf") {
- if ( Mf_->fixed() ) {
- Mf_->fixed( kFALSE );
- this->addFloatingParameter( Mf_ );
- } else {
- std::cerr << "WARNING in LauRescatteringRes::floatResonanceParameter: Parameter already floating. No parameter changes made." << std::endl;
- }
- }
- else if (name == "Ms") {
- if ( Ms_->fixed() ) {
- Ms_->fixed( kFALSE );
- this->addFloatingParameter( Ms_ );
- } else {
- std::cerr << "WARNING in LauRescatteringRes::floatResonanceParameter: Parameter already floating. No parameter changes made." << std::endl;
- }
- }
- else if (name == "Mprime") {
- if ( Mprime_->fixed() ) {
- Mprime_->fixed( kFALSE );
- this->addFloatingParameter( Mprime_ );
- } else {
- std::cerr << "WARNING in LauRescatteringRes::floatResonanceParameter: Parameter already floating. No parameter changes made." << std::endl;
- }
- }
- else if (name == "Eps1") {
- if ( Eps1_->fixed() ) {
- Eps1_->fixed( kFALSE );
- this->addFloatingParameter( Eps1_ );
- } else {
- std::cerr << "WARNING in LauRescatteringRes::floatResonanceParameter: Parameter already floating. No parameter changes made." << std::endl;
- }
- }
- else if (name == "Eps2") {
- if ( Eps2_->fixed() ) {
- Eps2_->fixed( kFALSE );
- this->addFloatingParameter( Eps2_ );
- } else {
- std::cerr << "WARNING in LauRescatteringRes::floatResonanceParameter: Parameter already floating. No parameter changes made." << std::endl;
- }
- }
- else if (name == "C0") {
- if ( C0_->fixed() ) {
- C0_->fixed( kFALSE );
- this->addFloatingParameter( C0_ );
- } else {
- std::cerr << "WARNING in LauRescatteringRes::floatResonanceParameter: Parameter already floating. No parameter changes made." << std::endl;
- }
- }
-
- else {
- std::cerr << "WARNING in LauRescatteringRes::fixResonanceParameter: Parameter name not reconised. No parameter changes made." << std::endl;
- }
+ if ( name == "lambdaPiPi" ) {
+ if ( lambdaPiPi_->fixed() ) {
+ lambdaPiPi_->fixed( kFALSE );
+ this->addFloatingParameter( lambdaPiPi_ );
+ } else {
+ std::cerr << "WARNING in LauRescatteringRes::floatResonanceParameter: Parameter already floating. No parameter changes made."
+ << std::endl;
+ }
+ } else if ( name == "lambdaKK" ) {
+ if ( lambdaKK_->fixed() ) {
+ lambdaKK_->fixed( kFALSE );
+ this->addFloatingParameter( lambdaKK_ );
+ } else {
+ std::cerr << "WARNING in LauRescatteringRes::floatResonanceParameter: Parameter already floating. No parameter changes made."
+ << std::endl;
+ }
+ } else if ( name == "Mf" ) {
+ if ( Mf_->fixed() ) {
+ Mf_->fixed( kFALSE );
+ this->addFloatingParameter( Mf_ );
+ } else {
+ std::cerr << "WARNING in LauRescatteringRes::floatResonanceParameter: Parameter already floating. No parameter changes made."
+ << std::endl;
+ }
+ } else if ( name == "Ms" ) {
+ if ( Ms_->fixed() ) {
+ Ms_->fixed( kFALSE );
+ this->addFloatingParameter( Ms_ );
+ } else {
+ std::cerr << "WARNING in LauRescatteringRes::floatResonanceParameter: Parameter already floating. No parameter changes made."
+ << std::endl;
+ }
+ } else if ( name == "Mprime" ) {
+ if ( Mprime_->fixed() ) {
+ Mprime_->fixed( kFALSE );
+ this->addFloatingParameter( Mprime_ );
+ } else {
+ std::cerr << "WARNING in LauRescatteringRes::floatResonanceParameter: Parameter already floating. No parameter changes made."
+ << std::endl;
+ }
+ } else if ( name == "Eps1" ) {
+ if ( Eps1_->fixed() ) {
+ Eps1_->fixed( kFALSE );
+ this->addFloatingParameter( Eps1_ );
+ } else {
+ std::cerr << "WARNING in LauRescatteringRes::floatResonanceParameter: Parameter already floating. No parameter changes made."
+ << std::endl;
+ }
+ } else if ( name == "Eps2" ) {
+ if ( Eps2_->fixed() ) {
+ Eps2_->fixed( kFALSE );
+ this->addFloatingParameter( Eps2_ );
+ } else {
+ std::cerr << "WARNING in LauRescatteringRes::floatResonanceParameter: Parameter already floating. No parameter changes made."
+ << std::endl;
+ }
+ } else if ( name == "C0" ) {
+ if ( C0_->fixed() ) {
+ C0_->fixed( kFALSE );
+ this->addFloatingParameter( C0_ );
+ } else {
+ std::cerr << "WARNING in LauRescatteringRes::floatResonanceParameter: Parameter already floating. No parameter changes made."
+ << std::endl;
+ }
+ }
+
+ else {
+ std::cerr << "WARNING in LauRescatteringRes::fixResonanceParameter: Parameter name not reconised. No parameter changes made."
+ << std::endl;
+ }
}
-LauParameter* LauRescatteringRes::getResonanceParameter(const TString& name)
+LauParameter* LauRescatteringRes::getResonanceParameter( const TString& name )
{
- if (name == "lambdaPiPi") {
- return lambdaPiPi_;
- }
- else if (name == "lambdaKK") {
- return lambdaKK_;
- }
- if (name == "Mf") {
- return Mf_;
- }
- else if (name == "Ms") {
- return Ms_;
- }
- if (name == "Mprime") {
- return Mprime_;
- }
- if (name == "Eps1") {
- return Eps1_;
- }
- if (name == "Eps2") {
- return Eps2_;
- }
- if (name == "C0") {
- return C0_;
- }
- else {
- std::cerr << "WARNING in LauRescatteringRes::getResonanceParameter: Parameter name not reconised." << std::endl;
- return 0;
- }
+ if ( name == "lambdaPiPi" ) {
+ return lambdaPiPi_;
+ } else if ( name == "lambdaKK" ) {
+ return lambdaKK_;
+ }
+ if ( name == "Mf" ) {
+ return Mf_;
+ } else if ( name == "Ms" ) {
+ return Ms_;
+ }
+ if ( name == "Mprime" ) {
+ return Mprime_;
+ }
+ if ( name == "Eps1" ) {
+ return Eps1_;
+ }
+ if ( name == "Eps2" ) {
+ return Eps2_;
+ }
+ if ( name == "C0" ) {
+ return C0_;
+ } else {
+ std::cerr << "WARNING in LauRescatteringRes::getResonanceParameter: Parameter name not reconised."
+ << std::endl;
+ return 0;
+ }
}
-void LauRescatteringRes::setLambdaPiPi(const Double_t lambda)
+void LauRescatteringRes::setLambdaPiPi( const Double_t lambda )
{
- lambdaPiPi_->value( lambda );
- lambdaPiPi_->genValue( lambda );
- lambdaPiPi_->initValue( lambda );
+ lambdaPiPi_->value( lambda );
+ lambdaPiPi_->genValue( lambda );
+ lambdaPiPi_->initValue( lambda );
}
-void LauRescatteringRes::setLambdaKK(const Double_t lambda)
+void LauRescatteringRes::setLambdaKK( const Double_t lambda )
{
- lambdaKK_->value( lambda );
- lambdaKK_->genValue( lambda );
- lambdaKK_->initValue( lambda );
+ lambdaKK_->value( lambda );
+ lambdaKK_->genValue( lambda );
+ lambdaKK_->initValue( lambda );
}
-void LauRescatteringRes::setMf(const Double_t Mf)
+void LauRescatteringRes::setMf( const Double_t Mf )
{
- Mf_->value( Mf );
- Mf_->genValue( Mf );
- Mf_->initValue( Mf );
+ Mf_->value( Mf );
+ Mf_->genValue( Mf );
+ Mf_->initValue( Mf );
}
-void LauRescatteringRes::setMs(const Double_t Ms)
+void LauRescatteringRes::setMs( const Double_t Ms )
{
- Ms_->value( Ms );
- Ms_->genValue( Ms );
- Ms_->initValue( Ms );
+ Ms_->value( Ms );
+ Ms_->genValue( Ms );
+ Ms_->initValue( Ms );
}
-void LauRescatteringRes::setMprime(const Double_t Mprime)
+void LauRescatteringRes::setMprime( const Double_t Mprime )
{
- Mprime_->value( Mprime );
- Mprime_->genValue( Mprime);
- Mprime_->initValue( Mprime );
+ Mprime_->value( Mprime );
+ Mprime_->genValue( Mprime );
+ Mprime_->initValue( Mprime );
}
-void LauRescatteringRes::setEps1(const Double_t Eps1)
+void LauRescatteringRes::setEps1( const Double_t Eps1 )
{
- Eps1_->value( Eps1 );
- Eps1_->genValue( Eps1 );
- Eps1_->initValue( Eps1 );
+ Eps1_->value( Eps1 );
+ Eps1_->genValue( Eps1 );
+ Eps1_->initValue( Eps1 );
}
-void LauRescatteringRes::setEps2(const Double_t Eps2)
+void LauRescatteringRes::setEps2( const Double_t Eps2 )
{
- Eps2_->value( Eps2 );
- Eps2_->genValue( Eps2 );
- Eps2_->initValue( Eps2 );
+ Eps2_->value( Eps2 );
+ Eps2_->genValue( Eps2 );
+ Eps2_->initValue( Eps2 );
}
-void LauRescatteringRes::setC0(const Double_t C0)
+void LauRescatteringRes::setC0( const Double_t C0 )
{
- C0_->value( C0 );
- C0_->genValue( C0 );
- C0_->initValue( C0 );
+ C0_->value( C0 );
+ C0_->genValue( C0 );
+ C0_->initValue( C0 );
}
-
-
diff --git a/src/LauResonanceInfo.cc b/src/LauResonanceInfo.cc
index b2b4504..f8a14a3 100644
--- a/src/LauResonanceInfo.cc
+++ b/src/LauResonanceInfo.cc
@@ -1,211 +1,230 @@
/*
Copyright 2006 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauResonanceInfo.cc
\brief File containing implementation of LauResonanceInfo class.
*/
-#include <iostream>
-
-#include "LauParameter.hh"
#include "LauResonanceInfo.hh"
+#include "LauParameter.hh"
+#include <iostream>
-LauResonanceInfo::LauResonanceInfo(const TString& name, const Double_t mass, const Double_t width, const Int_t spin, const Int_t charge, const LauBlattWeisskopfFactor::BlattWeisskopfCategory bwCategory, const Double_t bwRadius) :
- name_(name),
- sanitisedName_(""),
- mass_(0),
- width_(0),
- spin_(spin),
- charge_(charge),
- bwCategory_(bwCategory),
- bwRadius_(bwRadius),
- conjugate_(0),
- extraPars_()
+LauResonanceInfo::LauResonanceInfo( const TString& name,
+ const Double_t mass,
+ const Double_t width,
+ const Int_t spin,
+ const Int_t charge,
+ const LauBlattWeisskopfFactor::BlattWeisskopfCategory bwCategory,
+ const Double_t bwRadius ) :
+ name_( name ),
+ sanitisedName_( "" ),
+ mass_( 0 ),
+ width_( 0 ),
+ spin_( spin ),
+ charge_( charge ),
+ bwCategory_( bwCategory ),
+ bwRadius_( bwRadius ),
+ conjugate_( 0 ),
+ extraPars_()
{
- this->sanitiseName();
- mass_ = new LauParameter(sanitisedName_+"_MASS",mass,0.0,3.0*mass,kTRUE);
- mass_->secondStage(kTRUE);
- width_ = new LauParameter(sanitisedName_+"_WIDTH",width,0.0,3.0*width,kTRUE);
- width_->secondStage(kTRUE);
+ this->sanitiseName();
+ mass_ = new LauParameter( sanitisedName_ + "_MASS", mass, 0.0, 3.0 * mass, kTRUE );
+ mass_->secondStage( kTRUE );
+ width_ = new LauParameter( sanitisedName_ + "_WIDTH", width, 0.0, 3.0 * width, kTRUE );
+ width_->secondStage( kTRUE );
}
LauResonanceInfo::~LauResonanceInfo()
{
- delete mass_; mass_ = 0;
- delete width_; width_ = 0;
-
- for ( std::set<LauParameter*>::iterator iter = extraPars_.begin(); iter != extraPars_.end(); ++iter ) {
- delete (*iter);
- }
- extraPars_.clear();
+ delete mass_;
+ mass_ = 0;
+ delete width_;
+ width_ = 0;
+
+ for ( std::set<LauParameter*>::iterator iter = extraPars_.begin(); iter != extraPars_.end();
+ ++iter ) {
+ delete ( *iter );
+ }
+ extraPars_.clear();
}
-LauResonanceInfo::LauResonanceInfo( const LauResonanceInfo& other, const TString& newName, const Int_t newCharge ) :
- name_(newName),
- sanitisedName_(""),
- mass_(0),
- width_(0),
- spin_(other.spin_),
- charge_(newCharge),
- bwCategory_(other.bwCategory_),
- bwRadius_(other.bwRadius_),
- conjugate_(0),
- extraPars_()
+LauResonanceInfo::LauResonanceInfo( const LauResonanceInfo& other,
+ const TString& newName,
+ const Int_t newCharge ) :
+ name_( newName ),
+ sanitisedName_( "" ),
+ mass_( 0 ),
+ width_( 0 ),
+ spin_( other.spin_ ),
+ charge_( newCharge ),
+ bwCategory_( other.bwCategory_ ),
+ bwRadius_( other.bwRadius_ ),
+ conjugate_( 0 ),
+ extraPars_()
{
- this->sanitiseName();
- mass_ = other.mass_->createClone( sanitisedName_+"_MASS" );
- width_ = other.width_->createClone( sanitisedName_+"_WIDTH" );
- for ( std::set<LauParameter*>::iterator iter = other.extraPars_.begin(); iter != other.extraPars_.end(); ++iter ) {
- TString parName = (*iter)->name();
- parName.Remove(0, parName.Last('_'));
- parName.Prepend( sanitisedName_ );
- LauParameter* par = (*iter)->createClone( parName );
- extraPars_.insert( par );
- }
+ this->sanitiseName();
+ mass_ = other.mass_->createClone( sanitisedName_ + "_MASS" );
+ width_ = other.width_->createClone( sanitisedName_ + "_WIDTH" );
+ for ( std::set<LauParameter*>::iterator iter = other.extraPars_.begin();
+ iter != other.extraPars_.end();
+ ++iter ) {
+ TString parName = ( *iter )->name();
+ parName.Remove( 0, parName.Last( '_' ) );
+ parName.Prepend( sanitisedName_ );
+ LauParameter* par = ( *iter )->createClone( parName );
+ extraPars_.insert( par );
+ }
}
LauResonanceInfo* LauResonanceInfo::createChargeConjugate()
{
- Int_t newCharge = -charge_;
-
- TString newName( name_ );
- Ssiz_t index = newName.Index("+");
- if ( index != -1 ) {
- newName.Replace( index, 1, "-" );
- } else {
- index = newName.Index("-");
- if ( index != -1 ) {
- newName.Replace( index, 1, "+" );
- }
- }
-
- LauResonanceInfo* conjugate = new LauResonanceInfo( *this, newName, newCharge );
- conjugate->conjugate_ = this;
- this->conjugate_ = conjugate;
-
- return conjugate;
+ Int_t newCharge = -charge_;
+
+ TString newName( name_ );
+ Ssiz_t index = newName.Index( "+" );
+ if ( index != -1 ) {
+ newName.Replace( index, 1, "-" );
+ } else {
+ index = newName.Index( "-" );
+ if ( index != -1 ) {
+ newName.Replace( index, 1, "+" );
+ }
+ }
+
+ LauResonanceInfo* conjugate = new LauResonanceInfo( *this, newName, newCharge );
+ conjugate->conjugate_ = this;
+ this->conjugate_ = conjugate;
+
+ return conjugate;
}
LauResonanceInfo* LauResonanceInfo::createSharedParameterRecord( const TString& name )
{
- LauResonanceInfo* newinfo = new LauResonanceInfo( *this, name, charge_ );
+ LauResonanceInfo* newinfo = new LauResonanceInfo( *this, name, charge_ );
- sharedParRecords_.push_back(newinfo);
+ sharedParRecords_.push_back( newinfo );
- return newinfo;
+ return newinfo;
}
LauParameter* LauResonanceInfo::getExtraParameter( const TString& parName )
{
- LauParameter* par(0);
- for ( std::set<LauParameter*>::iterator iter = extraPars_.begin(); iter != extraPars_.end(); ++iter ) {
- if ( (*iter)->name() == parName ) {
- par = (*iter);
- }
- }
- return par;
+ LauParameter* par( 0 );
+ for ( std::set<LauParameter*>::iterator iter = extraPars_.begin(); iter != extraPars_.end();
+ ++iter ) {
+ if ( ( *iter )->name() == parName ) {
+ par = ( *iter );
+ }
+ }
+ return par;
}
void LauResonanceInfo::addExtraParameter( LauParameter* param, const Bool_t independentPar )
{
- bool ok = extraPars_.insert( param ).second;
- if ( !ok ) {
- std::cerr << "WARNING in LauResonanceInfo::addExtraParameter : parameter already present, not adding again" << std::endl;
- return;
- }
-
- if ( conjugate_ != 0 ) {
- conjugate_->addCloneOfExtraParameter( param, independentPar );
- }
-
- for ( std::vector<LauResonanceInfo*>::iterator iter = sharedParRecords_.begin(); iter != sharedParRecords_.end(); ++iter ) {
- (*iter)->addCloneOfExtraParameter( param, independentPar );
- }
+ bool ok = extraPars_.insert( param ).second;
+ if ( ! ok ) {
+ std::cerr << "WARNING in LauResonanceInfo::addExtraParameter : parameter already present, not adding again"
+ << std::endl;
+ return;
+ }
+
+ if ( conjugate_ != 0 ) {
+ conjugate_->addCloneOfExtraParameter( param, independentPar );
+ }
+
+ for ( std::vector<LauResonanceInfo*>::iterator iter = sharedParRecords_.begin();
+ iter != sharedParRecords_.end();
+ ++iter ) {
+ ( *iter )->addCloneOfExtraParameter( param, independentPar );
+ }
}
void LauResonanceInfo::addCloneOfExtraParameter( LauParameter* param, const Bool_t copyNotClone )
{
- TString parName = param->name();
- parName.Remove(0, parName.Last('_'));
- parName.Prepend( sanitisedName_ );
-
- LauParameter* cloneParam(0);
- if ( copyNotClone ) {
- cloneParam = new LauParameter( parName, param->unblindValue(), param->minValue(), param->maxValue(), param->fixed() );
- cloneParam->secondStage(kTRUE);
- } else {
- cloneParam = param->createClone( parName );
- }
- extraPars_.insert( cloneParam );
+ TString parName = param->name();
+ parName.Remove( 0, parName.Last( '_' ) );
+ parName.Prepend( sanitisedName_ );
+
+ LauParameter* cloneParam( 0 );
+ if ( copyNotClone ) {
+ cloneParam = new LauParameter( parName,
+ param->unblindValue(),
+ param->minValue(),
+ param->maxValue(),
+ param->fixed() );
+ cloneParam->secondStage( kTRUE );
+ } else {
+ cloneParam = param->createClone( parName );
+ }
+ extraPars_.insert( cloneParam );
}
std::ostream& operator<<( std::ostream& stream, const LauResonanceInfo& infoRecord )
{
- stream << infoRecord.getName() << ": ";
- stream << "mass = " << infoRecord.getMass()->value() << ", ";
- stream << "width = " << infoRecord.getWidth()->value() << ", ";
- stream << "spin = " << infoRecord.getSpin() << ", ";
- Int_t charge = infoRecord.getCharge();
- if ( charge < 0 ) {
- stream << "charge = " << infoRecord.getCharge() << ", ";
- } else {
- stream << "charge = " << infoRecord.getCharge() << ", ";
- }
- stream << "BW radius = " << infoRecord.getBWRadius();
-
- return stream;
+ stream << infoRecord.getName() << ": ";
+ stream << "mass = " << infoRecord.getMass()->value() << ", ";
+ stream << "width = " << infoRecord.getWidth()->value() << ", ";
+ stream << "spin = " << infoRecord.getSpin() << ", ";
+ Int_t charge = infoRecord.getCharge();
+ if ( charge < 0 ) {
+ stream << "charge = " << infoRecord.getCharge() << ", ";
+ } else {
+ stream << "charge = " << infoRecord.getCharge() << ", ";
+ }
+ stream << "BW radius = " << infoRecord.getBWRadius();
+
+ return stream;
}
void LauResonanceInfo::sanitiseName()
{
- sanitisedName_ = name_;
- sanitisedName_ = sanitisedName_.ReplaceAll("+","p");
- sanitisedName_ = sanitisedName_.ReplaceAll("-","m");
- sanitisedName_ = sanitisedName_.ReplaceAll("*","st");
- sanitisedName_ = sanitisedName_.ReplaceAll("(","_");
- sanitisedName_ = sanitisedName_.ReplaceAll(")","_");
- sanitisedName_ = sanitisedName_.ReplaceAll("[","_");
- sanitisedName_ = sanitisedName_.ReplaceAll("]","_");
- sanitisedName_ = sanitisedName_.ReplaceAll("<","_");
- sanitisedName_ = sanitisedName_.ReplaceAll(">","_");
- sanitisedName_ = sanitisedName_.ReplaceAll("{","_");
- sanitisedName_ = sanitisedName_.ReplaceAll("}","_");
- sanitisedName_ = sanitisedName_.ReplaceAll(" ","_");
- sanitisedName_ = sanitisedName_.ReplaceAll("$","");
- sanitisedName_ = sanitisedName_.ReplaceAll("%","");
- sanitisedName_ = sanitisedName_.ReplaceAll("&","");
- sanitisedName_ = sanitisedName_.ReplaceAll("/","");
- sanitisedName_ = sanitisedName_.ReplaceAll(":","");
- sanitisedName_ = sanitisedName_.ReplaceAll(";","");
- sanitisedName_ = sanitisedName_.ReplaceAll("=","");
- sanitisedName_ = sanitisedName_.ReplaceAll("\\","");
- sanitisedName_ = sanitisedName_.ReplaceAll("^","");
- sanitisedName_ = sanitisedName_.ReplaceAll("|","");
- sanitisedName_ = sanitisedName_.ReplaceAll(",","");
- sanitisedName_ = sanitisedName_.ReplaceAll(".","");
- sanitisedName_.Remove(TString::kBoth,'_');
+ sanitisedName_ = name_;
+ sanitisedName_ = sanitisedName_.ReplaceAll( "+", "p" );
+ sanitisedName_ = sanitisedName_.ReplaceAll( "-", "m" );
+ sanitisedName_ = sanitisedName_.ReplaceAll( "*", "st" );
+ sanitisedName_ = sanitisedName_.ReplaceAll( "(", "_" );
+ sanitisedName_ = sanitisedName_.ReplaceAll( ")", "_" );
+ sanitisedName_ = sanitisedName_.ReplaceAll( "[", "_" );
+ sanitisedName_ = sanitisedName_.ReplaceAll( "]", "_" );
+ sanitisedName_ = sanitisedName_.ReplaceAll( "<", "_" );
+ sanitisedName_ = sanitisedName_.ReplaceAll( ">", "_" );
+ sanitisedName_ = sanitisedName_.ReplaceAll( "{", "_" );
+ sanitisedName_ = sanitisedName_.ReplaceAll( "}", "_" );
+ sanitisedName_ = sanitisedName_.ReplaceAll( " ", "_" );
+ sanitisedName_ = sanitisedName_.ReplaceAll( "$", "" );
+ sanitisedName_ = sanitisedName_.ReplaceAll( "%", "" );
+ sanitisedName_ = sanitisedName_.ReplaceAll( "&", "" );
+ sanitisedName_ = sanitisedName_.ReplaceAll( "/", "" );
+ sanitisedName_ = sanitisedName_.ReplaceAll( ":", "" );
+ sanitisedName_ = sanitisedName_.ReplaceAll( ";", "" );
+ sanitisedName_ = sanitisedName_.ReplaceAll( "=", "" );
+ sanitisedName_ = sanitisedName_.ReplaceAll( "\\", "" );
+ sanitisedName_ = sanitisedName_.ReplaceAll( "^", "" );
+ sanitisedName_ = sanitisedName_.ReplaceAll( "|", "" );
+ sanitisedName_ = sanitisedName_.ReplaceAll( ",", "" );
+ sanitisedName_ = sanitisedName_.ReplaceAll( ".", "" );
+ sanitisedName_.Remove( TString::kBoth, '_' );
}
-
diff --git a/src/LauResonanceMaker.cc b/src/LauResonanceMaker.cc
index b264fb8..1f5bc81 100644
--- a/src/LauResonanceMaker.cc
+++ b/src/LauResonanceMaker.cc
@@ -1,1042 +1,1187 @@
/*
Copyright 2004 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauResonanceMaker.cc
\brief File containing implementation of LauResonanceMaker class.
*/
-#include <iostream>
+#include "LauResonanceMaker.hh"
#include "LauAbsResonance.hh"
#include "LauBelleNR.hh"
#include "LauBelleSymNR.hh"
#include "LauBreitWignerRes.hh"
#include "LauDabbaRes.hh"
#include "LauDaughters.hh"
#include "LauEFKLLMRes.hh"
-#include "LauFlatteRes.hh"
#include "LauFlatNR.hh"
+#include "LauFlatteRes.hh"
#include "LauGaussIncohRes.hh"
#include "LauGounarisSakuraiRes.hh"
#include "LauKappaRes.hh"
-#include "LauLASSRes.hh"
#include "LauLASSBWRes.hh"
#include "LauLASSNRRes.hh"
+#include "LauLASSRes.hh"
#include "LauModIndPartWaveMagPhase.hh"
#include "LauModIndPartWaveRealImag.hh"
#include "LauNRAmplitude.hh"
-#include "LauRescatteringRes.hh"
-#include "LauRescattering2Res.hh"
#include "LauPolNR.hh"
-#include "LauPoleRes.hh"
#include "LauPolarFormFactorNR.hh"
#include "LauPolarFormFactorSymNR.hh"
+#include "LauPoleRes.hh"
#include "LauRelBreitWignerRes.hh"
+#include "LauRescattering2Res.hh"
+#include "LauRescatteringRes.hh"
#include "LauResonanceInfo.hh"
-#include "LauResonanceMaker.hh"
#include "LauRhoOmegaMix.hh"
#include "LauSigmaRes.hh"
-
+#include <iostream>
LauResonanceMaker* LauResonanceMaker::resonanceMaker_ = 0;
-
LauResonanceMaker::LauResonanceMaker() :
- nResDefMax_(0),
- bwBarrierType_(LauBlattWeisskopfFactor::BWPrimeBarrier),
- bwRestFrame_(LauBlattWeisskopfFactor::ResonanceFrame),
- spinFormalism_(LauAbsResonance::Zemach_P),
- summaryPrinted_(kFALSE)
+ nResDefMax_( 0 ),
+ bwBarrierType_( LauBlattWeisskopfFactor::BWPrimeBarrier ),
+ bwRestFrame_( LauBlattWeisskopfFactor::ResonanceFrame ),
+ spinFormalism_( LauAbsResonance::Zemach_P ),
+ summaryPrinted_( kFALSE )
{
- this->createResonanceVector();
- this->setDefaultBWRadius( LauBlattWeisskopfFactor::Parent, 4.0 );
+ this->createResonanceVector();
+ this->setDefaultBWRadius( LauBlattWeisskopfFactor::Parent, 4.0 );
}
LauResonanceMaker::~LauResonanceMaker()
{
- for ( std::vector<LauBlattWeisskopfFactor*>::iterator iter = bwIndepFactors_.begin(); iter != bwIndepFactors_.end(); ++iter ) {
- delete *iter;
- }
- bwIndepFactors_.clear();
- for ( BWFactorCategoryMap::iterator iter = bwFactors_.begin(); iter != bwFactors_.end(); ++iter ) {
- delete iter->second.bwFactor_;
- }
- bwFactors_.clear();
+ for ( std::vector<LauBlattWeisskopfFactor*>::iterator iter = bwIndepFactors_.begin();
+ iter != bwIndepFactors_.end();
+ ++iter ) {
+ delete *iter;
+ }
+ bwIndepFactors_.clear();
+ for ( BWFactorCategoryMap::iterator iter = bwFactors_.begin(); iter != bwFactors_.end(); ++iter ) {
+ delete iter->second.bwFactor_;
+ }
+ bwFactors_.clear();
}
LauResonanceMaker& LauResonanceMaker::get()
{
- if ( resonanceMaker_ == 0 ) {
- resonanceMaker_ = new LauResonanceMaker();
- }
+ if ( resonanceMaker_ == 0 ) {
+ resonanceMaker_ = new LauResonanceMaker();
+ }
- return *resonanceMaker_;
+ return *resonanceMaker_;
}
void LauResonanceMaker::createResonanceVector()
{
- // Function to create all possible resonances that this class supports.
- // Also add in the sigma and kappa - but a special paramterisation is used
- // instead of the PDG "pole mass and width" values.
-
- std::cout << "INFO in LauResonanceMaker::createResonanceVector : Setting up possible resonance states..." << std::endl;
-
- LauResonanceInfo* neutral(0);
- LauResonanceInfo* positve(0);
- LauResonanceInfo* negatve(0);
-
- // Define the resonance names and store them in the array
- resInfo_.clear();
- resInfo_.reserve(100);
- // rho resonances name, mass, width, spin, charge, default BW category, BW radius parameter (defaults to 4.0)
- // rho(770)
- neutral = new LauResonanceInfo("rho0(770)", 0.77526, 0.1478, 1, 0, LauBlattWeisskopfFactor::Light, 5.3);
- positve = new LauResonanceInfo("rho+(770)", 0.77511, 0.1491, 1, 1, LauBlattWeisskopfFactor::Light, 5.3);
- negatve = positve->createChargeConjugate();
- resInfo_.push_back( neutral );
- resInfo_.push_back( positve );
- resInfo_.push_back( negatve );
- // The following two lines of code are placed here in order to allow the following, rather niche, scenario:
- // The LauRhoOmegaMix code permits (through the use of the optional independentPar argument of LauResonanceInfo::addExtraParameter) the magnitude and phase of the rho/omega mixing to potentially differ between the decay of the parent particle to rho0 X and the parent antiparticle to rho0 Xbar.
- // This can be acheived by using the rho0(770) record in one case and the rho0(770)_COPY record in the other.
- neutral = neutral->createSharedParameterRecord("rho0(770)_COPY");
- resInfo_.push_back( neutral );
- // rho(1450)
- neutral = new LauResonanceInfo("rho0(1450)", 1.465, 0.400, 1, 0, LauBlattWeisskopfFactor::Light );
- positve = new LauResonanceInfo("rho+(1450)", 1.465, 0.400, 1, 1, LauBlattWeisskopfFactor::Light );
- negatve = positve->createChargeConjugate();
- resInfo_.push_back( neutral );
- resInfo_.push_back( positve );
- resInfo_.push_back( negatve );
- // rho_3(1690)
- neutral = new LauResonanceInfo("rho0_3(1690)", 1.686, 0.186, 3, 0, LauBlattWeisskopfFactor::Light );
- positve = new LauResonanceInfo("rho+_3(1690)", 1.686, 0.186, 3, 1, LauBlattWeisskopfFactor::Light );
- negatve = positve->createChargeConjugate();
- resInfo_.push_back( neutral );
- resInfo_.push_back( positve );
- resInfo_.push_back( negatve );
- // rho(1700)
- neutral = new LauResonanceInfo("rho0(1700)", 1.720, 0.250, 1, 0, LauBlattWeisskopfFactor::Light );
- positve = new LauResonanceInfo("rho+(1700)", 1.720, 0.250, 1, 1, LauBlattWeisskopfFactor::Light );
- negatve = positve->createChargeConjugate();
- resInfo_.push_back( neutral );
- resInfo_.push_back( positve );
- resInfo_.push_back( negatve );
- // rho(1900)
- neutral = new LauResonanceInfo("rho0(1900)", 1.909, 0.130, 1, 0, LauBlattWeisskopfFactor::Light );
- positve = new LauResonanceInfo("rho+(1900)", 1.909, 0.130, 1, 1, LauBlattWeisskopfFactor::Light );
- negatve = positve->createChargeConjugate();
- resInfo_.push_back( neutral );
- resInfo_.push_back( positve );
- resInfo_.push_back( negatve );
- // rho_3(1990)
- neutral = new LauResonanceInfo("rho0_3(1990)", 1.982, 0.188, 3, 0, LauBlattWeisskopfFactor::Light );
- positve = new LauResonanceInfo("rho+_3(1990)", 1.982, 0.188, 3, 1, LauBlattWeisskopfFactor::Light );
- negatve = positve->createChargeConjugate();
- resInfo_.push_back( neutral );
- resInfo_.push_back( positve );
- resInfo_.push_back( negatve );
-
- // K* resonances name, mass, width, spin, charge, BW category, BW radius parameter (defaults to 4.0)
- // K*(892)
- neutral = new LauResonanceInfo("K*0(892)", 0.89555, 0.0473, 1, 0, LauBlattWeisskopfFactor::Kstar, 3.0);
- positve = new LauResonanceInfo("K*+(892)", 0.89166, 0.0508, 1, 1, LauBlattWeisskopfFactor::Kstar, 3.0);
- negatve = positve->createChargeConjugate();
- resInfo_.push_back( neutral );
- resInfo_.push_back( positve );
- resInfo_.push_back( negatve );
- // K*(1410)
- neutral = new LauResonanceInfo("K*0(1410)", 1.414, 0.232, 1, 0, LauBlattWeisskopfFactor::Kstar );
- positve = new LauResonanceInfo("K*+(1410)", 1.414, 0.232, 1, 1, LauBlattWeisskopfFactor::Kstar );
- negatve = positve->createChargeConjugate();
- resInfo_.push_back( neutral );
- resInfo_.push_back( positve );
- resInfo_.push_back( negatve );
- // K*_0(1430)
- neutral = new LauResonanceInfo("K*0_0(1430)", 1.425, 0.270, 0, 0, LauBlattWeisskopfFactor::Kstar );
- positve = new LauResonanceInfo("K*+_0(1430)", 1.425, 0.270, 0, 1, LauBlattWeisskopfFactor::Kstar );
- negatve = positve->createChargeConjugate();
- resInfo_.push_back( neutral );
- resInfo_.push_back( positve );
- resInfo_.push_back( negatve );
- // LASS nonresonant model
- neutral = neutral->createSharedParameterRecord("LASSNR0");
- positve = positve->createSharedParameterRecord("LASSNR+");
- negatve = negatve->createSharedParameterRecord("LASSNR-");
- resInfo_.push_back( neutral );
- resInfo_.push_back( positve );
- resInfo_.push_back( negatve );
- // K*_2(1430)
- neutral = new LauResonanceInfo("K*0_2(1430)", 1.4324, 0.109, 2, 0, LauBlattWeisskopfFactor::Kstar );
- positve = new LauResonanceInfo("K*+_2(1430)", 1.4273, 0.100, 2, 1, LauBlattWeisskopfFactor::Kstar );
- negatve = positve->createChargeConjugate();
- resInfo_.push_back( neutral );
- resInfo_.push_back( positve );
- resInfo_.push_back( negatve );
- // K*(1680)
- neutral = new LauResonanceInfo("K*0(1680)", 1.718, 0.322, 1, 0, LauBlattWeisskopfFactor::Kstar );
- positve = new LauResonanceInfo("K*+(1680)", 1.718, 0.322, 1, 1, LauBlattWeisskopfFactor::Kstar );
- negatve = positve->createChargeConjugate();
- resInfo_.push_back( neutral );
- resInfo_.push_back( positve );
- resInfo_.push_back( negatve );
- // K*(1950)
- neutral = new LauResonanceInfo("K*0_0(1950)", 1.945, 0.201, 0, 0, LauBlattWeisskopfFactor::Kstar );
- positve = new LauResonanceInfo("K*+_0(1950)", 1.945, 0.201, 0, 1, LauBlattWeisskopfFactor::Kstar );
- negatve = positve->createChargeConjugate();
- resInfo_.push_back( neutral );
- resInfo_.push_back( positve );
- resInfo_.push_back( negatve );
-
- // phi resonances name, mass, width, spin, charge, BW category, BW radius parameter (defaults to 4.0)
- // phi(1020)
- neutral = new LauResonanceInfo("phi(1020)", 1.019461, 0.004249, 1, 0, LauBlattWeisskopfFactor::Light );
- resInfo_.push_back( neutral );
- // phi(1680)
- neutral = new LauResonanceInfo("phi(1680)", 1.680, 0.150, 1, 0, LauBlattWeisskopfFactor::Light );
- resInfo_.push_back( neutral );
-
- // f resonances name, mass, width, spin, charge, BW category, BW radius parameter (defaults to 4.0)
- // f_0(980)
- neutral = new LauResonanceInfo("f_0(980)", 0.990, 0.070, 0, 0, LauBlattWeisskopfFactor::Light );
- resInfo_.push_back( neutral );
- // f_2(1270)
- neutral = new LauResonanceInfo("f_2(1270)", 1.2755, 0.1867, 2, 0, LauBlattWeisskopfFactor::Light );
- resInfo_.push_back( neutral );
- // f_0(1370)
- neutral = new LauResonanceInfo("f_0(1370)", 1.370, 0.350, 0, 0, LauBlattWeisskopfFactor::Light );
- resInfo_.push_back( neutral );
- // f'_0(1300), from Belle's Kspipi paper
- neutral = new LauResonanceInfo("f'_0(1300)", 1.449, 0.126, 0, 0, LauBlattWeisskopfFactor::Light );
- resInfo_.push_back( neutral );
- // f_2(1430)
- neutral = new LauResonanceInfo("f_2(1430)", 1.430, 0.150, 2, 0, LauBlattWeisskopfFactor::Light ); // PDG width in the range 13 - 150
- resInfo_.push_back( neutral );
- // f_0(1500)
- neutral = new LauResonanceInfo("f_0(1500)", 1.506, 0.112, 0, 0, LauBlattWeisskopfFactor::Light );
- resInfo_.push_back( neutral );
- // f'_2(1525)
- neutral = new LauResonanceInfo("f'_2(1525)", 1.5174, 0.086, 2, 0, LauBlattWeisskopfFactor::Light );
- resInfo_.push_back( neutral );
- // f_2(1565)
- neutral = new LauResonanceInfo("f_2(1565)", 1.542, 0.122, 2, 0, LauBlattWeisskopfFactor::Light );
- resInfo_.push_back( neutral );
- // f_2(1640)
- neutral = new LauResonanceInfo("f_2(1640)", 1.639, 0.099, 2, 0, LauBlattWeisskopfFactor::Light );
- resInfo_.push_back( neutral );
- // f_0(1710)
- neutral = new LauResonanceInfo("f_0(1710)", 1.704, 0.123, 0, 0, LauBlattWeisskopfFactor::Light );
- resInfo_.push_back( neutral );
- // f_2(1810)
- neutral = new LauResonanceInfo("f_2(1810)", 1.815, 0.197, 2, 0, LauBlattWeisskopfFactor::Light );
- resInfo_.push_back( neutral );
- // f_2(1910)
- neutral = new LauResonanceInfo("f_2(1910)", 1.900, 0.167, 2, 0, LauBlattWeisskopfFactor::Light );
- resInfo_.push_back( neutral );
- // f_2(1950)
- neutral = new LauResonanceInfo("f_2(1950)", 1.936, 0.464, 2, 0, LauBlattWeisskopfFactor::Light );
- resInfo_.push_back( neutral );
- // f_2(2010)
- neutral = new LauResonanceInfo("f_2(2010)", 2.011, 0.202, 2, 0, LauBlattWeisskopfFactor::Light );
- resInfo_.push_back( neutral );
- // f_0(2020)
- neutral = new LauResonanceInfo("f_0(2020)", 1.992, 0.442, 0, 0, LauBlattWeisskopfFactor::Light );
- resInfo_.push_back( neutral );
- // f_4(2050)
- neutral = new LauResonanceInfo("f_4(2050)", 2.018, 0.237, 4, 0, LauBlattWeisskopfFactor::Light );
- resInfo_.push_back( neutral );
- // f_0(2100)
- neutral = new LauResonanceInfo("f_0(2100)", 2.086, 0.284, 0, 0, LauBlattWeisskopfFactor::Light );
- resInfo_.push_back( neutral );
-
- // omega resonances name, mass, width, spin, charge, BW category, BW radius parameter (defaults to 4.0)
- // omega(782)
- neutral = new LauResonanceInfo("omega(782)", 0.78265, 0.00849, 1, 0, LauBlattWeisskopfFactor::Light );
- resInfo_.push_back( neutral );
-
- // a resonances name, mass, width, spin, charge, BW category, BW radius parameter (defaults to 4.0)
- // a_0(980)
- neutral = new LauResonanceInfo("a0_0(980)", 0.980, 0.092, 0, 0, LauBlattWeisskopfFactor::Light );
- positve = new LauResonanceInfo("a+_0(980)", 0.980, 0.092, 0, 1, LauBlattWeisskopfFactor::Light );
- negatve = positve->createChargeConjugate();
- resInfo_.push_back( neutral );
- resInfo_.push_back( positve );
- resInfo_.push_back( negatve );
- // a_0(1450)
- neutral = new LauResonanceInfo("a0_0(1450)", 1.474, 0.265, 0, 0, LauBlattWeisskopfFactor::Light );
- positve = new LauResonanceInfo("a+_0(1450)", 1.474, 0.265, 0, 1, LauBlattWeisskopfFactor::Light );
- negatve = positve->createChargeConjugate();
- resInfo_.push_back( neutral );
- resInfo_.push_back( positve );
- resInfo_.push_back( negatve );
- // a_2(1320)
- neutral = new LauResonanceInfo("a0_2(1320)", 1.3169, 0.1050, 2, 0, LauBlattWeisskopfFactor::Light );
- positve = new LauResonanceInfo("a+_2(1320)", 1.3169, 0.1050, 2, 1, LauBlattWeisskopfFactor::Light );
- negatve = positve->createChargeConjugate();
- resInfo_.push_back( neutral );
- resInfo_.push_back( positve );
- resInfo_.push_back( negatve );
-
- // charmonium resonances name, mass, width, spin, charge, BW category, BW radius parameter (defaults to 4.0)
- // chi_c0
- neutral = new LauResonanceInfo("chi_c0", 3.41471, 0.0108, 0, 0, LauBlattWeisskopfFactor::Charmonium );
- resInfo_.push_back( neutral );
- // chi_c1
- neutral = new LauResonanceInfo("chi_c1", 3.51067, 0.00084, 0, 0, LauBlattWeisskopfFactor::Charmonium );
- resInfo_.push_back( neutral );
- // chi_c2
- neutral = new LauResonanceInfo("chi_c2", 3.55617, 0.00197, 2, 0, LauBlattWeisskopfFactor::Charmonium );
- resInfo_.push_back( neutral );
- // psi(3770)
- neutral = new LauResonanceInfo("psi(3770)", 3.7737, 0.0272, 1, 0, LauBlattWeisskopfFactor::Charmonium );
- resInfo_.push_back( neutral );
- // X(3872)
- neutral = new LauResonanceInfo("X(3872)", 3.87169, 0.0012, 1, 0, LauBlattWeisskopfFactor::Charmonium );
- resInfo_.push_back( neutral );
- // chi_c2(2P)
- neutral = new LauResonanceInfo("chi_c2(2P)", 3.9222, 0.0353, 2, 0, LauBlattWeisskopfFactor::Charmonium );
- resInfo_.push_back( neutral );
-
- // unknown scalars name, mass, width, spin, charge, BW category, BW radius parameter (defaults to 4.0)
- // sigma
- neutral = new LauResonanceInfo("sigma0", 0.475, 0.550, 0, 0, LauBlattWeisskopfFactor::Light );
- positve = new LauResonanceInfo("sigma+", 0.475, 0.550, 0, 1, LauBlattWeisskopfFactor::Light );
- negatve = positve->createChargeConjugate();
- resInfo_.push_back( neutral );
- resInfo_.push_back( positve );
- resInfo_.push_back( negatve );
- // kappa
- neutral = new LauResonanceInfo("kappa0", 0.824, 0.478, 0, 0, LauBlattWeisskopfFactor::Kstar );
- positve = new LauResonanceInfo("kappa+", 0.824, 0.478, 0, 1, LauBlattWeisskopfFactor::Kstar );
- negatve = positve->createChargeConjugate();
- resInfo_.push_back( neutral );
- resInfo_.push_back( positve );
- resInfo_.push_back( negatve );
- // dabba
- neutral = new LauResonanceInfo("dabba0", 2.098, 0.520, 0, 0, LauBlattWeisskopfFactor::Charm );
- positve = new LauResonanceInfo("dabba+", 2.098, 0.520, 0, 1, LauBlattWeisskopfFactor::Charm );
- negatve = positve->createChargeConjugate();
- resInfo_.push_back( neutral );
- resInfo_.push_back( positve );
- resInfo_.push_back( negatve );
-
- // excited charm states name, mass, width, spin, charge, BW category, BW radius parameter (defaults to 4.0)
- // D*
- neutral = new LauResonanceInfo("D*0", 2.00685, 0.0021, 1, 0, LauBlattWeisskopfFactor::Charm );
- positve = new LauResonanceInfo("D*+", 2.01026, 83.4e-6, 1, 1, LauBlattWeisskopfFactor::Charm );
- negatve = positve->createChargeConjugate();
- resInfo_.push_back( neutral );
- resInfo_.push_back( positve );
- resInfo_.push_back( negatve );
- // D*_0
- neutral = new LauResonanceInfo("D*0_0", 2.300, 0.274, 0, 0, LauBlattWeisskopfFactor::Charm );
- positve = new LauResonanceInfo("D*+_0", 2.349, 0.221, 0, 1, LauBlattWeisskopfFactor::Charm );
- negatve = positve->createChargeConjugate();
- resInfo_.push_back( neutral );
- resInfo_.push_back( positve );
- resInfo_.push_back( negatve );
- // D*_2
- //AVERAGE--neutral = new LauResonanceInfo("D*0_2", 2.4618, 0.049, 2, 0 );
- neutral = new LauResonanceInfo("D*0_2", 2.4607, 0.0475, 2, 0, LauBlattWeisskopfFactor::Charm );
- positve = new LauResonanceInfo("D*+_2", 2.4654, 0.0467, 2, 1, LauBlattWeisskopfFactor::Charm );
- negatve = positve->createChargeConjugate();
- resInfo_.push_back( neutral );
- resInfo_.push_back( positve );
- resInfo_.push_back( negatve );
- // D1(2420)
- neutral = new LauResonanceInfo("D0_1(2420)", 2.4208, 0.0317, 1, 0, LauBlattWeisskopfFactor::Charm );
- positve = new LauResonanceInfo("D+_1(2420)", 2.4232, 0.025, 1, 1, LauBlattWeisskopfFactor::Charm );
- negatve = positve->createChargeConjugate();
- resInfo_.push_back( neutral );
- resInfo_.push_back( positve );
- resInfo_.push_back( negatve );
- // D(2600)
- //OLD--neutral = new LauResonanceInfo("D0(2600)", 2.6087, 0.093, 0, 0 );
- //OLD--positve = new LauResonanceInfo("D+(2600)", 2.6213, 0.093, 0, 1 );
- neutral = new LauResonanceInfo("D0(2600)", 2.623, 0.139, 0, 0, LauBlattWeisskopfFactor::Charm );
- positve = new LauResonanceInfo("D+(2600)", 2.623, 0.139, 0, 1, LauBlattWeisskopfFactor::Charm );
- negatve = positve->createChargeConjugate();
- resInfo_.push_back( neutral );
- resInfo_.push_back( positve );
- resInfo_.push_back( negatve );
- // D(2680)
- neutral = new LauResonanceInfo("D*0_1(2680)", 2.6811, 0.1867, 1, 0, LauBlattWeisskopfFactor::Charm );
- resInfo_.push_back( neutral );
- // D(2760)
- //OLD-- neutral = new LauResonanceInfo("D0(2760)", 2.7633, 0.061, 1, 0 );
- //OLD-- positve = new LauResonanceInfo("D+(2760)", 2.7697, 0.061, 1, 1 );
- neutral = new LauResonanceInfo("D0(2760)", 2.761, 0.063, 1, 0, LauBlattWeisskopfFactor::Charm );
- positve = new LauResonanceInfo("D+(2760)", 2.761, 0.063, 1, 1, LauBlattWeisskopfFactor::Charm );
- negatve = positve->createChargeConjugate();
- resInfo_.push_back( neutral );
- resInfo_.push_back( positve );
- resInfo_.push_back( negatve );
- neutral = new LauResonanceInfo("D*0_3(2760)", 2.7755, 0.0953, 3, 0, LauBlattWeisskopfFactor::Charm );
- resInfo_.push_back( neutral );
- // D(2900)
- neutral = new LauResonanceInfo("D0(3000)", 3.214, 0.186, 0, 0, LauBlattWeisskopfFactor::Charm );
- resInfo_.push_back( neutral );
- // D(3400)
- neutral = new LauResonanceInfo("D0(3400)", 3.4, 0.15, 0, 0, LauBlattWeisskopfFactor::Charm );
- resInfo_.push_back( neutral );
-
- // excited strange charm name, mass, width, spin, charge, BW category, BW radius parameter (defaults to 4.0)
- // Ds*
- positve = new LauResonanceInfo("Ds*+", 2.1121, 0.0019, 1, 1, LauBlattWeisskopfFactor::StrangeCharm );
- negatve = positve->createChargeConjugate();
- resInfo_.push_back( positve );
- resInfo_.push_back( negatve );
- // Ds0*(2317)
- positve = new LauResonanceInfo("Ds*+_0(2317)", 2.3178, 0.0038, 0, 1, LauBlattWeisskopfFactor::StrangeCharm );
- negatve = positve->createChargeConjugate();
- resInfo_.push_back( positve );
- resInfo_.push_back( negatve );
- // Ds2*(2573)
- positve = new LauResonanceInfo("Ds*+_2(2573)", 2.5691, 0.0169, 2, 1, LauBlattWeisskopfFactor::StrangeCharm );
- negatve = positve->createChargeConjugate();
- resInfo_.push_back( positve );
- resInfo_.push_back( negatve );
- // Ds1*(2700)
- positve = new LauResonanceInfo("Ds*+_1(2700)", 2.7083, 0.120, 1, 1, LauBlattWeisskopfFactor::StrangeCharm );
- negatve = positve->createChargeConjugate();
- resInfo_.push_back( positve );
- resInfo_.push_back( negatve );
- // Ds1*(2860)
- positve = new LauResonanceInfo("Ds*+_1(2860)", 2.859, 0.159, 1, 1, LauBlattWeisskopfFactor::StrangeCharm );
- negatve = positve->createChargeConjugate();
- resInfo_.push_back( positve );
- resInfo_.push_back( negatve );
- // Ds3*(2860)
- positve = new LauResonanceInfo("Ds*+_3(2860)", 2.860, 0.053, 3, 1, LauBlattWeisskopfFactor::StrangeCharm );
- negatve = positve->createChargeConjugate();
- resInfo_.push_back( positve );
- resInfo_.push_back( negatve );
-
- // excited bottom states name, mass, width, spin, charge, BW category, BW radius parameter (defaults to 4.0)
- // B*
- neutral = new LauResonanceInfo("B*0", 5.3247, 0.00, 1, 0, LauBlattWeisskopfFactor::Beauty, 6.0);
- positve = new LauResonanceInfo("B*+", 5.3247, 0.00, 1, 1, LauBlattWeisskopfFactor::Beauty, 6.0);
- negatve = positve->createChargeConjugate();
- resInfo_.push_back( neutral );
- resInfo_.push_back( positve );
- resInfo_.push_back( negatve );
-
- // excited strange bottom name, mass, width, spin, charge, BW category, BW radius parameter (defaults to 4.0)
- // Bs*
- neutral = new LauResonanceInfo("Bs*0", 5.4154, 0.00, 1, 0, LauBlattWeisskopfFactor::StrangeBeauty, 6.0);
- resInfo_.push_back( neutral );
-
- // nonresonant models name, mass, width, spin, charge, BW category, BW radius parameter (defaults to 4.0)
- // Phase-space nonresonant model
- neutral = new LauResonanceInfo("NonReson", 0.0, 0.0, 0, 0, LauBlattWeisskopfFactor::Light );
- resInfo_.push_back( neutral );
- // Theory-based nonresonant model
- neutral = new LauResonanceInfo("NRModel", 0.0, 0.0, 0, 0, LauBlattWeisskopfFactor::Light );
- resInfo_.push_back( neutral );
- // Belle nonresonant models
- neutral = new LauResonanceInfo("BelleSymNR", 0.0, 0.0, 0, 0, LauBlattWeisskopfFactor::Light );
- resInfo_.push_back( neutral );
- neutral = new LauResonanceInfo("BelleNR", 0.0, 0.0, 0, 0, LauBlattWeisskopfFactor::Light );
- resInfo_.push_back( neutral );
- positve = new LauResonanceInfo("BelleNR+", 0.0, 0.0, 0, 1, LauBlattWeisskopfFactor::Light );
- negatve = positve->createChargeConjugate();
- resInfo_.push_back( positve );
- resInfo_.push_back( negatve );
- neutral = new LauResonanceInfo("BelleNR_Swave", 0.0, 0.0, 0, 0, LauBlattWeisskopfFactor::Light );
- resInfo_.push_back( neutral );
- positve = new LauResonanceInfo("BelleNR_Swave+",0.0, 0.0, 0, 1, LauBlattWeisskopfFactor::Light );
- negatve = positve->createChargeConjugate();
- resInfo_.push_back( positve );
- resInfo_.push_back( negatve );
- neutral = new LauResonanceInfo("BelleNR_Pwave", 0.0, 0.0, 1, 0, LauBlattWeisskopfFactor::Light );
- resInfo_.push_back( neutral );
- positve = new LauResonanceInfo("BelleNR_Pwave+",0.0, 0.0, 1, 1, LauBlattWeisskopfFactor::Light );
- negatve = positve->createChargeConjugate();
- resInfo_.push_back( positve );
- resInfo_.push_back( negatve );
- neutral = new LauResonanceInfo("BelleNR_Dwave", 0.0, 0.0, 2, 0, LauBlattWeisskopfFactor::Light );
- resInfo_.push_back( neutral );
- positve = new LauResonanceInfo("BelleNR_Dwave+",0.0, 0.0, 2, 1, LauBlattWeisskopfFactor::Light );
- negatve = positve->createChargeConjugate();
- resInfo_.push_back( positve );
- resInfo_.push_back( negatve );
- neutral = new LauResonanceInfo("BelleNR_Fwave", 0.0, 0.0, 3, 0, LauBlattWeisskopfFactor::Light );
- resInfo_.push_back( neutral );
- positve = new LauResonanceInfo("BelleNR_Fwave+",0.0, 0.0, 3, 1, LauBlattWeisskopfFactor::Light );
- negatve = positve->createChargeConjugate();
- resInfo_.push_back( positve );
- resInfo_.push_back( negatve );
- // Taylor expansion nonresonant model
- neutral = new LauResonanceInfo("NRTaylor", 0.0, 0.0, 0, 0, LauBlattWeisskopfFactor::Light );
- resInfo_.push_back( neutral );
- // Polynomial nonresonant models
- neutral = new LauResonanceInfo("PolNR_S0", 0.0, 0.0, 0, 0, LauBlattWeisskopfFactor::Light );
- resInfo_.push_back( neutral );
- neutral = new LauResonanceInfo("PolNR_S1", 0.0, 0.0, 0, 0, LauBlattWeisskopfFactor::Light );
- resInfo_.push_back( neutral );
- neutral = new LauResonanceInfo("PolNR_S2", 0.0, 0.0, 0, 0, LauBlattWeisskopfFactor::Light );
- resInfo_.push_back( neutral );
- neutral = new LauResonanceInfo("PolNR_P0", 0.0, 0.0, 1, 0, LauBlattWeisskopfFactor::Light );
- resInfo_.push_back( neutral );
- neutral = new LauResonanceInfo("PolNR_P1", 0.0, 0.0, 1, 0, LauBlattWeisskopfFactor::Light );
- resInfo_.push_back( neutral );
- neutral = new LauResonanceInfo("PolNR_P2", 0.0, 0.0, 1, 0, LauBlattWeisskopfFactor::Light );
- resInfo_.push_back( neutral );
-
- // Fake resonances for S-Wave splines
- neutral = new LauResonanceInfo("Spline_S0", 0.0, 0.0, 0, 0, LauBlattWeisskopfFactor::Light );
- resInfo_.push_back( neutral );
- neutral = new LauResonanceInfo("Spline_S0_Bar", 0.0, 0.0, 0, 0, LauBlattWeisskopfFactor::Light );
- resInfo_.push_back( neutral );
-
- // Polar Form Factor nonresonant model
- neutral = new LauResonanceInfo("PolarFFSymNR", 0.0, 0.0, 0, 0, LauBlattWeisskopfFactor::Light );
- resInfo_.push_back( neutral );
- neutral = new LauResonanceInfo("PolarFFNR", 0.0, 0.0, 0, 0, LauBlattWeisskopfFactor::Light );
- resInfo_.push_back( neutral );
-
- // PiPi-KK Inelastic Scattering
- neutral = new LauResonanceInfo("Rescattering", 0.0, 0.0, 0, 0, LauBlattWeisskopfFactor::Light );
- resInfo_.push_back( neutral );
-
- nResDefMax_ = resInfo_.size();
+ // Function to create all possible resonances that this class supports.
+ // Also add in the sigma and kappa - but a special paramterisation is used
+ // instead of the PDG "pole mass and width" values.
+
+ std::cout << "INFO in LauResonanceMaker::createResonanceVector : Setting up possible resonance states..."
+ << std::endl;
+
+ LauResonanceInfo* neutral( 0 );
+ LauResonanceInfo* positve( 0 );
+ LauResonanceInfo* negatve( 0 );
+
+ // Define the resonance names and store them in the array
+ resInfo_.clear();
+ resInfo_.reserve( 100 );
+ // rho resonances name, mass, width, spin, charge, default BW category, BW radius parameter (defaults to 4.0)
+ // rho(770)
+ neutral =
+ new LauResonanceInfo( "rho0(770)", 0.77526, 0.1478, 1, 0, LauBlattWeisskopfFactor::Light, 5.3 );
+ positve =
+ new LauResonanceInfo( "rho+(770)", 0.77511, 0.1491, 1, 1, LauBlattWeisskopfFactor::Light, 5.3 );
+ negatve = positve->createChargeConjugate();
+ resInfo_.push_back( neutral );
+ resInfo_.push_back( positve );
+ resInfo_.push_back( negatve );
+ // The following two lines of code are placed here in order to allow the following, rather niche, scenario:
+ // The LauRhoOmegaMix code permits (through the use of the optional independentPar argument of LauResonanceInfo::addExtraParameter) the magnitude and phase of the rho/omega mixing to potentially differ between the decay of the parent particle to rho0 X and the parent antiparticle to rho0 Xbar.
+ // This can be acheived by using the rho0(770) record in one case and the rho0(770)_COPY record in the other.
+ neutral = neutral->createSharedParameterRecord( "rho0(770)_COPY" );
+ resInfo_.push_back( neutral );
+ // rho(1450)
+ neutral = new LauResonanceInfo( "rho0(1450)", 1.465, 0.400, 1, 0, LauBlattWeisskopfFactor::Light );
+ positve = new LauResonanceInfo( "rho+(1450)", 1.465, 0.400, 1, 1, LauBlattWeisskopfFactor::Light );
+ negatve = positve->createChargeConjugate();
+ resInfo_.push_back( neutral );
+ resInfo_.push_back( positve );
+ resInfo_.push_back( negatve );
+ // rho_3(1690)
+ neutral =
+ new LauResonanceInfo( "rho0_3(1690)", 1.686, 0.186, 3, 0, LauBlattWeisskopfFactor::Light );
+ positve =
+ new LauResonanceInfo( "rho+_3(1690)", 1.686, 0.186, 3, 1, LauBlattWeisskopfFactor::Light );
+ negatve = positve->createChargeConjugate();
+ resInfo_.push_back( neutral );
+ resInfo_.push_back( positve );
+ resInfo_.push_back( negatve );
+ // rho(1700)
+ neutral = new LauResonanceInfo( "rho0(1700)", 1.720, 0.250, 1, 0, LauBlattWeisskopfFactor::Light );
+ positve = new LauResonanceInfo( "rho+(1700)", 1.720, 0.250, 1, 1, LauBlattWeisskopfFactor::Light );
+ negatve = positve->createChargeConjugate();
+ resInfo_.push_back( neutral );
+ resInfo_.push_back( positve );
+ resInfo_.push_back( negatve );
+ // rho(1900)
+ neutral = new LauResonanceInfo( "rho0(1900)", 1.909, 0.130, 1, 0, LauBlattWeisskopfFactor::Light );
+ positve = new LauResonanceInfo( "rho+(1900)", 1.909, 0.130, 1, 1, LauBlattWeisskopfFactor::Light );
+ negatve = positve->createChargeConjugate();
+ resInfo_.push_back( neutral );
+ resInfo_.push_back( positve );
+ resInfo_.push_back( negatve );
+ // rho_3(1990)
+ neutral =
+ new LauResonanceInfo( "rho0_3(1990)", 1.982, 0.188, 3, 0, LauBlattWeisskopfFactor::Light );
+ positve =
+ new LauResonanceInfo( "rho+_3(1990)", 1.982, 0.188, 3, 1, LauBlattWeisskopfFactor::Light );
+ negatve = positve->createChargeConjugate();
+ resInfo_.push_back( neutral );
+ resInfo_.push_back( positve );
+ resInfo_.push_back( negatve );
+
+ // K* resonances name, mass, width, spin, charge, BW category, BW radius parameter (defaults to 4.0)
+ // K*(892)
+ neutral =
+ new LauResonanceInfo( "K*0(892)", 0.89555, 0.0473, 1, 0, LauBlattWeisskopfFactor::Kstar, 3.0 );
+ positve =
+ new LauResonanceInfo( "K*+(892)", 0.89166, 0.0508, 1, 1, LauBlattWeisskopfFactor::Kstar, 3.0 );
+ negatve = positve->createChargeConjugate();
+ resInfo_.push_back( neutral );
+ resInfo_.push_back( positve );
+ resInfo_.push_back( negatve );
+ // K*(1410)
+ neutral = new LauResonanceInfo( "K*0(1410)", 1.414, 0.232, 1, 0, LauBlattWeisskopfFactor::Kstar );
+ positve = new LauResonanceInfo( "K*+(1410)", 1.414, 0.232, 1, 1, LauBlattWeisskopfFactor::Kstar );
+ negatve = positve->createChargeConjugate();
+ resInfo_.push_back( neutral );
+ resInfo_.push_back( positve );
+ resInfo_.push_back( negatve );
+ // K*_0(1430)
+ neutral = new LauResonanceInfo( "K*0_0(1430)", 1.425, 0.270, 0, 0, LauBlattWeisskopfFactor::Kstar );
+ positve = new LauResonanceInfo( "K*+_0(1430)", 1.425, 0.270, 0, 1, LauBlattWeisskopfFactor::Kstar );
+ negatve = positve->createChargeConjugate();
+ resInfo_.push_back( neutral );
+ resInfo_.push_back( positve );
+ resInfo_.push_back( negatve );
+ // LASS nonresonant model
+ neutral = neutral->createSharedParameterRecord( "LASSNR0" );
+ positve = positve->createSharedParameterRecord( "LASSNR+" );
+ negatve = negatve->createSharedParameterRecord( "LASSNR-" );
+ resInfo_.push_back( neutral );
+ resInfo_.push_back( positve );
+ resInfo_.push_back( negatve );
+ // K*_2(1430)
+ neutral =
+ new LauResonanceInfo( "K*0_2(1430)", 1.4324, 0.109, 2, 0, LauBlattWeisskopfFactor::Kstar );
+ positve =
+ new LauResonanceInfo( "K*+_2(1430)", 1.4273, 0.100, 2, 1, LauBlattWeisskopfFactor::Kstar );
+ negatve = positve->createChargeConjugate();
+ resInfo_.push_back( neutral );
+ resInfo_.push_back( positve );
+ resInfo_.push_back( negatve );
+ // K*(1680)
+ neutral = new LauResonanceInfo( "K*0(1680)", 1.718, 0.322, 1, 0, LauBlattWeisskopfFactor::Kstar );
+ positve = new LauResonanceInfo( "K*+(1680)", 1.718, 0.322, 1, 1, LauBlattWeisskopfFactor::Kstar );
+ negatve = positve->createChargeConjugate();
+ resInfo_.push_back( neutral );
+ resInfo_.push_back( positve );
+ resInfo_.push_back( negatve );
+ // K*(1950)
+ neutral = new LauResonanceInfo( "K*0_0(1950)", 1.945, 0.201, 0, 0, LauBlattWeisskopfFactor::Kstar );
+ positve = new LauResonanceInfo( "K*+_0(1950)", 1.945, 0.201, 0, 1, LauBlattWeisskopfFactor::Kstar );
+ negatve = positve->createChargeConjugate();
+ resInfo_.push_back( neutral );
+ resInfo_.push_back( positve );
+ resInfo_.push_back( negatve );
+
+ // phi resonances name, mass, width, spin, charge, BW category, BW radius parameter (defaults to 4.0)
+ // phi(1020)
+ neutral =
+ new LauResonanceInfo( "phi(1020)", 1.019461, 0.004249, 1, 0, LauBlattWeisskopfFactor::Light );
+ resInfo_.push_back( neutral );
+ // phi(1680)
+ neutral = new LauResonanceInfo( "phi(1680)", 1.680, 0.150, 1, 0, LauBlattWeisskopfFactor::Light );
+ resInfo_.push_back( neutral );
+
+ // f resonances name, mass, width, spin, charge, BW category, BW radius parameter (defaults to 4.0)
+ // f_0(980)
+ neutral = new LauResonanceInfo( "f_0(980)", 0.990, 0.070, 0, 0, LauBlattWeisskopfFactor::Light );
+ resInfo_.push_back( neutral );
+ // f_2(1270)
+ neutral = new LauResonanceInfo( "f_2(1270)", 1.2755, 0.1867, 2, 0, LauBlattWeisskopfFactor::Light );
+ resInfo_.push_back( neutral );
+ // f_0(1370)
+ neutral = new LauResonanceInfo( "f_0(1370)", 1.370, 0.350, 0, 0, LauBlattWeisskopfFactor::Light );
+ resInfo_.push_back( neutral );
+ // f'_0(1300), from Belle's Kspipi paper
+ neutral = new LauResonanceInfo( "f'_0(1300)", 1.449, 0.126, 0, 0, LauBlattWeisskopfFactor::Light );
+ resInfo_.push_back( neutral );
+ // f_2(1430)
+ neutral = new LauResonanceInfo( "f_2(1430)",
+ 1.430,
+ 0.150,
+ 2,
+ 0,
+ LauBlattWeisskopfFactor::Light ); // PDG width in the range 13 - 150
+ resInfo_.push_back( neutral );
+ // f_0(1500)
+ neutral = new LauResonanceInfo( "f_0(1500)", 1.506, 0.112, 0, 0, LauBlattWeisskopfFactor::Light );
+ resInfo_.push_back( neutral );
+ // f'_2(1525)
+ neutral = new LauResonanceInfo( "f'_2(1525)", 1.5174, 0.086, 2, 0, LauBlattWeisskopfFactor::Light );
+ resInfo_.push_back( neutral );
+ // f_2(1565)
+ neutral = new LauResonanceInfo( "f_2(1565)", 1.542, 0.122, 2, 0, LauBlattWeisskopfFactor::Light );
+ resInfo_.push_back( neutral );
+ // f_2(1640)
+ neutral = new LauResonanceInfo( "f_2(1640)", 1.639, 0.099, 2, 0, LauBlattWeisskopfFactor::Light );
+ resInfo_.push_back( neutral );
+ // f_0(1710)
+ neutral = new LauResonanceInfo( "f_0(1710)", 1.704, 0.123, 0, 0, LauBlattWeisskopfFactor::Light );
+ resInfo_.push_back( neutral );
+ // f_2(1810)
+ neutral = new LauResonanceInfo( "f_2(1810)", 1.815, 0.197, 2, 0, LauBlattWeisskopfFactor::Light );
+ resInfo_.push_back( neutral );
+ // f_2(1910)
+ neutral = new LauResonanceInfo( "f_2(1910)", 1.900, 0.167, 2, 0, LauBlattWeisskopfFactor::Light );
+ resInfo_.push_back( neutral );
+ // f_2(1950)
+ neutral = new LauResonanceInfo( "f_2(1950)", 1.936, 0.464, 2, 0, LauBlattWeisskopfFactor::Light );
+ resInfo_.push_back( neutral );
+ // f_2(2010)
+ neutral = new LauResonanceInfo( "f_2(2010)", 2.011, 0.202, 2, 0, LauBlattWeisskopfFactor::Light );
+ resInfo_.push_back( neutral );
+ // f_0(2020)
+ neutral = new LauResonanceInfo( "f_0(2020)", 1.992, 0.442, 0, 0, LauBlattWeisskopfFactor::Light );
+ resInfo_.push_back( neutral );
+ // f_4(2050)
+ neutral = new LauResonanceInfo( "f_4(2050)", 2.018, 0.237, 4, 0, LauBlattWeisskopfFactor::Light );
+ resInfo_.push_back( neutral );
+ // f_0(2100)
+ neutral = new LauResonanceInfo( "f_0(2100)", 2.086, 0.284, 0, 0, LauBlattWeisskopfFactor::Light );
+ resInfo_.push_back( neutral );
+
+ // omega resonances name, mass, width, spin, charge, BW category, BW radius parameter (defaults to 4.0)
+ // omega(782)
+ neutral =
+ new LauResonanceInfo( "omega(782)", 0.78265, 0.00849, 1, 0, LauBlattWeisskopfFactor::Light );
+ resInfo_.push_back( neutral );
+
+ // a resonances name, mass, width, spin, charge, BW category, BW radius parameter (defaults to 4.0)
+ // a_0(980)
+ neutral = new LauResonanceInfo( "a0_0(980)", 0.980, 0.092, 0, 0, LauBlattWeisskopfFactor::Light );
+ positve = new LauResonanceInfo( "a+_0(980)", 0.980, 0.092, 0, 1, LauBlattWeisskopfFactor::Light );
+ negatve = positve->createChargeConjugate();
+ resInfo_.push_back( neutral );
+ resInfo_.push_back( positve );
+ resInfo_.push_back( negatve );
+ // a_0(1450)
+ neutral = new LauResonanceInfo( "a0_0(1450)", 1.474, 0.265, 0, 0, LauBlattWeisskopfFactor::Light );
+ positve = new LauResonanceInfo( "a+_0(1450)", 1.474, 0.265, 0, 1, LauBlattWeisskopfFactor::Light );
+ negatve = positve->createChargeConjugate();
+ resInfo_.push_back( neutral );
+ resInfo_.push_back( positve );
+ resInfo_.push_back( negatve );
+ // a_2(1320)
+ neutral =
+ new LauResonanceInfo( "a0_2(1320)", 1.3169, 0.1050, 2, 0, LauBlattWeisskopfFactor::Light );
+ positve =
+ new LauResonanceInfo( "a+_2(1320)", 1.3169, 0.1050, 2, 1, LauBlattWeisskopfFactor::Light );
+ negatve = positve->createChargeConjugate();
+ resInfo_.push_back( neutral );
+ resInfo_.push_back( positve );
+ resInfo_.push_back( negatve );
+
+ // charmonium resonances name, mass, width, spin, charge, BW category, BW radius parameter (defaults to 4.0)
+ // chi_c0
+ neutral =
+ new LauResonanceInfo( "chi_c0", 3.41471, 0.0108, 0, 0, LauBlattWeisskopfFactor::Charmonium );
+ resInfo_.push_back( neutral );
+ // chi_c1
+ neutral =
+ new LauResonanceInfo( "chi_c1", 3.51067, 0.00084, 0, 0, LauBlattWeisskopfFactor::Charmonium );
+ resInfo_.push_back( neutral );
+ // chi_c2
+ neutral =
+ new LauResonanceInfo( "chi_c2", 3.55617, 0.00197, 2, 0, LauBlattWeisskopfFactor::Charmonium );
+ resInfo_.push_back( neutral );
+ // psi(3770)
+ neutral =
+ new LauResonanceInfo( "psi(3770)", 3.7737, 0.0272, 1, 0, LauBlattWeisskopfFactor::Charmonium );
+ resInfo_.push_back( neutral );
+ // X(3872)
+ neutral =
+ new LauResonanceInfo( "X(3872)", 3.87169, 0.0012, 1, 0, LauBlattWeisskopfFactor::Charmonium );
+ resInfo_.push_back( neutral );
+ // chi_c2(2P)
+ neutral =
+ new LauResonanceInfo( "chi_c2(2P)", 3.9222, 0.0353, 2, 0, LauBlattWeisskopfFactor::Charmonium );
+ resInfo_.push_back( neutral );
+
+ // unknown scalars name, mass, width, spin, charge, BW category, BW radius parameter (defaults to 4.0)
+ // sigma
+ neutral = new LauResonanceInfo( "sigma0", 0.475, 0.550, 0, 0, LauBlattWeisskopfFactor::Light );
+ positve = new LauResonanceInfo( "sigma+", 0.475, 0.550, 0, 1, LauBlattWeisskopfFactor::Light );
+ negatve = positve->createChargeConjugate();
+ resInfo_.push_back( neutral );
+ resInfo_.push_back( positve );
+ resInfo_.push_back( negatve );
+ // kappa
+ neutral = new LauResonanceInfo( "kappa0", 0.824, 0.478, 0, 0, LauBlattWeisskopfFactor::Kstar );
+ positve = new LauResonanceInfo( "kappa+", 0.824, 0.478, 0, 1, LauBlattWeisskopfFactor::Kstar );
+ negatve = positve->createChargeConjugate();
+ resInfo_.push_back( neutral );
+ resInfo_.push_back( positve );
+ resInfo_.push_back( negatve );
+ // dabba
+ neutral = new LauResonanceInfo( "dabba0", 2.098, 0.520, 0, 0, LauBlattWeisskopfFactor::Charm );
+ positve = new LauResonanceInfo( "dabba+", 2.098, 0.520, 0, 1, LauBlattWeisskopfFactor::Charm );
+ negatve = positve->createChargeConjugate();
+ resInfo_.push_back( neutral );
+ resInfo_.push_back( positve );
+ resInfo_.push_back( negatve );
+
+ // excited charm states name, mass, width, spin, charge, BW category, BW radius parameter (defaults to 4.0)
+ // D*
+ neutral = new LauResonanceInfo( "D*0", 2.00685, 0.0021, 1, 0, LauBlattWeisskopfFactor::Charm );
+ positve = new LauResonanceInfo( "D*+", 2.01026, 83.4e-6, 1, 1, LauBlattWeisskopfFactor::Charm );
+ negatve = positve->createChargeConjugate();
+ resInfo_.push_back( neutral );
+ resInfo_.push_back( positve );
+ resInfo_.push_back( negatve );
+ // D*_0
+ neutral = new LauResonanceInfo( "D*0_0", 2.300, 0.274, 0, 0, LauBlattWeisskopfFactor::Charm );
+ positve = new LauResonanceInfo( "D*+_0", 2.349, 0.221, 0, 1, LauBlattWeisskopfFactor::Charm );
+ negatve = positve->createChargeConjugate();
+ resInfo_.push_back( neutral );
+ resInfo_.push_back( positve );
+ resInfo_.push_back( negatve );
+ // D*_2
+ //AVERAGE--neutral = new LauResonanceInfo("D*0_2", 2.4618, 0.049, 2, 0 );
+ neutral = new LauResonanceInfo( "D*0_2", 2.4607, 0.0475, 2, 0, LauBlattWeisskopfFactor::Charm );
+ positve = new LauResonanceInfo( "D*+_2", 2.4654, 0.0467, 2, 1, LauBlattWeisskopfFactor::Charm );
+ negatve = positve->createChargeConjugate();
+ resInfo_.push_back( neutral );
+ resInfo_.push_back( positve );
+ resInfo_.push_back( negatve );
+ // D1(2420)
+ neutral =
+ new LauResonanceInfo( "D0_1(2420)", 2.4208, 0.0317, 1, 0, LauBlattWeisskopfFactor::Charm );
+ positve = new LauResonanceInfo( "D+_1(2420)", 2.4232, 0.025, 1, 1, LauBlattWeisskopfFactor::Charm );
+ negatve = positve->createChargeConjugate();
+ resInfo_.push_back( neutral );
+ resInfo_.push_back( positve );
+ resInfo_.push_back( negatve );
+ // D(2600)
+ //OLD--neutral = new LauResonanceInfo("D0(2600)", 2.6087, 0.093, 0, 0 );
+ //OLD--positve = new LauResonanceInfo("D+(2600)", 2.6213, 0.093, 0, 1 );
+ neutral = new LauResonanceInfo( "D0(2600)", 2.623, 0.139, 0, 0, LauBlattWeisskopfFactor::Charm );
+ positve = new LauResonanceInfo( "D+(2600)", 2.623, 0.139, 0, 1, LauBlattWeisskopfFactor::Charm );
+ negatve = positve->createChargeConjugate();
+ resInfo_.push_back( neutral );
+ resInfo_.push_back( positve );
+ resInfo_.push_back( negatve );
+ // D(2680)
+ neutral =
+ new LauResonanceInfo( "D*0_1(2680)", 2.6811, 0.1867, 1, 0, LauBlattWeisskopfFactor::Charm );
+ resInfo_.push_back( neutral );
+ // D(2760)
+ //OLD-- neutral = new LauResonanceInfo("D0(2760)", 2.7633, 0.061, 1, 0 );
+ //OLD-- positve = new LauResonanceInfo("D+(2760)", 2.7697, 0.061, 1, 1 );
+ neutral = new LauResonanceInfo( "D0(2760)", 2.761, 0.063, 1, 0, LauBlattWeisskopfFactor::Charm );
+ positve = new LauResonanceInfo( "D+(2760)", 2.761, 0.063, 1, 1, LauBlattWeisskopfFactor::Charm );
+ negatve = positve->createChargeConjugate();
+ resInfo_.push_back( neutral );
+ resInfo_.push_back( positve );
+ resInfo_.push_back( negatve );
+ neutral =
+ new LauResonanceInfo( "D*0_3(2760)", 2.7755, 0.0953, 3, 0, LauBlattWeisskopfFactor::Charm );
+ resInfo_.push_back( neutral );
+ // D(2900)
+ neutral = new LauResonanceInfo( "D0(3000)", 3.214, 0.186, 0, 0, LauBlattWeisskopfFactor::Charm );
+ resInfo_.push_back( neutral );
+ // D(3400)
+ neutral = new LauResonanceInfo( "D0(3400)", 3.4, 0.15, 0, 0, LauBlattWeisskopfFactor::Charm );
+ resInfo_.push_back( neutral );
+
+ // excited strange charm name, mass, width, spin, charge, BW category, BW radius parameter (defaults to 4.0)
+ // Ds*
+ positve =
+ new LauResonanceInfo( "Ds*+", 2.1121, 0.0019, 1, 1, LauBlattWeisskopfFactor::StrangeCharm );
+ negatve = positve->createChargeConjugate();
+ resInfo_.push_back( positve );
+ resInfo_.push_back( negatve );
+ // Ds0*(2317)
+ positve = new LauResonanceInfo( "Ds*+_0(2317)",
+ 2.3178,
+ 0.0038,
+ 0,
+ 1,
+ LauBlattWeisskopfFactor::StrangeCharm );
+ negatve = positve->createChargeConjugate();
+ resInfo_.push_back( positve );
+ resInfo_.push_back( negatve );
+ // Ds2*(2573)
+ positve = new LauResonanceInfo( "Ds*+_2(2573)",
+ 2.5691,
+ 0.0169,
+ 2,
+ 1,
+ LauBlattWeisskopfFactor::StrangeCharm );
+ negatve = positve->createChargeConjugate();
+ resInfo_.push_back( positve );
+ resInfo_.push_back( negatve );
+ // Ds1*(2700)
+ positve = new LauResonanceInfo( "Ds*+_1(2700)",
+ 2.7083,
+ 0.120,
+ 1,
+ 1,
+ LauBlattWeisskopfFactor::StrangeCharm );
+ negatve = positve->createChargeConjugate();
+ resInfo_.push_back( positve );
+ resInfo_.push_back( negatve );
+ // Ds1*(2860)
+ positve = new LauResonanceInfo( "Ds*+_1(2860)",
+ 2.859,
+ 0.159,
+ 1,
+ 1,
+ LauBlattWeisskopfFactor::StrangeCharm );
+ negatve = positve->createChargeConjugate();
+ resInfo_.push_back( positve );
+ resInfo_.push_back( negatve );
+ // Ds3*(2860)
+ positve = new LauResonanceInfo( "Ds*+_3(2860)",
+ 2.860,
+ 0.053,
+ 3,
+ 1,
+ LauBlattWeisskopfFactor::StrangeCharm );
+ negatve = positve->createChargeConjugate();
+ resInfo_.push_back( positve );
+ resInfo_.push_back( negatve );
+
+ // excited bottom states name, mass, width, spin, charge, BW category, BW radius parameter (defaults to 4.0)
+ // B*
+ neutral = new LauResonanceInfo( "B*0", 5.3247, 0.00, 1, 0, LauBlattWeisskopfFactor::Beauty, 6.0 );
+ positve = new LauResonanceInfo( "B*+", 5.3247, 0.00, 1, 1, LauBlattWeisskopfFactor::Beauty, 6.0 );
+ negatve = positve->createChargeConjugate();
+ resInfo_.push_back( neutral );
+ resInfo_.push_back( positve );
+ resInfo_.push_back( negatve );
+
+ // excited strange bottom name, mass, width, spin, charge, BW category, BW radius parameter (defaults to 4.0)
+ // Bs*
+ neutral =
+ new LauResonanceInfo( "Bs*0", 5.4154, 0.00, 1, 0, LauBlattWeisskopfFactor::StrangeBeauty, 6.0 );
+ resInfo_.push_back( neutral );
+
+ // nonresonant models name, mass, width, spin, charge, BW category, BW radius parameter (defaults to 4.0)
+ // Phase-space nonresonant model
+ neutral = new LauResonanceInfo( "NonReson", 0.0, 0.0, 0, 0, LauBlattWeisskopfFactor::Light );
+ resInfo_.push_back( neutral );
+ // Theory-based nonresonant model
+ neutral = new LauResonanceInfo( "NRModel", 0.0, 0.0, 0, 0, LauBlattWeisskopfFactor::Light );
+ resInfo_.push_back( neutral );
+ // Belle nonresonant models
+ neutral = new LauResonanceInfo( "BelleSymNR", 0.0, 0.0, 0, 0, LauBlattWeisskopfFactor::Light );
+ resInfo_.push_back( neutral );
+ neutral = new LauResonanceInfo( "BelleNR", 0.0, 0.0, 0, 0, LauBlattWeisskopfFactor::Light );
+ resInfo_.push_back( neutral );
+ positve = new LauResonanceInfo( "BelleNR+", 0.0, 0.0, 0, 1, LauBlattWeisskopfFactor::Light );
+ negatve = positve->createChargeConjugate();
+ resInfo_.push_back( positve );
+ resInfo_.push_back( negatve );
+ neutral = new LauResonanceInfo( "BelleNR_Swave", 0.0, 0.0, 0, 0, LauBlattWeisskopfFactor::Light );
+ resInfo_.push_back( neutral );
+ positve = new LauResonanceInfo( "BelleNR_Swave+", 0.0, 0.0, 0, 1, LauBlattWeisskopfFactor::Light );
+ negatve = positve->createChargeConjugate();
+ resInfo_.push_back( positve );
+ resInfo_.push_back( negatve );
+ neutral = new LauResonanceInfo( "BelleNR_Pwave", 0.0, 0.0, 1, 0, LauBlattWeisskopfFactor::Light );
+ resInfo_.push_back( neutral );
+ positve = new LauResonanceInfo( "BelleNR_Pwave+", 0.0, 0.0, 1, 1, LauBlattWeisskopfFactor::Light );
+ negatve = positve->createChargeConjugate();
+ resInfo_.push_back( positve );
+ resInfo_.push_back( negatve );
+ neutral = new LauResonanceInfo( "BelleNR_Dwave", 0.0, 0.0, 2, 0, LauBlattWeisskopfFactor::Light );
+ resInfo_.push_back( neutral );
+ positve = new LauResonanceInfo( "BelleNR_Dwave+", 0.0, 0.0, 2, 1, LauBlattWeisskopfFactor::Light );
+ negatve = positve->createChargeConjugate();
+ resInfo_.push_back( positve );
+ resInfo_.push_back( negatve );
+ neutral = new LauResonanceInfo( "BelleNR_Fwave", 0.0, 0.0, 3, 0, LauBlattWeisskopfFactor::Light );
+ resInfo_.push_back( neutral );
+ positve = new LauResonanceInfo( "BelleNR_Fwave+", 0.0, 0.0, 3, 1, LauBlattWeisskopfFactor::Light );
+ negatve = positve->createChargeConjugate();
+ resInfo_.push_back( positve );
+ resInfo_.push_back( negatve );
+ // Taylor expansion nonresonant model
+ neutral = new LauResonanceInfo( "NRTaylor", 0.0, 0.0, 0, 0, LauBlattWeisskopfFactor::Light );
+ resInfo_.push_back( neutral );
+ // Polynomial nonresonant models
+ neutral = new LauResonanceInfo( "PolNR_S0", 0.0, 0.0, 0, 0, LauBlattWeisskopfFactor::Light );
+ resInfo_.push_back( neutral );
+ neutral = new LauResonanceInfo( "PolNR_S1", 0.0, 0.0, 0, 0, LauBlattWeisskopfFactor::Light );
+ resInfo_.push_back( neutral );
+ neutral = new LauResonanceInfo( "PolNR_S2", 0.0, 0.0, 0, 0, LauBlattWeisskopfFactor::Light );
+ resInfo_.push_back( neutral );
+ neutral = new LauResonanceInfo( "PolNR_P0", 0.0, 0.0, 1, 0, LauBlattWeisskopfFactor::Light );
+ resInfo_.push_back( neutral );
+ neutral = new LauResonanceInfo( "PolNR_P1", 0.0, 0.0, 1, 0, LauBlattWeisskopfFactor::Light );
+ resInfo_.push_back( neutral );
+ neutral = new LauResonanceInfo( "PolNR_P2", 0.0, 0.0, 1, 0, LauBlattWeisskopfFactor::Light );
+ resInfo_.push_back( neutral );
+
+ // Fake resonances for S-Wave splines
+ neutral = new LauResonanceInfo( "Spline_S0", 0.0, 0.0, 0, 0, LauBlattWeisskopfFactor::Light );
+ resInfo_.push_back( neutral );
+ neutral = new LauResonanceInfo( "Spline_S0_Bar", 0.0, 0.0, 0, 0, LauBlattWeisskopfFactor::Light );
+ resInfo_.push_back( neutral );
+
+ // Polar Form Factor nonresonant model
+ neutral = new LauResonanceInfo( "PolarFFSymNR", 0.0, 0.0, 0, 0, LauBlattWeisskopfFactor::Light );
+ resInfo_.push_back( neutral );
+ neutral = new LauResonanceInfo( "PolarFFNR", 0.0, 0.0, 0, 0, LauBlattWeisskopfFactor::Light );
+ resInfo_.push_back( neutral );
+
+ // PiPi-KK Inelastic Scattering
+ neutral = new LauResonanceInfo( "Rescattering", 0.0, 0.0, 0, 0, LauBlattWeisskopfFactor::Light );
+ resInfo_.push_back( neutral );
+
+ nResDefMax_ = resInfo_.size();
}
-void LauResonanceMaker::setBWType(const LauBlattWeisskopfFactor::BarrierType bwType)
+void LauResonanceMaker::setBWType( const LauBlattWeisskopfFactor::BarrierType bwType )
{
- // Check whether any BW factors have been created and bail out if so
- if ( ! bwIndepFactors_.empty() ) {
- std::cerr << "ERROR in LauResonanceMaker::setBWType : some barrier factors have already been created - cannot change the barrier type now!" << std::endl;
- return;
- }
- for ( BWFactorCategoryMap::const_iterator iter = bwFactors_.begin(); iter != bwFactors_.end(); ++iter ) {
- if ( iter->second.bwFactor_ != 0 ) {
- std::cerr << "ERROR in LauResonanceMaker::setBWType : some barrier factors have already been created - cannot change the barrier type now!" << std::endl;
- return;
- }
- }
-
- bwBarrierType_ = bwType;
+ // Check whether any BW factors have been created and bail out if so
+ if ( ! bwIndepFactors_.empty() ) {
+ std::cerr << "ERROR in LauResonanceMaker::setBWType : some barrier factors have already been created - cannot change the barrier type now!"
+ << std::endl;
+ return;
+ }
+ for ( BWFactorCategoryMap::const_iterator iter = bwFactors_.begin(); iter != bwFactors_.end();
+ ++iter ) {
+ if ( iter->second.bwFactor_ != 0 ) {
+ std::cerr << "ERROR in LauResonanceMaker::setBWType : some barrier factors have already been created - cannot change the barrier type now!"
+ << std::endl;
+ return;
+ }
+ }
+
+ bwBarrierType_ = bwType;
}
-void LauResonanceMaker::setBWBachelorRestFrame(const LauBlattWeisskopfFactor::RestFrame restFrame)
+void LauResonanceMaker::setBWBachelorRestFrame( const LauBlattWeisskopfFactor::RestFrame restFrame )
{
- // Check whether any BW factors have been created and bail out if so
- if ( ! bwIndepFactors_.empty() ) {
- std::cerr << "ERROR in LauResonanceMaker::setBWBachelorRestFrame : some barrier factors have already been created - cannot change the rest frame now!" << std::endl;
- return;
- }
- for ( BWFactorCategoryMap::const_iterator iter = bwFactors_.begin(); iter != bwFactors_.end(); ++iter ) {
- if ( iter->second.bwFactor_ != 0 ) {
- std::cerr << "ERROR in LauResonanceMaker::setBWBachelorRestFrame : some barrier factors have already been created - cannot change the rest frame now!" << std::endl;
- return;
- }
- }
-
- bwRestFrame_ = restFrame;
+ // Check whether any BW factors have been created and bail out if so
+ if ( ! bwIndepFactors_.empty() ) {
+ std::cerr << "ERROR in LauResonanceMaker::setBWBachelorRestFrame : some barrier factors have already been created - cannot change the rest frame now!"
+ << std::endl;
+ return;
+ }
+ for ( BWFactorCategoryMap::const_iterator iter = bwFactors_.begin(); iter != bwFactors_.end();
+ ++iter ) {
+ if ( iter->second.bwFactor_ != 0 ) {
+ std::cerr << "ERROR in LauResonanceMaker::setBWBachelorRestFrame : some barrier factors have already been created - cannot change the rest frame now!"
+ << std::endl;
+ return;
+ }
+ }
+
+ bwRestFrame_ = restFrame;
}
-void LauResonanceMaker::setSpinFormalism(const LauAbsResonance::LauSpinType spinType)
+void LauResonanceMaker::setSpinFormalism( const LauAbsResonance::LauSpinType spinType )
{
- if ( summaryPrinted_ ) {
- std::cerr << "ERROR in LauResonanceMaker::setSpinFormalism : cannot redefine the spin formalism after creating one or more resonances" << std::endl;
- return;
- }
- spinFormalism_ = spinType;
+ if ( summaryPrinted_ ) {
+ std::cerr << "ERROR in LauResonanceMaker::setSpinFormalism : cannot redefine the spin formalism after creating one or more resonances"
+ << std::endl;
+ return;
+ }
+ spinFormalism_ = spinType;
}
-void LauResonanceMaker::setDefaultBWRadius(const LauBlattWeisskopfFactor::BlattWeisskopfCategory bwCategory, const Double_t bwRadius)
+void LauResonanceMaker::setDefaultBWRadius(
+ const LauBlattWeisskopfFactor::BlattWeisskopfCategory bwCategory,
+ const Double_t bwRadius )
{
- if ( bwCategory == LauBlattWeisskopfFactor::Default || bwCategory == LauBlattWeisskopfFactor::Indep ) {
- std::cerr << "WARNING in LauResonanceMaker::setDefaultBWRadius : cannot set radius values for Default or Indep categories" << std::endl;
- return;
- }
-
- // Check if we have an information object for this category
- BWFactorCategoryMap::iterator factor_iter = bwFactors_.find( bwCategory );
- if ( factor_iter != bwFactors_.end() ) {
- // If so, we can set the value in the information object
- BlattWeisskopfCategoryInfo& categoryInfo = factor_iter->second;
- categoryInfo.defaultRadius_ = bwRadius;
-
- // Then we can check if a LauBlattWeisskopfFactor object has been created for this category
- LauBlattWeisskopfFactor* bwFactor = categoryInfo.bwFactor_;
- if ( bwFactor != 0 ) {
- // If it has then we can also set its radius value directly
- LauParameter* radius = bwFactor->getRadiusParameter();
- radius->value(bwRadius);
- radius->initValue(bwRadius);
- radius->genValue(bwRadius);
- }
- } else {
- // If not then we just store the value to be used later
- BlattWeisskopfCategoryInfo& categoryInfo = bwFactors_[bwCategory];
- categoryInfo.bwFactor_ = 0;
- categoryInfo.defaultRadius_ = bwRadius;
- categoryInfo.radiusFixed_ = kTRUE;
- }
+ if ( bwCategory == LauBlattWeisskopfFactor::Default ||
+ bwCategory == LauBlattWeisskopfFactor::Indep ) {
+ std::cerr << "WARNING in LauResonanceMaker::setDefaultBWRadius : cannot set radius values for Default or Indep categories"
+ << std::endl;
+ return;
+ }
+
+ // Check if we have an information object for this category
+ BWFactorCategoryMap::iterator factor_iter = bwFactors_.find( bwCategory );
+ if ( factor_iter != bwFactors_.end() ) {
+ // If so, we can set the value in the information object
+ BlattWeisskopfCategoryInfo& categoryInfo = factor_iter->second;
+ categoryInfo.defaultRadius_ = bwRadius;
+
+ // Then we can check if a LauBlattWeisskopfFactor object has been created for this category
+ LauBlattWeisskopfFactor* bwFactor = categoryInfo.bwFactor_;
+ if ( bwFactor != 0 ) {
+ // If it has then we can also set its radius value directly
+ LauParameter* radius = bwFactor->getRadiusParameter();
+ radius->value( bwRadius );
+ radius->initValue( bwRadius );
+ radius->genValue( bwRadius );
+ }
+ } else {
+ // If not then we just store the value to be used later
+ BlattWeisskopfCategoryInfo& categoryInfo = bwFactors_[bwCategory];
+ categoryInfo.bwFactor_ = 0;
+ categoryInfo.defaultRadius_ = bwRadius;
+ categoryInfo.radiusFixed_ = kTRUE;
+ }
}
-void LauResonanceMaker::fixBWRadius(const LauBlattWeisskopfFactor::BlattWeisskopfCategory bwCategory, const Bool_t fixRadius)
+void LauResonanceMaker::fixBWRadius( const LauBlattWeisskopfFactor::BlattWeisskopfCategory bwCategory,
+ const Bool_t fixRadius )
{
- if ( bwCategory == LauBlattWeisskopfFactor::Default || bwCategory == LauBlattWeisskopfFactor::Indep ) {
- std::cerr << "WARNING in LauResonanceMaker::fixBWRadius : cannot fix/float radius values for Default or Indep categories" << std::endl;
- return;
- }
-
- // Check if we have an information object for this category
- BWFactorCategoryMap::iterator factor_iter = bwFactors_.find( bwCategory );
- if ( factor_iter != bwFactors_.end() ) {
- // If so, we can set the value in the information object
- BlattWeisskopfCategoryInfo& categoryInfo = factor_iter->second;
- categoryInfo.radiusFixed_ = fixRadius;
-
- // Then we can check if a LauBlattWeisskopfFactor object has been created for this category
- LauBlattWeisskopfFactor* bwFactor = categoryInfo.bwFactor_;
- if ( bwFactor != 0 ) {
- // If it has then we can also fix/float its radius value directly
- LauParameter* radius = bwFactor->getRadiusParameter();
- radius->fixed(fixRadius);
- }
- } else {
- // If not then we just store the value to be used later
- BlattWeisskopfCategoryInfo& categoryInfo = bwFactors_[bwCategory];
- categoryInfo.bwFactor_ = 0;
- categoryInfo.defaultRadius_ = -1.0;
- categoryInfo.radiusFixed_ = fixRadius;
- }
+ if ( bwCategory == LauBlattWeisskopfFactor::Default ||
+ bwCategory == LauBlattWeisskopfFactor::Indep ) {
+ std::cerr << "WARNING in LauResonanceMaker::fixBWRadius : cannot fix/float radius values for Default or Indep categories"
+ << std::endl;
+ return;
+ }
+
+ // Check if we have an information object for this category
+ BWFactorCategoryMap::iterator factor_iter = bwFactors_.find( bwCategory );
+ if ( factor_iter != bwFactors_.end() ) {
+ // If so, we can set the value in the information object
+ BlattWeisskopfCategoryInfo& categoryInfo = factor_iter->second;
+ categoryInfo.radiusFixed_ = fixRadius;
+
+ // Then we can check if a LauBlattWeisskopfFactor object has been created for this category
+ LauBlattWeisskopfFactor* bwFactor = categoryInfo.bwFactor_;
+ if ( bwFactor != 0 ) {
+ // If it has then we can also fix/float its radius value directly
+ LauParameter* radius = bwFactor->getRadiusParameter();
+ radius->fixed( fixRadius );
+ }
+ } else {
+ // If not then we just store the value to be used later
+ BlattWeisskopfCategoryInfo& categoryInfo = bwFactors_[bwCategory];
+ categoryInfo.bwFactor_ = 0;
+ categoryInfo.defaultRadius_ = -1.0;
+ categoryInfo.radiusFixed_ = fixRadius;
+ }
}
-LauBlattWeisskopfFactor* LauResonanceMaker::getParentBWFactor(Int_t resSpin, LauBlattWeisskopfFactor::BarrierType barrierType)
+LauBlattWeisskopfFactor* LauResonanceMaker::getParentBWFactor(
+ Int_t resSpin,
+ LauBlattWeisskopfFactor::BarrierType barrierType )
{
- LauBlattWeisskopfFactor* bwFactor(0);
-
- // Look up the category in the category information map
- BWFactorCategoryMap::iterator factor_iter = bwFactors_.find( LauBlattWeisskopfFactor::Parent );
-
- if ( factor_iter == bwFactors_.end() ) {
- // If the category is currently undefined we need to create it
- bwFactor = new LauBlattWeisskopfFactor( resSpin, 4.0, bwBarrierType_, bwRestFrame_, LauBlattWeisskopfFactor::Parent );
- std::cerr<<"WARNING in LauResonanceMaker::getParentBWFactor : Default radius 4.0 set for Blatt-Weisskopf factor category: Parent"<<std::endl;
-
- BlattWeisskopfCategoryInfo& categoryInfo = bwFactors_[LauBlattWeisskopfFactor::Parent];
- categoryInfo.bwFactor_ = bwFactor;
- categoryInfo.defaultRadius_ = bwFactor->getRadiusParameter()->value();
- categoryInfo.radiusFixed_ = kTRUE;
- } else {
- // If it exists, we can check if the factor object has been created
- BlattWeisskopfCategoryInfo& categoryInfo = factor_iter->second;
-
- if ( categoryInfo.bwFactor_ != 0 ) {
- // If so, simply clone it
- bwFactor = categoryInfo.bwFactor_->createClone( resSpin, barrierType );
- } else {
- // Otherwise we need to create it, using the default value if it has been set
- if ( categoryInfo.defaultRadius_ >= 0.0 ) {
- bwFactor = new LauBlattWeisskopfFactor( resSpin, categoryInfo.defaultRadius_, bwBarrierType_, bwRestFrame_, LauBlattWeisskopfFactor::Parent );
- } else {
- bwFactor = new LauBlattWeisskopfFactor( resSpin, 4.0, bwBarrierType_, bwRestFrame_, LauBlattWeisskopfFactor::Parent );
- std::cerr<<"WARNING in LauResonanceMaker::getParentBWFactor : Default radius 4.0 set for Blatt-Weisskopf factor category: Parent"<<std::endl;
- }
- categoryInfo.bwFactor_ = bwFactor;
-
- // Set whether the radius should be fixed/floated
- LauParameter* radius = bwFactor->getRadiusParameter();
- radius->fixed( categoryInfo.radiusFixed_ );
- }
- }
-
- return bwFactor;
+ LauBlattWeisskopfFactor* bwFactor( 0 );
+
+ // Look up the category in the category information map
+ BWFactorCategoryMap::iterator factor_iter = bwFactors_.find( LauBlattWeisskopfFactor::Parent );
+
+ if ( factor_iter == bwFactors_.end() ) {
+ // If the category is currently undefined we need to create it
+ bwFactor = new LauBlattWeisskopfFactor( resSpin,
+ 4.0,
+ bwBarrierType_,
+ bwRestFrame_,
+ LauBlattWeisskopfFactor::Parent );
+ std::cerr << "WARNING in LauResonanceMaker::getParentBWFactor : Default radius 4.0 set for Blatt-Weisskopf factor category: Parent"
+ << std::endl;
+
+ BlattWeisskopfCategoryInfo& categoryInfo = bwFactors_[LauBlattWeisskopfFactor::Parent];
+ categoryInfo.bwFactor_ = bwFactor;
+ categoryInfo.defaultRadius_ = bwFactor->getRadiusParameter()->value();
+ categoryInfo.radiusFixed_ = kTRUE;
+ } else {
+ // If it exists, we can check if the factor object has been created
+ BlattWeisskopfCategoryInfo& categoryInfo = factor_iter->second;
+
+ if ( categoryInfo.bwFactor_ != 0 ) {
+ // If so, simply clone it
+ bwFactor = categoryInfo.bwFactor_->createClone( resSpin, barrierType );
+ } else {
+ // Otherwise we need to create it, using the default value if it has been set
+ if ( categoryInfo.defaultRadius_ >= 0.0 ) {
+ bwFactor = new LauBlattWeisskopfFactor( resSpin,
+ categoryInfo.defaultRadius_,
+ bwBarrierType_,
+ bwRestFrame_,
+ LauBlattWeisskopfFactor::Parent );
+ } else {
+ bwFactor = new LauBlattWeisskopfFactor( resSpin,
+ 4.0,
+ bwBarrierType_,
+ bwRestFrame_,
+ LauBlattWeisskopfFactor::Parent );
+ std::cerr << "WARNING in LauResonanceMaker::getParentBWFactor : Default radius 4.0 set for Blatt-Weisskopf factor category: Parent"
+ << std::endl;
+ }
+ categoryInfo.bwFactor_ = bwFactor;
+
+ // Set whether the radius should be fixed/floated
+ LauParameter* radius = bwFactor->getRadiusParameter();
+ radius->fixed( categoryInfo.radiusFixed_ );
+ }
+ }
+
+ return bwFactor;
}
-LauBlattWeisskopfFactor* LauResonanceMaker::getBWFactor( const LauBlattWeisskopfFactor::BlattWeisskopfCategory bwCategory, const LauResonanceInfo* resInfo )
+LauBlattWeisskopfFactor* LauResonanceMaker::getBWFactor(
+ const LauBlattWeisskopfFactor::BlattWeisskopfCategory bwCategory,
+ const LauResonanceInfo* resInfo )
{
- LauBlattWeisskopfFactor* bwFactor(0);
-
- // If this is an independent factor, create it and add it to the list of independent factors, then return it
- if ( bwCategory == LauBlattWeisskopfFactor::Indep ) {
- bwFactor = new LauBlattWeisskopfFactor( *resInfo, bwBarrierType_, bwRestFrame_, bwCategory );
- bwIndepFactors_.push_back(bwFactor);
- return bwFactor;
- }
-
- // Otherwise, look up the category in the category information map
- BWFactorCategoryMap::iterator factor_iter = bwFactors_.find( bwCategory );
-
- if ( factor_iter == bwFactors_.end() ) {
- // If the category is currently undefined we need to create it
- bwFactor = new LauBlattWeisskopfFactor( *resInfo, bwBarrierType_, bwRestFrame_, bwCategory );
-
- BlattWeisskopfCategoryInfo& categoryInfo = bwFactors_[bwCategory];
- categoryInfo.bwFactor_ = bwFactor;
- categoryInfo.defaultRadius_ = bwFactor->getRadiusParameter()->value();
- categoryInfo.radiusFixed_ = kTRUE;
- } else {
- // If it exists, we can check if the factor object has been created
- BlattWeisskopfCategoryInfo& categoryInfo = factor_iter->second;
-
- if ( categoryInfo.bwFactor_ != 0 ) {
- // If so, simply clone it
- const UInt_t resSpin = resInfo->getSpin();
- bwFactor = categoryInfo.bwFactor_->createClone( resSpin, categoryInfo.bwFactor_->getBarrierType() );
- } else {
- // Otherwise we need to create it, using the default value if it has been set
- if ( categoryInfo.defaultRadius_ >= 0.0 ) {
- bwFactor = new LauBlattWeisskopfFactor( *resInfo, categoryInfo.defaultRadius_, bwBarrierType_, bwRestFrame_, bwCategory );
- } else {
- bwFactor = new LauBlattWeisskopfFactor( *resInfo, bwBarrierType_, bwRestFrame_, bwCategory );
- }
- categoryInfo.bwFactor_ = bwFactor;
-
- // Set whether the radius should be fixed/floated
- LauParameter* radius = bwFactor->getRadiusParameter();
- radius->fixed( categoryInfo.radiusFixed_ );
- }
- }
-
- return bwFactor;
+ LauBlattWeisskopfFactor* bwFactor( 0 );
+
+ // If this is an independent factor, create it and add it to the list of independent factors, then return it
+ if ( bwCategory == LauBlattWeisskopfFactor::Indep ) {
+ bwFactor = new LauBlattWeisskopfFactor( *resInfo, bwBarrierType_, bwRestFrame_, bwCategory );
+ bwIndepFactors_.push_back( bwFactor );
+ return bwFactor;
+ }
+
+ // Otherwise, look up the category in the category information map
+ BWFactorCategoryMap::iterator factor_iter = bwFactors_.find( bwCategory );
+
+ if ( factor_iter == bwFactors_.end() ) {
+ // If the category is currently undefined we need to create it
+ bwFactor = new LauBlattWeisskopfFactor( *resInfo, bwBarrierType_, bwRestFrame_, bwCategory );
+
+ BlattWeisskopfCategoryInfo& categoryInfo = bwFactors_[bwCategory];
+ categoryInfo.bwFactor_ = bwFactor;
+ categoryInfo.defaultRadius_ = bwFactor->getRadiusParameter()->value();
+ categoryInfo.radiusFixed_ = kTRUE;
+ } else {
+ // If it exists, we can check if the factor object has been created
+ BlattWeisskopfCategoryInfo& categoryInfo = factor_iter->second;
+
+ if ( categoryInfo.bwFactor_ != 0 ) {
+ // If so, simply clone it
+ const UInt_t resSpin = resInfo->getSpin();
+ bwFactor = categoryInfo.bwFactor_->createClone( resSpin,
+ categoryInfo.bwFactor_->getBarrierType() );
+ } else {
+ // Otherwise we need to create it, using the default value if it has been set
+ if ( categoryInfo.defaultRadius_ >= 0.0 ) {
+ bwFactor = new LauBlattWeisskopfFactor( *resInfo,
+ categoryInfo.defaultRadius_,
+ bwBarrierType_,
+ bwRestFrame_,
+ bwCategory );
+ } else {
+ bwFactor =
+ new LauBlattWeisskopfFactor( *resInfo, bwBarrierType_, bwRestFrame_, bwCategory );
+ }
+ categoryInfo.bwFactor_ = bwFactor;
+
+ // Set whether the radius should be fixed/floated
+ LauParameter* radius = bwFactor->getRadiusParameter();
+ radius->fixed( categoryInfo.radiusFixed_ );
+ }
+ }
+
+ return bwFactor;
}
-LauAbsResonance* LauResonanceMaker::getResonance(const LauDaughters* daughters, const TString& resName, const Int_t resPairAmpInt, const LauAbsResonance::LauResonanceModel resType, const LauBlattWeisskopfFactor::BlattWeisskopfCategory bwCategory)
+LauAbsResonance* LauResonanceMaker::getResonance(
+ const LauDaughters* daughters,
+ const TString& resName,
+ const Int_t resPairAmpInt,
+ const LauAbsResonance::LauResonanceModel resType,
+ const LauBlattWeisskopfFactor::BlattWeisskopfCategory bwCategory )
{
- // Routine to return the appropriate LauAbsResonance object given the resonance
- // name (resName), which daughter is the bachelor track (resPairAmpInt = 1,2 or 3),
- // and the resonance type ("BW" = Breit-Wigner, "Flatte" = Flatte distribution).
-
- // If this is the first resonance we are making, first print a summary of the formalism
- if ( ! summaryPrinted_ ) {
- std::cout << "INFO in LauResonanceMaker::getResonance : Freezing amplitude formalism:" << std::endl;
- switch ( spinFormalism_ ) {
- case LauAbsResonance::Zemach_P :
- std::cout << " : Spin factors use Zemach spin tensors, with bachelor momentum in resonance rest frame" << std::endl;
- break;
- case LauAbsResonance::Zemach_Pstar :
- std::cout << " : Spin factors use Zemach spin tensors, with bachelor momentum in parent rest frame" << std::endl;
- break;
- case LauAbsResonance::Covariant :
- std::cout << " : Spin factors use Covariant spin tensors" << std::endl;
- break;
- case LauAbsResonance::Legendre :
- std::cout << " : Spin factors are just Legendre polynomials" << std::endl;
- break;
- }
- switch ( bwBarrierType_ ) {
- case LauBlattWeisskopfFactor::BWBarrier :
- std::cout << " : Blatt-Weisskopf barrier factors are the 'non-primed' form" << std::endl;
- break;
- case LauBlattWeisskopfFactor::BWPrimeBarrier :
- std::cout << " : Blatt-Weisskopf barrier factors are the 'primed' form" << std::endl;
- break;
- case LauBlattWeisskopfFactor::ExpBarrier :
- std::cout << " : Blatt-Weisskopf barrier factors are the exponential form" << std::endl;
- break;
- }
- switch ( bwRestFrame_ ) {
- case LauBlattWeisskopfFactor::ParentFrame :
- std::cout << " : Blatt-Weisskopf barrier factors use bachelor momentum in parent rest frame" << std::endl;
- break;
- case LauBlattWeisskopfFactor::ResonanceFrame :
- std::cout << " : Blatt-Weisskopf barrier factors use bachelor momentum in resonance rest frame" << std::endl;
- break;
- case LauBlattWeisskopfFactor::Covariant :
- std::cout << " : Blatt-Weisskopf barrier factors use covariant expression" << std::endl;
- break;
- }
-
- summaryPrinted_ = kTRUE;
- }
-
- // Loop over all possible resonance states we have defined in
- // createResonanceVector() until we get a match with the name of the resonance
-
- LauResonanceInfo* resInfo(0);
- for (std::vector<LauResonanceInfo*>::const_iterator iter=resInfo_.begin(); iter!=resInfo_.end(); ++iter) {
-
- if (resName == (*iter)->getName()) {
- // We have recognised the resonance name.
- std::cout<<"INFO in LauResonanceMaker::getResonance : Creating resonance: "<<resName<<std::endl;
-
- resInfo = (*iter);
-
- // stop looping
- break;
- }
- }
-
- // if we couldn't find the right resonance then we should return a null pointer
- if ( resInfo == 0 ) {
- std::cout<<"ERROR in LauResonanceMaker::getResonance : Unable to locate resonance info for: "<<resName<<std::endl;
- return 0;
- }
-
- // Now construct the resonance using the specified type
- LauAbsResonance* theResonance(0);
- switch ( resType ) {
-
- case LauAbsResonance::BW :
- // Simple non-relativistic Breit-Wigner
- std::cout<<" : Using simple Breit-Wigner lineshape. "<<std::endl;
- theResonance = new LauBreitWignerRes(resInfo, resPairAmpInt, daughters);
- break;
-
- case LauAbsResonance::RelBW :
- {
- // Relativistic Breit-Wigner with Blatt-Weisskopf factors.
- std::cout<<" : Using relativistic Breit-Wigner lineshape. "<<std::endl;
- theResonance = new LauRelBreitWignerRes(resInfo, resPairAmpInt, daughters);
- LauBlattWeisskopfFactor::BlattWeisskopfCategory parCategory = LauBlattWeisskopfFactor::Parent;
- LauBlattWeisskopfFactor::BlattWeisskopfCategory resCategory = bwCategory;
- if ( bwCategory == LauBlattWeisskopfFactor::Default ) {
- resCategory = resInfo->getBWCategory();
- }
- LauBlattWeisskopfFactor* resBWFactor = this->getBWFactor( resCategory, resInfo );
- LauBlattWeisskopfFactor* parBWFactor = this->getBWFactor( parCategory, resInfo );
- theResonance->setBarrierRadii( resBWFactor, parBWFactor );
- break;
- }
-
- case LauAbsResonance::GS :
- {
- // Gounaris-Sakurai function to try and model the rho(770) better
- std::cout<<" : Using Gounaris-Sakurai lineshape. "<<std::endl;
- theResonance = new LauGounarisSakuraiRes(resInfo, resPairAmpInt, daughters);
- LauBlattWeisskopfFactor::BlattWeisskopfCategory parCategory = LauBlattWeisskopfFactor::Parent;
- LauBlattWeisskopfFactor::BlattWeisskopfCategory resCategory = bwCategory;
- if ( bwCategory == LauBlattWeisskopfFactor::Default ) {
- resCategory = resInfo->getBWCategory();
- }
- LauBlattWeisskopfFactor* resBWFactor = this->getBWFactor( resCategory, resInfo );
- LauBlattWeisskopfFactor* parBWFactor = this->getBWFactor( parCategory, resInfo );
- theResonance->setBarrierRadii( resBWFactor, parBWFactor );
- break;
- }
-
- case LauAbsResonance::Flatte :
- // Flatte distribution - coupled channel Breit-Wigner
- std::cout<<" : Using Flatte lineshape. "<<std::endl;
- theResonance = new LauFlatteRes(resInfo, resPairAmpInt, daughters);
- break;
-
- case LauAbsResonance::Sigma :
- // Sigma model - should only be used for the pi-pi system
- std::cout<<" : Using Sigma lineshape. "<<std::endl;
- theResonance = new LauSigmaRes(resInfo, resPairAmpInt, daughters);
- break;
-
- case LauAbsResonance::Kappa :
- // Kappa model - should only be used for the K-pi system
- std::cout<<" : Using Kappa lineshape. "<<std::endl;
- theResonance = new LauKappaRes(resInfo, resPairAmpInt, daughters);
- break;
-
- case LauAbsResonance::Dabba :
- // Dabba model - should only be used for the D-pi system
- std::cout<<" : Using Dabba lineshape. "<<std::endl;
- theResonance = new LauDabbaRes(resInfo, resPairAmpInt, daughters);
- break;
-
- case LauAbsResonance::LASS :
- // LASS function to try and model the K-pi S-wave better
- std::cout<<" : Using LASS lineshape. "<<std::endl;
- theResonance = new LauLASSRes(resInfo, resPairAmpInt, daughters);
- break;
-
- case LauAbsResonance::LASS_BW :
- // LASS function to try and model the K-pi S-wave better
- std::cout<<" : Using LASS lineshape (resonant part only). "<<std::endl;
- theResonance = new LauLASSBWRes(resInfo, resPairAmpInt, daughters);
- break;
-
- case LauAbsResonance::LASS_NR :
- // LASS function to try and model the K-pi S-wave better
- std::cout<<" : Using LASS lineshape (nonresonant part only). "<<std::endl;
- theResonance = new LauLASSNRRes(resInfo, resPairAmpInt, daughters);
- break;
-
- case LauAbsResonance::EFKLLM :
- // EFKLLM form-factor description of the K-pi S-wave
- std::cout<<" : Using EFKLLM lineshape. "<<std::endl;
- theResonance = new LauEFKLLMRes(resInfo, resPairAmpInt, daughters);
- break;
-
- case LauAbsResonance::KMatrix :
- // K-matrix description
- std::cerr<<"ERROR in LauResonanceMaker::getResonance : K-matrix type specified, which should be separately handled."<<std::endl;
- break;
-
- case LauAbsResonance::FlatNR :
- // uniform NR amplitude - arguments are there to preserve the interface
- std::cout<<" : Using uniform NR lineshape. "<<std::endl;
- // we override resPairAmpInt here
- theResonance = new LauFlatNR(resInfo, 0, daughters);
- break;
-
- case LauAbsResonance::NRModel :
- // NR amplitude model - arguments are there to preserve the interface
- std::cout<<" : Using NR-model lineshape. "<<std::endl;
- // we override resPairAmpInt here
- theResonance = new LauNRAmplitude(resInfo, 0, daughters);
- break;
-
- case LauAbsResonance::BelleNR :
- case LauAbsResonance::PowerLawNR :
- // Belle NR amplitude model - arguments are there to preserve the interface
- std::cout<<" : Using Belle NR lineshape. "<<std::endl;
- theResonance = new LauBelleNR(resInfo, resType, resPairAmpInt, daughters);
- break;
-
- case LauAbsResonance::BelleSymNR :
- case LauAbsResonance::BelleSymNRNoInter :
- case LauAbsResonance::TaylorNR :
- // Belle NR amplitude model - arguments are there to preserve the interface
- std::cout<<" : Using Belle symmetric NR lineshape. "<<std::endl;
- theResonance = new LauBelleSymNR(resInfo, resType, resPairAmpInt, daughters);
- break;
-
- case LauAbsResonance::PolNR :
- // Polynomial NR amplitude model - arguments are there to preserve the interface
- std::cout<<" : Using polynomial NR lineshape. "<<std::endl;
- theResonance = new LauPolNR(resInfo, resPairAmpInt, daughters);
- break;
-
- case LauAbsResonance::Pole :
- // Scalar pole model
- std::cout<<" : Using the scalar Pole lineshape.. "<<std::endl;
- theResonance = new LauPoleRes(resInfo, resPairAmpInt, daughters);
- break;
-
- case LauAbsResonance::PolarFFNR :
- // Polar Form Factor NR amplitude model - arguments are there to preserve the interface
- std::cout<<" : Using Polar FormFactor NR lineshape.. "<<std::endl;
- theResonance = new LauPolarFormFactorNR(resInfo, resType, resPairAmpInt, daughters);
- break;
-
- case LauAbsResonance::PolarFFSymNR :
- case LauAbsResonance::PolarFFSymNRNoInter :
- // Polar Form Factor NR amplitude model - arguments are there to preserve the interface
- std::cout<<" : Using Polar FormFactor Symetric NR lineshape. "<<std::endl;
- theResonance = new LauPolarFormFactorSymNR(resInfo, resType, resPairAmpInt, daughters);
- break;
-
- case LauAbsResonance::Rescattering:
- case LauAbsResonance::RescatteringNoInter:
- // KKPiPi Inelastic Scattering amplitude - arguments are there to preserve the interface
- std::cout<<" : KKPiPi Inelastic Scattering amplitude lineshape. "<<std::endl;
- theResonance = new LauRescatteringRes(resInfo, resType, resPairAmpInt, daughters);
- break;
-
- case LauAbsResonance::Rescattering2:
- // KKPiPi Inelastic Scattering amplitude - arguments are there to preserve the interface
- std::cout<<" : KKPiPi Inelastic Scattering amplitude lineshape. "<<std::endl;
- theResonance = new LauRescattering2Res(resInfo, resPairAmpInt, daughters);
- break;
-
- case LauAbsResonance::MIPW_MagPhase :
- // Model independent partial wave
- std::cout<<" : Using model independent partial wave lineshape (magnitude and phase). "<<std::endl;
- theResonance = new LauModIndPartWaveMagPhase(resInfo, resPairAmpInt, daughters);
- break;
-
- case LauAbsResonance::MIPW_RealImag :
- // Model independent partial wave
- std::cout<<" : Using model independent partial wave lineshape (real and imaginary part). "<<std::endl;
- theResonance = new LauModIndPartWaveRealImag(resInfo, resPairAmpInt, daughters);
- break;
-
- case LauAbsResonance::GaussIncoh :
- // Incoherent Gaussian
- std::cout<<" : Using incoherent Gaussian lineshape. "<<std::endl;
- theResonance = new LauGaussIncohRes(resInfo, resPairAmpInt, daughters);
- break;
-
- case LauAbsResonance::RhoOmegaMix_GS :
- case LauAbsResonance::RhoOmegaMix_RBW :
- case LauAbsResonance::RhoOmegaMix_GS_1 :
- case LauAbsResonance::RhoOmegaMix_RBW_1 :
- // Rho-omega mass mixing model
- std::cout<<" : Using rho-omega mass mixing lineshape. "<<std::endl;
- theResonance = new LauRhoOmegaMix(resInfo, resType, resPairAmpInt, daughters);
- LauBlattWeisskopfFactor::BlattWeisskopfCategory parCategory = LauBlattWeisskopfFactor::Parent;
- LauBlattWeisskopfFactor::BlattWeisskopfCategory resCategory = bwCategory;
- if ( bwCategory == LauBlattWeisskopfFactor::Default ) {
- resCategory = resInfo->getBWCategory();
- }
- LauBlattWeisskopfFactor* resBWFactor = this->getBWFactor( resCategory, resInfo );
- LauBlattWeisskopfFactor* parBWFactor = this->getBWFactor( parCategory, resInfo );
- theResonance->setBarrierRadii( resBWFactor, parBWFactor );
- break;
-
- }
-
- // Set the spin formalism choice
- theResonance->setSpinType( spinFormalism_ );
-
- return theResonance;
+ // Routine to return the appropriate LauAbsResonance object given the resonance
+ // name (resName), which daughter is the bachelor track (resPairAmpInt = 1,2 or 3),
+ // and the resonance type ("BW" = Breit-Wigner, "Flatte" = Flatte distribution).
+
+ // If this is the first resonance we are making, first print a summary of the formalism
+ if ( ! summaryPrinted_ ) {
+ std::cout << "INFO in LauResonanceMaker::getResonance : Freezing amplitude formalism:"
+ << std::endl;
+ switch ( spinFormalism_ ) {
+ case LauAbsResonance::Zemach_P :
+ std::cout << " : Spin factors use Zemach spin tensors, with bachelor momentum in resonance rest frame"
+ << std::endl;
+ break;
+ case LauAbsResonance::Zemach_Pstar :
+ std::cout << " : Spin factors use Zemach spin tensors, with bachelor momentum in parent rest frame"
+ << std::endl;
+ break;
+ case LauAbsResonance::Covariant :
+ std::cout << " : Spin factors use Covariant spin tensors"
+ << std::endl;
+ break;
+ case LauAbsResonance::Legendre :
+ std::cout << " : Spin factors are just Legendre polynomials"
+ << std::endl;
+ break;
+ }
+ switch ( bwBarrierType_ ) {
+ case LauBlattWeisskopfFactor::BWBarrier :
+ std::cout << " : Blatt-Weisskopf barrier factors are the 'non-primed' form"
+ << std::endl;
+ break;
+ case LauBlattWeisskopfFactor::BWPrimeBarrier :
+ std::cout << " : Blatt-Weisskopf barrier factors are the 'primed' form"
+ << std::endl;
+ break;
+ case LauBlattWeisskopfFactor::ExpBarrier :
+ std::cout << " : Blatt-Weisskopf barrier factors are the exponential form"
+ << std::endl;
+ break;
+ }
+ switch ( bwRestFrame_ ) {
+ case LauBlattWeisskopfFactor::ParentFrame :
+ std::cout << " : Blatt-Weisskopf barrier factors use bachelor momentum in parent rest frame"
+ << std::endl;
+ break;
+ case LauBlattWeisskopfFactor::ResonanceFrame :
+ std::cout << " : Blatt-Weisskopf barrier factors use bachelor momentum in resonance rest frame"
+ << std::endl;
+ break;
+ case LauBlattWeisskopfFactor::Covariant :
+ std::cout << " : Blatt-Weisskopf barrier factors use covariant expression"
+ << std::endl;
+ break;
+ }
+
+ summaryPrinted_ = kTRUE;
+ }
+
+ // Loop over all possible resonance states we have defined in
+ // createResonanceVector() until we get a match with the name of the resonance
+
+ LauResonanceInfo* resInfo( 0 );
+ for ( std::vector<LauResonanceInfo*>::const_iterator iter = resInfo_.begin();
+ iter != resInfo_.end();
+ ++iter ) {
+
+ if ( resName == ( *iter )->getName() ) {
+ // We have recognised the resonance name.
+ std::cout << "INFO in LauResonanceMaker::getResonance : Creating resonance: " << resName
+ << std::endl;
+
+ resInfo = ( *iter );
+
+ // stop looping
+ break;
+ }
+ }
+
+ // if we couldn't find the right resonance then we should return a null pointer
+ if ( resInfo == 0 ) {
+ std::cout << "ERROR in LauResonanceMaker::getResonance : Unable to locate resonance info for: "
+ << resName << std::endl;
+ return 0;
+ }
+
+ // Now construct the resonance using the specified type
+ LauAbsResonance* theResonance( 0 );
+ switch ( resType ) {
+
+ case LauAbsResonance::BW :
+ // Simple non-relativistic Breit-Wigner
+ std::cout << " : Using simple Breit-Wigner lineshape. "
+ << std::endl;
+ theResonance = new LauBreitWignerRes( resInfo, resPairAmpInt, daughters );
+ break;
+
+ case LauAbsResonance::RelBW : {
+ // Relativistic Breit-Wigner with Blatt-Weisskopf factors.
+ std::cout << " : Using relativistic Breit-Wigner lineshape. "
+ << std::endl;
+ theResonance = new LauRelBreitWignerRes( resInfo, resPairAmpInt, daughters );
+ LauBlattWeisskopfFactor::BlattWeisskopfCategory parCategory =
+ LauBlattWeisskopfFactor::Parent;
+ LauBlattWeisskopfFactor::BlattWeisskopfCategory resCategory = bwCategory;
+ if ( bwCategory == LauBlattWeisskopfFactor::Default ) {
+ resCategory = resInfo->getBWCategory();
+ }
+ LauBlattWeisskopfFactor* resBWFactor = this->getBWFactor( resCategory, resInfo );
+ LauBlattWeisskopfFactor* parBWFactor = this->getBWFactor( parCategory, resInfo );
+ theResonance->setBarrierRadii( resBWFactor, parBWFactor );
+ break;
+ }
+
+ case LauAbsResonance::GS : {
+ // Gounaris-Sakurai function to try and model the rho(770) better
+ std::cout << " : Using Gounaris-Sakurai lineshape. "
+ << std::endl;
+ theResonance = new LauGounarisSakuraiRes( resInfo, resPairAmpInt, daughters );
+ LauBlattWeisskopfFactor::BlattWeisskopfCategory parCategory =
+ LauBlattWeisskopfFactor::Parent;
+ LauBlattWeisskopfFactor::BlattWeisskopfCategory resCategory = bwCategory;
+ if ( bwCategory == LauBlattWeisskopfFactor::Default ) {
+ resCategory = resInfo->getBWCategory();
+ }
+ LauBlattWeisskopfFactor* resBWFactor = this->getBWFactor( resCategory, resInfo );
+ LauBlattWeisskopfFactor* parBWFactor = this->getBWFactor( parCategory, resInfo );
+ theResonance->setBarrierRadii( resBWFactor, parBWFactor );
+ break;
+ }
+
+ case LauAbsResonance::Flatte :
+ // Flatte distribution - coupled channel Breit-Wigner
+ std::cout << " : Using Flatte lineshape. "
+ << std::endl;
+ theResonance = new LauFlatteRes( resInfo, resPairAmpInt, daughters );
+ break;
+
+ case LauAbsResonance::Sigma :
+ // Sigma model - should only be used for the pi-pi system
+ std::cout << " : Using Sigma lineshape. "
+ << std::endl;
+ theResonance = new LauSigmaRes( resInfo, resPairAmpInt, daughters );
+ break;
+
+ case LauAbsResonance::Kappa :
+ // Kappa model - should only be used for the K-pi system
+ std::cout << " : Using Kappa lineshape. "
+ << std::endl;
+ theResonance = new LauKappaRes( resInfo, resPairAmpInt, daughters );
+ break;
+
+ case LauAbsResonance::Dabba :
+ // Dabba model - should only be used for the D-pi system
+ std::cout << " : Using Dabba lineshape. "
+ << std::endl;
+ theResonance = new LauDabbaRes( resInfo, resPairAmpInt, daughters );
+ break;
+
+ case LauAbsResonance::LASS :
+ // LASS function to try and model the K-pi S-wave better
+ std::cout << " : Using LASS lineshape. "
+ << std::endl;
+ theResonance = new LauLASSRes( resInfo, resPairAmpInt, daughters );
+ break;
+
+ case LauAbsResonance::LASS_BW :
+ // LASS function to try and model the K-pi S-wave better
+ std::cout << " : Using LASS lineshape (resonant part only). "
+ << std::endl;
+ theResonance = new LauLASSBWRes( resInfo, resPairAmpInt, daughters );
+ break;
+
+ case LauAbsResonance::LASS_NR :
+ // LASS function to try and model the K-pi S-wave better
+ std::cout << " : Using LASS lineshape (nonresonant part only). "
+ << std::endl;
+ theResonance = new LauLASSNRRes( resInfo, resPairAmpInt, daughters );
+ break;
+
+ case LauAbsResonance::EFKLLM :
+ // EFKLLM form-factor description of the K-pi S-wave
+ std::cout << " : Using EFKLLM lineshape. "
+ << std::endl;
+ theResonance = new LauEFKLLMRes( resInfo, resPairAmpInt, daughters );
+ break;
+
+ case LauAbsResonance::KMatrix :
+ // K-matrix description
+ std::cerr << "ERROR in LauResonanceMaker::getResonance : K-matrix type specified, which should be separately handled."
+ << std::endl;
+ break;
+
+ case LauAbsResonance::FlatNR :
+ // uniform NR amplitude - arguments are there to preserve the interface
+ std::cout << " : Using uniform NR lineshape. "
+ << std::endl;
+ // we override resPairAmpInt here
+ theResonance = new LauFlatNR( resInfo, 0, daughters );
+ break;
+
+ case LauAbsResonance::NRModel :
+ // NR amplitude model - arguments are there to preserve the interface
+ std::cout << " : Using NR-model lineshape. "
+ << std::endl;
+ // we override resPairAmpInt here
+ theResonance = new LauNRAmplitude( resInfo, 0, daughters );
+ break;
+
+ case LauAbsResonance::BelleNR :
+ case LauAbsResonance::PowerLawNR :
+ // Belle NR amplitude model - arguments are there to preserve the interface
+ std::cout << " : Using Belle NR lineshape. "
+ << std::endl;
+ theResonance = new LauBelleNR( resInfo, resType, resPairAmpInt, daughters );
+ break;
+
+ case LauAbsResonance::BelleSymNR :
+ case LauAbsResonance::BelleSymNRNoInter :
+ case LauAbsResonance::TaylorNR :
+ // Belle NR amplitude model - arguments are there to preserve the interface
+ std::cout << " : Using Belle symmetric NR lineshape. "
+ << std::endl;
+ theResonance = new LauBelleSymNR( resInfo, resType, resPairAmpInt, daughters );
+ break;
+
+ case LauAbsResonance::PolNR :
+ // Polynomial NR amplitude model - arguments are there to preserve the interface
+ std::cout << " : Using polynomial NR lineshape. "
+ << std::endl;
+ theResonance = new LauPolNR( resInfo, resPairAmpInt, daughters );
+ break;
+
+ case LauAbsResonance::Pole :
+ // Scalar pole model
+ std::cout << " : Using the scalar Pole lineshape.. "
+ << std::endl;
+ theResonance = new LauPoleRes( resInfo, resPairAmpInt, daughters );
+ break;
+
+ case LauAbsResonance::PolarFFNR :
+ // Polar Form Factor NR amplitude model - arguments are there to preserve the interface
+ std::cout << " : Using Polar FormFactor NR lineshape.. "
+ << std::endl;
+ theResonance = new LauPolarFormFactorNR( resInfo, resType, resPairAmpInt, daughters );
+ break;
+
+ case LauAbsResonance::PolarFFSymNR :
+ case LauAbsResonance::PolarFFSymNRNoInter :
+ // Polar Form Factor NR amplitude model - arguments are there to preserve the interface
+ std::cout << " : Using Polar FormFactor Symetric NR lineshape. "
+ << std::endl;
+ theResonance = new LauPolarFormFactorSymNR( resInfo, resType, resPairAmpInt, daughters );
+ break;
+
+ case LauAbsResonance::Rescattering :
+ case LauAbsResonance::RescatteringNoInter :
+ // KKPiPi Inelastic Scattering amplitude - arguments are there to preserve the interface
+ std::cout << " : KKPiPi Inelastic Scattering amplitude lineshape. "
+ << std::endl;
+ theResonance = new LauRescatteringRes( resInfo, resType, resPairAmpInt, daughters );
+ break;
+
+ case LauAbsResonance::Rescattering2 :
+ // KKPiPi Inelastic Scattering amplitude - arguments are there to preserve the interface
+ std::cout << " : KKPiPi Inelastic Scattering amplitude lineshape. "
+ << std::endl;
+ theResonance = new LauRescattering2Res( resInfo, resPairAmpInt, daughters );
+ break;
+
+ case LauAbsResonance::MIPW_MagPhase :
+ // Model independent partial wave
+ std::cout << " : Using model independent partial wave lineshape (magnitude and phase). "
+ << std::endl;
+ theResonance = new LauModIndPartWaveMagPhase( resInfo, resPairAmpInt, daughters );
+ break;
+
+ case LauAbsResonance::MIPW_RealImag :
+ // Model independent partial wave
+ std::cout << " : Using model independent partial wave lineshape (real and imaginary part). "
+ << std::endl;
+ theResonance = new LauModIndPartWaveRealImag( resInfo, resPairAmpInt, daughters );
+ break;
+
+ case LauAbsResonance::GaussIncoh :
+ // Incoherent Gaussian
+ std::cout << " : Using incoherent Gaussian lineshape. "
+ << std::endl;
+ theResonance = new LauGaussIncohRes( resInfo, resPairAmpInt, daughters );
+ break;
+
+ case LauAbsResonance::RhoOmegaMix_GS :
+ case LauAbsResonance::RhoOmegaMix_RBW :
+ case LauAbsResonance::RhoOmegaMix_GS_1 :
+ case LauAbsResonance::RhoOmegaMix_RBW_1 :
+ // Rho-omega mass mixing model
+ std::cout << " : Using rho-omega mass mixing lineshape. "
+ << std::endl;
+ theResonance = new LauRhoOmegaMix( resInfo, resType, resPairAmpInt, daughters );
+ LauBlattWeisskopfFactor::BlattWeisskopfCategory parCategory =
+ LauBlattWeisskopfFactor::Parent;
+ LauBlattWeisskopfFactor::BlattWeisskopfCategory resCategory = bwCategory;
+ if ( bwCategory == LauBlattWeisskopfFactor::Default ) {
+ resCategory = resInfo->getBWCategory();
+ }
+ LauBlattWeisskopfFactor* resBWFactor = this->getBWFactor( resCategory, resInfo );
+ LauBlattWeisskopfFactor* parBWFactor = this->getBWFactor( parCategory, resInfo );
+ theResonance->setBarrierRadii( resBWFactor, parBWFactor );
+ break;
+ }
+
+ // Set the spin formalism choice
+ theResonance->setSpinType( spinFormalism_ );
+
+ return theResonance;
}
-Int_t LauResonanceMaker::resTypeInt(const TString& name) const
+Int_t LauResonanceMaker::resTypeInt( const TString& name ) const
{
- // Internal function that returns the resonance integer, specified by the
- // order of the resonance vector defined in createResonanceVector(),
- // for a given resonance name.
- Int_t resTypInt(-99);
- Int_t i(0);
-
- for (std::vector<LauResonanceInfo*>::const_iterator iter=resInfo_.begin(); iter!=resInfo_.end(); ++iter) {
-
- if (name.BeginsWith((*iter)->getName(), TString::kExact) == kTRUE) {
- // We have recognised the resonance from those that are available
- resTypInt = i;
- return resTypInt;
- }
- ++i;
- }
-
- return resTypInt;
+ // Internal function that returns the resonance integer, specified by the
+ // order of the resonance vector defined in createResonanceVector(),
+ // for a given resonance name.
+ Int_t resTypInt( -99 );
+ Int_t i( 0 );
+
+ for ( std::vector<LauResonanceInfo*>::const_iterator iter = resInfo_.begin();
+ iter != resInfo_.end();
+ ++iter ) {
+
+ if ( name.BeginsWith( ( *iter )->getName(), TString::kExact ) == kTRUE ) {
+ // We have recognised the resonance from those that are available
+ resTypInt = i;
+ return resTypInt;
+ }
+ ++i;
+ }
+
+ return resTypInt;
}
void LauResonanceMaker::printAll( std::ostream& stream ) const
{
- for ( std::vector<LauResonanceInfo*>::const_iterator iter = resInfo_.begin(); iter != resInfo_.end(); ++iter ) {
- stream << (**iter) << std::endl;
- }
+ for ( std::vector<LauResonanceInfo*>::const_iterator iter = resInfo_.begin();
+ iter != resInfo_.end();
+ ++iter ) {
+ stream << ( **iter ) << std::endl;
+ }
}
-LauResonanceInfo* LauResonanceMaker::getResInfo(const TString& resName) const
+LauResonanceInfo* LauResonanceMaker::getResInfo( const TString& resName ) const
{
- LauResonanceInfo* resInfo(0);
- for (std::vector<LauResonanceInfo*>::const_iterator iter=resInfo_.begin(); iter!=resInfo_.end(); ++iter) {
-
- if (resName == (*iter)->getName()) {
- // We have recognised the resonance name.
- resInfo = (*iter);
- // stop looping
- break;
- }
- }
-
- return resInfo;
-
+ LauResonanceInfo* resInfo( 0 );
+ for ( std::vector<LauResonanceInfo*>::const_iterator iter = resInfo_.begin();
+ iter != resInfo_.end();
+ ++iter ) {
+
+ if ( resName == ( *iter )->getName() ) {
+ // We have recognised the resonance name.
+ resInfo = ( *iter );
+ // stop looping
+ break;
+ }
+ }
+
+ return resInfo;
}
diff --git a/src/LauResultsExtractor.cc b/src/LauResultsExtractor.cc
index f10e0f0..8be8065 100644
--- a/src/LauResultsExtractor.cc
+++ b/src/LauResultsExtractor.cc
@@ -1,295 +1,312 @@
/*
Copyright 2005 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauResultsExtractor.cc
- \brief File containing implementation of LauResultsExtractor class.
- */
+ \brief File containing implementation of LauResultsExtractor class.
+*/
#include "LauResultsExtractor.hh"
-#include <iostream>
-#include <fstream>
-#include <cstdlib>
-#include <vector>
-#include <map>
-
#include "TChain.h"
#include "TFile.h"
#include "TH1.h"
#include "TLeaf.h"
#include "TObjArray.h"
#include "TSystem.h"
+#include <cstdlib>
+#include <fstream>
+#include <iostream>
+#include <map>
+#include <vector>
-
-LauResultsExtractor::LauResultsExtractor(const TString& inputFileName, const TString& outputFileName, const TString& treeName) :
- inputFileName_(inputFileName),
- outputFileName_(outputFileName),
- treeName_(treeName),
- inputTree_(0),
- outputFile_(0),
- outputTree_(0),
- nEntries_(0)
+LauResultsExtractor::LauResultsExtractor( const TString& inputFileName,
+ const TString& outputFileName,
+ const TString& treeName ) :
+ inputFileName_( inputFileName ),
+ outputFileName_( outputFileName ),
+ treeName_( treeName ),
+ inputTree_( 0 ),
+ outputFile_( 0 ),
+ outputTree_( 0 ),
+ nEntries_( 0 )
{
}
LauResultsExtractor::~LauResultsExtractor()
{
- this->clearMaps();
- delete inputTree_; inputTree_ = 0;
- if (outputFile_ && outputFile_->IsOpen()) {
- delete outputTree_; outputTree_ = 0;
- }
- delete outputFile_; outputFile_ = 0;
+ this->clearMaps();
+ delete inputTree_;
+ inputTree_ = 0;
+ if ( outputFile_ && outputFile_->IsOpen() ) {
+ delete outputTree_;
+ outputTree_ = 0;
+ }
+ delete outputFile_;
+ outputFile_ = 0;
}
void LauResultsExtractor::setupInputTree()
{
- TObjArray* leaves = inputTree_->GetListOfLeaves();
- Int_t nLeaves = leaves->GetEntries();
-
- std::cout<<"Setting branches for input tree \""<<inputTree_->GetName()<<"\" with "<<nEntries_<<" entries..."<<std::endl;
- inputTree_->SetBranchAddress("iExpt",&iExpt_);
- inputTree_->SetBranchAddress("fitStatus",&fitStatus_);
- inputTree_->SetBranchAddress("NLL",&NLL_);
- inputTree_->SetBranchAddress("EDM",&EDM_);
-
- for (Int_t iLeaf(3); iLeaf<nLeaves; ++iLeaf) {
-
- TLeaf * leaf = dynamic_cast<TLeaf*>((*leaves)[iLeaf]);
- TString type = leaf->GetTypeName();
- TString name = leaf->GetName();
- Int_t size = leaf->GetNdata();
-
- if ((type != "Double_t") || (size != 1)) {
- continue;
- }
-
- std::pair<std::map<TString,Double_t>::iterator,bool> result = otherVars_.insert(std::make_pair(name,0.0));
- std::map<TString,Double_t>::iterator iter = result.first;
- bool ok = result.second;
- if (ok) {
- inputTree_->SetBranchAddress(name,&(iter->second));
- }
- }
-
- std::cout<<"Set branch addresses for "<<otherVars_.size()+3<<" branches.\n"<<std::endl;
+ TObjArray* leaves = inputTree_->GetListOfLeaves();
+ Int_t nLeaves = leaves->GetEntries();
+
+ std::cout << "Setting branches for input tree \"" << inputTree_->GetName() << "\" with "
+ << nEntries_ << " entries..." << std::endl;
+ inputTree_->SetBranchAddress( "iExpt", &iExpt_ );
+ inputTree_->SetBranchAddress( "fitStatus", &fitStatus_ );
+ inputTree_->SetBranchAddress( "NLL", &NLL_ );
+ inputTree_->SetBranchAddress( "EDM", &EDM_ );
+
+ for ( Int_t iLeaf( 3 ); iLeaf < nLeaves; ++iLeaf ) {
+
+ TLeaf* leaf = dynamic_cast<TLeaf*>( ( *leaves )[iLeaf] );
+ TString type = leaf->GetTypeName();
+ TString name = leaf->GetName();
+ Int_t size = leaf->GetNdata();
+
+ if ( ( type != "Double_t" ) || ( size != 1 ) ) {
+ continue;
+ }
+
+ std::pair<std::map<TString, Double_t>::iterator, bool> result = otherVars_.insert(
+ std::make_pair( name, 0.0 ) );
+ std::map<TString, Double_t>::iterator iter = result.first;
+ bool ok = result.second;
+ if ( ok ) {
+ inputTree_->SetBranchAddress( name, &( iter->second ) );
+ }
+ }
+
+ std::cout << "Set branch addresses for " << otherVars_.size() + 3 << " branches.\n"
+ << std::endl;
}
-void LauResultsExtractor::setupOutputTree(TTree * tree)
+void LauResultsExtractor::setupOutputTree( TTree* tree )
{
- std::cout<<"Creating branches for output tree \""<<tree->GetName()<<"\"..."<<std::endl;
-
- tree->Branch("iExpt",&iExpt_,"iExpt/I");
- tree->Branch("fitStatus",&fitStatus_,"fitStatus/I");
- tree->Branch("NLL",&NLL_,"NLL/D");
- tree->Branch("EDM",&EDM_,"EDM/D");
-
- for (std::map<TString,Double_t>::iterator iter = otherVars_.begin(); iter != otherVars_.end(); ++iter) {
- TString name = iter->first;
- Double_t * address = &(iter->second);
- TString thirdBit = name;
- thirdBit += "/D";
-
- tree->Branch(name,address,thirdBit);
- }
- std::cout<<"Created "<<otherVars_.size()<<" branches.\n"<<std::endl;
+ std::cout << "Creating branches for output tree \"" << tree->GetName() << "\"..." << std::endl;
+
+ tree->Branch( "iExpt", &iExpt_, "iExpt/I" );
+ tree->Branch( "fitStatus", &fitStatus_, "fitStatus/I" );
+ tree->Branch( "NLL", &NLL_, "NLL/D" );
+ tree->Branch( "EDM", &EDM_, "EDM/D" );
+
+ for ( std::map<TString, Double_t>::iterator iter = otherVars_.begin(); iter != otherVars_.end();
+ ++iter ) {
+ TString name = iter->first;
+ Double_t* address = &( iter->second );
+ TString thirdBit = name;
+ thirdBit += "/D";
+
+ tree->Branch( name, address, thirdBit );
+ }
+ std::cout << "Created " << otherVars_.size() << " branches.\n" << std::endl;
}
-void LauResultsExtractor::setInputTreeBranchStatus(const Bool_t status)
+void LauResultsExtractor::setInputTreeBranchStatus( const Bool_t status )
{
- inputTree_->SetBranchStatus("iExpt",kTRUE);
- inputTree_->SetBranchStatus("fitStatus",kTRUE);
- inputTree_->SetBranchStatus("NLL",kTRUE);
- inputTree_->SetBranchStatus("EDM",kTRUE);
-
- for (std::map<TString,Double_t>::iterator iter = otherVars_.begin(); iter != otherVars_.end(); ++iter) {
- TString name = iter->first;
- inputTree_->SetBranchStatus(name,status);
- }
+ inputTree_->SetBranchStatus( "iExpt", kTRUE );
+ inputTree_->SetBranchStatus( "fitStatus", kTRUE );
+ inputTree_->SetBranchStatus( "NLL", kTRUE );
+ inputTree_->SetBranchStatus( "EDM", kTRUE );
+
+ for ( std::map<TString, Double_t>::iterator iter = otherVars_.begin(); iter != otherVars_.end();
+ ++iter ) {
+ TString name = iter->first;
+ inputTree_->SetBranchStatus( name, status );
+ }
}
void LauResultsExtractor::clearMaps()
{
- for (std::map<Int_t,TH1*>::iterator iter = nllHistos_.begin(); iter != nllHistos_.end(); ++iter) {
- delete (iter->second);
- }
- bestNLL_.clear();
- worstNLL_.clear();
- allNLLs_.clear();
- nllHistos_.clear();
+ for ( std::map<Int_t, TH1*>::iterator iter = nllHistos_.begin(); iter != nllHistos_.end();
+ ++iter ) {
+ delete ( iter->second );
+ }
+ bestNLL_.clear();
+ worstNLL_.clear();
+ allNLLs_.clear();
+ nllHistos_.clear();
}
-void LauResultsExtractor::process(Int_t numExpts)
+void LauResultsExtractor::process( Int_t numExpts )
{
- // open the text file
- std::cout << "\n" << "Chaining...\n" << std::endl;
- std::ifstream textFile(inputFileName_, std::ios::in);
- if (!textFile.good()) {
- std::cerr<<"Problem opening file: \""<<inputFileName_<<"\", exiting..."<<std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- if (inputTree_) { delete inputTree_; inputTree_ = 0; }
- inputTree_ = new TChain(treeName_);
-
- // Read the text file and add each valid entry to the chain
- TString inputFileName = "";
- while(inputFileName.ReadLine(textFile) && (!inputFileName.IsNull())) {
- if (inputFileName.EndsWith(".root") && !inputFileName.BeginsWith("#")) {
- std::cout << inputFileName << std::endl;
- inputTree_->Add(inputFileName);
- }
- else {
- std::cout << inputFileName << "\t *** Skipped ***" << std::endl;
- }
- }
-
- textFile.close();
- std::cout << "\n" << "... finished.\n" << std::endl;
-
- nEntries_ = inputTree_->GetEntries();
- this->setupInputTree();
-
- outputTree_ = new TTree(treeName_,"");
- this->setupOutputTree(outputTree_);
-
- // setup the map:
- // for each experiment there is a pair object holding
- // the best NLL and the tree entry for that NLL value
- // each expt starts out with NLL = 0.0 and entry = -1
- std::cout<<"Setting up the map..."<<std::flush;
- this->clearMaps();
- for (Int_t i(0); i<numExpts; ++i) {
- bestNLL_.insert(std::make_pair(i, std::make_pair(0.0,-1)));
- worstNLL_.insert(std::make_pair(i, std::make_pair(0.0,-1)));
- allNLLs_.insert(std::make_pair(i, std::vector<Double_t>()));
- allNLLs_[i].reserve(nEntries_);
- }
- std::cout<<" done.\n"<<std::endl;
-
- // only read the 3 info branches
- //this->setInputTreeBranchStatus(kFALSE);
-
- // loop over the tree and store the best entries for each expt
- std::cout<<"Starting to store best entry info..."<<std::endl;
- for (Int_t j(0); j<nEntries_; ++j) {
-
- if ((nEntries_<100) || (j%(nEntries_/100)==0)) {
- std::cout<<"Examining entry "<<j<<std::endl;
- }
-
- inputTree_->GetEntry(j);
-
- if ( (fitStatus_ == 3) && (NLL_ > -DBL_MAX/10.0) ) {
- allNLLs_[iExpt_].push_back(NLL_);
-
- Double_t curBestNLL = bestNLL_[iExpt_].first;
- Int_t curBestEntry = bestNLL_[iExpt_].second;
- if ((NLL_ < curBestNLL) || (curBestEntry == -1)) {
- bestNLL_[iExpt_] = std::make_pair(NLL_,j);
- }
-
- Double_t curWorstNLL = worstNLL_[iExpt_].first;
- Int_t curWorstEntry = worstNLL_[iExpt_].second;
- if ((NLL_ > curWorstNLL) || (curWorstEntry == -1)) {
- worstNLL_[iExpt_] = std::make_pair(NLL_,j);
- }
- }
-
- }
- std::cout<<"Finished storing best entry info.\n"<<std::endl;
-
- std::cout<<"Creating NLL histograms..."<<std::flush;
- TH1* histo(0);
- for (Int_t i(0); i<numExpts; ++i) {
- Double_t min = bestNLL_[i].first;
- Double_t max = worstNLL_[i].first;
- Double_t range = max - min;
- if (range < 1e-3) {
- min -= 0.005;
- max += 0.005;
- } else {
- min -= range*0.2;
- max += range*0.2;
- }
- TString name("expt");
- name += i;
- name += "NLL";
- histo = new TH1F(name,"",100,min,max);
- for (std::vector<Double_t>::const_iterator iter = allNLLs_[i].begin(); iter != allNLLs_[i].end(); ++iter) {
- histo->Fill(*iter);
- }
- nllHistos_.insert(std::make_pair(i, histo));
- }
- std::cout<<" done.\n"<<std::endl;
-
- // now need to read all branches
- //this->setInputTreeBranchStatus(kTRUE);
-
- std::ofstream fout("best-fit.txt");
-
- // loop over the experiments, grab the best entry and store it
- std::cout<<"Starting to retrieve best entries and fill output tree."<<std::endl;
- for (Int_t i(0); i<numExpts; ++i) {
- Int_t bestEntry = bestNLL_[i].second;
- if (bestEntry != -1) {
- inputTree_->GetEntry(bestEntry);
- outputTree_->Fill();
- }
- if ((numExpts<100) || (i%(numExpts/100)==0)) {
- std::cout<<"Writing out experiment "<<i<<std::endl;
- }
- TString bestFit(inputTree_->GetCurrentFile()->GetName());
- bestFit.Remove(0,3);
- Int_t index = bestFit.Index("_");
- if ( index < 1 ) {
- index = bestFit.Index(".");
- }
- bestFit.Remove(index);
- fout<<"Experiment "<<i<<" BestFit "<<bestFit<<std::endl;
- }
- std::cout<<"Finished filling best entries in output tree.\n"<<std::endl;
- fout.close();
-
- std::cout<<"Writing output file."<<std::endl;
-
- this->writeFile();
+ // open the text file
+ std::cout << "\n"
+ << "Chaining...\n"
+ << std::endl;
+ std::ifstream textFile( inputFileName_, std::ios::in );
+ if ( ! textFile.good() ) {
+ std::cerr << "Problem opening file: \"" << inputFileName_ << "\", exiting..." << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ if ( inputTree_ ) {
+ delete inputTree_;
+ inputTree_ = 0;
+ }
+ inputTree_ = new TChain( treeName_ );
+
+ // Read the text file and add each valid entry to the chain
+ TString inputFileName = "";
+ while ( inputFileName.ReadLine( textFile ) && ( ! inputFileName.IsNull() ) ) {
+ if ( inputFileName.EndsWith( ".root" ) && ! inputFileName.BeginsWith( "#" ) ) {
+ std::cout << inputFileName << std::endl;
+ inputTree_->Add( inputFileName );
+ } else {
+ std::cout << inputFileName << "\t *** Skipped ***" << std::endl;
+ }
+ }
+
+ textFile.close();
+ std::cout << "\n"
+ << "... finished.\n"
+ << std::endl;
+
+ nEntries_ = inputTree_->GetEntries();
+ this->setupInputTree();
+
+ outputTree_ = new TTree( treeName_, "" );
+ this->setupOutputTree( outputTree_ );
+
+ // setup the map:
+ // for each experiment there is a pair object holding
+ // the best NLL and the tree entry for that NLL value
+ // each expt starts out with NLL = 0.0 and entry = -1
+ std::cout << "Setting up the map..." << std::flush;
+ this->clearMaps();
+ for ( Int_t i( 0 ); i < numExpts; ++i ) {
+ bestNLL_.insert( std::make_pair( i, std::make_pair( 0.0, -1 ) ) );
+ worstNLL_.insert( std::make_pair( i, std::make_pair( 0.0, -1 ) ) );
+ allNLLs_.insert( std::make_pair( i, std::vector<Double_t>() ) );
+ allNLLs_[i].reserve( nEntries_ );
+ }
+ std::cout << " done.\n" << std::endl;
+
+ // only read the 3 info branches
+ //this->setInputTreeBranchStatus(kFALSE);
+
+ // loop over the tree and store the best entries for each expt
+ std::cout << "Starting to store best entry info..." << std::endl;
+ for ( Int_t j( 0 ); j < nEntries_; ++j ) {
+
+ if ( ( nEntries_ < 100 ) || ( j % ( nEntries_ / 100 ) == 0 ) ) {
+ std::cout << "Examining entry " << j << std::endl;
+ }
+
+ inputTree_->GetEntry( j );
+
+ if ( ( fitStatus_ == 3 ) && ( NLL_ > -DBL_MAX / 10.0 ) ) {
+ allNLLs_[iExpt_].push_back( NLL_ );
+
+ Double_t curBestNLL = bestNLL_[iExpt_].first;
+ Int_t curBestEntry = bestNLL_[iExpt_].second;
+ if ( ( NLL_ < curBestNLL ) || ( curBestEntry == -1 ) ) {
+ bestNLL_[iExpt_] = std::make_pair( NLL_, j );
+ }
+
+ Double_t curWorstNLL = worstNLL_[iExpt_].first;
+ Int_t curWorstEntry = worstNLL_[iExpt_].second;
+ if ( ( NLL_ > curWorstNLL ) || ( curWorstEntry == -1 ) ) {
+ worstNLL_[iExpt_] = std::make_pair( NLL_, j );
+ }
+ }
+ }
+ std::cout << "Finished storing best entry info.\n" << std::endl;
+
+ std::cout << "Creating NLL histograms..." << std::flush;
+ TH1* histo( 0 );
+ for ( Int_t i( 0 ); i < numExpts; ++i ) {
+ Double_t min = bestNLL_[i].first;
+ Double_t max = worstNLL_[i].first;
+ Double_t range = max - min;
+ if ( range < 1e-3 ) {
+ min -= 0.005;
+ max += 0.005;
+ } else {
+ min -= range * 0.2;
+ max += range * 0.2;
+ }
+ TString name( "expt" );
+ name += i;
+ name += "NLL";
+ histo = new TH1F( name, "", 100, min, max );
+ for ( std::vector<Double_t>::const_iterator iter = allNLLs_[i].begin();
+ iter != allNLLs_[i].end();
+ ++iter ) {
+ histo->Fill( *iter );
+ }
+ nllHistos_.insert( std::make_pair( i, histo ) );
+ }
+ std::cout << " done.\n" << std::endl;
+
+ // now need to read all branches
+ //this->setInputTreeBranchStatus(kTRUE);
+
+ std::ofstream fout( "best-fit.txt" );
+
+ // loop over the experiments, grab the best entry and store it
+ std::cout << "Starting to retrieve best entries and fill output tree." << std::endl;
+ for ( Int_t i( 0 ); i < numExpts; ++i ) {
+ Int_t bestEntry = bestNLL_[i].second;
+ if ( bestEntry != -1 ) {
+ inputTree_->GetEntry( bestEntry );
+ outputTree_->Fill();
+ }
+ if ( ( numExpts < 100 ) || ( i % ( numExpts / 100 ) == 0 ) ) {
+ std::cout << "Writing out experiment " << i << std::endl;
+ }
+ TString bestFit( inputTree_->GetCurrentFile()->GetName() );
+ bestFit.Remove( 0, 3 );
+ Int_t index = bestFit.Index( "_" );
+ if ( index < 1 ) {
+ index = bestFit.Index( "." );
+ }
+ bestFit.Remove( index );
+ fout << "Experiment " << i << " BestFit " << bestFit << std::endl;
+ }
+ std::cout << "Finished filling best entries in output tree.\n" << std::endl;
+ fout.close();
+
+ std::cout << "Writing output file." << std::endl;
+
+ this->writeFile();
}
void LauResultsExtractor::writeFile()
{
- if (!outputFile_) {
- outputFile_ = new TFile(outputFileName_,"recreate");
- }
- for (std::map<Int_t,TH1*>::iterator iter = nllHistos_.begin(); iter != nllHistos_.end(); ++iter) {
- (iter->second)->SetDirectory(outputFile_);
- }
- outputTree_->SetDirectory(outputFile_);
- outputFile_->Write();
- outputFile_->Close();
- delete outputFile_; outputFile_ = 0;
- nllHistos_.clear();
+ if ( ! outputFile_ ) {
+ outputFile_ = new TFile( outputFileName_, "recreate" );
+ }
+ for ( std::map<Int_t, TH1*>::iterator iter = nllHistos_.begin(); iter != nllHistos_.end();
+ ++iter ) {
+ ( iter->second )->SetDirectory( outputFile_ );
+ }
+ outputTree_->SetDirectory( outputFile_ );
+ outputFile_->Write();
+ outputFile_->Close();
+ delete outputFile_;
+ outputFile_ = 0;
+ nllHistos_.clear();
}
-
diff --git a/src/LauRhoOmegaMix.cc b/src/LauRhoOmegaMix.cc
index ea9f744..9a02fea 100644
--- a/src/LauRhoOmegaMix.cc
+++ b/src/LauRhoOmegaMix.cc
@@ -1,509 +1,539 @@
/*
Copyright 2016 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauRhoOmegaMix.cc
\brief File containing implementation of LauRhoOmegaMix class.
*/
-#include <iostream>
+#include "LauRhoOmegaMix.hh"
#include "LauBlattWeisskopfFactor.hh"
#include "LauConstants.hh"
#include "LauDaughters.hh"
#include "LauParameter.hh"
-#include "LauRhoOmegaMix.hh"
#include "LauResonanceInfo.hh"
#include "LauResonanceMaker.hh"
+#include <iostream>
-
-LauRhoOmegaMix::LauRhoOmegaMix(LauResonanceInfo* resInfo, const LauAbsResonance::LauResonanceModel resType,
- const Int_t resPairAmpInt, const LauDaughters* daughters) :
- LauAbsResonance(resInfo, resPairAmpInt, daughters),
- model_(resType),
- rhoMass_(0.0),
- rhoResRadius_(0.0),
- rhoParRadius_(0.0),
- mOmega_(0),
- mOmega0_(0.0),
- mOmegaCur_(0.0),
- wOmega_(0),
- wOmega0_(0.0),
- wOmegaCur_(0.0),
- magB_(0),
- phiB_(0),
- delta_(0),
- useDenom_(kTRUE),
- doneFirstInit_(kFALSE),
- rhoRes_(0),
- omegaRes_(0),
- whichAmpSq_(0)
+LauRhoOmegaMix::LauRhoOmegaMix( LauResonanceInfo* resInfo,
+ const LauAbsResonance::LauResonanceModel resType,
+ const Int_t resPairAmpInt,
+ const LauDaughters* daughters ) :
+ LauAbsResonance( resInfo, resPairAmpInt, daughters ),
+ model_( resType ),
+ rhoMass_( 0.0 ),
+ rhoResRadius_( 0.0 ),
+ rhoParRadius_( 0.0 ),
+ mOmega_( 0 ),
+ mOmega0_( 0.0 ),
+ mOmegaCur_( 0.0 ),
+ wOmega_( 0 ),
+ wOmega0_( 0.0 ),
+ wOmegaCur_( 0.0 ),
+ magB_( 0 ),
+ phiB_( 0 ),
+ delta_( 0 ),
+ useDenom_( kTRUE ),
+ doneFirstInit_( kFALSE ),
+ rhoRes_( 0 ),
+ omegaRes_( 0 ),
+ whichAmpSq_( 0 )
{
// Create the rho and omega lineshapes depending on the resonance type enumeration.
// The narrow omega is always a relativistic Breit-Wigner (RBW), but the broader rho
// can either be a RBW or a Gounaris-Sakurai lineshape. The" _1" form for the resonance type
// specifies that we want to assume the amplitude denominator correction term is set to 1.
// In principle, the rho lineshape can be any resonance defined by the resInfo pointer, so we
// use that to extract all relevant information about the first resonance.
// We do not need the barrier nor spin factor terms for the components separately, since
// they will be added after the lineshapes have been combined
LauResonanceMaker& resMaker = LauResonanceMaker::get();
LauAbsResonance::LauResonanceModel rhoType = LauAbsResonance::RelBW;
- if (resType == LauAbsResonance::RhoOmegaMix_GS || resType == LauAbsResonance::RhoOmegaMix_GS_1) {
- rhoType = LauAbsResonance::GS;
+ if ( resType == LauAbsResonance::RhoOmegaMix_GS || resType == LauAbsResonance::RhoOmegaMix_GS_1 ) {
+ rhoType = LauAbsResonance::GS;
}
- rhoRes_ = resMaker.getResonance(daughters, resInfo->getName(), resPairAmpInt, rhoType,
- LauBlattWeisskopfFactor::Light);
+ rhoRes_ = resMaker.getResonance( daughters,
+ resInfo->getName(),
+ resPairAmpInt,
+ rhoType,
+ LauBlattWeisskopfFactor::Light );
- LauResonanceInfo* omegaInfo = resMaker.getResInfo("omega(782)");
- omegaRes_ = resMaker.getResonance(daughters, omegaInfo->getName(), resPairAmpInt, LauAbsResonance::RelBW,
- LauBlattWeisskopfFactor::Light);
+ LauResonanceInfo* omegaInfo = resMaker.getResInfo( "omega(782)" );
+ omegaRes_ = resMaker.getResonance( daughters,
+ omegaInfo->getName(),
+ resPairAmpInt,
+ LauAbsResonance::RelBW,
+ LauBlattWeisskopfFactor::Light );
// Check to see if we want to set the denominator factor to unity
- if (resType == LauAbsResonance::RhoOmegaMix_RBW_1 || resType == LauAbsResonance::RhoOmegaMix_GS_1) {
- useDenom_ = kFALSE;
+ if ( resType == LauAbsResonance::RhoOmegaMix_RBW_1 ||
+ resType == LauAbsResonance::RhoOmegaMix_GS_1 ) {
+ useDenom_ = kFALSE;
}
// Initialise various parameters that can be used in the model
const TString& parNameBase = this->getSanitisedName();
// Pole mass of the omega (2nd) resonance. Initialise using the resonance maker (PDG) info
mOmega0_ = omegaInfo->getMass()->unblindValue();
// Also set the current internal value of the omega mass for initialisation logic
mOmegaCur_ = mOmega0_;
- TString mOmegaName(parNameBase); mOmegaName += "_mOmega";
- mOmega_ = resInfo->getExtraParameter(mOmegaName);
- if (!mOmega_) {
- mOmega_ = new LauParameter(mOmegaName, mOmega0_, 0.0, 100.0, kTRUE);
- mOmega_->secondStage(kTRUE);
- resInfo->addExtraParameter(mOmega_);
+ TString mOmegaName( parNameBase );
+ mOmegaName += "_mOmega";
+ mOmega_ = resInfo->getExtraParameter( mOmegaName );
+ if ( ! mOmega_ ) {
+ mOmega_ = new LauParameter( mOmegaName, mOmega0_, 0.0, 100.0, kTRUE );
+ mOmega_->secondStage( kTRUE );
+ resInfo->addExtraParameter( mOmega_ );
}
// Pole width of the omega (2nd) resonance. Initialise using the resonance maker (PDG) info
wOmega0_ = omegaInfo->getWidth()->unblindValue();
// Also set the current internal value of the omega width for initialisation logic
wOmegaCur_ = wOmega0_;
- TString wOmegaName(parNameBase); wOmegaName += "_wOmega";
- wOmega_ = resInfo->getExtraParameter(wOmegaName);
- if (!wOmega_) {
- wOmega_ = new LauParameter(wOmegaName, wOmega0_, 0.0, 100.0, kTRUE);
- wOmega_->secondStage(kTRUE);
- resInfo->addExtraParameter(wOmega_);
+ TString wOmegaName( parNameBase );
+ wOmegaName += "_wOmega";
+ wOmega_ = resInfo->getExtraParameter( wOmegaName );
+ if ( ! wOmega_ ) {
+ wOmega_ = new LauParameter( wOmegaName, wOmega0_, 0.0, 100.0, kTRUE );
+ wOmega_->secondStage( kTRUE );
+ resInfo->addExtraParameter( wOmega_ );
}
// Set the magnitude and phase of the omega amplitude mixing term.
// These should be fitted
const Double_t magBVal = 1.0;
const Double_t phiBVal = 0.0;
- TString magBName(parNameBase); magBName += "_magB";
- magB_ = resInfo->getExtraParameter(magBName);
- if (!magB_) {
- magB_ = new LauParameter(magBName, magBVal, 0.0, 100.0, kTRUE);
- magB_->secondStage(kTRUE);
- resInfo->addExtraParameter(magB_, kTRUE); // the kTRUE here allows this value to vary between B and Bbar - TODO: maybe make this configurable?
+ TString magBName( parNameBase );
+ magBName += "_magB";
+ magB_ = resInfo->getExtraParameter( magBName );
+ if ( ! magB_ ) {
+ magB_ = new LauParameter( magBName, magBVal, 0.0, 100.0, kTRUE );
+ magB_->secondStage( kTRUE );
+ resInfo->addExtraParameter(
+ magB_,
+ kTRUE ); // the kTRUE here allows this value to vary between B and Bbar - TODO: maybe make this configurable?
}
- TString phiBName(parNameBase); phiBName += "_phiB";
- phiB_ = resInfo->getExtraParameter(phiBName);
- if (!phiB_) {
- phiB_ = new LauParameter(phiBName, phiBVal, -10.0, 10.0, kTRUE);
- phiB_->secondStage(kTRUE);
- resInfo->addExtraParameter(phiB_, kTRUE); // the kTRUE here allows this value to vary between B and Bbar - TODO: maybe make this configurable?
+ TString phiBName( parNameBase );
+ phiBName += "_phiB";
+ phiB_ = resInfo->getExtraParameter( phiBName );
+ if ( ! phiB_ ) {
+ phiB_ = new LauParameter( phiBName, phiBVal, -10.0, 10.0, kTRUE );
+ phiB_->secondStage( kTRUE );
+ resInfo->addExtraParameter(
+ phiB_,
+ kTRUE ); // the kTRUE here allows this value to vary between B and Bbar - TODO: maybe make this configurable?
}
// Set the delta parameter for the omega amplitude mixing term. This
// is usually fixed but should be varied for systematic error checks.
// In theory, this parameter can be complex, but we only use its magnitude
// in the mixing amplitude, since its usually very small: (2.15 +- 0.35) MeV/c^2
const Double_t deltaVal = 2.15e-3;
- TString deltaName(parNameBase); deltaName += "_delta";
- delta_ = resInfo->getExtraParameter(deltaName);
- if (!delta_) {
- delta_ = new LauParameter(deltaName, deltaVal, 0.0, 100.0, kTRUE);
- delta_->secondStage(kTRUE);
- resInfo->addExtraParameter(delta_);
+ TString deltaName( parNameBase );
+ deltaName += "_delta";
+ delta_ = resInfo->getExtraParameter( deltaName );
+ if ( ! delta_ ) {
+ delta_ = new LauParameter( deltaName, deltaVal, 0.0, 100.0, kTRUE );
+ delta_->secondStage( kTRUE );
+ resInfo->addExtraParameter( delta_ );
}
-
}
LauRhoOmegaMix::~LauRhoOmegaMix()
{
}
void LauRhoOmegaMix::initialise()
{
// Initialise the two resonances. This is done within each amplitude() function
// call and so floating parameters are checked every time, although secondary
// initialisation checks will be "skipped" since the parameters will be unchanged
// for the given set of kinematic variables/parameters
this->initialiseRho();
this->initialiseOmega();
-
}
void LauRhoOmegaMix::initialiseRho()
{
// Propagate settings
rhoRes_->setSpinType( this->getSpinType() );
rhoRes_->flipHelicity( this->flipHelicity() );
rhoRes_->ignoreMomenta( this->ignoreMomenta() );
rhoRes_->ignoreSpin( this->ignoreSpin() );
rhoRes_->ignoreBarrierScaling( this->ignoreBarrierScaling() );
// Do the initialisation
rhoRes_->initialise();
// Keep track of the current pole mass and barrier factor terms so that
// we can reinitialise the rho resonance if they change
- rhoMass_ = rhoRes_->getMass();
+ rhoMass_ = rhoRes_->getMass();
rhoResRadius_ = rhoRes_->getResRadius();
rhoParRadius_ = rhoRes_->getParRadius();
-
}
void LauRhoOmegaMix::initialiseOmega()
{
// Set the pole mass and width of the omega resonance if this has changed
// using the parameters mOmega_ and wOmega_
- Double_t newOmegaM(-1.0), newOmegaW(-1.0);
- const Int_t newOmegaSpin(-1);
+ Double_t newOmegaM( -1.0 ), newOmegaW( -1.0 );
+ const Int_t newOmegaSpin( -1 );
// See if the new pole mass is different from the current value
Double_t tmpOmegaM = mOmega_->unblindValue();
- if (fabs(tmpOmegaM - mOmegaCur_) > 1e-10) {
- newOmegaM = tmpOmegaM;
+ if ( fabs( tmpOmegaM - mOmegaCur_ ) > 1e-10 ) {
+ newOmegaM = tmpOmegaM;
}
// See if the new pole width is different from the current value
Double_t tmpOmegaW = wOmega_->unblindValue();
- if (fabs(tmpOmegaW - wOmegaCur_) > 1e-10) {
- newOmegaW = tmpOmegaW;
+ if ( fabs( tmpOmegaW - wOmegaCur_ ) > 1e-10 ) {
+ newOmegaW = tmpOmegaW;
}
// If any parameter is negative, they are unchanged
- omegaRes_->changeResonance(newOmegaM, newOmegaW, newOmegaSpin);
+ omegaRes_->changeResonance( newOmegaM, newOmegaW, newOmegaSpin );
- Bool_t changedOmegaM(kFALSE);
- if (newOmegaM > -1.0) {
- changedOmegaM = kTRUE;
+ Bool_t changedOmegaM( kFALSE );
+ if ( newOmegaM > -1.0 ) {
+ changedOmegaM = kTRUE;
}
- if (doneFirstInit_ == kFALSE) {
+ if ( doneFirstInit_ == kFALSE ) {
- // Let the omega resonance pointer know if the mass or width are fixed or floating
- omegaRes_->fixMass(this->fixmOmegaValue());
- omegaRes_->fixWidth(this->fixwOmegaValue());
+ // Let the omega resonance pointer know if the mass or width are fixed or floating
+ omegaRes_->fixMass( this->fixmOmegaValue() );
+ omegaRes_->fixWidth( this->fixwOmegaValue() );
- // We do not need to use the spin terms for the omega lineshape, since we
- // use those from the rho for the full amplitude later on
- // (as such we do not need to propagate the flip helicity setting to the omega, just to the rho)
- omegaRes_->ignoreSpin(kTRUE);
+ // We do not need to use the spin terms for the omega lineshape, since we
+ // use those from the rho for the full amplitude later on
+ // (as such we do not need to propagate the flip helicity setting to the omega, just to the rho)
+ omegaRes_->ignoreSpin( kTRUE );
- // We want to ignore momentum-dependent width effects: just use the constant pole width
- omegaRes_->ignoreMomenta(kTRUE);
+ // We want to ignore momentum-dependent width effects: just use the constant pole width
+ omegaRes_->ignoreMomenta( kTRUE );
- // And we also need to ignore barrier scaling
- omegaRes_->ignoreBarrierScaling(kTRUE);
+ // And we also need to ignore barrier scaling
+ omegaRes_->ignoreBarrierScaling( kTRUE );
- // Initialise the omega resonance pointer
- omegaRes_->initialise();
+ // Initialise the omega resonance pointer
+ omegaRes_->initialise();
- doneFirstInit_ = kTRUE;
+ doneFirstInit_ = kTRUE;
} else {
- // Reinitialise the omega resonance pointer only if we have changed
- // its pole mass. It has no barrier factor
-
- if (changedOmegaM == kTRUE) {
- omegaRes_->initialise();
- }
+ // Reinitialise the omega resonance pointer only if we have changed
+ // its pole mass. It has no barrier factor
+ if ( changedOmegaM == kTRUE ) {
+ omegaRes_->initialise();
+ }
}
// Keep track of the current values of the mass and width of the omega (floating/fixed)
mOmegaCur_ = tmpOmegaM;
wOmegaCur_ = tmpOmegaW;
-
}
-LauComplex LauRhoOmegaMix::amplitude(const LauKinematics* kinematics) {
+LauComplex LauRhoOmegaMix::amplitude( const LauKinematics* kinematics )
+{
// This function overrides and returns the complex dynamical amplitude for the
// rho-omega mass mixing amplitude given the kinematics
// Check to see if we need to reinitialise the rho resonance pointer
- const Double_t resMass = rhoRes_->getMass();
+ const Double_t resMass = rhoRes_->getMass();
const Double_t resRadius = rhoRes_->getResRadius();
const Double_t parRadius = rhoRes_->getParRadius();
- if ( ( (!this->fixMass()) && fabs(resMass - rhoMass_) > 1e-10) ||
- ( (!this->fixResRadius()) && fabs(resRadius - rhoResRadius_) > 1e-10 ) ||
- ( (!this->fixParRadius()) && fabs(parRadius - rhoParRadius_) > 1e-10 ) ) {
-
- this->initialiseRho();
+ if ( ( ( ! this->fixMass() ) && fabs( resMass - rhoMass_ ) > 1e-10 ) ||
+ ( ( ! this->fixResRadius() ) && fabs( resRadius - rhoResRadius_ ) > 1e-10 ) ||
+ ( ( ! this->fixParRadius() ) && fabs( parRadius - rhoParRadius_ ) > 1e-10 ) ) {
+ this->initialiseRho();
}
// Always check the initialisaton of the omega resonance in case we have varied
// its mass/width via the fit parameters
this->initialiseOmega();
// First, get the amplitude of the first (rho) resonance.
// This will include the full barrier and spin terms
- const LauComplex rhoAmp = rhoRes_->amplitude(kinematics);
+ const LauComplex rhoAmp = rhoRes_->amplitude( kinematics );
// Next, get the amplitude of the second (omega) resonance. This ignores barrier
// and spin terms, and uses the pole width only (no momentum dependence)
- const LauComplex omegaAmp = omegaRes_->amplitude(kinematics);
+ const LauComplex omegaAmp = omegaRes_->amplitude( kinematics );
// The Delta parameter, which we assume is purely real. Theoretically, delta can
// be complex, but in practice we only use its (usually small) magnitude
- const Double_t Delta = (resMass + mOmegaCur_)*this->getdeltaValue();
+ const Double_t Delta = ( resMass + mOmegaCur_ ) * this->getdeltaValue();
// The B amplitude term
- const Double_t magBVal = this->getmagBValue()*Delta;
+ const Double_t magBVal = this->getmagBValue() * Delta;
const Double_t phiBVal = this->getphiBValue();
- const LauComplex BTerm = LauComplex(magBVal*cos(phiBVal), magBVal*sin(phiBVal));
+ const LauComplex BTerm = LauComplex( magBVal * cos( phiBVal ), magBVal * sin( phiBVal ) );
// The mass mixing term
- const LauComplex unity(1.0, 0.0);
- const LauComplex mixingTerm = BTerm*omegaAmp + unity;
+ const LauComplex unity( 1.0, 0.0 );
+ const LauComplex mixingTerm = BTerm * omegaAmp + unity;
// Now form the full amplitude
- LauComplex resAmplitude = rhoAmp*mixingTerm;
+ LauComplex resAmplitude = rhoAmp * mixingTerm;
// Add the mixing correction denominator term if required
- if (useDenom_) {
-
- // Here, we need to disable the rho barrier & spin factors, since they are
- // only needed for the numerator term of the full amplitude. Note that we still
- // need to use the momentum-dependent width (with its resonance barrier term)
+ if ( useDenom_ ) {
- // Disable barrier scaling factors for the amplitude (not width)
- rhoRes_->ignoreBarrierScaling(kTRUE);
- // Also ignore spin terms for now
- rhoRes_->ignoreSpin(kTRUE);
+ // Here, we need to disable the rho barrier & spin factors, since they are
+ // only needed for the numerator term of the full amplitude. Note that we still
+ // need to use the momentum-dependent width (with its resonance barrier term)
- const LauComplex rhoAmp2 = rhoRes_->amplitude(kinematics);
+ // Disable barrier scaling factors for the amplitude (not width)
+ rhoRes_->ignoreBarrierScaling( kTRUE );
+ // Also ignore spin terms for now
+ rhoRes_->ignoreSpin( kTRUE );
- // Reinstate barrier scaling and spin term flags
- rhoRes_->ignoreBarrierScaling(kFALSE);
- rhoRes_->ignoreSpin(kFALSE);
+ const LauComplex rhoAmp2 = rhoRes_->amplitude( kinematics );
- // Denominator term
- const LauComplex DeltaSq = LauComplex(Delta*Delta, 0.0);
- const LauComplex denomTerm = unity - DeltaSq*rhoAmp2*omegaAmp;
+ // Reinstate barrier scaling and spin term flags
+ rhoRes_->ignoreBarrierScaling( kFALSE );
+ rhoRes_->ignoreSpin( kFALSE );
- // Modify the full amplitude
- resAmplitude = resAmplitude/denomTerm;
+ // Denominator term
+ const LauComplex DeltaSq = LauComplex( Delta * Delta, 0.0 );
+ const LauComplex denomTerm = unity - DeltaSq * rhoAmp2 * omegaAmp;
- if (this->whichAmpSq_ == 1) {
- // For omega fit fraction
- return LauComplex(sqrt(omegaAmp.abs() * Delta * magBVal), 0.0);
- } else if (this->whichAmpSq_ == 2) {
- // For rho fit fraction
- return rhoAmp;
- }
+ // Modify the full amplitude
+ resAmplitude = resAmplitude / denomTerm;
+ if ( this->whichAmpSq_ == 1 ) {
+ // For omega fit fraction
+ return LauComplex( sqrt( omegaAmp.abs() * Delta * magBVal ), 0.0 );
+ } else if ( this->whichAmpSq_ == 2 ) {
+ // For rho fit fraction
+ return rhoAmp;
+ }
}
return resAmplitude;
-
}
-LauComplex LauRhoOmegaMix::resAmp(Double_t mass, Double_t spinTerm)
+LauComplex LauRhoOmegaMix::resAmp( Double_t mass, Double_t spinTerm )
{
std::cerr << "ERROR in LauRhoOmegaMix : This method should never be called." << std::endl;
- std::cerr << " : Returning zero amplitude for mass = " << mass << " and spinTerm = " << spinTerm << "." << std::endl;
- return LauComplex(0.0, 0.0);
+ std::cerr << " : Returning zero amplitude for mass = " << mass
+ << " and spinTerm = " << spinTerm << "." << std::endl;
+ return LauComplex( 0.0, 0.0 );
}
-const std::vector<LauParameter*>& LauRhoOmegaMix::getFloatingParameters() {
+const std::vector<LauParameter*>& LauRhoOmegaMix::getFloatingParameters()
+{
this->clearFloatingParameters();
if ( ! this->fixmOmegaValue() ) {
- this->addFloatingParameter( mOmega_ );
+ this->addFloatingParameter( mOmega_ );
}
if ( ! this->fixwOmegaValue() ) {
- this->addFloatingParameter( wOmega_ );
+ this->addFloatingParameter( wOmega_ );
}
if ( ! this->fixmagBValue() ) {
- this->addFloatingParameter( magB_ );
+ this->addFloatingParameter( magB_ );
}
if ( ! this->fixphiBValue() ) {
- this->addFloatingParameter( phiB_ );
+ this->addFloatingParameter( phiB_ );
}
if ( ! this->fixdeltaValue() ) {
- this->addFloatingParameter( delta_ );
+ this->addFloatingParameter( delta_ );
}
if ( ! this->fixMass() ) {
- this->addFloatingParameter( this->getMassPar() );
+ this->addFloatingParameter( this->getMassPar() );
}
if ( ! this->fixWidth() ) {
- this->addFloatingParameter( this->getWidthPar() );
+ this->addFloatingParameter( this->getWidthPar() );
}
if ( ! this->fixResRadius() ) {
- this->addFloatingParameter( this->getResBWFactor()->getRadiusParameter() );
+ this->addFloatingParameter( this->getResBWFactor()->getRadiusParameter() );
}
if ( ! this->fixParRadius() ) {
- this->addFloatingParameter( this->getParBWFactor()->getRadiusParameter() );
+ this->addFloatingParameter( this->getParBWFactor()->getRadiusParameter() );
}
return this->getParameters();
}
-void LauRhoOmegaMix::setResonanceParameter(const TString& name, const Double_t value) {
+void LauRhoOmegaMix::setResonanceParameter( const TString& name, const Double_t value )
+{
// Set various parameters for the lineshape
- if (name == "mOmega") {
- this->setmOmegaValue(value);
- std::cout << "INFO in LauRhoOmegaMix::setResonanceParameter : Setting parameter mOmega = " << this->getmOmegaValue() << std::endl;
- } else if (name == "wOmega") {
- this->setwOmegaValue(value);
- std::cout << "INFO in LauRhoOmegaMix::setResonanceParameter : Setting parameter wOmega = " << this->getwOmegaValue() << std::endl;
- } else if (name == "magB") {
- this->setmagBValue(value);
- std::cout << "INFO in LauRhoOmegaMix::setResonanceParameter : Setting parameter magB = " << this->getmagBValue() << std::endl;
- } else if (name == "phiB") {
- this->setphiBValue(value);
- std::cout << "INFO in LauRhoOmegaMix::setResonanceParameter : Setting parameter phiB = " << this->getphiBValue() << std::endl;
- } else if (name == "delta") {
- this->setdeltaValue(value);
- std::cout << "INFO in LauRhoOmegaMix::setResonanceParameter : Setting parameter delta = " << this->getdeltaValue() << std::endl;
+ if ( name == "mOmega" ) {
+ this->setmOmegaValue( value );
+ std::cout << "INFO in LauRhoOmegaMix::setResonanceParameter : Setting parameter mOmega = "
+ << this->getmOmegaValue() << std::endl;
+ } else if ( name == "wOmega" ) {
+ this->setwOmegaValue( value );
+ std::cout << "INFO in LauRhoOmegaMix::setResonanceParameter : Setting parameter wOmega = "
+ << this->getwOmegaValue() << std::endl;
+ } else if ( name == "magB" ) {
+ this->setmagBValue( value );
+ std::cout << "INFO in LauRhoOmegaMix::setResonanceParameter : Setting parameter magB = "
+ << this->getmagBValue() << std::endl;
+ } else if ( name == "phiB" ) {
+ this->setphiBValue( value );
+ std::cout << "INFO in LauRhoOmegaMix::setResonanceParameter : Setting parameter phiB = "
+ << this->getphiBValue() << std::endl;
+ } else if ( name == "delta" ) {
+ this->setdeltaValue( value );
+ std::cout << "INFO in LauRhoOmegaMix::setResonanceParameter : Setting parameter delta = "
+ << this->getdeltaValue() << std::endl;
} else {
- std::cerr << "WARNING in LauSigmaRes::setResonanceParameter: Parameter name "<<name<<" not recognised. No parameter changes made." << std::endl;
+ std::cerr << "WARNING in LauSigmaRes::setResonanceParameter: Parameter name " << name
+ << " not recognised. No parameter changes made." << std::endl;
}
-
}
-void LauRhoOmegaMix::floatResonanceParameter(const TString& name) {
-
- if (name == "mOmega") {
- if ( mOmega_->fixed() ) {
- mOmega_->fixed( kFALSE );
- this->addFloatingParameter( mOmega_ );
- } else {
- std::cerr << "WARNING in LauRhoOmegaMix::floatResonanceParameter: Parameter "<<name<<" already floating. No parameter changes made." << std::endl;
- }
- } else if (name == "wOmega") {
- if ( wOmega_->fixed() ) {
- wOmega_->fixed( kFALSE );
- this->addFloatingParameter( wOmega_ );
- } else {
- std::cerr << "WARNING in LauRhoOmegaMix::floatResonanceParameter: Parameter "<<name<<" already floating. No parameter changes made." << std::endl;
- }
- } else if (name == "magB") {
- if ( magB_->fixed() ) {
- magB_->fixed( kFALSE );
- this->addFloatingParameter( magB_ );
- } else {
- std::cerr << "WARNING in LauRhoOmegaMix::floatResonanceParameter: Parameter "<<name<<" already floating. No parameter changes made." << std::endl;
- }
- } else if (name == "phiB") {
- if ( phiB_->fixed() ) {
- phiB_->fixed( kFALSE );
- this->addFloatingParameter( phiB_ );
- } else {
- std::cerr << "WARNING in LauRhoOmegaMix::floatResonanceParameter: Parameter "<<name<<" already floating. No parameter changes made." << std::endl;
- }
- } else if (name == "delta") {
- if ( delta_->fixed() ) {
- delta_->fixed( kFALSE );
- this->addFloatingParameter( delta_ );
- } else {
- std::cerr << "WARNING in LauRhoOmegaMix::floatResonanceParameter: Parameter "<<name<<" already floating. No parameter changes made." << std::endl;
- }
- }
+void LauRhoOmegaMix::floatResonanceParameter( const TString& name )
+{
+ if ( name == "mOmega" ) {
+ if ( mOmega_->fixed() ) {
+ mOmega_->fixed( kFALSE );
+ this->addFloatingParameter( mOmega_ );
+ } else {
+ std::cerr << "WARNING in LauRhoOmegaMix::floatResonanceParameter: Parameter " << name
+ << " already floating. No parameter changes made." << std::endl;
+ }
+ } else if ( name == "wOmega" ) {
+ if ( wOmega_->fixed() ) {
+ wOmega_->fixed( kFALSE );
+ this->addFloatingParameter( wOmega_ );
+ } else {
+ std::cerr << "WARNING in LauRhoOmegaMix::floatResonanceParameter: Parameter " << name
+ << " already floating. No parameter changes made." << std::endl;
+ }
+ } else if ( name == "magB" ) {
+ if ( magB_->fixed() ) {
+ magB_->fixed( kFALSE );
+ this->addFloatingParameter( magB_ );
+ } else {
+ std::cerr << "WARNING in LauRhoOmegaMix::floatResonanceParameter: Parameter " << name
+ << " already floating. No parameter changes made." << std::endl;
+ }
+ } else if ( name == "phiB" ) {
+ if ( phiB_->fixed() ) {
+ phiB_->fixed( kFALSE );
+ this->addFloatingParameter( phiB_ );
+ } else {
+ std::cerr << "WARNING in LauRhoOmegaMix::floatResonanceParameter: Parameter " << name
+ << " already floating. No parameter changes made." << std::endl;
+ }
+ } else if ( name == "delta" ) {
+ if ( delta_->fixed() ) {
+ delta_->fixed( kFALSE );
+ this->addFloatingParameter( delta_ );
+ } else {
+ std::cerr << "WARNING in LauRhoOmegaMix::floatResonanceParameter: Parameter " << name
+ << " already floating. No parameter changes made." << std::endl;
+ }
+ }
}
-LauParameter* LauRhoOmegaMix::getResonanceParameter(const TString& name) {
-
- if (name == "mOmega") {
- return mOmega_;
- } else if (name == "wOmega") {
- return wOmega_;
- } else if (name == "magB") {
- return magB_;
- } else if (name == "phiB") {
- return phiB_;
- } else if (name == "delta") {
- return delta_;
+LauParameter* LauRhoOmegaMix::getResonanceParameter( const TString& name )
+{
+
+ if ( name == "mOmega" ) {
+ return mOmega_;
+ } else if ( name == "wOmega" ) {
+ return wOmega_;
+ } else if ( name == "magB" ) {
+ return magB_;
+ } else if ( name == "phiB" ) {
+ return phiB_;
+ } else if ( name == "delta" ) {
+ return delta_;
} else {
- std::cerr << "WARNING in LauRhoOmegaMix::getResonanceParameter: Parameter name "<<name<<" not reconised." << std::endl;
- return 0;
+ std::cerr << "WARNING in LauRhoOmegaMix::getResonanceParameter: Parameter name " << name
+ << " not reconised." << std::endl;
+ return 0;
}
}
-void LauRhoOmegaMix::setmOmegaValue(const Double_t mOmega) {
+void LauRhoOmegaMix::setmOmegaValue( const Double_t mOmega )
+{
mOmega_->value( mOmega );
mOmega_->genValue( mOmega );
mOmega_->initValue( mOmega );
}
-void LauRhoOmegaMix::setwOmegaValue(const Double_t wOmega) {
+void LauRhoOmegaMix::setwOmegaValue( const Double_t wOmega )
+{
wOmega_->value( wOmega );
wOmega_->genValue( wOmega );
wOmega_->initValue( wOmega );
}
-void LauRhoOmegaMix::setmagBValue(const Double_t magB) {
+void LauRhoOmegaMix::setmagBValue( const Double_t magB )
+{
magB_->value( magB );
magB_->genValue( magB );
magB_->initValue( magB );
}
-void LauRhoOmegaMix::setphiBValue(const Double_t phiB) {
+void LauRhoOmegaMix::setphiBValue( const Double_t phiB )
+{
phiB_->value( phiB );
phiB_->genValue( phiB );
phiB_->initValue( phiB );
}
-void LauRhoOmegaMix::setdeltaValue(const Double_t delta) {
+void LauRhoOmegaMix::setdeltaValue( const Double_t delta )
+{
delta_->value( delta );
delta_->genValue( delta );
delta_->initValue( delta );
}
diff --git a/src/LauRooFitTask.cc b/src/LauRooFitTask.cc
index 7e046b6..dce527d 100644
--- a/src/LauRooFitTask.cc
+++ b/src/LauRooFitTask.cc
@@ -1,394 +1,442 @@
/*
Copyright 2017 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauRooFitTask.cc
- \brief File containing implementation of LauRooFitTask class.
- */
+ \brief File containing implementation of LauRooFitTask class.
+*/
-#include <iostream>
-#include <vector>
+#include "LauRooFitTask.hh"
+
+#include "LauFitNtuple.hh"
+#include "LauParameter.hh"
+#include "LauSimFitTask.hh"
#include "RooAbsPdf.h"
#include "RooDataSet.h"
#include "RooFormulaVar.h"
#include "RooNLLVar.h"
#include "RooRealVar.h"
#include "TFile.h"
#include "TString.h"
#include "TSystem.h"
#include "TTree.h"
-#include "LauFitNtuple.hh"
-#include "LauParameter.hh"
-#include "LauSimFitTask.hh"
-#include "LauRooFitTask.hh"
-
-
+#include <iostream>
+#include <vector>
-LauRooFitTask::LauRooFitTask( RooAbsPdf& model, const Bool_t extended, const RooArgSet& vars, const TString& weightVarName ) :
- LauSimFitTask(),
- model_(model),
- dataVars_(vars),
- weightVarName_(weightVarName),
- dataFile_(0),
- dataTree_(0),
- exptData_(0),
- extended_(extended),
- iExptSet_(),
- nllVar_(0)
+LauRooFitTask::LauRooFitTask( RooAbsPdf& model,
+ const Bool_t extended,
+ const RooArgSet& vars,
+ const TString& weightVarName ) :
+ LauSimFitTask(),
+ model_( model ),
+ dataVars_( vars ),
+ weightVarName_( weightVarName ),
+ dataFile_( 0 ),
+ dataTree_( 0 ),
+ exptData_( 0 ),
+ extended_( extended ),
+ iExptSet_(),
+ nllVar_( 0 )
{
}
LauRooFitTask::~LauRooFitTask()
{
- delete nllVar_; nllVar_ = 0;
- this->cleanData();
+ delete nllVar_;
+ nllVar_ = 0;
+ this->cleanData();
}
void LauRooFitTask::cleanData()
{
- if ( dataFile_ != 0 ) {
- dataFile_->Close();
- delete dataFile_;
- dataTree_ = 0;
- dataFile_ = 0;
- }
- delete exptData_;
- exptData_ = 0;
+ if ( dataFile_ != 0 ) {
+ dataFile_->Close();
+ delete dataFile_;
+ dataTree_ = 0;
+ dataFile_ = 0;
+ }
+ delete exptData_;
+ exptData_ = 0;
}
void LauRooFitTask::initialise()
{
- if ( weightVarName_ != "" ) {
- Bool_t weightVarFound = kFALSE;
- RooFIter argset_iter = dataVars_.fwdIterator();
- RooAbsArg* param(0);
- while ( (param = argset_iter.next()) ) {
- TString name = param->GetName();
- if ( name == weightVarName_ ) {
- weightVarFound = kTRUE;
- break;
- }
- }
- if ( ! weightVarFound ) {
- std::cerr << "ERROR in LauRooFitTask::initialise : The set of data variables does not contain the weighting variable \"" << weightVarName_ << std::endl;
- std::cerr << " : Weighting will be disabled." << std::endl;
- weightVarName_ = "";
- }
- }
+ if ( weightVarName_ != "" ) {
+ Bool_t weightVarFound = kFALSE;
+ RooFIter argset_iter = dataVars_.fwdIterator();
+ RooAbsArg* param( 0 );
+ while ( ( param = argset_iter.next() ) ) {
+ TString name = param->GetName();
+ if ( name == weightVarName_ ) {
+ weightVarFound = kTRUE;
+ break;
+ }
+ }
+ if ( ! weightVarFound ) {
+ std::cerr << "ERROR in LauRooFitTask::initialise : The set of data variables does not contain the weighting variable \""
+ << weightVarName_ << std::endl;
+ std::cerr << " : Weighting will be disabled."
+ << std::endl;
+ weightVarName_ = "";
+ }
+ }
}
-Bool_t LauRooFitTask::verifyFitData(const TString& dataFileName, const TString& dataTreeName)
+Bool_t LauRooFitTask::verifyFitData( const TString& dataFileName, const TString& dataTreeName )
{
- // Clean-up from any previous runs
- if ( dataFile_ != 0 ) {
- this->cleanData();
- }
-
- // Open the data file
- dataFile_ = TFile::Open( dataFileName );
- if ( ! dataFile_ ) {
- std::cerr << "ERROR in LauRooFitTask::verifyFitData : Problem opening data file \"" << dataFileName << "\"" << std::endl;
- return kFALSE;
- }
-
- // Retrieve the tree
- dataTree_ = dynamic_cast<TTree*>( dataFile_->Get( dataTreeName ) );
- if ( ! dataTree_ ) {
- std::cerr << "ERROR in LauRooFitTask::verifyFitData : Problem retrieving tree \"" << dataTreeName << "\" from data file \"" << dataFileName << "\"" << std::endl;
- dataFile_->Close();
- delete dataFile_;
- dataFile_ = 0;
- return kFALSE;
- }
-
- // Check that the tree contains branches for all the fit variables
- RooFIter argset_iter = dataVars_.fwdIterator();
- RooAbsArg* param(0);
- Bool_t allOK(kTRUE);
- while ( (param = argset_iter.next()) ) {
- TString name = param->GetName();
- TBranch* branch = dataTree_->GetBranch( name );
- if ( branch == 0 ) {
- std::cerr << "ERROR in LauRooFitTask::verifyFitData : The data tree does not contain a branch for fit variable \"" << name << std::endl;
- allOK = kFALSE;
- }
- }
- if ( ! allOK ) {
- return kFALSE;
- }
-
- // Check whether the tree has the branch iExpt
- TBranch* branch = dataTree_->GetBranch("iExpt");
- if ( branch == 0 ) {
- std::cout << "WARNING in LauRooFitTask::verifyFitData : Cannot find branch \"iExpt\" in the tree, will treat all data as being from a single experiment" << std::endl;
- } else {
- // Define the valid values for iExpt
- iExptSet_.clear();
- const UInt_t firstExp = dataTree_->GetMinimum("iExpt");
- const UInt_t lastExp = dataTree_->GetMaximum("iExpt");
- for ( UInt_t iExp = firstExp; iExp <= lastExp; ++iExp ) {
- iExptSet_.insert( iExp );
- }
- }
-
- return kTRUE;
+ // Clean-up from any previous runs
+ if ( dataFile_ != 0 ) {
+ this->cleanData();
+ }
+
+ // Open the data file
+ dataFile_ = TFile::Open( dataFileName );
+ if ( ! dataFile_ ) {
+ std::cerr << "ERROR in LauRooFitTask::verifyFitData : Problem opening data file \""
+ << dataFileName << "\"" << std::endl;
+ return kFALSE;
+ }
+
+ // Retrieve the tree
+ dataTree_ = dynamic_cast<TTree*>( dataFile_->Get( dataTreeName ) );
+ if ( ! dataTree_ ) {
+ std::cerr << "ERROR in LauRooFitTask::verifyFitData : Problem retrieving tree \""
+ << dataTreeName << "\" from data file \"" << dataFileName << "\"" << std::endl;
+ dataFile_->Close();
+ delete dataFile_;
+ dataFile_ = 0;
+ return kFALSE;
+ }
+
+ // Check that the tree contains branches for all the fit variables
+ RooFIter argset_iter = dataVars_.fwdIterator();
+ RooAbsArg* param( 0 );
+ Bool_t allOK( kTRUE );
+ while ( ( param = argset_iter.next() ) ) {
+ TString name = param->GetName();
+ TBranch* branch = dataTree_->GetBranch( name );
+ if ( branch == 0 ) {
+ std::cerr << "ERROR in LauRooFitTask::verifyFitData : The data tree does not contain a branch for fit variable \""
+ << name << std::endl;
+ allOK = kFALSE;
+ }
+ }
+ if ( ! allOK ) {
+ return kFALSE;
+ }
+
+ // Check whether the tree has the branch iExpt
+ TBranch* branch = dataTree_->GetBranch( "iExpt" );
+ if ( branch == 0 ) {
+ std::cout << "WARNING in LauRooFitTask::verifyFitData : Cannot find branch \"iExpt\" in the tree, will treat all data as being from a single experiment"
+ << std::endl;
+ } else {
+ // Define the valid values for iExpt
+ iExptSet_.clear();
+ const UInt_t firstExp = dataTree_->GetMinimum( "iExpt" );
+ const UInt_t lastExp = dataTree_->GetMaximum( "iExpt" );
+ for ( UInt_t iExp = firstExp; iExp <= lastExp; ++iExp ) {
+ iExptSet_.insert( iExp );
+ }
+ }
+
+ return kTRUE;
}
void LauRooFitTask::prepareInitialParArray( TObjArray& array )
{
- // Check that the NLL variable has been initialised
- if ( ! nllVar_ ) {
- std::cerr << "ERROR in LauRooFitTask::prepareInitialParArray : NLL var not initialised" << std::endl;
- return;
- }
-
- // If we already prepared the entries in the fitPars_ vector then we only need to add the contents to the array
- if ( ! fitPars_.empty() ) {
- for ( std::vector<LauParameter*>::iterator iter = fitPars_.begin(); iter != fitPars_.end(); ++iter ) {
- array.Add(*iter);
- }
- return;
- }
-
- // Store the set of parameters and the total number of parameters
- RooArgSet* varSet = nllVar_->getParameters( exptData_ );
- UInt_t nFreePars(0);
-
- // Loop through the fit parameters
- RooFIter argset_iter = varSet->fwdIterator();
- RooAbsArg* param(0);
- while ( (param = argset_iter.next()) ) {
- // Only consider the free parameters
- if ( ! param->isConstant() ) {
- // Add the parameter
- RooRealVar* rrvar = dynamic_cast<RooRealVar*>( param );
- if ( rrvar != 0 ) {
- // Count the number of free parameters
- ++nFreePars;
- // Do the conversion and add it to the array
- LauParameter* lpar = this->convertToLauParameter( rrvar );
- fitVars_.push_back( rrvar );
- fitPars_.push_back( lpar );
- array.Add( lpar );
- } else {
- RooFormulaVar* rfvar = dynamic_cast<RooFormulaVar*>( param );
- if ( rfvar == 0 ) {
- std::cerr << "ERROR in LauRooFitTask::prepareInitialParArray : The parameter is neither a RooRealVar nor a RooFormulaVar, don't know what to do" << std::endl;
- continue;
- }
- std::vector< std::pair<RooRealVar*,LauParameter*> > lpars = this->convertToLauParameters( rfvar );
- for ( std::vector< std::pair<RooRealVar*,LauParameter*> >::iterator iter = lpars.begin(); iter != lpars.end(); ++iter ) {
- RooRealVar* rrv = iter->first;
- LauParameter* lpar = iter->second;
- if ( ! rrv->isConstant() ) {
- continue;
- }
-
- // Count the number of free parameters
- ++nFreePars;
- // Add the parameter to the array
- fitVars_.push_back( rrvar );
- fitPars_.push_back( lpar );
- array.Add( lpar );
- }
- }
- }
- }
- delete varSet;
-
- this->startNewFit( nFreePars, nFreePars );
+ // Check that the NLL variable has been initialised
+ if ( ! nllVar_ ) {
+ std::cerr << "ERROR in LauRooFitTask::prepareInitialParArray : NLL var not initialised"
+ << std::endl;
+ return;
+ }
+
+ // If we already prepared the entries in the fitPars_ vector then we only need to add the contents to the array
+ if ( ! fitPars_.empty() ) {
+ for ( std::vector<LauParameter*>::iterator iter = fitPars_.begin(); iter != fitPars_.end();
+ ++iter ) {
+ array.Add( *iter );
+ }
+ return;
+ }
+
+ // Store the set of parameters and the total number of parameters
+ RooArgSet* varSet = nllVar_->getParameters( exptData_ );
+ UInt_t nFreePars( 0 );
+
+ // Loop through the fit parameters
+ RooFIter argset_iter = varSet->fwdIterator();
+ RooAbsArg* param( 0 );
+ while ( ( param = argset_iter.next() ) ) {
+ // Only consider the free parameters
+ if ( ! param->isConstant() ) {
+ // Add the parameter
+ RooRealVar* rrvar = dynamic_cast<RooRealVar*>( param );
+ if ( rrvar != 0 ) {
+ // Count the number of free parameters
+ ++nFreePars;
+ // Do the conversion and add it to the array
+ LauParameter* lpar = this->convertToLauParameter( rrvar );
+ fitVars_.push_back( rrvar );
+ fitPars_.push_back( lpar );
+ array.Add( lpar );
+ } else {
+ RooFormulaVar* rfvar = dynamic_cast<RooFormulaVar*>( param );
+ if ( rfvar == 0 ) {
+ std::cerr << "ERROR in LauRooFitTask::prepareInitialParArray : The parameter is neither a RooRealVar nor a RooFormulaVar, don't know what to do"
+ << std::endl;
+ continue;
+ }
+ std::vector<std::pair<RooRealVar*, LauParameter*>> lpars =
+ this->convertToLauParameters( rfvar );
+ for ( std::vector<std::pair<RooRealVar*, LauParameter*>>::iterator iter =
+ lpars.begin();
+ iter != lpars.end();
+ ++iter ) {
+ RooRealVar* rrv = iter->first;
+ LauParameter* lpar = iter->second;
+ if ( ! rrv->isConstant() ) {
+ continue;
+ }
+
+ // Count the number of free parameters
+ ++nFreePars;
+ // Add the parameter to the array
+ fitVars_.push_back( rrvar );
+ fitPars_.push_back( lpar );
+ array.Add( lpar );
+ }
+ }
+ }
+ }
+ delete varSet;
+
+ this->startNewFit( nFreePars, nFreePars );
}
LauParameter* LauRooFitTask::convertToLauParameter( const RooRealVar* rooParameter ) const
{
- return new LauParameter( rooParameter->GetName(), rooParameter->getVal(), rooParameter->getMin(), rooParameter->getMax(), rooParameter->isConstant() );
+ return new LauParameter( rooParameter->GetName(),
+ rooParameter->getVal(),
+ rooParameter->getMin(),
+ rooParameter->getMax(),
+ rooParameter->isConstant() );
}
-std::vector< std::pair<RooRealVar*,LauParameter*> > LauRooFitTask::convertToLauParameters( const RooFormulaVar* rooFormula ) const
+std::vector<std::pair<RooRealVar*, LauParameter*>> LauRooFitTask::convertToLauParameters(
+ const RooFormulaVar* rooFormula ) const
{
- // Create the empty vector
- std::vector< std::pair<RooRealVar*,LauParameter*> > lauParameters;
-
- Int_t parIndex(0);
- RooAbsArg* rabsarg(0);
- RooRealVar* rrvar(0);
- RooFormulaVar* rfvar(0);
- // Loop through all the parameters of the formula
- while ( (rabsarg = rooFormula->getParameter(parIndex)) ) {
- // First try converting to a RooRealVar
- rrvar = dynamic_cast<RooRealVar*>( rabsarg );
- if ( rrvar ) {
- // Do the conversion and add it to the array
- LauParameter* lpar = this->convertToLauParameter( rrvar );
- lauParameters.push_back( std::make_pair(rrvar,lpar) );
- continue;
- }
-
- // If that didn't work, try converting to a RooFormulaVar
- rfvar = dynamic_cast<RooFormulaVar*>( rabsarg );
- if ( rfvar ) {
- // Do the conversion and add these to the array
- std::vector< std::pair<RooRealVar*,LauParameter*> > lpars = this->convertToLauParameters( rfvar );
- for ( std::vector< std::pair<RooRealVar*,LauParameter*> >::iterator iter = lpars.begin(); iter != lpars.end(); ++iter ) {
- lauParameters.push_back( *iter );
- }
- continue;
- }
-
- // If neither of those worked we don't know what to do, so print an error message and continue
- std::cerr << "ERROR in LauRooFitTask::convertToLauParameters : One of the parameters is not a RooRealVar nor a RooFormulaVar, it is a: " << rabsarg->ClassName() << std::endl;
- std::cerr << " : Do not know how to process that - it will be skipped." << std::endl;
- }
-
- return lauParameters;
+ // Create the empty vector
+ std::vector<std::pair<RooRealVar*, LauParameter*>> lauParameters;
+
+ Int_t parIndex( 0 );
+ RooAbsArg* rabsarg( 0 );
+ RooRealVar* rrvar( 0 );
+ RooFormulaVar* rfvar( 0 );
+ // Loop through all the parameters of the formula
+ while ( ( rabsarg = rooFormula->getParameter( parIndex ) ) ) {
+ // First try converting to a RooRealVar
+ rrvar = dynamic_cast<RooRealVar*>( rabsarg );
+ if ( rrvar ) {
+ // Do the conversion and add it to the array
+ LauParameter* lpar = this->convertToLauParameter( rrvar );
+ lauParameters.push_back( std::make_pair( rrvar, lpar ) );
+ continue;
+ }
+
+ // If that didn't work, try converting to a RooFormulaVar
+ rfvar = dynamic_cast<RooFormulaVar*>( rabsarg );
+ if ( rfvar ) {
+ // Do the conversion and add these to the array
+ std::vector<std::pair<RooRealVar*, LauParameter*>> lpars = this->convertToLauParameters(
+ rfvar );
+ for ( std::vector<std::pair<RooRealVar*, LauParameter*>>::iterator iter = lpars.begin();
+ iter != lpars.end();
+ ++iter ) {
+ lauParameters.push_back( *iter );
+ }
+ continue;
+ }
+
+ // If neither of those worked we don't know what to do, so print an error message and continue
+ std::cerr << "ERROR in LauRooFitTask::convertToLauParameters : One of the parameters is not a RooRealVar nor a RooFormulaVar, it is a: "
+ << rabsarg->ClassName() << std::endl;
+ std::cerr << " : Do not know how to process that - it will be skipped."
+ << std::endl;
+ }
+
+ return lauParameters;
}
Double_t LauRooFitTask::getTotNegLogLikelihood()
{
- Double_t nLL = (nllVar_ != 0) ? nllVar_->getVal() : 0.0;
- return nLL;
+ Double_t nLL = ( nllVar_ != 0 ) ? nllVar_->getVal() : 0.0;
+ return nLL;
}
-void LauRooFitTask::setParsFromMinuit(Double_t* par, Int_t npar)
+void LauRooFitTask::setParsFromMinuit( Double_t* par, Int_t npar )
{
- // This function sets the internal parameters based on the values
- // that Minuit is using when trying to minimise the total likelihood function.
-
- // MINOS reports different numbers of free parameters depending on the
- // situation, so disable this check
- const UInt_t nFreePars = this->nFreeParams();
- if ( ! this->withinAsymErrorCalc() ) {
- if (static_cast<UInt_t>(npar) != nFreePars) {
- std::cerr << "ERROR in LauRooFitTask::setParsFromMinuit : Unexpected number of free parameters: " << npar << ".\n";
- std::cerr << " Expected: " << nFreePars << ".\n" << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- }
-
- // Despite npar being the number of free parameters
- // the par array actually contains all the parameters,
- // free and floating...
-
- // Update all the floating ones with their new values
- for (UInt_t i(0); i<nFreePars; ++i) {
- if (!fitPars_[i]->fixed()) {
- // Set both the RooRealVars and the LauParameters
- fitPars_[i]->value(par[i]);
- fitVars_[i]->setVal(par[i]);
- }
- }
+ // This function sets the internal parameters based on the values
+ // that Minuit is using when trying to minimise the total likelihood function.
+
+ // MINOS reports different numbers of free parameters depending on the
+ // situation, so disable this check
+ const UInt_t nFreePars = this->nFreeParams();
+ if ( ! this->withinAsymErrorCalc() ) {
+ if ( static_cast<UInt_t>( npar ) != nFreePars ) {
+ std::cerr << "ERROR in LauRooFitTask::setParsFromMinuit : Unexpected number of free parameters: "
+ << npar << ".\n";
+ std::cerr << " Expected: " << nFreePars
+ << ".\n"
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ }
+
+ // Despite npar being the number of free parameters
+ // the par array actually contains all the parameters,
+ // free and floating...
+
+ // Update all the floating ones with their new values
+ for ( UInt_t i( 0 ); i < nFreePars; ++i ) {
+ if ( ! fitPars_[i]->fixed() ) {
+ // Set both the RooRealVars and the LauParameters
+ fitPars_[i]->value( par[i] );
+ fitVars_[i]->setVal( par[i] );
+ }
+ }
}
UInt_t LauRooFitTask::readExperimentData()
{
- // check that we're being asked to read a valid index
- const UInt_t exptIndex = this->iExpt();
- if ( iExptSet_.empty() && exptIndex != 0 ) {
- std::cerr << "ERROR in LauRooFitTask::readExperimentData : Invalid experiment number " << exptIndex << ", data contains only one experiment" << std::endl;
- return 0;
- } else if ( iExptSet_.find( exptIndex ) == iExptSet_.end() ) {
- std::cerr << "ERROR in LauRooFitTask::readExperimentData : Invalid experiment number " << exptIndex << std::endl;
- return 0;
- }
-
- // cleanup the data from any previous experiment
- delete exptData_;
-
- // retrieve the data and find out how many events have been read
- if ( iExptSet_.empty() ) {
- exptData_ = new RooDataSet( TString::Format("expt%dData",exptIndex), "", dataTree_, dataVars_, "", (weightVarName_ != "") ? weightVarName_.Data() : 0 );
- } else {
- const TString selectionString { TString::Format("iExpt==%d",exptIndex) };
- TTree* exptTree { dataTree_->CopyTree(selectionString) };
- exptData_ = new RooDataSet( TString::Format("expt%dData",exptIndex), "", exptTree, dataVars_, "", (weightVarName_ != "") ? weightVarName_.Data() : 0 );
- delete exptTree;
- }
-
- const UInt_t nEvent = exptData_->numEntries();
- this->eventsPerExpt( nEvent );
- return nEvent;
+ // check that we're being asked to read a valid index
+ const UInt_t exptIndex = this->iExpt();
+ if ( iExptSet_.empty() && exptIndex != 0 ) {
+ std::cerr << "ERROR in LauRooFitTask::readExperimentData : Invalid experiment number "
+ << exptIndex << ", data contains only one experiment" << std::endl;
+ return 0;
+ } else if ( iExptSet_.find( exptIndex ) == iExptSet_.end() ) {
+ std::cerr << "ERROR in LauRooFitTask::readExperimentData : Invalid experiment number "
+ << exptIndex << std::endl;
+ return 0;
+ }
+
+ // cleanup the data from any previous experiment
+ delete exptData_;
+
+ // retrieve the data and find out how many events have been read
+ if ( iExptSet_.empty() ) {
+ exptData_ = new RooDataSet( TString::Format( "expt%dData", exptIndex ),
+ "",
+ dataTree_,
+ dataVars_,
+ "",
+ ( weightVarName_ != "" ) ? weightVarName_.Data() : 0 );
+ } else {
+ const TString selectionString { TString::Format( "iExpt==%d", exptIndex ) };
+ TTree* exptTree { dataTree_->CopyTree( selectionString ) };
+ exptData_ = new RooDataSet( TString::Format( "expt%dData", exptIndex ),
+ "",
+ exptTree,
+ dataVars_,
+ "",
+ ( weightVarName_ != "" ) ? weightVarName_.Data() : 0 );
+ delete exptTree;
+ }
+
+ const UInt_t nEvent = exptData_->numEntries();
+ this->eventsPerExpt( nEvent );
+ return nEvent;
}
void LauRooFitTask::cacheInputFitVars()
{
- // cleanup the old NLL info
- delete nllVar_;
+ // cleanup the old NLL info
+ delete nllVar_;
- // construct the new NLL variable for this dataset
- nllVar_ = new RooNLLVar("nllVar", "", model_, *exptData_, extended_);
+ // construct the new NLL variable for this dataset
+ nllVar_ = new RooNLLVar( "nllVar", "", model_, *exptData_, extended_ );
}
-void LauRooFitTask::finaliseExperiment( const LauAbsFitter::FitStatus& fitStat, const TObjArray* parsFromCoordinator, const TMatrixD* covMat, TObjArray& parsToCoordinator )
+void LauRooFitTask::finaliseExperiment( const LauAbsFitter::FitStatus& fitStat,
+ const TObjArray* parsFromCoordinator,
+ const TMatrixD* covMat,
+ TObjArray& parsToCoordinator )
{
- // Copy the fit status information
- this->storeFitStatus( fitStat, *covMat );
-
- // Now process the parameters
- const UInt_t nFreePars = this->nFreeParams();
- UInt_t nPars = parsFromCoordinator->GetEntries();
- if ( nPars != nFreePars ) {
- std::cerr << "ERROR in LauRooFitTask::finaliseExperiment : Unexpected number of parameters received from coordinator" << std::endl;
- std::cerr << " : Received " << nPars << " when expecting " << nFreePars << std::endl;
- gSystem->Exit( EXIT_FAILURE );
- }
-
- for ( UInt_t iPar(0); iPar < nPars; ++iPar ) {
- LauParameter* parameter = dynamic_cast<LauParameter*>( (*parsFromCoordinator)[iPar] );
- if ( ! parameter ) {
- std::cerr << "ERROR in LauRooFitTask::finaliseExperiment : Error reading parameter from coordinator" << std::endl;
- gSystem->Exit( EXIT_FAILURE );
- }
-
- if ( parameter->name() != fitPars_[iPar]->name() ) {
- std::cerr << "ERROR in LauRooFitTask::finaliseExperiment : Error reading parameter from coordinator" << std::endl;
- gSystem->Exit( EXIT_FAILURE );
- }
-
- *(fitPars_[iPar]) = *parameter;
-
- RooRealVar* rrv = fitVars_[iPar];
- rrv->setVal( parameter->value() );
- rrv->setError( parameter->error() );
- rrv->setAsymError( parameter->negError(), parameter->posError() );
- }
-
- // Update the pulls and add each finalised fit parameter to the list to
- // send back to the coordinator
- for ( std::vector<LauParameter*>::iterator iter = fitPars_.begin(); iter != fitPars_.end(); ++iter ) {
- (*iter)->updatePull();
- parsToCoordinator.Add( *iter );
- }
-
- // Write the results into the ntuple
- LauFitNtuple* ntuple = this->fitNtuple();
- ntuple->storeParsAndErrors(fitPars_, this->multiDimConstrainedPars(), {});
-
- // find out the correlation matrix for the parameters
- ntuple->storeCorrMatrix(this->iExpt(), this->fitStatus(), this->covarianceMatrix());
-
- // Fill the data into ntuple
- ntuple->updateFitNtuple();
+ // Copy the fit status information
+ this->storeFitStatus( fitStat, *covMat );
+
+ // Now process the parameters
+ const UInt_t nFreePars = this->nFreeParams();
+ UInt_t nPars = parsFromCoordinator->GetEntries();
+ if ( nPars != nFreePars ) {
+ std::cerr << "ERROR in LauRooFitTask::finaliseExperiment : Unexpected number of parameters received from coordinator"
+ << std::endl;
+ std::cerr << " : Received " << nPars
+ << " when expecting " << nFreePars << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ for ( UInt_t iPar( 0 ); iPar < nPars; ++iPar ) {
+ LauParameter* parameter = dynamic_cast<LauParameter*>( ( *parsFromCoordinator )[iPar] );
+ if ( ! parameter ) {
+ std::cerr << "ERROR in LauRooFitTask::finaliseExperiment : Error reading parameter from coordinator"
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ if ( parameter->name() != fitPars_[iPar]->name() ) {
+ std::cerr << "ERROR in LauRooFitTask::finaliseExperiment : Error reading parameter from coordinator"
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ *( fitPars_[iPar] ) = *parameter;
+
+ RooRealVar* rrv = fitVars_[iPar];
+ rrv->setVal( parameter->value() );
+ rrv->setError( parameter->error() );
+ rrv->setAsymError( parameter->negError(), parameter->posError() );
+ }
+
+ // Update the pulls and add each finalised fit parameter to the list to
+ // send back to the coordinator
+ for ( std::vector<LauParameter*>::iterator iter = fitPars_.begin(); iter != fitPars_.end();
+ ++iter ) {
+ ( *iter )->updatePull();
+ parsToCoordinator.Add( *iter );
+ }
+
+ // Write the results into the ntuple
+ LauFitNtuple* ntuple = this->fitNtuple();
+ ntuple->storeParsAndErrors( fitPars_, this->multiDimConstrainedPars(), {} );
+
+ // find out the correlation matrix for the parameters
+ ntuple->storeCorrMatrix( this->iExpt(), this->fitStatus(), this->covarianceMatrix() );
+
+ // Fill the data into ntuple
+ ntuple->updateFitNtuple();
}
-
diff --git a/src/LauSPlot.cc b/src/LauSPlot.cc
index 7db40e6..23adb0b 100644
--- a/src/LauSPlot.cc
+++ b/src/LauSPlot.cc
@@ -1,1301 +1,1430 @@
/*
Copyright 2006 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauSPlot.cc
\brief File containing implementation of LauSPlot class.
Class for defining the SPlot technique based on TSplot from ROOT by the following authors:
Muriel Pivk, Anna Kreshuk (10/2005).
(Original copyright notice below)
*/
/**********************************************************************
* *
* Copyright (c) 2005 ROOT Foundation, CERN/PH-SFT *
* *
**********************************************************************/
#include <cfloat>
#include <iostream>
#include <vector>
-using std::cout;
using std::cerr;
+using std::cout;
using std::endl;
+#include "LauSPlot.hh"
+
#include "TEventList.h"
#include "TFile.h"
#include "TLeaf.h"
#include "TMath.h"
#include "TObjArray.h"
#include "TSystem.h"
#include "TTree.h"
#include "TVirtualFitter.h"
-#include "LauSPlot.hh"
-
-extern void Yields(Int_t &, Double_t *, Double_t &f, Double_t *x, Int_t iflag);
-
-
-
-LauSPlot::LauSPlot(const TString& fileName, const TString& treeName,
- Int_t firstExpt,
- Int_t nExpt,
- const NameSet& variableNames,
- const NumbMap& freeSpecies,
- const NumbMap& fixdSpecies,
- const TwoDMap& twodimPDFs,
- Bool_t sigSplit,
- Bool_t scfDPSmeared) :
- fileName_(fileName),
- inputTreeName_(treeName),
- cnTreeName_(""),
- sweightTreeName_(""),
- file_(0),
- inputTree_(0),
- cnTree_(0),
- sweightTree_(0),
- eventList_(0),
- variableNames_(variableNames),
- freeSpecies_(freeSpecies),
- fixdSpecies_(fixdSpecies),
- origFreeSpecies_(freeSpecies),
- origFixdSpecies_(fixdSpecies),
- twodimPDFs_(twodimPDFs),
- signalSplit_(sigSplit),
- scfDPSmear_(scfDPSmeared),
- readInput_(kFALSE),
- definedCNBranches_(kFALSE),
- definedSWeightBranches_(kFALSE),
- firstExpt_(firstExpt),
- nExpt_(nExpt),
- iExpt_(0),
- nEvents_(0),
- nDiscVars_(variableNames.size()),
- nFreeSpecies_(freeSpecies.size()),
- nFixdSpecies_(fixdSpecies.size()),
- nSpecies_(freeSpecies.size()+fixdSpecies.size())
+extern void Yields( Int_t&, Double_t*, Double_t& f, Double_t* x, Int_t iflag );
+
+LauSPlot::LauSPlot( const TString& fileName,
+ const TString& treeName,
+ Int_t firstExpt,
+ Int_t nExpt,
+ const NameSet& variableNames,
+ const NumbMap& freeSpecies,
+ const NumbMap& fixdSpecies,
+ const TwoDMap& twodimPDFs,
+ Bool_t sigSplit,
+ Bool_t scfDPSmeared ) :
+ fileName_( fileName ),
+ inputTreeName_( treeName ),
+ cnTreeName_( "" ),
+ sweightTreeName_( "" ),
+ file_( 0 ),
+ inputTree_( 0 ),
+ cnTree_( 0 ),
+ sweightTree_( 0 ),
+ eventList_( 0 ),
+ variableNames_( variableNames ),
+ freeSpecies_( freeSpecies ),
+ fixdSpecies_( fixdSpecies ),
+ origFreeSpecies_( freeSpecies ),
+ origFixdSpecies_( fixdSpecies ),
+ twodimPDFs_( twodimPDFs ),
+ signalSplit_( sigSplit ),
+ scfDPSmear_( scfDPSmeared ),
+ readInput_( kFALSE ),
+ definedCNBranches_( kFALSE ),
+ definedSWeightBranches_( kFALSE ),
+ firstExpt_( firstExpt ),
+ nExpt_( nExpt ),
+ iExpt_( 0 ),
+ nEvents_( 0 ),
+ nDiscVars_( variableNames.size() ),
+ nFreeSpecies_( freeSpecies.size() ),
+ nFixdSpecies_( fixdSpecies.size() ),
+ nSpecies_( freeSpecies.size() + fixdSpecies.size() )
{
- this->openInputFileAndTree();
- this->readInputInfo();
- this->createSWeightTree();
- if (nFixdSpecies_>0) {
- this->createCNTree();
- }
+ this->openInputFileAndTree();
+ this->readInputInfo();
+ this->createSWeightTree();
+ if ( nFixdSpecies_ > 0 ) {
+ this->createCNTree();
+ }
}
LauSPlot::~LauSPlot()
{
- // seems that closing the file deletes the tree
- // so only delete if the file is still open
- if (file_ && file_->IsOpen()) {
- delete inputTree_; inputTree_ = 0;
- delete sweightTree_; sweightTree_ = 0;
- delete cnTree_; cnTree_ = 0;
- }
- delete file_; file_ = 0;
+ // seems that closing the file deletes the tree
+ // so only delete if the file is still open
+ if ( file_ && file_->IsOpen() ) {
+ delete inputTree_;
+ inputTree_ = 0;
+ delete sweightTree_;
+ sweightTree_ = 0;
+ delete cnTree_;
+ cnTree_ = 0;
+ }
+ delete file_;
+ file_ = 0;
}
void LauSPlot::openInputFileAndTree()
{
- // first check whether we've already opened up the file or not
- if (!file_) {
- // if not, first check the filename and if all ok create the file
- if (fileName_ == "") {
- cerr<<"ERROR in LauSPlot::createFileAndTree : Bad filename supplied, not creating file or tree."<<endl;
- return;
- }
- file_ = TFile::Open(fileName_, "update");
- if (!file_ || file_->IsZombie() || !file_->IsWritable()) {
- cerr<<"ERROR in LauSPlot::createFileAndTree : Problem opening file \""<<fileName_<<"\" for updating, can't do anything."<<endl;
- return;
- }
- }
- // next open the input tree for reading
- if (!inputTree_) {
- file_->cd();
- inputTree_ = dynamic_cast<TTree*>(file_->Get(inputTreeName_));
- inputTree_->SetDirectory(file_);
- }
+ // first check whether we've already opened up the file or not
+ if ( ! file_ ) {
+ // if not, first check the filename and if all ok create the file
+ if ( fileName_ == "" ) {
+ cerr << "ERROR in LauSPlot::createFileAndTree : Bad filename supplied, not creating file or tree."
+ << endl;
+ return;
+ }
+ file_ = TFile::Open( fileName_, "update" );
+ if ( ! file_ || file_->IsZombie() || ! file_->IsWritable() ) {
+ cerr << "ERROR in LauSPlot::createFileAndTree : Problem opening file \"" << fileName_
+ << "\" for updating, can't do anything." << endl;
+ return;
+ }
+ }
+ // next open the input tree for reading
+ if ( ! inputTree_ ) {
+ file_->cd();
+ inputTree_ = dynamic_cast<TTree*>( file_->Get( inputTreeName_ ) );
+ inputTree_->SetDirectory( file_ );
+ }
}
void LauSPlot::readInputInfo()
{
- // Read the tree and then setup the maps so we know which leaves to
- // read from the tree to get the various PDF values
-
- Bool_t inputOK = this->readInputLeaves();
- if (!inputOK) {
- this->readInput(inputOK);
- return;
- }
-
- inputOK = this->checkLeaves();
- this->readInput(inputOK);
- return;
+ // Read the tree and then setup the maps so we know which leaves to
+ // read from the tree to get the various PDF values
+
+ Bool_t inputOK = this->readInputLeaves();
+ if ( ! inputOK ) {
+ this->readInput( inputOK );
+ return;
+ }
+
+ inputOK = this->checkLeaves();
+ this->readInput( inputOK );
+ return;
}
Bool_t LauSPlot::readInputLeaves()
{
- // Read all the leaves in the tree and store them in the leaves map
-
- if (!inputTree_) {
- cerr<<"ERROR in LauSPlot::readInputInfo : Invalid pointer to data tree."<<endl;
- return kFALSE;
- }
-
- Int_t nBranches = inputTree_ ? static_cast<Int_t>(inputTree_->GetNbranches()) : 0;
- TObjArray* pLeaves = inputTree_->GetListOfLeaves();
- if (!pLeaves) {
- cerr<<"ERROR in LauSPlot::readInputInfo : Problem retrieving leaves from the tree."<<endl;
- return kFALSE;
- }
- TObjArray& leaves = *pLeaves;
-
- if (nBranches > leaves.GetSize()) {
- cerr<<"ERROR in LauSPlot::readInputInfo : List of leaves is smaller than number of branches - this is strange!"<<endl;
- return kFALSE;
- }
-
- for (Int_t iLeaf = 0; iLeaf < nBranches; ++iLeaf) {
-
- TLeaf * leaf = dynamic_cast<TLeaf*>(leaves[iLeaf]);
-
- // we can't deal with arrays
- Int_t size = leaf->GetNdata();
- if (size != 1) {
- cerr<<"ERROR in LauSPlot::readInputInfo : Tree has array branches, can't deal with those."<<endl;
- return kFALSE;
- }
-
- // find the name of the leaf
- TString name = leaf->GetName();
-
- // initialise an entry in the maps to hold the value
- leaves_[name] = leaf;
- }
-
- return kTRUE;
+ // Read all the leaves in the tree and store them in the leaves map
+
+ if ( ! inputTree_ ) {
+ cerr << "ERROR in LauSPlot::readInputInfo : Invalid pointer to data tree." << endl;
+ return kFALSE;
+ }
+
+ Int_t nBranches = inputTree_ ? static_cast<Int_t>( inputTree_->GetNbranches() ) : 0;
+ TObjArray* pLeaves = inputTree_->GetListOfLeaves();
+ if ( ! pLeaves ) {
+ cerr << "ERROR in LauSPlot::readInputInfo : Problem retrieving leaves from the tree." << endl;
+ return kFALSE;
+ }
+ TObjArray& leaves = *pLeaves;
+
+ if ( nBranches > leaves.GetSize() ) {
+ cerr << "ERROR in LauSPlot::readInputInfo : List of leaves is smaller than number of branches - this is strange!"
+ << endl;
+ return kFALSE;
+ }
+
+ for ( Int_t iLeaf = 0; iLeaf < nBranches; ++iLeaf ) {
+
+ TLeaf* leaf = dynamic_cast<TLeaf*>( leaves[iLeaf] );
+
+ // we can't deal with arrays
+ Int_t size = leaf->GetNdata();
+ if ( size != 1 ) {
+ cerr << "ERROR in LauSPlot::readInputInfo : Tree has array branches, can't deal with those."
+ << endl;
+ return kFALSE;
+ }
+
+ // find the name of the leaf
+ TString name = leaf->GetName();
+
+ // initialise an entry in the maps to hold the value
+ leaves_[name] = leaf;
+ }
+
+ return kTRUE;
}
Bool_t LauSPlot::checkLeaves() const
{
- // Analyse the names of the leaves to check that we have a leaf for
- // all bits of information we require, i.e. a likelihood value for
- // each combination of variable and species
-
- // If we have 2D PDFs then we have to look for some extra leaves
- for ( TwoDMap::const_iterator twodim_iter = twodimPDFs_.begin(); twodim_iter != twodimPDFs_.end(); ++twodim_iter ) {
-
- const TString& specName = twodim_iter->first;
- const TString& firstVarName = twodim_iter->second.first;
- const TString& secondVarName = twodim_iter->second.second;
-
- TString expectedName(specName);
- expectedName += firstVarName;
- expectedName += secondVarName;
- expectedName += "Like";
-
- Bool_t found(kFALSE);
- for (LeafMap::const_iterator leaf_iter = leaves_.begin(); leaf_iter != leaves_.end(); ++leaf_iter) {
- const TString& leafName = leaf_iter->first;
- const TLeaf* leaf = leaf_iter->second;
-
- if ((leafName == expectedName) && (leaf != 0)) {
- found = kTRUE;
- break;
- }
- }
-
- if (!found) {
- cerr<<"ERROR in LauSPlot::checkLeaves : Could not find expected leaf \""<<expectedName<<"\"."<<endl;
- return kFALSE;
- }
- }
-
- // Search for all other "standard" leaves, i.e. <species><var>Like
-
- for (NumbMap::const_iterator fixd_iter = fixdSpecies_.begin(); fixd_iter != fixdSpecies_.end(); ++fixd_iter) {
-
- const TString& specName = fixd_iter->first;
-
- // if the signal is split we need to do a dedicated search
- // for sigTM and sigSCF, so skip the signal here
- if ( specName == "sig" && this->signalSplit() ) {
- continue;
- }
-
- for (NameSet::const_iterator vars_iter = variableNames_.begin(); vars_iter != variableNames_.end(); ++vars_iter) {
- const TString& varName = (*vars_iter);
- TString expectedName(specName);
- expectedName += varName;
- expectedName += "Like";
- Bool_t found(kFALSE);
- for (LeafMap::const_iterator leaf_iter = leaves_.begin(); leaf_iter != leaves_.end(); ++leaf_iter) {
- const TString& leafName = leaf_iter->first;
- const TLeaf* leaf = leaf_iter->second;
-
- if ((leafName == expectedName) && (leaf != 0)) {
- found = kTRUE;
- break;
- }
- }
-
- if (!found) {
- cerr<<"ERROR in LauSPlot::checkLeaves : Could not find expected leaf \""<<expectedName<<"\"."<<endl;
- return kFALSE;
- }
- }
- }
-
- for (NumbMap::const_iterator free_iter = freeSpecies_.begin(); free_iter != freeSpecies_.end(); ++free_iter) {
-
- const TString& specName = free_iter->first;
-
- // if the signal is split we need to do a dedicated search
- // for sigTM and sigSCF, so skip the signal here
- if ( specName == "sig" && this->signalSplit() ) {
- continue;
- }
-
- for (NameSet::const_iterator vars_iter = variableNames_.begin(); vars_iter != variableNames_.end(); ++vars_iter) {
- const TString& varName = (*vars_iter);
- TString expectedName(specName);
- expectedName += varName;
- expectedName += "Like";
- Bool_t found(kFALSE);
- for (LeafMap::const_iterator leaf_iter = leaves_.begin(); leaf_iter != leaves_.end(); ++leaf_iter) {
- const TString& leafName = leaf_iter->first;
- const TLeaf* leaf = leaf_iter->second;
-
- if ((leafName == expectedName) && (leaf != 0)) {
- found = kTRUE;
- break;
- }
- }
-
- if (!found) {
- cerr<<"ERROR in LauSPlot::checkLeaves : Could not find expected leaf \""<<expectedName<<"\"."<<endl;
- return kFALSE;
- }
- }
- }
-
- if ( this->signalSplit() ) {
-
- // now need to search for the sigTM and sigSCF leaves
-
- for (NameSet::const_iterator vars_iter = variableNames_.begin(); vars_iter != variableNames_.end(); ++vars_iter) {
- const TString& varName = (*vars_iter);
- TString expectedName("sigTM");
- expectedName += varName;
- expectedName += "Like";
- Bool_t found(kFALSE);
- for (LeafMap::const_iterator leaf_iter = leaves_.begin(); leaf_iter != leaves_.end(); ++leaf_iter) {
- const TString& leafName = leaf_iter->first;
- const TLeaf* leaf = leaf_iter->second;
-
- if ((leafName == expectedName) && (leaf != 0)) {
- found = kTRUE;
- break;
- }
- }
-
- if (!found) {
- cerr<<"ERROR in LauSPlot::checkLeaves : Could not find expected leaf \""<<expectedName<<"\"."<<endl;
- return kFALSE;
- }
-
- expectedName = "sigSCF";
- expectedName += varName;
- expectedName += "Like";
- found = kFALSE;
- for (LeafMap::const_iterator leaf_iter = leaves_.begin(); leaf_iter != leaves_.end(); ++leaf_iter) {
- const TString& leafName = leaf_iter->first;
- const TLeaf* leaf = leaf_iter->second;
-
- if ((leafName == expectedName) && (leaf != 0)) {
- found = kTRUE;
- break;
- }
- }
-
- if (!found) {
- cerr<<"ERROR in LauSPlot::checkLeaves : Could not find expected leaf \""<<expectedName<<"\"."<<endl;
- return kFALSE;
- }
-
- expectedName = "sigSCFFrac";
- found = kFALSE;
- for (LeafMap::const_iterator leaf_iter = leaves_.begin(); leaf_iter != leaves_.end(); ++leaf_iter) {
- const TString& leafName = leaf_iter->first;
- const TLeaf* leaf = leaf_iter->second;
-
- if ((leafName == expectedName) && (leaf != 0)) {
- found = kTRUE;
- break;
- }
- }
-
- if (!found) {
- cerr<<"ERROR in LauSPlot::checkLeaves : Could not find expected leaf \""<<expectedName<<"\"."<<endl;
- return kFALSE;
- }
- }
- }
-
- return kTRUE;
+ // Analyse the names of the leaves to check that we have a leaf for
+ // all bits of information we require, i.e. a likelihood value for
+ // each combination of variable and species
+
+ // If we have 2D PDFs then we have to look for some extra leaves
+ for ( TwoDMap::const_iterator twodim_iter = twodimPDFs_.begin(); twodim_iter != twodimPDFs_.end();
+ ++twodim_iter ) {
+
+ const TString& specName = twodim_iter->first;
+ const TString& firstVarName = twodim_iter->second.first;
+ const TString& secondVarName = twodim_iter->second.second;
+
+ TString expectedName( specName );
+ expectedName += firstVarName;
+ expectedName += secondVarName;
+ expectedName += "Like";
+
+ Bool_t found( kFALSE );
+ for ( LeafMap::const_iterator leaf_iter = leaves_.begin(); leaf_iter != leaves_.end();
+ ++leaf_iter ) {
+ const TString& leafName = leaf_iter->first;
+ const TLeaf* leaf = leaf_iter->second;
+
+ if ( ( leafName == expectedName ) && ( leaf != 0 ) ) {
+ found = kTRUE;
+ break;
+ }
+ }
+
+ if ( ! found ) {
+ cerr << "ERROR in LauSPlot::checkLeaves : Could not find expected leaf \""
+ << expectedName << "\"." << endl;
+ return kFALSE;
+ }
+ }
+
+ // Search for all other "standard" leaves, i.e. <species><var>Like
+
+ for ( NumbMap::const_iterator fixd_iter = fixdSpecies_.begin(); fixd_iter != fixdSpecies_.end();
+ ++fixd_iter ) {
+
+ const TString& specName = fixd_iter->first;
+
+ // if the signal is split we need to do a dedicated search
+ // for sigTM and sigSCF, so skip the signal here
+ if ( specName == "sig" && this->signalSplit() ) {
+ continue;
+ }
+
+ for ( NameSet::const_iterator vars_iter = variableNames_.begin();
+ vars_iter != variableNames_.end();
+ ++vars_iter ) {
+ const TString& varName = ( *vars_iter );
+ TString expectedName( specName );
+ expectedName += varName;
+ expectedName += "Like";
+ Bool_t found( kFALSE );
+ for ( LeafMap::const_iterator leaf_iter = leaves_.begin(); leaf_iter != leaves_.end();
+ ++leaf_iter ) {
+ const TString& leafName = leaf_iter->first;
+ const TLeaf* leaf = leaf_iter->second;
+
+ if ( ( leafName == expectedName ) && ( leaf != 0 ) ) {
+ found = kTRUE;
+ break;
+ }
+ }
+
+ if ( ! found ) {
+ cerr << "ERROR in LauSPlot::checkLeaves : Could not find expected leaf \""
+ << expectedName << "\"." << endl;
+ return kFALSE;
+ }
+ }
+ }
+
+ for ( NumbMap::const_iterator free_iter = freeSpecies_.begin(); free_iter != freeSpecies_.end();
+ ++free_iter ) {
+
+ const TString& specName = free_iter->first;
+
+ // if the signal is split we need to do a dedicated search
+ // for sigTM and sigSCF, so skip the signal here
+ if ( specName == "sig" && this->signalSplit() ) {
+ continue;
+ }
+
+ for ( NameSet::const_iterator vars_iter = variableNames_.begin();
+ vars_iter != variableNames_.end();
+ ++vars_iter ) {
+ const TString& varName = ( *vars_iter );
+ TString expectedName( specName );
+ expectedName += varName;
+ expectedName += "Like";
+ Bool_t found( kFALSE );
+ for ( LeafMap::const_iterator leaf_iter = leaves_.begin(); leaf_iter != leaves_.end();
+ ++leaf_iter ) {
+ const TString& leafName = leaf_iter->first;
+ const TLeaf* leaf = leaf_iter->second;
+
+ if ( ( leafName == expectedName ) && ( leaf != 0 ) ) {
+ found = kTRUE;
+ break;
+ }
+ }
+
+ if ( ! found ) {
+ cerr << "ERROR in LauSPlot::checkLeaves : Could not find expected leaf \""
+ << expectedName << "\"." << endl;
+ return kFALSE;
+ }
+ }
+ }
+
+ if ( this->signalSplit() ) {
+
+ // now need to search for the sigTM and sigSCF leaves
+
+ for ( NameSet::const_iterator vars_iter = variableNames_.begin();
+ vars_iter != variableNames_.end();
+ ++vars_iter ) {
+ const TString& varName = ( *vars_iter );
+ TString expectedName( "sigTM" );
+ expectedName += varName;
+ expectedName += "Like";
+ Bool_t found( kFALSE );
+ for ( LeafMap::const_iterator leaf_iter = leaves_.begin(); leaf_iter != leaves_.end();
+ ++leaf_iter ) {
+ const TString& leafName = leaf_iter->first;
+ const TLeaf* leaf = leaf_iter->second;
+
+ if ( ( leafName == expectedName ) && ( leaf != 0 ) ) {
+ found = kTRUE;
+ break;
+ }
+ }
+
+ if ( ! found ) {
+ cerr << "ERROR in LauSPlot::checkLeaves : Could not find expected leaf \""
+ << expectedName << "\"." << endl;
+ return kFALSE;
+ }
+
+ expectedName = "sigSCF";
+ expectedName += varName;
+ expectedName += "Like";
+ found = kFALSE;
+ for ( LeafMap::const_iterator leaf_iter = leaves_.begin(); leaf_iter != leaves_.end();
+ ++leaf_iter ) {
+ const TString& leafName = leaf_iter->first;
+ const TLeaf* leaf = leaf_iter->second;
+
+ if ( ( leafName == expectedName ) && ( leaf != 0 ) ) {
+ found = kTRUE;
+ break;
+ }
+ }
+
+ if ( ! found ) {
+ cerr << "ERROR in LauSPlot::checkLeaves : Could not find expected leaf \""
+ << expectedName << "\"." << endl;
+ return kFALSE;
+ }
+
+ expectedName = "sigSCFFrac";
+ found = kFALSE;
+ for ( LeafMap::const_iterator leaf_iter = leaves_.begin(); leaf_iter != leaves_.end();
+ ++leaf_iter ) {
+ const TString& leafName = leaf_iter->first;
+ const TLeaf* leaf = leaf_iter->second;
+
+ if ( ( leafName == expectedName ) && ( leaf != 0 ) ) {
+ found = kTRUE;
+ break;
+ }
+ }
+
+ if ( ! found ) {
+ cerr << "ERROR in LauSPlot::checkLeaves : Could not find expected leaf \""
+ << expectedName << "\"." << endl;
+ return kFALSE;
+ }
+ }
+ }
+
+ return kTRUE;
}
void LauSPlot::createCNTree()
{
- // check whether we've already created the tree
- if (!cnTree_) {
- // if not change to the file's directory and create the tree
- cnTreeName_ = inputTreeName_;
- cnTreeName_ += "_cNCoeffs";
- file_->cd();
- cnTree_ = new TTree(cnTreeName_, cnTreeName_);
- cnTree_->SetDirectory(file_);
- this->definedCNBranches(kFALSE);
- }
+ // check whether we've already created the tree
+ if ( ! cnTree_ ) {
+ // if not change to the file's directory and create the tree
+ cnTreeName_ = inputTreeName_;
+ cnTreeName_ += "_cNCoeffs";
+ file_->cd();
+ cnTree_ = new TTree( cnTreeName_, cnTreeName_ );
+ cnTree_->SetDirectory( file_ );
+ this->definedCNBranches( kFALSE );
+ }
}
void LauSPlot::createSWeightTree()
{
- // check whether we've already created the tree
- if (!sweightTree_) {
- // if not change to the file's directory and create the tree
- sweightTreeName_ = inputTreeName_;
- sweightTreeName_ += "_sWeights";
- file_->cd();
- sweightTree_ = new TTree(sweightTreeName_, sweightTreeName_);
- sweightTree_->SetDirectory(file_);
- this->definedSWeightBranches(kFALSE);
- }
+ // check whether we've already created the tree
+ if ( ! sweightTree_ ) {
+ // if not change to the file's directory and create the tree
+ sweightTreeName_ = inputTreeName_;
+ sweightTreeName_ += "_sWeights";
+ file_->cd();
+ sweightTree_ = new TTree( sweightTreeName_, sweightTreeName_ );
+ sweightTree_->SetDirectory( file_ );
+ this->definedSWeightBranches( kFALSE );
+ }
}
void LauSPlot::defineCNBranches()
{
- if (this->definedCNBranches()) {
- cerr<<"ERROR in LauSPlot::defineCNBranches : Already defined branches, not doing it again."<<endl;
- return;
- }
- if (cN_.empty()) {
- cerr<<"ERROR in LauSPlot::defineCNBranches : No entries in the cN container, can't define branches."<<endl;
- return;
- }
- if (!cnTree_) {
- cerr<<"ERROR in LauSPlot::defineCNBranches : Invalid pointer to the tree, can't define branches."<<endl;
- return;
- }
-
- // In the cN tree there is one entry per experiment, so need to know the experiment number.
- cnTree_->Branch("iExpt", &iExpt_, "iExpt/I");
-
- for (std::map<TString,NumbMap>::iterator excl_iter = cN_.begin(); excl_iter != cN_.end(); ++excl_iter) {
- const TString& exclName = excl_iter->first;
- NumbMap& species = excl_iter->second;
- for (NumbMap::iterator spec_iter = species.begin(); spec_iter != species.end(); ++spec_iter) {
- const TString& specName = spec_iter->first;
- Double_t * pointer = &(spec_iter->second);
- TString name(specName); name += "_cN";
- if (exclName == "none") {
- name += "_all";
- } else {
- name += "_no";
- name += exclName;
- }
- TString thirdPart(name); thirdPart += "/D";
- cnTree_->Branch(name, pointer, thirdPart);
- }
- }
- this->definedCNBranches(kTRUE);
+ if ( this->definedCNBranches() ) {
+ cerr << "ERROR in LauSPlot::defineCNBranches : Already defined branches, not doing it again."
+ << endl;
+ return;
+ }
+ if ( cN_.empty() ) {
+ cerr << "ERROR in LauSPlot::defineCNBranches : No entries in the cN container, can't define branches."
+ << endl;
+ return;
+ }
+ if ( ! cnTree_ ) {
+ cerr << "ERROR in LauSPlot::defineCNBranches : Invalid pointer to the tree, can't define branches."
+ << endl;
+ return;
+ }
+
+ // In the cN tree there is one entry per experiment, so need to know the experiment number.
+ cnTree_->Branch( "iExpt", &iExpt_, "iExpt/I" );
+
+ for ( std::map<TString, NumbMap>::iterator excl_iter = cN_.begin(); excl_iter != cN_.end();
+ ++excl_iter ) {
+ const TString& exclName = excl_iter->first;
+ NumbMap& species = excl_iter->second;
+ for ( NumbMap::iterator spec_iter = species.begin(); spec_iter != species.end();
+ ++spec_iter ) {
+ const TString& specName = spec_iter->first;
+ Double_t* pointer = &( spec_iter->second );
+ TString name( specName );
+ name += "_cN";
+ if ( exclName == "none" ) {
+ name += "_all";
+ } else {
+ name += "_no";
+ name += exclName;
+ }
+ TString thirdPart( name );
+ thirdPart += "/D";
+ cnTree_->Branch( name, pointer, thirdPart );
+ }
+ }
+ this->definedCNBranches( kTRUE );
}
void LauSPlot::defineSWeightBranches()
{
- if (this->definedSWeightBranches()) {
- cerr<<"ERROR in LauSPlot::defineSWeightBranches : Already defined branches, not doing it again."<<endl;
- return;
- }
- if (sWeights_.empty()) {
- cerr<<"ERROR in LauSPlot::defineSWeightBranches : No entries in the sWeights container, can't define branches."<<endl;
- return;
- }
- if (!sweightTree_) {
- cerr<<"ERROR in LauSPlot::defineSWeightBranches : Invalid pointer to the tree, can't define branches."<<endl;
- return;
- }
-
- for (std::map<TString,NumbMap>::iterator excl_iter = sWeightsCurrent_.begin(); excl_iter != sWeightsCurrent_.end(); ++excl_iter) {
- const TString& exclName = excl_iter->first;
- NumbMap& species = excl_iter->second;
- for (NumbMap::iterator spec_iter = species.begin(); spec_iter != species.end(); ++spec_iter) {
- const TString& specName = spec_iter->first;
- Double_t * pointer = &(spec_iter->second);
- TString name(specName); name += "_sWeight";
- if (exclName == "none") {
- name += "_all";
- } else {
- name += "_no";
- name += exclName;
- }
- TString thirdPart(name); thirdPart += "/D";
- sweightTree_->Branch(name, pointer, thirdPart);
- }
- }
- this->definedSWeightBranches(kTRUE);
+ if ( this->definedSWeightBranches() ) {
+ cerr << "ERROR in LauSPlot::defineSWeightBranches : Already defined branches, not doing it again."
+ << endl;
+ return;
+ }
+ if ( sWeights_.empty() ) {
+ cerr << "ERROR in LauSPlot::defineSWeightBranches : No entries in the sWeights container, can't define branches."
+ << endl;
+ return;
+ }
+ if ( ! sweightTree_ ) {
+ cerr << "ERROR in LauSPlot::defineSWeightBranches : Invalid pointer to the tree, can't define branches."
+ << endl;
+ return;
+ }
+
+ for ( std::map<TString, NumbMap>::iterator excl_iter = sWeightsCurrent_.begin();
+ excl_iter != sWeightsCurrent_.end();
+ ++excl_iter ) {
+ const TString& exclName = excl_iter->first;
+ NumbMap& species = excl_iter->second;
+ for ( NumbMap::iterator spec_iter = species.begin(); spec_iter != species.end();
+ ++spec_iter ) {
+ const TString& specName = spec_iter->first;
+ Double_t* pointer = &( spec_iter->second );
+ TString name( specName );
+ name += "_sWeight";
+ if ( exclName == "none" ) {
+ name += "_all";
+ } else {
+ name += "_no";
+ name += exclName;
+ }
+ TString thirdPart( name );
+ thirdPart += "/D";
+ sweightTree_->Branch( name, pointer, thirdPart );
+ }
+ }
+ this->definedSWeightBranches( kTRUE );
}
-void LauSPlot::setExperiment(Int_t iExpt)
+void LauSPlot::setExperiment( Int_t iExpt )
{
- if (!inputTree_) {
- cerr<<"ERROR in LauSPlot::setExperiment : Invalid pointer to data tree."<<endl;
- return;
- }
-
- // create the event list if we haven't already done so
- if (!eventList_) {
- eventList_ = new TEventList("splotelist","splotelist");
- eventList_->SetDirectory(file_);
- }
-
- // fill the event list with this experiment's events
- TString listName(eventList_->GetName());
- listName.Prepend(">>");
- TString selection("iExpt==");
- selection += iExpt;
- cout<<"LauSPlot::setExperiment : Setting tree to experiment number "<<iExpt<<"."<<endl;
- inputTree_->Draw(listName,selection);
-
- // find how many events there are
- nEvents_ = eventList_->GetN();
- cout<<" Found "<<nEvents_<<" events."<<endl;
-
- // make sure we have enough space in the per-event value vectors
- pdfTot_.clear(); pdfTot_.resize(nEvents_);
- discPdf_.clear(); discPdf_.resize(nEvents_);
- scfFrac_.clear(); scfFrac_.resize(nEvents_);
- sWeights_.clear(); sWeights_.resize(nEvents_);
-
- // read the info for this experiment
- this->readExpt();
+ if ( ! inputTree_ ) {
+ cerr << "ERROR in LauSPlot::setExperiment : Invalid pointer to data tree." << endl;
+ return;
+ }
+
+ // create the event list if we haven't already done so
+ if ( ! eventList_ ) {
+ eventList_ = new TEventList( "splotelist", "splotelist" );
+ eventList_->SetDirectory( file_ );
+ }
+
+ // fill the event list with this experiment's events
+ TString listName( eventList_->GetName() );
+ listName.Prepend( ">>" );
+ TString selection( "iExpt==" );
+ selection += iExpt;
+ cout << "LauSPlot::setExperiment : Setting tree to experiment number " << iExpt << "." << endl;
+ inputTree_->Draw( listName, selection );
+
+ // find how many events there are
+ nEvents_ = eventList_->GetN();
+ cout << " Found " << nEvents_ << " events." << endl;
+
+ // make sure we have enough space in the per-event value vectors
+ pdfTot_.clear();
+ pdfTot_.resize( nEvents_ );
+ discPdf_.clear();
+ discPdf_.resize( nEvents_ );
+ scfFrac_.clear();
+ scfFrac_.resize( nEvents_ );
+ sWeights_.clear();
+ sWeights_.resize( nEvents_ );
+
+ // read the info for this experiment
+ this->readExpt();
}
void LauSPlot::readExpt()
{
- for (Int_t iEvt(0); iEvt < nEvents_; ++iEvt) {
- // Find which entry from the full tree contains the requested event
- Long64_t iEntry = eventList_ ? eventList_->GetEntry(iEvt) : iEvt;
- if (iEntry<0) { // this shouldn't happen, but just in case...
- cerr<<"ERROR in LauSPlot::readExpt : Problem retrieving event."<<endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // Then retrieve that entry from the tree
- inputTree_->GetEntry(iEntry);
-
- // If needed retrieve the SCF fraction values
- if ( this->signalSplit() ) {
- for (LeafMap::const_iterator leaf_iter = leaves_.begin(); leaf_iter != leaves_.end(); ++leaf_iter) {
- const TString& leafName = leaf_iter->first;
- const TLeaf* leaf = leaf_iter->second;
- if ((leafName == "sigSCFFrac") && (leaf != 0)) {
- scfFrac_[iEvt] = leaf->GetValue();
- break;
- }
- }
- }
-
- // Copy the leaf values into discPdf_
- for ( TwoDMap::const_iterator twodim_iter = twodimPDFs_.begin(); twodim_iter != twodimPDFs_.end(); ++twodim_iter ) {
- const TString& specName = twodim_iter->first;
- const TString& firstVarName = twodim_iter->second.first;
- const TString& secondVarName = twodim_iter->second.second;
-
- TString varName = firstVarName + secondVarName;
-
- TString expectedName(specName);
- expectedName += varName;
- expectedName += "Like";
-
- for (LeafMap::const_iterator leaf_iter = leaves_.begin(); leaf_iter != leaves_.end(); ++leaf_iter) {
- const TString& leafName = leaf_iter->first;
- const TLeaf* leaf = leaf_iter->second;
- if ((leafName == expectedName) && (leaf != 0)) {
- discPdf_[iEvt][specName][varName] = leaf->GetValue();
- break;
- }
- }
- }
-
- Bool_t needSignalSearch(kFALSE);
- for (NumbMap::const_iterator fixd_iter = fixdSpecies_.begin(); fixd_iter != fixdSpecies_.end(); ++fixd_iter) {
- const TString& specName = fixd_iter->first;
-
- // if the signal is split we need to do a dedicated search
- // for sigTM and sigSCF, so skip the signal here
- if ( specName == "sig" && this->signalSplit() ) {
- needSignalSearch = kTRUE;
- continue;
- }
-
- for (NameSet::const_iterator vars_iter = variableNames_.begin(); vars_iter != variableNames_.end(); ++vars_iter) {
- const TString& varName = (*vars_iter);
- TString expectedName(specName);
- expectedName += varName;
- expectedName += "Like";
- for (LeafMap::const_iterator leaf_iter = leaves_.begin(); leaf_iter != leaves_.end(); ++leaf_iter) {
- const TString& leafName = leaf_iter->first;
- const TLeaf* leaf = leaf_iter->second;
- if ((leafName == expectedName) && (leaf != 0)) {
- discPdf_[iEvt][specName][varName] = leaf->GetValue();
- break;
- }
- }
- }
- }
-
- for (NumbMap::const_iterator free_iter = freeSpecies_.begin(); free_iter != freeSpecies_.end(); ++free_iter) {
- const TString& specName = free_iter->first;
-
- // if the signal is split we need to do a dedicated search
- // for sigTM and sigSCF, so skip the signal here
- if ( specName == "sig" && this->signalSplit() ) {
- needSignalSearch = kTRUE;
- continue;
- }
-
- for (NameSet::const_iterator vars_iter = variableNames_.begin(); vars_iter != variableNames_.end(); ++vars_iter) {
- const TString& varName = (*vars_iter);
- TString expectedName(specName);
- expectedName += varName;
- expectedName += "Like";
- for (LeafMap::const_iterator leaf_iter = leaves_.begin(); leaf_iter != leaves_.end(); ++leaf_iter) {
- const TString& leafName = leaf_iter->first;
- const TLeaf* leaf = leaf_iter->second;
- if ((leafName == expectedName) && (leaf != 0)) {
- discPdf_[iEvt][specName][varName] = leaf->GetValue();
- break;
- }
- }
- }
- }
-
- if ( needSignalSearch ) {
- for (NameSet::const_iterator vars_iter = variableNames_.begin(); vars_iter != variableNames_.end(); ++vars_iter) {
- const TString& varName = (*vars_iter);
- TString specName("sigTM");
- TString expectedName(specName);
- expectedName += varName;
- expectedName += "Like";
- for (LeafMap::const_iterator leaf_iter = leaves_.begin(); leaf_iter != leaves_.end(); ++leaf_iter) {
- const TString& leafName = leaf_iter->first;
- const TLeaf* leaf = leaf_iter->second;
- if ((leafName == expectedName) && (leaf != 0)) {
- discPdf_[iEvt][specName][varName] = leaf->GetValue();
- break;
- }
- }
- specName = "sigSCF";
- expectedName = specName;
- expectedName += varName;
- expectedName += "Like";
- for (LeafMap::const_iterator leaf_iter = leaves_.begin(); leaf_iter != leaves_.end(); ++leaf_iter) {
- const TString& leafName = leaf_iter->first;
- const TLeaf* leaf = leaf_iter->second;
- if ((leafName == expectedName) && (leaf != 0)) {
- discPdf_[iEvt][specName][varName] = leaf->GetValue();
- break;
- }
- }
- }
- }
- }
+ for ( Int_t iEvt( 0 ); iEvt < nEvents_; ++iEvt ) {
+ // Find which entry from the full tree contains the requested event
+ Long64_t iEntry = eventList_ ? eventList_->GetEntry( iEvt ) : iEvt;
+ if ( iEntry < 0 ) { // this shouldn't happen, but just in case...
+ cerr << "ERROR in LauSPlot::readExpt : Problem retrieving event." << endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // Then retrieve that entry from the tree
+ inputTree_->GetEntry( iEntry );
+
+ // If needed retrieve the SCF fraction values
+ if ( this->signalSplit() ) {
+ for ( LeafMap::const_iterator leaf_iter = leaves_.begin(); leaf_iter != leaves_.end();
+ ++leaf_iter ) {
+ const TString& leafName = leaf_iter->first;
+ const TLeaf* leaf = leaf_iter->second;
+ if ( ( leafName == "sigSCFFrac" ) && ( leaf != 0 ) ) {
+ scfFrac_[iEvt] = leaf->GetValue();
+ break;
+ }
+ }
+ }
+
+ // Copy the leaf values into discPdf_
+ for ( TwoDMap::const_iterator twodim_iter = twodimPDFs_.begin();
+ twodim_iter != twodimPDFs_.end();
+ ++twodim_iter ) {
+ const TString& specName = twodim_iter->first;
+ const TString& firstVarName = twodim_iter->second.first;
+ const TString& secondVarName = twodim_iter->second.second;
+
+ TString varName = firstVarName + secondVarName;
+
+ TString expectedName( specName );
+ expectedName += varName;
+ expectedName += "Like";
+
+ for ( LeafMap::const_iterator leaf_iter = leaves_.begin(); leaf_iter != leaves_.end();
+ ++leaf_iter ) {
+ const TString& leafName = leaf_iter->first;
+ const TLeaf* leaf = leaf_iter->second;
+ if ( ( leafName == expectedName ) && ( leaf != 0 ) ) {
+ discPdf_[iEvt][specName][varName] = leaf->GetValue();
+ break;
+ }
+ }
+ }
+
+ Bool_t needSignalSearch( kFALSE );
+ for ( NumbMap::const_iterator fixd_iter = fixdSpecies_.begin();
+ fixd_iter != fixdSpecies_.end();
+ ++fixd_iter ) {
+ const TString& specName = fixd_iter->first;
+
+ // if the signal is split we need to do a dedicated search
+ // for sigTM and sigSCF, so skip the signal here
+ if ( specName == "sig" && this->signalSplit() ) {
+ needSignalSearch = kTRUE;
+ continue;
+ }
+
+ for ( NameSet::const_iterator vars_iter = variableNames_.begin();
+ vars_iter != variableNames_.end();
+ ++vars_iter ) {
+ const TString& varName = ( *vars_iter );
+ TString expectedName( specName );
+ expectedName += varName;
+ expectedName += "Like";
+ for ( LeafMap::const_iterator leaf_iter = leaves_.begin(); leaf_iter != leaves_.end();
+ ++leaf_iter ) {
+ const TString& leafName = leaf_iter->first;
+ const TLeaf* leaf = leaf_iter->second;
+ if ( ( leafName == expectedName ) && ( leaf != 0 ) ) {
+ discPdf_[iEvt][specName][varName] = leaf->GetValue();
+ break;
+ }
+ }
+ }
+ }
+
+ for ( NumbMap::const_iterator free_iter = freeSpecies_.begin();
+ free_iter != freeSpecies_.end();
+ ++free_iter ) {
+ const TString& specName = free_iter->first;
+
+ // if the signal is split we need to do a dedicated search
+ // for sigTM and sigSCF, so skip the signal here
+ if ( specName == "sig" && this->signalSplit() ) {
+ needSignalSearch = kTRUE;
+ continue;
+ }
+
+ for ( NameSet::const_iterator vars_iter = variableNames_.begin();
+ vars_iter != variableNames_.end();
+ ++vars_iter ) {
+ const TString& varName = ( *vars_iter );
+ TString expectedName( specName );
+ expectedName += varName;
+ expectedName += "Like";
+ for ( LeafMap::const_iterator leaf_iter = leaves_.begin(); leaf_iter != leaves_.end();
+ ++leaf_iter ) {
+ const TString& leafName = leaf_iter->first;
+ const TLeaf* leaf = leaf_iter->second;
+ if ( ( leafName == expectedName ) && ( leaf != 0 ) ) {
+ discPdf_[iEvt][specName][varName] = leaf->GetValue();
+ break;
+ }
+ }
+ }
+ }
+
+ if ( needSignalSearch ) {
+ for ( NameSet::const_iterator vars_iter = variableNames_.begin();
+ vars_iter != variableNames_.end();
+ ++vars_iter ) {
+ const TString& varName = ( *vars_iter );
+ TString specName( "sigTM" );
+ TString expectedName( specName );
+ expectedName += varName;
+ expectedName += "Like";
+ for ( LeafMap::const_iterator leaf_iter = leaves_.begin(); leaf_iter != leaves_.end();
+ ++leaf_iter ) {
+ const TString& leafName = leaf_iter->first;
+ const TLeaf* leaf = leaf_iter->second;
+ if ( ( leafName == expectedName ) && ( leaf != 0 ) ) {
+ discPdf_[iEvt][specName][varName] = leaf->GetValue();
+ break;
+ }
+ }
+ specName = "sigSCF";
+ expectedName = specName;
+ expectedName += varName;
+ expectedName += "Like";
+ for ( LeafMap::const_iterator leaf_iter = leaves_.begin(); leaf_iter != leaves_.end();
+ ++leaf_iter ) {
+ const TString& leafName = leaf_iter->first;
+ const TLeaf* leaf = leaf_iter->second;
+ if ( ( leafName == expectedName ) && ( leaf != 0 ) ) {
+ discPdf_[iEvt][specName][varName] = leaf->GetValue();
+ break;
+ }
+ }
+ }
+ }
+ }
}
-void LauSPlot::runCalculations(const TString& option)
+void LauSPlot::runCalculations( const TString& option )
{
- // Calculates the sWeights and cN coeffs
- // The option controls the print level:
- // "Q" - no print out (default)
- // "V" - prints the estimated # of events in species
- // "VV" - as "V" + the MINUIT printing + sums of weights for control
-
- if (!this->readInput()) {
- cerr<<"ERROR in LauSPlot::runCalculations : The input ntuple has not been successfully read, can't calculate anything."<<endl;
- return;
- }
-
- if (freeSpecies_.empty()) {
- cerr<<"ERROR in LauSPlot::runCalculations : Numbers of events in species have not been set."<<endl;
- return;
- }
-
- TString opt(option);
- opt.ToUpper();
- opt.ReplaceAll("VV", "W");
-
- // Make sure that global fitter is MINUIT
- this->checkFitter();
-
- // Loop over experiments
- for (iExpt_ = firstExpt_; iExpt_ < (firstExpt_+nExpt_); ++iExpt_) {
-
- this->setExperiment(iExpt_);
-
- if (nEvents_ < 1) {
- cerr<<"ERROR in LauSPlot::runCalculations : Zero events in experiment "<<iExpt_<<", skipping..."<<endl;
- continue;
- }
-
- // Now loop over the PDFs to exclude, including the case where none are to be excluded.
- NameSet excludePdf;
- if (variableNames_.size()<2) {
- excludePdf.insert("none");
- } else {
- excludePdf = variableNames_;
- excludePdf.insert("none");
- }
-
- for (NameSet::const_iterator excl_iter = excludePdf.begin(); excl_iter != excludePdf.end(); ++excl_iter) {
-
- const TString& exclName = (*excl_iter);
-
- cout<<"LauSPlot::runCalculations : Calculating sWeights, excluding PDF: "<<exclName<<"."<<endl;
-
- // Calculate the per-event total PDF values for each species.
- this->calcTotPDFValues(exclName);
-
- // Reset the fitter
- this->initialiseFitter(opt);
-
- // Set the parameters to their initial values
- this->setFitParameters();
-
- // Run the fit
- this->runFit();
-
- // Get the fitted parameter values back
- this->retrieveFittedParameters(opt);
-
- // Get the covariance matrix
- Bool_t covMatOK = this->calcCovMatrix();
- Double_t * covmat(0);
- if (!covMatOK) {
- TVirtualFitter * fitter = TVirtualFitter::GetFitter();
- covmat = fitter->GetCovarianceMatrix();
- }
- if (opt.Contains("W")) {
- this->printCovMatrixElements(covmat);
- }
-
- // calculate the cN and sWeights from the covariance matrix
- if (nFixdSpecies_ > 0) {
- this->calcCNCoeffs(exclName, covmat);
- }
- this->calcSWeights(exclName, covmat);
-
- // print verbose info if required
- if (opt.Contains("W")) {
- this->printSumOfWeights(exclName);
- }
- }
-
- // Finally fill all the branches for this experiment
- if (nFixdSpecies_ > 0) {
- this->fillCNBranches();
- }
- this->fillSWeightBranches();
- }
+ // Calculates the sWeights and cN coeffs
+ // The option controls the print level:
+ // "Q" - no print out (default)
+ // "V" - prints the estimated # of events in species
+ // "VV" - as "V" + the MINUIT printing + sums of weights for control
+
+ if ( ! this->readInput() ) {
+ cerr << "ERROR in LauSPlot::runCalculations : The input ntuple has not been successfully read, can't calculate anything."
+ << endl;
+ return;
+ }
+
+ if ( freeSpecies_.empty() ) {
+ cerr << "ERROR in LauSPlot::runCalculations : Numbers of events in species have not been set."
+ << endl;
+ return;
+ }
+
+ TString opt( option );
+ opt.ToUpper();
+ opt.ReplaceAll( "VV", "W" );
+
+ // Make sure that global fitter is MINUIT
+ this->checkFitter();
+
+ // Loop over experiments
+ for ( iExpt_ = firstExpt_; iExpt_ < ( firstExpt_ + nExpt_ ); ++iExpt_ ) {
+
+ this->setExperiment( iExpt_ );
+
+ if ( nEvents_ < 1 ) {
+ cerr << "ERROR in LauSPlot::runCalculations : Zero events in experiment " << iExpt_
+ << ", skipping..." << endl;
+ continue;
+ }
+
+ // Now loop over the PDFs to exclude, including the case where none are to be excluded.
+ NameSet excludePdf;
+ if ( variableNames_.size() < 2 ) {
+ excludePdf.insert( "none" );
+ } else {
+ excludePdf = variableNames_;
+ excludePdf.insert( "none" );
+ }
+
+ for ( NameSet::const_iterator excl_iter = excludePdf.begin(); excl_iter != excludePdf.end();
+ ++excl_iter ) {
+
+ const TString& exclName = ( *excl_iter );
+
+ cout << "LauSPlot::runCalculations : Calculating sWeights, excluding PDF: " << exclName
+ << "." << endl;
+
+ // Calculate the per-event total PDF values for each species.
+ this->calcTotPDFValues( exclName );
+
+ // Reset the fitter
+ this->initialiseFitter( opt );
+
+ // Set the parameters to their initial values
+ this->setFitParameters();
+
+ // Run the fit
+ this->runFit();
+
+ // Get the fitted parameter values back
+ this->retrieveFittedParameters( opt );
+
+ // Get the covariance matrix
+ Bool_t covMatOK = this->calcCovMatrix();
+ Double_t* covmat( 0 );
+ if ( ! covMatOK ) {
+ TVirtualFitter* fitter = TVirtualFitter::GetFitter();
+ covmat = fitter->GetCovarianceMatrix();
+ }
+ if ( opt.Contains( "W" ) ) {
+ this->printCovMatrixElements( covmat );
+ }
+
+ // calculate the cN and sWeights from the covariance matrix
+ if ( nFixdSpecies_ > 0 ) {
+ this->calcCNCoeffs( exclName, covmat );
+ }
+ this->calcSWeights( exclName, covmat );
+
+ // print verbose info if required
+ if ( opt.Contains( "W" ) ) {
+ this->printSumOfWeights( exclName );
+ }
+ }
+
+ // Finally fill all the branches for this experiment
+ if ( nFixdSpecies_ > 0 ) {
+ this->fillCNBranches();
+ }
+ this->fillSWeightBranches();
+ }
}
void LauSPlot::checkFitter() const
{
- TString minuitName("TFitter");
- TVirtualFitter * fitter = TVirtualFitter::GetFitter();
- if (fitter) {
- TString fitterName(fitter->IsA()->GetName());
- if (fitterName != minuitName) {
- delete fitter; fitter = 0;
- }
- }
- fitter = TVirtualFitter::Fitter(0);
+ TString minuitName( "TFitter" );
+ TVirtualFitter* fitter = TVirtualFitter::GetFitter();
+ if ( fitter ) {
+ TString fitterName( fitter->IsA()->GetName() );
+ if ( fitterName != minuitName ) {
+ delete fitter;
+ fitter = 0;
+ }
+ }
+ fitter = TVirtualFitter::Fitter( 0 );
}
-void LauSPlot::initialiseFitter(const TString& opt)
+void LauSPlot::initialiseFitter( const TString& opt )
{
- TVirtualFitter * fitter = TVirtualFitter::GetFitter();
- fitter->Clear();
- fitter->SetFCN(Yields);
- fitter->SetObjectFit(this);
-
- // Set the print level
- Double_t arglist[10];
- if (opt.Contains("Q")) {
- arglist[0]=-1;
- }
- if (opt.Contains("V")) {
- arglist[0]=0;
- }
- if (opt.Contains("W")) {
- arglist[0]=1;
- }
- fitter->ExecuteCommand("SET PRINT", arglist, 1);
-
- // Need to set the "SET ERR" command to +0.5 for +/-1 sigma errors
- // for maximum likelihood fit.
- arglist[0] = 0.5;
- fitter->ExecuteCommand("SET ERR", arglist, 1);
+ TVirtualFitter* fitter = TVirtualFitter::GetFitter();
+ fitter->Clear();
+ fitter->SetFCN( Yields );
+ fitter->SetObjectFit( this );
+
+ // Set the print level
+ Double_t arglist[10];
+ if ( opt.Contains( "Q" ) ) {
+ arglist[0] = -1;
+ }
+ if ( opt.Contains( "V" ) ) {
+ arglist[0] = 0;
+ }
+ if ( opt.Contains( "W" ) ) {
+ arglist[0] = 1;
+ }
+ fitter->ExecuteCommand( "SET PRINT", arglist, 1 );
+
+ // Need to set the "SET ERR" command to +0.5 for +/-1 sigma errors
+ // for maximum likelihood fit.
+ arglist[0] = 0.5;
+ fitter->ExecuteCommand( "SET ERR", arglist, 1 );
}
void LauSPlot::setFitParameters() const
{
- TVirtualFitter * fitter = TVirtualFitter::GetFitter();
-
- // must add the parameters in the same order as they are stored in pdfTot_
- Int_t ispecies(0);
- const NumbMap& species = pdfTot_.front();
-
- for (NumbMap::const_iterator spec_iter = species.begin(); spec_iter != species.end(); ++spec_iter) {
- const TString& name(spec_iter->first);
-
- // starting parameters should be the original values,
- // not those that came out of the last fit
- NumbMap::const_iterator free_iter = origFreeSpecies_.find(name);
- NumbMap::const_iterator fixd_iter = origFixdSpecies_.find(name);
- Bool_t fixed = fixd_iter != origFixdSpecies_.end();
-
- Double_t value(0.0);
- if (fixed) {
- value = fixd_iter->second;
- } else {
- value = free_iter->second;
- }
- fitter->SetParameter(ispecies, name, value, 1, 0, 0);
- if (fixed) {
- fitter->FixParameter(ispecies);
- }
- ++ispecies;
- }
+ TVirtualFitter* fitter = TVirtualFitter::GetFitter();
+
+ // must add the parameters in the same order as they are stored in pdfTot_
+ Int_t ispecies( 0 );
+ const NumbMap& species = pdfTot_.front();
+
+ for ( NumbMap::const_iterator spec_iter = species.begin(); spec_iter != species.end();
+ ++spec_iter ) {
+ const TString& name( spec_iter->first );
+
+ // starting parameters should be the original values,
+ // not those that came out of the last fit
+ NumbMap::const_iterator free_iter = origFreeSpecies_.find( name );
+ NumbMap::const_iterator fixd_iter = origFixdSpecies_.find( name );
+ Bool_t fixed = fixd_iter != origFixdSpecies_.end();
+
+ Double_t value( 0.0 );
+ if ( fixed ) {
+ value = fixd_iter->second;
+ } else {
+ value = free_iter->second;
+ }
+ fitter->SetParameter( ispecies, name, value, 1, 0, 0 );
+ if ( fixed ) {
+ fitter->FixParameter( ispecies );
+ }
+ ++ispecies;
+ }
}
void LauSPlot::runFit()
{
- TVirtualFitter * fitter = TVirtualFitter::GetFitter();
-
- Double_t arglist[10];
- arglist[0] = 1000*nFreeSpecies_; // maximum iterations
- arglist[1] = 0.05; // tolerance : min EDM = 0.001*tolerance
-
- // Execute MIGRAD
- Int_t fitStatus = fitter->ExecuteCommand("MIGRAD", arglist, 2);
-
- if (fitStatus != 0) {
- cerr<<"ERROR in LauSPlot::runFit : Error during MIGRAD minimisation."<<endl;
- } else {
- // Execute HESSE
- fitStatus = fitter->ExecuteCommand("HESSE", arglist, 1);
- if (fitStatus != 0) {
- cerr<<"ERROR in LauSPlot::runFit : Error during HESSE error calculation."<<endl;
- }
- }
+ TVirtualFitter* fitter = TVirtualFitter::GetFitter();
+
+ Double_t arglist[10];
+ arglist[0] = 1000 * nFreeSpecies_; // maximum iterations
+ arglist[1] = 0.05; // tolerance : min EDM = 0.001*tolerance
+
+ // Execute MIGRAD
+ Int_t fitStatus = fitter->ExecuteCommand( "MIGRAD", arglist, 2 );
+
+ if ( fitStatus != 0 ) {
+ cerr << "ERROR in LauSPlot::runFit : Error during MIGRAD minimisation." << endl;
+ } else {
+ // Execute HESSE
+ fitStatus = fitter->ExecuteCommand( "HESSE", arglist, 1 );
+ if ( fitStatus != 0 ) {
+ cerr << "ERROR in LauSPlot::runFit : Error during HESSE error calculation." << endl;
+ }
+ }
}
-void LauSPlot::printCovMatrixElements(const Double_t * covmat) const
+void LauSPlot::printCovMatrixElements( const Double_t* covmat ) const
{
- Int_t a(0);
- cout<<endl;
- for (NumbMap::const_iterator iter_a = freeSpecies_.begin(); iter_a != freeSpecies_.end(); ++iter_a) {
- Int_t b(0);
- for (NumbMap::const_iterator iter_b = freeSpecies_.begin(); iter_b != freeSpecies_.end(); ++iter_b) {
- if (covmat) {
- cout<<"CovMat Elem: ["<<iter_a->first<<","<<iter_b->first<<"] = "<<covmat[a*nSpecies_+b]<<endl;
- } else {
- cout<<"CovMat Elem: ["<<iter_a->first<<","<<iter_b->first<<"] = "<<covMat_(a,b)<<endl;
- }
- ++b;
- }
- ++a;
- }
- cout<<endl;
-
- if (!covmat) {
- covMat_.Print();
- }
+ Int_t a( 0 );
+ cout << endl;
+ for ( NumbMap::const_iterator iter_a = freeSpecies_.begin(); iter_a != freeSpecies_.end();
+ ++iter_a ) {
+ Int_t b( 0 );
+ for ( NumbMap::const_iterator iter_b = freeSpecies_.begin(); iter_b != freeSpecies_.end();
+ ++iter_b ) {
+ if ( covmat ) {
+ cout << "CovMat Elem: [" << iter_a->first << "," << iter_b->first
+ << "] = " << covmat[a * nSpecies_ + b] << endl;
+ } else {
+ cout << "CovMat Elem: [" << iter_a->first << "," << iter_b->first
+ << "] = " << covMat_( a, b ) << endl;
+ }
+ ++b;
+ }
+ ++a;
+ }
+ cout << endl;
+
+ if ( ! covmat ) {
+ covMat_.Print();
+ }
}
-void LauSPlot::retrieveFittedParameters(const TString& opt)
+void LauSPlot::retrieveFittedParameters( const TString& opt )
{
- TVirtualFitter * fitter = TVirtualFitter::GetFitter();
-
- // remember fit parameters are in same order as in pdfTot_
- Int_t ispecies(0);
- const NumbMap& species = pdfTot_.front();
-
- for (NumbMap::const_iterator spec_iter = species.begin(); spec_iter != species.end(); ++spec_iter) {
- const TString& name(spec_iter->first);
- NumbMap::iterator free_iter = freeSpecies_.find(name);
- if (free_iter != freeSpecies_.end()) {
- free_iter->second = fitter->GetParameter(ispecies);
- if (!opt.Contains("Q")) {
- cout<<"Estimated # of events in species "<<name<<" = "<<free_iter->second<<endl;
- }
- }
- ++ispecies;
- }
- if (!opt.Contains("Q")) {cout<<endl;}
+ TVirtualFitter* fitter = TVirtualFitter::GetFitter();
+
+ // remember fit parameters are in same order as in pdfTot_
+ Int_t ispecies( 0 );
+ const NumbMap& species = pdfTot_.front();
+
+ for ( NumbMap::const_iterator spec_iter = species.begin(); spec_iter != species.end();
+ ++spec_iter ) {
+ const TString& name( spec_iter->first );
+ NumbMap::iterator free_iter = freeSpecies_.find( name );
+ if ( free_iter != freeSpecies_.end() ) {
+ free_iter->second = fitter->GetParameter( ispecies );
+ if ( ! opt.Contains( "Q" ) ) {
+ cout << "Estimated # of events in species " << name << " = " << free_iter->second
+ << endl;
+ }
+ }
+ ++ispecies;
+ }
+ if ( ! opt.Contains( "Q" ) ) {
+ cout << endl;
+ }
}
-void LauSPlot::printSumOfWeights(const TString& exclName) const
+void LauSPlot::printSumOfWeights( const TString& exclName ) const
{
- for (NumbMap::const_iterator spec_iter = freeSpecies_.begin(); spec_iter != freeSpecies_.end(); ++spec_iter) {
- const TString& specName = spec_iter->first;
- Double_t sumweight(0.0);
- for (Int_t iEvt(0); iEvt < nEvents_; ++iEvt) {
- const NumbMap& specWeightMap = sWeights_[iEvt].find(exclName)->second;
- Double_t weight = specWeightMap.find(specName)->second;
- sumweight += weight;
- }
- cout<<"Sum of sWeights for species \""<<specName<<"\" = "<<sumweight<<endl;
- }
- cout<<endl;
+ for ( NumbMap::const_iterator spec_iter = freeSpecies_.begin(); spec_iter != freeSpecies_.end();
+ ++spec_iter ) {
+ const TString& specName = spec_iter->first;
+ Double_t sumweight( 0.0 );
+ for ( Int_t iEvt( 0 ); iEvt < nEvents_; ++iEvt ) {
+ const NumbMap& specWeightMap = sWeights_[iEvt].find( exclName )->second;
+ Double_t weight = specWeightMap.find( specName )->second;
+ sumweight += weight;
+ }
+ cout << "Sum of sWeights for species \"" << specName << "\" = " << sumweight << endl;
+ }
+ cout << endl;
}
Bool_t LauSPlot::calcCovMatrix()
{
- // Calculate our inverse covariance matrix from the various PDFs
-
- TMatrixD invMatrix(nFreeSpecies_,nFreeSpecies_);
-
- // First calculate the denominator, which is common to all elements
- std::vector<Double_t> denominator(nEvents_);
- for (Int_t iEvt(0); iEvt<nEvents_; ++iEvt) {
- denominator[iEvt] = 0.0;
- for (NumbMap::const_iterator spec_iter = freeSpecies_.begin(); spec_iter != freeSpecies_.end(); ++spec_iter) {
- const TString& specName = spec_iter->first;
- Double_t specNumEvents = spec_iter->second;
- denominator[iEvt] += specNumEvents * pdfTot_[iEvt][specName];
- }
- for (NumbMap::const_iterator spec_iter = fixdSpecies_.begin(); spec_iter != fixdSpecies_.end(); ++spec_iter) {
- const TString& specName = spec_iter->first;
- Double_t specNumEvents = spec_iter->second;
- denominator[iEvt] += specNumEvents * pdfTot_[iEvt][specName];
- }
- // Square to get the final denominator
- denominator[iEvt] *= denominator[iEvt];
- }
-
- // Then calculate each element
- Int_t i(0);
- for (NumbMap::const_iterator spec_iter_i = freeSpecies_.begin(); spec_iter_i != freeSpecies_.end(); ++spec_iter_i) {
- const TString& specName_i = spec_iter_i->first;
- Int_t j(0);
- for (NumbMap::const_iterator spec_iter_j = freeSpecies_.begin(); spec_iter_j != freeSpecies_.end(); ++spec_iter_j) {
- const TString& specName_j = spec_iter_j->first;
- invMatrix(i,j) = 0.0;
- for (Int_t iEvt(0); iEvt<nEvents_; ++iEvt) {
- Double_t numerator = pdfTot_[iEvt][specName_i] * pdfTot_[iEvt][specName_j];
- invMatrix(i,j) += numerator/denominator[iEvt];
- }
- ++j;
- }
- ++i;
- }
-
- // Check for a singular matrix
- if (invMatrix.Determinant() < 1e-15) {
- cerr<<"ERROR in LauSPlot::calcCovMatrix : Calculated inverse covariance matrix is singular, can't invert it."<<endl;
- return kFALSE;
- }
-
- // Invert and store in the covariance matrix
- covMat_.ResizeTo(nFreeSpecies_,nFreeSpecies_);
- covMat_ = TMatrixD(TMatrixD::kInverted, invMatrix);
-
- return kTRUE;
+ // Calculate our inverse covariance matrix from the various PDFs
+
+ TMatrixD invMatrix( nFreeSpecies_, nFreeSpecies_ );
+
+ // First calculate the denominator, which is common to all elements
+ std::vector<Double_t> denominator( nEvents_ );
+ for ( Int_t iEvt( 0 ); iEvt < nEvents_; ++iEvt ) {
+ denominator[iEvt] = 0.0;
+ for ( NumbMap::const_iterator spec_iter = freeSpecies_.begin();
+ spec_iter != freeSpecies_.end();
+ ++spec_iter ) {
+ const TString& specName = spec_iter->first;
+ Double_t specNumEvents = spec_iter->second;
+ denominator[iEvt] += specNumEvents * pdfTot_[iEvt][specName];
+ }
+ for ( NumbMap::const_iterator spec_iter = fixdSpecies_.begin();
+ spec_iter != fixdSpecies_.end();
+ ++spec_iter ) {
+ const TString& specName = spec_iter->first;
+ Double_t specNumEvents = spec_iter->second;
+ denominator[iEvt] += specNumEvents * pdfTot_[iEvt][specName];
+ }
+ // Square to get the final denominator
+ denominator[iEvt] *= denominator[iEvt];
+ }
+
+ // Then calculate each element
+ Int_t i( 0 );
+ for ( NumbMap::const_iterator spec_iter_i = freeSpecies_.begin();
+ spec_iter_i != freeSpecies_.end();
+ ++spec_iter_i ) {
+ const TString& specName_i = spec_iter_i->first;
+ Int_t j( 0 );
+ for ( NumbMap::const_iterator spec_iter_j = freeSpecies_.begin();
+ spec_iter_j != freeSpecies_.end();
+ ++spec_iter_j ) {
+ const TString& specName_j = spec_iter_j->first;
+ invMatrix( i, j ) = 0.0;
+ for ( Int_t iEvt( 0 ); iEvt < nEvents_; ++iEvt ) {
+ Double_t numerator = pdfTot_[iEvt][specName_i] * pdfTot_[iEvt][specName_j];
+ invMatrix( i, j ) += numerator / denominator[iEvt];
+ }
+ ++j;
+ }
+ ++i;
+ }
+
+ // Check for a singular matrix
+ if ( invMatrix.Determinant() < 1e-15 ) {
+ cerr << "ERROR in LauSPlot::calcCovMatrix : Calculated inverse covariance matrix is singular, can't invert it."
+ << endl;
+ return kFALSE;
+ }
+
+ // Invert and store in the covariance matrix
+ covMat_.ResizeTo( nFreeSpecies_, nFreeSpecies_ );
+ covMat_ = TMatrixD( TMatrixD::kInverted, invMatrix );
+
+ return kTRUE;
}
-void LauSPlot::calcTotPDFValues(const TString& exclName)
+void LauSPlot::calcTotPDFValues( const TString& exclName )
{
- for (Int_t iEvt(0); iEvt<nEvents_; iEvt++) {
-
- Bool_t needSignalSearch(kFALSE);
-
- for (NumbMap::const_iterator spec_iter = fixdSpecies_.begin(); spec_iter != fixdSpecies_.end(); ++spec_iter) {
- const TString& specName = spec_iter->first;
-
- // if the signal is split we need to do a dedicated search
- // for sigTM and sigSCF, so skip the signal here
- if ( specName == "sig" && this->signalSplit() ) {
- needSignalSearch = kTRUE;
- continue;
- }
-
- pdfTot_[iEvt][specName] = 1.0;
-
- // loop through the 2D histo list
- NameSet skipList;
- for ( TwoDMap::const_iterator twodim_iter = twodimPDFs_.begin(); twodim_iter != twodimPDFs_.end(); ++twodim_iter ) {
- // if the entry doesn't refer to this
- // species then skip on
- if ( specName != twodim_iter->first ) {
- continue;
- }
-
- // retrieve the two variable names
- const TString& firstVarName = twodim_iter->second.first;
- const TString& secondVarName = twodim_iter->second.second;
- if ( firstVarName != exclName && secondVarName != exclName ) {
- // if neither name is the one being excluded then...
- // add them both to the skip list
- skipList.insert( firstVarName );
- skipList.insert( secondVarName );
- // and multiply the total by the combined PDF value
- TString varName = firstVarName + secondVarName;
- pdfTot_[iEvt][specName] *= discPdf_[iEvt][specName][varName];
- }
- }
-
- // loop through all the variables
- for (NameSet::const_iterator var_iter = variableNames_.begin(); var_iter != variableNames_.end(); ++var_iter) {
- const TString& varName = (*var_iter);
- // if the variable isn't the one being excluded
- if (exclName != varName) {
- // and it's not involved in a 2D PDF
- if ( skipList.find(varName) == skipList.end() ) {
- // multiply the total by its PDF value
- pdfTot_[iEvt][specName] *= discPdf_[iEvt][specName][varName];
- }
- }
- }
- }
-
- for (NumbMap::const_iterator spec_iter = freeSpecies_.begin(); spec_iter != freeSpecies_.end(); ++spec_iter) {
- const TString& specName = spec_iter->first;
-
- // if the signal is split we need to do a dedicated search
- // for sigTM and sigSCF, so skip the signal here
- if ( specName == "sig" && this->signalSplit() ) {
- needSignalSearch = kTRUE;
- continue;
- }
-
- pdfTot_[iEvt][specName] = 1.0;
-
- // loop through the 2D histo list
- NameSet skipList;
- for ( TwoDMap::const_iterator twodim_iter = twodimPDFs_.begin(); twodim_iter != twodimPDFs_.end(); ++twodim_iter ) {
- // if the entry doesn't refer to this
- // species then skip on
- if ( specName != twodim_iter->first ) {
- continue;
- }
-
- // retrieve the two variable names
- const TString& firstVarName = twodim_iter->second.first;
- const TString& secondVarName = twodim_iter->second.second;
- if ( firstVarName != exclName && secondVarName != exclName ) {
- // if neither name is the one being excluded then...
- // add them both to the skip list
- skipList.insert( firstVarName );
- skipList.insert( secondVarName );
- // and multiply the total by the combined PDF value
- TString varName = firstVarName + secondVarName;
- pdfTot_[iEvt][specName] *= discPdf_[iEvt][specName][varName];
- }
- }
-
- // loop through all the variables
- for (NameSet::const_iterator var_iter = variableNames_.begin(); var_iter != variableNames_.end(); ++var_iter) {
- const TString& varName = (*var_iter);
- // if the variable isn't the one being excluded
- if (exclName != varName) {
- // and it's not involved in a 2D PDF
- if ( skipList.find(varName) == skipList.end() ) {
- // multiply the total by its PDF value
- pdfTot_[iEvt][specName] *= discPdf_[iEvt][specName][varName];
- }
- }
- }
- }
-
- if ( needSignalSearch ) {
-
- // loop through the 2D histo list
- TString specName("sigTM");
- Double_t tmPDFVal(1.0);
- NameSet skipList;
- for ( TwoDMap::const_iterator twodim_iter = twodimPDFs_.begin(); twodim_iter != twodimPDFs_.end(); ++twodim_iter ) {
- // if the entry doesn't refer to this
- // species then skip on
- if ( specName != twodim_iter->first ) {
- continue;
- }
-
- // retrieve the two variable names
- const TString& firstVarName = twodim_iter->second.first;
- const TString& secondVarName = twodim_iter->second.second;
- if ( firstVarName != exclName && secondVarName != exclName ) {
- // if neither name is the one being excluded then...
- // add them both to the skip list
- skipList.insert( firstVarName );
- skipList.insert( secondVarName );
- // and multiply the total by the combined PDF value
- TString varName = firstVarName + secondVarName;
- tmPDFVal *= discPdf_[iEvt][specName][varName];
- }
- }
-
- // loop through all the variables
- for (NameSet::const_iterator var_iter = variableNames_.begin(); var_iter != variableNames_.end(); ++var_iter) {
- const TString& varName = (*var_iter);
- // if the variable isn't the one being excluded
- if (exclName != varName) {
- // and it's not involved in a 2D PDF
- if ( skipList.find(varName) == skipList.end() ) {
- // multiply the total by its PDF value
- tmPDFVal *= discPdf_[iEvt][specName][varName];
- }
- }
- }
-
- tmPDFVal *= (1.0 - scfFrac_[iEvt]);
-
-
- // loop through the 2D histo list
- specName = "sigSCF";
- Double_t scfPDFVal(1.0);
- skipList.clear();
- for ( TwoDMap::const_iterator twodim_iter = twodimPDFs_.begin(); twodim_iter != twodimPDFs_.end(); ++twodim_iter ) {
- // if the entry doesn't refer to this
- // species then skip on
- if ( specName != twodim_iter->first ) {
- continue;
- }
-
- // retrieve the two variable names
- const TString& firstVarName = twodim_iter->second.first;
- const TString& secondVarName = twodim_iter->second.second;
- if ( firstVarName != exclName && secondVarName != exclName ) {
- // if neither name is the one being excluded then...
- // add them both to the skip list
- skipList.insert( firstVarName );
- skipList.insert( secondVarName );
- // and multiply the total by the combined PDF value
- TString varName = firstVarName + secondVarName;
- scfPDFVal *= discPdf_[iEvt][specName][varName];
- }
- }
-
- // loop through all the variables
- for (NameSet::const_iterator var_iter = variableNames_.begin(); var_iter != variableNames_.end(); ++var_iter) {
- const TString& varName = (*var_iter);
- // if the variable isn't the one being excluded
- if (exclName != varName) {
- // and it's not involved in a 2D PDF
- if ( skipList.find(varName) == skipList.end() ) {
- // multiply the total by its PDF value
- scfPDFVal *= discPdf_[iEvt][specName][varName];
- }
- }
- }
-
- if ( exclName == "DP" || !this->scfDPSmear() ) {
- scfPDFVal *= scfFrac_[iEvt];
- }
-
- pdfTot_[iEvt]["sig"] = tmPDFVal + scfPDFVal;
- }
- }
+ for ( Int_t iEvt( 0 ); iEvt < nEvents_; iEvt++ ) {
+
+ Bool_t needSignalSearch( kFALSE );
+
+ for ( NumbMap::const_iterator spec_iter = fixdSpecies_.begin();
+ spec_iter != fixdSpecies_.end();
+ ++spec_iter ) {
+ const TString& specName = spec_iter->first;
+
+ // if the signal is split we need to do a dedicated search
+ // for sigTM and sigSCF, so skip the signal here
+ if ( specName == "sig" && this->signalSplit() ) {
+ needSignalSearch = kTRUE;
+ continue;
+ }
+
+ pdfTot_[iEvt][specName] = 1.0;
+
+ // loop through the 2D histo list
+ NameSet skipList;
+ for ( TwoDMap::const_iterator twodim_iter = twodimPDFs_.begin();
+ twodim_iter != twodimPDFs_.end();
+ ++twodim_iter ) {
+ // if the entry doesn't refer to this
+ // species then skip on
+ if ( specName != twodim_iter->first ) {
+ continue;
+ }
+
+ // retrieve the two variable names
+ const TString& firstVarName = twodim_iter->second.first;
+ const TString& secondVarName = twodim_iter->second.second;
+ if ( firstVarName != exclName && secondVarName != exclName ) {
+ // if neither name is the one being excluded then...
+ // add them both to the skip list
+ skipList.insert( firstVarName );
+ skipList.insert( secondVarName );
+ // and multiply the total by the combined PDF value
+ TString varName = firstVarName + secondVarName;
+ pdfTot_[iEvt][specName] *= discPdf_[iEvt][specName][varName];
+ }
+ }
+
+ // loop through all the variables
+ for ( NameSet::const_iterator var_iter = variableNames_.begin();
+ var_iter != variableNames_.end();
+ ++var_iter ) {
+ const TString& varName = ( *var_iter );
+ // if the variable isn't the one being excluded
+ if ( exclName != varName ) {
+ // and it's not involved in a 2D PDF
+ if ( skipList.find( varName ) == skipList.end() ) {
+ // multiply the total by its PDF value
+ pdfTot_[iEvt][specName] *= discPdf_[iEvt][specName][varName];
+ }
+ }
+ }
+ }
+
+ for ( NumbMap::const_iterator spec_iter = freeSpecies_.begin();
+ spec_iter != freeSpecies_.end();
+ ++spec_iter ) {
+ const TString& specName = spec_iter->first;
+
+ // if the signal is split we need to do a dedicated search
+ // for sigTM and sigSCF, so skip the signal here
+ if ( specName == "sig" && this->signalSplit() ) {
+ needSignalSearch = kTRUE;
+ continue;
+ }
+
+ pdfTot_[iEvt][specName] = 1.0;
+
+ // loop through the 2D histo list
+ NameSet skipList;
+ for ( TwoDMap::const_iterator twodim_iter = twodimPDFs_.begin();
+ twodim_iter != twodimPDFs_.end();
+ ++twodim_iter ) {
+ // if the entry doesn't refer to this
+ // species then skip on
+ if ( specName != twodim_iter->first ) {
+ continue;
+ }
+
+ // retrieve the two variable names
+ const TString& firstVarName = twodim_iter->second.first;
+ const TString& secondVarName = twodim_iter->second.second;
+ if ( firstVarName != exclName && secondVarName != exclName ) {
+ // if neither name is the one being excluded then...
+ // add them both to the skip list
+ skipList.insert( firstVarName );
+ skipList.insert( secondVarName );
+ // and multiply the total by the combined PDF value
+ TString varName = firstVarName + secondVarName;
+ pdfTot_[iEvt][specName] *= discPdf_[iEvt][specName][varName];
+ }
+ }
+
+ // loop through all the variables
+ for ( NameSet::const_iterator var_iter = variableNames_.begin();
+ var_iter != variableNames_.end();
+ ++var_iter ) {
+ const TString& varName = ( *var_iter );
+ // if the variable isn't the one being excluded
+ if ( exclName != varName ) {
+ // and it's not involved in a 2D PDF
+ if ( skipList.find( varName ) == skipList.end() ) {
+ // multiply the total by its PDF value
+ pdfTot_[iEvt][specName] *= discPdf_[iEvt][specName][varName];
+ }
+ }
+ }
+ }
+
+ if ( needSignalSearch ) {
+
+ // loop through the 2D histo list
+ TString specName( "sigTM" );
+ Double_t tmPDFVal( 1.0 );
+ NameSet skipList;
+ for ( TwoDMap::const_iterator twodim_iter = twodimPDFs_.begin();
+ twodim_iter != twodimPDFs_.end();
+ ++twodim_iter ) {
+ // if the entry doesn't refer to this
+ // species then skip on
+ if ( specName != twodim_iter->first ) {
+ continue;
+ }
+
+ // retrieve the two variable names
+ const TString& firstVarName = twodim_iter->second.first;
+ const TString& secondVarName = twodim_iter->second.second;
+ if ( firstVarName != exclName && secondVarName != exclName ) {
+ // if neither name is the one being excluded then...
+ // add them both to the skip list
+ skipList.insert( firstVarName );
+ skipList.insert( secondVarName );
+ // and multiply the total by the combined PDF value
+ TString varName = firstVarName + secondVarName;
+ tmPDFVal *= discPdf_[iEvt][specName][varName];
+ }
+ }
+
+ // loop through all the variables
+ for ( NameSet::const_iterator var_iter = variableNames_.begin();
+ var_iter != variableNames_.end();
+ ++var_iter ) {
+ const TString& varName = ( *var_iter );
+ // if the variable isn't the one being excluded
+ if ( exclName != varName ) {
+ // and it's not involved in a 2D PDF
+ if ( skipList.find( varName ) == skipList.end() ) {
+ // multiply the total by its PDF value
+ tmPDFVal *= discPdf_[iEvt][specName][varName];
+ }
+ }
+ }
+
+ tmPDFVal *= ( 1.0 - scfFrac_[iEvt] );
+
+ // loop through the 2D histo list
+ specName = "sigSCF";
+ Double_t scfPDFVal( 1.0 );
+ skipList.clear();
+ for ( TwoDMap::const_iterator twodim_iter = twodimPDFs_.begin();
+ twodim_iter != twodimPDFs_.end();
+ ++twodim_iter ) {
+ // if the entry doesn't refer to this
+ // species then skip on
+ if ( specName != twodim_iter->first ) {
+ continue;
+ }
+
+ // retrieve the two variable names
+ const TString& firstVarName = twodim_iter->second.first;
+ const TString& secondVarName = twodim_iter->second.second;
+ if ( firstVarName != exclName && secondVarName != exclName ) {
+ // if neither name is the one being excluded then...
+ // add them both to the skip list
+ skipList.insert( firstVarName );
+ skipList.insert( secondVarName );
+ // and multiply the total by the combined PDF value
+ TString varName = firstVarName + secondVarName;
+ scfPDFVal *= discPdf_[iEvt][specName][varName];
+ }
+ }
+
+ // loop through all the variables
+ for ( NameSet::const_iterator var_iter = variableNames_.begin();
+ var_iter != variableNames_.end();
+ ++var_iter ) {
+ const TString& varName = ( *var_iter );
+ // if the variable isn't the one being excluded
+ if ( exclName != varName ) {
+ // and it's not involved in a 2D PDF
+ if ( skipList.find( varName ) == skipList.end() ) {
+ // multiply the total by its PDF value
+ scfPDFVal *= discPdf_[iEvt][specName][varName];
+ }
+ }
+ }
+
+ if ( exclName == "DP" || ! this->scfDPSmear() ) {
+ scfPDFVal *= scfFrac_[iEvt];
+ }
+
+ pdfTot_[iEvt]["sig"] = tmPDFVal + scfPDFVal;
+ }
+ }
}
-void LauSPlot::calcCNCoeffs(const TString& exclName, const Double_t *covmat)
+void LauSPlot::calcCNCoeffs( const TString& exclName, const Double_t* covmat )
{
- // Computes the cN for the extended sPlots from the covariance matrix
-
- if (nFixdSpecies_ <= 0) {
- return;
- }
-
- Int_t species_n(0);
- for (NumbMap::const_iterator iter_n = freeSpecies_.begin(); iter_n != freeSpecies_.end(); ++iter_n) {
- Int_t species_j(0);
- const TString& specName = iter_n->first;
- Double_t value = iter_n->second;
- cN_[exclName][specName] = value;
- for (NumbMap::const_iterator iter_j = freeSpecies_.begin(); iter_j != freeSpecies_.end(); ++iter_j) {
- if (covmat) {
- cN_[exclName][specName] -= covmat[species_n*nSpecies_+species_j];
- } else {
- cN_[exclName][specName] -= covMat_(species_n,species_j);
- }
- ++species_j;
- }
- ++species_n;
- }
+ // Computes the cN for the extended sPlots from the covariance matrix
+
+ if ( nFixdSpecies_ <= 0 ) {
+ return;
+ }
+
+ Int_t species_n( 0 );
+ for ( NumbMap::const_iterator iter_n = freeSpecies_.begin(); iter_n != freeSpecies_.end();
+ ++iter_n ) {
+ Int_t species_j( 0 );
+ const TString& specName = iter_n->first;
+ Double_t value = iter_n->second;
+ cN_[exclName][specName] = value;
+ for ( NumbMap::const_iterator iter_j = freeSpecies_.begin(); iter_j != freeSpecies_.end();
+ ++iter_j ) {
+ if ( covmat ) {
+ cN_[exclName][specName] -= covmat[species_n * nSpecies_ + species_j];
+ } else {
+ cN_[exclName][specName] -= covMat_( species_n, species_j );
+ }
+ ++species_j;
+ }
+ ++species_n;
+ }
}
-void LauSPlot::calcSWeights(const TString& exclName, Double_t *covmat)
+void LauSPlot::calcSWeights( const TString& exclName, Double_t* covmat )
{
- // Computes the sWeights from the covariance matrix
- // NB for the extended sPlot the sum in the denominator is still over all species,
- // while that in the numerator is only over the free species.
- // Similarly the sWeights can only be calculated for the free species.
-
- Double_t numerator(0.0), denominator(0.0);
- for (Int_t iEvent = 0; iEvent < nEvents_; ++iEvent) {
- denominator = 0.0;
- for (NumbMap::const_iterator free_iter = freeSpecies_.begin(); free_iter != freeSpecies_.end(); ++free_iter) {
- denominator += free_iter->second * pdfTot_[iEvent][free_iter->first];
- }
- for (NumbMap::const_iterator fixd_iter = fixdSpecies_.begin(); fixd_iter != fixdSpecies_.end(); ++fixd_iter) {
- denominator += fixd_iter->second * pdfTot_[iEvent][fixd_iter->first];
- }
- Int_t species_n(0);
- for (NumbMap::const_iterator iter_n = freeSpecies_.begin(); iter_n != freeSpecies_.end(); ++iter_n) {
- numerator = 0.0;
- Int_t species_j(0);
- for (NumbMap::const_iterator iter_j = freeSpecies_.begin(); iter_j != freeSpecies_.end(); ++iter_j) {
- if (covmat) {
- numerator += covmat[species_n*nSpecies_+species_j] * pdfTot_[iEvent][iter_j->first];
- } else {
- numerator += covMat_(species_n,species_j) * pdfTot_[iEvent][iter_j->first];
- }
- ++species_j;
- }
- sWeights_[iEvent][exclName][iter_n->first] = numerator/denominator;
- ++species_n;
- }
- }
+ // Computes the sWeights from the covariance matrix
+ // NB for the extended sPlot the sum in the denominator is still over all species,
+ // while that in the numerator is only over the free species.
+ // Similarly the sWeights can only be calculated for the free species.
+
+ Double_t numerator( 0.0 ), denominator( 0.0 );
+ for ( Int_t iEvent = 0; iEvent < nEvents_; ++iEvent ) {
+ denominator = 0.0;
+ for ( NumbMap::const_iterator free_iter = freeSpecies_.begin();
+ free_iter != freeSpecies_.end();
+ ++free_iter ) {
+ denominator += free_iter->second * pdfTot_[iEvent][free_iter->first];
+ }
+ for ( NumbMap::const_iterator fixd_iter = fixdSpecies_.begin();
+ fixd_iter != fixdSpecies_.end();
+ ++fixd_iter ) {
+ denominator += fixd_iter->second * pdfTot_[iEvent][fixd_iter->first];
+ }
+ Int_t species_n( 0 );
+ for ( NumbMap::const_iterator iter_n = freeSpecies_.begin(); iter_n != freeSpecies_.end();
+ ++iter_n ) {
+ numerator = 0.0;
+ Int_t species_j( 0 );
+ for ( NumbMap::const_iterator iter_j = freeSpecies_.begin(); iter_j != freeSpecies_.end();
+ ++iter_j ) {
+ if ( covmat ) {
+ numerator += covmat[species_n * nSpecies_ + species_j] *
+ pdfTot_[iEvent][iter_j->first];
+ } else {
+ numerator += covMat_( species_n, species_j ) * pdfTot_[iEvent][iter_j->first];
+ }
+ ++species_j;
+ }
+ sWeights_[iEvent][exclName][iter_n->first] = numerator / denominator;
+ ++species_n;
+ }
+ }
}
void LauSPlot::fillCNBranches()
{
- if (!cnTree_) {
- cerr<<"ERROR in LauSPlot::fillCNBranches : Tree not created, cannot fill branches."<<endl;
- return;
- } else if (!this->definedCNBranches()) {
- this->defineCNBranches();
- }
- cnTree_->Fill();
+ if ( ! cnTree_ ) {
+ cerr << "ERROR in LauSPlot::fillCNBranches : Tree not created, cannot fill branches." << endl;
+ return;
+ } else if ( ! this->definedCNBranches() ) {
+ this->defineCNBranches();
+ }
+ cnTree_->Fill();
}
void LauSPlot::fillSWeightBranches()
{
- if (!sweightTree_) {
- cerr<<"ERROR in LauSPlot::fillSWeightBranches : Tree not created, cannot fill branches."<<endl;
- return;
- } else if (sWeights_.empty()) {
- cerr<<"ERROR in LauSPlot::fillSWeightBranches : No sWeights calculated, can't fill branches."<<endl;
- return;
- } else if (!this->definedSWeightBranches()) {
- this->copyEventWeights(0);
- this->defineSWeightBranches();
- }
-
- for (Int_t iEvent = 0; iEvent < nEvents_; ++iEvent) {
- this->copyEventWeights(iEvent);
- sweightTree_->Fill();
- }
+ if ( ! sweightTree_ ) {
+ cerr << "ERROR in LauSPlot::fillSWeightBranches : Tree not created, cannot fill branches."
+ << endl;
+ return;
+ } else if ( sWeights_.empty() ) {
+ cerr << "ERROR in LauSPlot::fillSWeightBranches : No sWeights calculated, can't fill branches."
+ << endl;
+ return;
+ } else if ( ! this->definedSWeightBranches() ) {
+ this->copyEventWeights( 0 );
+ this->defineSWeightBranches();
+ }
+
+ for ( Int_t iEvent = 0; iEvent < nEvents_; ++iEvent ) {
+ this->copyEventWeights( iEvent );
+ sweightTree_->Fill();
+ }
}
-void LauSPlot::copyEventWeights(Int_t iEvent)
+void LauSPlot::copyEventWeights( Int_t iEvent )
{
- for (std::map<TString,NumbMap>::const_iterator excl_iter = sWeights_[iEvent].begin(); excl_iter != sWeights_[iEvent].end(); ++excl_iter) {
- const TString& exclName = excl_iter->first;
- const NumbMap& species = excl_iter->second;
- for (NumbMap::const_iterator spec_iter = species.begin(); spec_iter != species.end(); ++spec_iter) {
- const TString& specName = spec_iter->first;
- sWeightsCurrent_[exclName][specName] = spec_iter->second;
- }
- }
+ for ( std::map<TString, NumbMap>::const_iterator excl_iter = sWeights_[iEvent].begin();
+ excl_iter != sWeights_[iEvent].end();
+ ++excl_iter ) {
+ const TString& exclName = excl_iter->first;
+ const NumbMap& species = excl_iter->second;
+ for ( NumbMap::const_iterator spec_iter = species.begin(); spec_iter != species.end();
+ ++spec_iter ) {
+ const TString& specName = spec_iter->first;
+ sWeightsCurrent_[exclName][specName] = spec_iter->second;
+ }
+ }
}
void LauSPlot::writeOutResults()
{
- // write out the results
-
- // remove the transient objects that we don't want (re-)written to the file
- if (eventList_) {
- delete eventList_; eventList_ = 0;
- }
- if (inputTree_) {
- delete inputTree_; inputTree_ = 0;
- }
-
- // first add the input tree as a friend of the output tree
- this->addFriendTree();
-
- // then write everything to the file and clean up
- file_->cd();
- file_->Write();
- file_->Close();
- delete file_; file_ = 0;
+ // write out the results
+
+ // remove the transient objects that we don't want (re-)written to the file
+ if ( eventList_ ) {
+ delete eventList_;
+ eventList_ = 0;
+ }
+ if ( inputTree_ ) {
+ delete inputTree_;
+ inputTree_ = 0;
+ }
+
+ // first add the input tree as a friend of the output tree
+ this->addFriendTree();
+
+ // then write everything to the file and clean up
+ file_->cd();
+ file_->Write();
+ file_->Close();
+ delete file_;
+ file_ = 0;
}
void LauSPlot::addFriendTree()
{
- if (!sweightTree_) {
- cerr<<"ERROR in LauSPlot::addFriendTree : Tree not created, cannot add friend."<<endl;
- return;
- }
- sweightTree_->AddFriend(inputTreeName_,fileName_);
+ if ( ! sweightTree_ ) {
+ cerr << "ERROR in LauSPlot::addFriendTree : Tree not created, cannot add friend." << endl;
+ return;
+ }
+ sweightTree_->AddFriend( inputTreeName_, fileName_ );
}
-void Yields(Int_t &, Double_t *, Double_t &f, Double_t *x, Int_t /*iflag*/)
+void Yields( Int_t&, Double_t*, Double_t& f, Double_t* x, Int_t /*iflag*/ )
{
- // FCN-function for Minuit
-
- f = 0.0;
-
- TVirtualFitter *fitter = TVirtualFitter::GetFitter();
- LauSPlot* theModel = dynamic_cast<LauSPlot*>(fitter->GetObjectFit());
- const std::vector<LauSPlot::NumbMap>& pdfTot = theModel->totalPdf();
-
- Double_t ntot(0.0);
- for (std::vector<LauSPlot::NumbMap>::const_iterator evt_iter = pdfTot.begin(); evt_iter != pdfTot.end(); ++evt_iter) { // loop over events
- const LauSPlot::NumbMap& species = (*evt_iter);
- Int_t ispecies(0);
- Double_t lik(0.0);
- ntot = 0.0;
- for (LauSPlot::NumbMap::const_iterator spec_iter = species.begin(); spec_iter != species.end(); ++spec_iter) { // loop over species
- lik += x[ispecies] * spec_iter->second;
- ntot += x[ispecies];
- ++ispecies;
- }
- if (lik < 0.0) {
- // make f the worst possible value to force MINUIT
- // out of this region of parameter space
- f = -DBL_MAX;
- break;
- } else {
- f += TMath::Log(lik);
- }
- }
-
- // extended likelihood
- f = (ntot-f);
+ // FCN-function for Minuit
+
+ f = 0.0;
+
+ TVirtualFitter* fitter = TVirtualFitter::GetFitter();
+ LauSPlot* theModel = dynamic_cast<LauSPlot*>( fitter->GetObjectFit() );
+ const std::vector<LauSPlot::NumbMap>& pdfTot = theModel->totalPdf();
+
+ Double_t ntot( 0.0 );
+ for ( std::vector<LauSPlot::NumbMap>::const_iterator evt_iter = pdfTot.begin();
+ evt_iter != pdfTot.end();
+ ++evt_iter ) { // loop over events
+ const LauSPlot::NumbMap& species = ( *evt_iter );
+ Int_t ispecies( 0 );
+ Double_t lik( 0.0 );
+ ntot = 0.0;
+ for ( LauSPlot::NumbMap::const_iterator spec_iter = species.begin();
+ spec_iter != species.end();
+ ++spec_iter ) { // loop over species
+ lik += x[ispecies] * spec_iter->second;
+ ntot += x[ispecies];
+ ++ispecies;
+ }
+ if ( lik < 0.0 ) {
+ // make f the worst possible value to force MINUIT
+ // out of this region of parameter space
+ f = -DBL_MAX;
+ break;
+ } else {
+ f += TMath::Log( lik );
+ }
+ }
+
+ // extended likelihood
+ f = ( ntot - f );
}
-
diff --git a/src/LauScfMap.cc b/src/LauScfMap.cc
index 6dabe2f..e499edf 100644
--- a/src/LauScfMap.cc
+++ b/src/LauScfMap.cc
@@ -1,210 +1,214 @@
/*
Copyright 2006 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauScfMap.cc
\brief File containing implementation of LauScfMap class.
*/
#include <cstdlib>
#include <iostream>
-#include <vector>
#include <map>
-using std::cout;
+#include <vector>
using std::cerr;
-using std::flush;
+using std::cout;
using std::endl;
+using std::flush;
+
+#include "LauScfMap.hh"
#include "TAxis.h"
#include "TH2.h"
#include "TSystem.h"
-#include "LauScfMap.hh"
-
-
-
-LauScfMap::LauScfMap():
- nBinsX_(-1),
- nBinsY_(-1),
- numberOfBins_(-1)
+LauScfMap::LauScfMap() :
+ nBinsX_( -1 ),
+ nBinsY_( -1 ),
+ numberOfBins_( -1 )
{
}
LauScfMap::~LauScfMap()
{
- for (std::vector<TH2*>::iterator iter = histos_.begin(); iter != histos_.end(); ++iter) {
- delete (*iter);
- }
+ for ( std::vector<TH2*>::iterator iter = histos_.begin(); iter != histos_.end(); ++iter ) {
+ delete ( *iter );
+ }
}
-void LauScfMap::setHistos(const std::vector<const TH2*>& histos)
+void LauScfMap::setHistos( const std::vector<const TH2*>& histos )
{
- // Check that we have enough histograms
- Int_t nBinsX = histos.front()->GetNbinsX();
- Int_t nBinsY = histos.front()->GetNbinsY();
- Int_t nHist = histos.size();
-
- if (nHist != nBinsX*nBinsY) {
- cerr<<"ERROR in LauScfMap::setHistos : There should be as many histograms supplied as there are bins in each of them."<<endl;
- cerr<<" : There are "<<nHist<<" histograms and "<<nBinsX*nBinsY<<" bins."<<endl;
- return;
- }
-
- // number of (tru, and reco as well) bins in a 2D histogram
- // Later we will create as many fake points to cache DP amplitudes
- nBinsX_ = nBinsX;
- nBinsY_ = nBinsY;
- numberOfBins_ = nBinsX_*nBinsY_;
-
- // Clear out any old histos we might have lying around
- for (std::vector<TH2*>::iterator iter = histos_.begin(); iter != histos_.end(); ++iter) {
- delete (*iter);
- }
- histos_.clear();
-
- // Make sure we have enough space for the new histograms
- histos_.reserve(nHist);
-
- // Loop through the supplied vector
- // Clone each histogram and store it
- for (std::vector<const TH2*>::const_iterator iter = histos.begin(); iter != histos.end(); ++iter) {
- TH2* histo = dynamic_cast<TH2*>((*iter)->Clone());
- if ( histo==0 ) {
- cerr<<"ERROR in LauScfMap::setHistos : Problem cloning one of the histograms."<<endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- histos_.push_back(histo);
- }
-
- if ( histos_.size() != histos.size() ) {
- cerr<<"ERROR in LauScfMap::setHistos : Problem cloning the histograms."<<endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // Now we need to setup the map
-
- // First clear it
- contribs_.clear();
-
- // Fill in the map that links, to each reco bin, a vector with the numbers of the tru bins
- // that have non-zero contributions in that reco bin
- // Loop over each histogram bin
- for (Int_t j(0); j<nBinsY_; ++j) {
- for (Int_t i(0); i<nBinsX_; ++i) {
- Int_t binNo = histos_.front()->GetBin(i+1,j+1);
- std::vector<Int_t>& truBins = contribs_[binNo];
- truBins.reserve(nHist);
- for (Int_t k(0); k<nHist; ++k) {
- Double_t content = histos_[k]->GetBinContent(binNo);
- if (content>0.0) {
- truBins.push_back(k);
- }
- }
- }
- }
+ // Check that we have enough histograms
+ Int_t nBinsX = histos.front()->GetNbinsX();
+ Int_t nBinsY = histos.front()->GetNbinsY();
+ Int_t nHist = histos.size();
+
+ if ( nHist != nBinsX * nBinsY ) {
+ cerr << "ERROR in LauScfMap::setHistos : There should be as many histograms supplied as there are bins in each of them."
+ << endl;
+ cerr << " : There are " << nHist << " histograms and "
+ << nBinsX * nBinsY << " bins." << endl;
+ return;
+ }
+
+ // number of (tru, and reco as well) bins in a 2D histogram
+ // Later we will create as many fake points to cache DP amplitudes
+ nBinsX_ = nBinsX;
+ nBinsY_ = nBinsY;
+ numberOfBins_ = nBinsX_ * nBinsY_;
+
+ // Clear out any old histos we might have lying around
+ for ( std::vector<TH2*>::iterator iter = histos_.begin(); iter != histos_.end(); ++iter ) {
+ delete ( *iter );
+ }
+ histos_.clear();
+
+ // Make sure we have enough space for the new histograms
+ histos_.reserve( nHist );
+
+ // Loop through the supplied vector
+ // Clone each histogram and store it
+ for ( std::vector<const TH2*>::const_iterator iter = histos.begin(); iter != histos.end();
+ ++iter ) {
+ TH2* histo = dynamic_cast<TH2*>( ( *iter )->Clone() );
+ if ( histo == 0 ) {
+ cerr << "ERROR in LauScfMap::setHistos : Problem cloning one of the histograms." << endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ histos_.push_back( histo );
+ }
+
+ if ( histos_.size() != histos.size() ) {
+ cerr << "ERROR in LauScfMap::setHistos : Problem cloning the histograms." << endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // Now we need to setup the map
+
+ // First clear it
+ contribs_.clear();
+
+ // Fill in the map that links, to each reco bin, a vector with the numbers of the tru bins
+ // that have non-zero contributions in that reco bin
+ // Loop over each histogram bin
+ for ( Int_t j( 0 ); j < nBinsY_; ++j ) {
+ for ( Int_t i( 0 ); i < nBinsX_; ++i ) {
+ Int_t binNo = histos_.front()->GetBin( i + 1, j + 1 );
+ std::vector<Int_t>& truBins = contribs_[binNo];
+ truBins.reserve( nHist );
+ for ( Int_t k( 0 ); k < nHist; ++k ) {
+ Double_t content = histos_[k]->GetBinContent( binNo );
+ if ( content > 0.0 ) {
+ truBins.push_back( k );
+ }
+ }
+ }
+ }
}
-void LauScfMap::listBinCentres( std::vector<Double_t>& xCoords, std::vector<Double_t>& yCoords) const
+void LauScfMap::listBinCentres( std::vector<Double_t>& xCoords, std::vector<Double_t>& yCoords ) const
{
- // Create the list of fake points, located at the centres of the
- // true bins, that we will add to the data points, so as to cache
- // the DP amplitudes, scfFractions and jacobians at those points.
- // that have non-zero contributions in that reco bin
-
- const TAxis* xAxis = histos_.front()->GetXaxis();
- Double_t xMax = xAxis->GetXmax();
- Double_t xMin = xAxis->GetXmin();
- Double_t xIncrement = (Double_t)((xMax - xMin)/nBinsX_);
-
- const TAxis* yAxis = histos_.front()->GetYaxis();
- Double_t yMax = yAxis->GetXmax();
- Double_t yMin = yAxis->GetXmin();
- Double_t yIncrement = (Double_t)((yMax - yMin)/nBinsY_);
-
- // Loop over each histogram bin
- Double_t yCoord = yMin + yIncrement/2;
- for (Int_t j(1); j<=nBinsY_; ++j) {
- Double_t xCoord = xMin + xIncrement/2;
- for (Int_t i(1); i<=nBinsX_; ++i) {
- xCoords.push_back(xCoord);
- yCoords.push_back(yCoord);
- xCoord += xIncrement;
- }
- yCoord += yIncrement;
- }
+ // Create the list of fake points, located at the centres of the
+ // true bins, that we will add to the data points, so as to cache
+ // the DP amplitudes, scfFractions and jacobians at those points.
+ // that have non-zero contributions in that reco bin
+
+ const TAxis* xAxis = histos_.front()->GetXaxis();
+ Double_t xMax = xAxis->GetXmax();
+ Double_t xMin = xAxis->GetXmin();
+ Double_t xIncrement = (Double_t)( ( xMax - xMin ) / nBinsX_ );
+
+ const TAxis* yAxis = histos_.front()->GetYaxis();
+ Double_t yMax = yAxis->GetXmax();
+ Double_t yMin = yAxis->GetXmin();
+ Double_t yIncrement = (Double_t)( ( yMax - yMin ) / nBinsY_ );
+
+ // Loop over each histogram bin
+ Double_t yCoord = yMin + yIncrement / 2;
+ for ( Int_t j( 1 ); j <= nBinsY_; ++j ) {
+ Double_t xCoord = xMin + xIncrement / 2;
+ for ( Int_t i( 1 ); i <= nBinsX_; ++i ) {
+ xCoords.push_back( xCoord );
+ yCoords.push_back( yCoord );
+ xCoord += xIncrement;
+ }
+ yCoord += yIncrement;
+ }
}
-Int_t LauScfMap::binNumber(Double_t xCoord, Double_t yCoord) const
+Int_t LauScfMap::binNumber( Double_t xCoord, Double_t yCoord ) const
{
- const TH2* histo = histos_.front();
- if (histo != 0) {
- return histo->FindFixBin(xCoord,yCoord);
- } else {
- cerr<<"ERROR in LauScfMap::recoBin : No valid histograms found."<<endl;
- return -1;
- }
+ const TH2* histo = histos_.front();
+ if ( histo != 0 ) {
+ return histo->FindFixBin( xCoord, yCoord );
+ } else {
+ cerr << "ERROR in LauScfMap::recoBin : No valid histograms found." << endl;
+ return -1;
+ }
}
-const std::vector<Int_t>* LauScfMap::trueBins(Int_t recoBin) const
+const std::vector<Int_t>* LauScfMap::trueBins( Int_t recoBin ) const
{
- std::map< Int_t, std::vector<Int_t> >::const_iterator iter = contribs_.find(recoBin);
- if (iter != contribs_.end()) {
- return &(iter->second);
- } else {
- return 0;
- }
+ std::map<Int_t, std::vector<Int_t>>::const_iterator iter = contribs_.find( recoBin );
+ if ( iter != contribs_.end() ) {
+ return &( iter->second );
+ } else {
+ return 0;
+ }
}
-Double_t LauScfMap::prob(Int_t recoBin, Int_t trueBin) const
+Double_t LauScfMap::prob( Int_t recoBin, Int_t trueBin ) const
{
- const TH2* histo = histos_[trueBin];
- if (histo != 0) {
- return histo->GetBinContent(recoBin);
- } else {
- cerr<<"ERROR in LauScfMap::prob : No histogram found for true bin "<<trueBin<<endl;
- return 0.0;
- }
+ const TH2* histo = histos_[trueBin];
+ if ( histo != 0 ) {
+ return histo->GetBinContent( recoBin );
+ } else {
+ cerr << "ERROR in LauScfMap::prob : No histogram found for true bin " << trueBin << endl;
+ return 0.0;
+ }
}
-TH2* LauScfMap::trueHist(Int_t trueBin)
+TH2* LauScfMap::trueHist( Int_t trueBin )
{
- // Need to turn the histogram bin number into the vector element
- Int_t x(0), y(0), z(0);
- histos_.front()->GetBinXYZ( trueBin, x, y, z );
-
- Int_t theBin = nBinsX_*(y-1) + (x-1);
-
- if ( theBin < 0 || static_cast<UInt_t>(theBin) >= histos_.size() ) {
- cerr<<"ERROR in LauScfMap::trueHist : No histogram found for true bin "<<trueBin<<", which corresponds to x="<<x<<", y="<<y<<", or entry "<<theBin<<" in the vector."<<endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- TH2* histo = histos_[theBin];
- if ( histo == 0 ) {
- cerr<<"ERROR in LauScfMap::trueHist : Null histogram pointer found for true bin "<<trueBin<<", which corresponds to x="<<x<<", y="<<y<<", or entry "<<theBin<<" in the vector."<<endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- return histo;
+ // Need to turn the histogram bin number into the vector element
+ Int_t x( 0 ), y( 0 ), z( 0 );
+ histos_.front()->GetBinXYZ( trueBin, x, y, z );
+
+ Int_t theBin = nBinsX_ * ( y - 1 ) + ( x - 1 );
+
+ if ( theBin < 0 || static_cast<UInt_t>( theBin ) >= histos_.size() ) {
+ cerr << "ERROR in LauScfMap::trueHist : No histogram found for true bin " << trueBin
+ << ", which corresponds to x=" << x << ", y=" << y << ", or entry " << theBin
+ << " in the vector." << endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ TH2* histo = histos_[theBin];
+ if ( histo == 0 ) {
+ cerr << "ERROR in LauScfMap::trueHist : Null histogram pointer found for true bin "
+ << trueBin << ", which corresponds to x=" << x << ", y=" << y << ", or entry "
+ << theBin << " in the vector." << endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ return histo;
}
-
diff --git a/src/LauSigmaRes.cc b/src/LauSigmaRes.cc
index 8f2a852..0704b29 100644
--- a/src/LauSigmaRes.cc
+++ b/src/LauSigmaRes.cc
@@ -1,305 +1,320 @@
/*
Copyright 2004 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauSigmaRes.cc
\brief File containing implementation of LauSigmaRes class.
*/
-#include <iostream>
+#include "LauSigmaRes.hh"
#include "LauConstants.hh"
-#include "LauSigmaRes.hh"
#include "LauResonanceInfo.hh"
+#include <iostream>
-
-LauSigmaRes::LauSigmaRes(LauResonanceInfo* resInfo, const Int_t resPairAmpInt, const LauDaughters* daughters) :
- LauAbsResonance(resInfo, resPairAmpInt, daughters),
- mPiSq4_(4.0*LauConstants::mPiSq),
- sAdler_(LauConstants::mPiSq*0.5),
- b1_(0),
- b2_(0),
- a_(0),
- m0_(0)
+LauSigmaRes::LauSigmaRes( LauResonanceInfo* resInfo,
+ const Int_t resPairAmpInt,
+ const LauDaughters* daughters ) :
+ LauAbsResonance( resInfo, resPairAmpInt, daughters ),
+ mPiSq4_( 4.0 * LauConstants::mPiSq ),
+ sAdler_( LauConstants::mPiSq * 0.5 ),
+ b1_( 0 ),
+ b2_( 0 ),
+ a_( 0 ),
+ m0_( 0 )
{
- // Initialise various constants
- mPiSq4_ = 4.0*LauConstants::mPiSq;
- sAdler_ = LauConstants::mPiSq*0.5; // Adler zero at 0.5*(mpi)^2
-
- // constant factors from BES data
- const Double_t b1Val = 0.5843;
- const Double_t b2Val = 1.6663;
- const Double_t aVal = 1.082;
- const Double_t m0Val = 0.9264;
-
- const TString& parNameBase = this->getSanitisedName();
-
- TString b1Name(parNameBase);
- b1Name += "_b1";
- b1_ = resInfo->getExtraParameter( b1Name );
- if ( b1_ == 0 ) {
- b1_ = new LauParameter( b1Name, b1Val, 0.0, 100.0, kTRUE );
- b1_->secondStage(kTRUE);
- resInfo->addExtraParameter( b1_ );
- }
-
- TString b2Name(parNameBase);
- b2Name += "_b2";
- b2_ = resInfo->getExtraParameter( b2Name );
- if ( b2_ == 0 ) {
- b2_ = new LauParameter( b2Name, b2Val, 0.0, 100.0, kTRUE );
- b2_->secondStage(kTRUE);
- resInfo->addExtraParameter( b2_ );
- }
-
- TString aName(parNameBase);
- aName += "_A";
- a_ = resInfo->getExtraParameter( aName );
- if ( a_ == 0 ) {
- a_ = new LauParameter( aName, aVal, 0.0, 10.0, kTRUE );
- a_->secondStage(kTRUE);
- resInfo->addExtraParameter( a_ );
- }
-
- TString m0Name(parNameBase);
- m0Name += "_m0";
- m0_ = resInfo->getExtraParameter( m0Name );
- if ( m0_ == 0 ) {
- m0_ = new LauParameter( m0Name, m0Val, 0.0, 10.0, kTRUE );
- m0_->secondStage(kTRUE);
- resInfo->addExtraParameter( m0_ );
- }
+ // Initialise various constants
+ mPiSq4_ = 4.0 * LauConstants::mPiSq;
+ sAdler_ = LauConstants::mPiSq * 0.5; // Adler zero at 0.5*(mpi)^2
+
+ // constant factors from BES data
+ const Double_t b1Val = 0.5843;
+ const Double_t b2Val = 1.6663;
+ const Double_t aVal = 1.082;
+ const Double_t m0Val = 0.9264;
+
+ const TString& parNameBase = this->getSanitisedName();
+
+ TString b1Name( parNameBase );
+ b1Name += "_b1";
+ b1_ = resInfo->getExtraParameter( b1Name );
+ if ( b1_ == 0 ) {
+ b1_ = new LauParameter( b1Name, b1Val, 0.0, 100.0, kTRUE );
+ b1_->secondStage( kTRUE );
+ resInfo->addExtraParameter( b1_ );
+ }
+
+ TString b2Name( parNameBase );
+ b2Name += "_b2";
+ b2_ = resInfo->getExtraParameter( b2Name );
+ if ( b2_ == 0 ) {
+ b2_ = new LauParameter( b2Name, b2Val, 0.0, 100.0, kTRUE );
+ b2_->secondStage( kTRUE );
+ resInfo->addExtraParameter( b2_ );
+ }
+
+ TString aName( parNameBase );
+ aName += "_A";
+ a_ = resInfo->getExtraParameter( aName );
+ if ( a_ == 0 ) {
+ a_ = new LauParameter( aName, aVal, 0.0, 10.0, kTRUE );
+ a_->secondStage( kTRUE );
+ resInfo->addExtraParameter( a_ );
+ }
+
+ TString m0Name( parNameBase );
+ m0Name += "_m0";
+ m0_ = resInfo->getExtraParameter( m0Name );
+ if ( m0_ == 0 ) {
+ m0_ = new LauParameter( m0Name, m0Val, 0.0, 10.0, kTRUE );
+ m0_->secondStage( kTRUE );
+ resInfo->addExtraParameter( m0_ );
+ }
}
LauSigmaRes::~LauSigmaRes()
{
}
void LauSigmaRes::initialise()
{
- this->checkDaughterTypes();
-
- Double_t resSpin = this->getSpin();
- if (resSpin != 0) {
- std::cerr << "WARNING in LauSigmaRes::initialise : Resonance spin is " << resSpin << "." << std::endl;
- std::cerr << " : Sigma amplitude is only for scalers, resetting spin to 0." << std::endl;
- this->changeResonance( -1.0, -1.0, 0 );
- }
+ this->checkDaughterTypes();
+
+ Double_t resSpin = this->getSpin();
+ if ( resSpin != 0 ) {
+ std::cerr << "WARNING in LauSigmaRes::initialise : Resonance spin is " << resSpin << "."
+ << std::endl;
+ std::cerr << " : Sigma amplitude is only for scalers, resetting spin to 0."
+ << std::endl;
+ this->changeResonance( -1.0, -1.0, 0 );
+ }
}
void LauSigmaRes::checkDaughterTypes() const
{
- // Check that the daughter tracks are the same type. Otherwise issue a warning
- // and set the type to be pion for the Sigma distribution.
- Int_t resPairAmpInt = this->getPairInt();
- if (resPairAmpInt < 1 || resPairAmpInt > 3) {
- std::cerr << "WARNING in LauSigmaRes::checkDaughterTypes : resPairAmpInt = " << resPairAmpInt << " is out of the range [1,2,3]." << std::endl;
- return;
- }
-
- const TString& nameDaug1 = this->getNameDaug1();
- const TString& nameDaug2 = this->getNameDaug2();
- if (!nameDaug1.CompareTo(nameDaug2, TString::kExact)) {
- // Daughter types agree. Find out if we have pion or kaon system
- if (!nameDaug1.Contains("pi")) {
- std::cerr << "ERROR in LauSigmaRes::checkDaughterTypes : Sigma model is using daughters \""<<nameDaug1<<"\" and \""<<nameDaug2<<"\", which are not pions." << std::endl;
- }
- }
+ // Check that the daughter tracks are the same type. Otherwise issue a warning
+ // and set the type to be pion for the Sigma distribution.
+ Int_t resPairAmpInt = this->getPairInt();
+ if ( resPairAmpInt < 1 || resPairAmpInt > 3 ) {
+ std::cerr << "WARNING in LauSigmaRes::checkDaughterTypes : resPairAmpInt = " << resPairAmpInt
+ << " is out of the range [1,2,3]." << std::endl;
+ return;
+ }
+
+ const TString& nameDaug1 = this->getNameDaug1();
+ const TString& nameDaug2 = this->getNameDaug2();
+ if ( ! nameDaug1.CompareTo( nameDaug2, TString::kExact ) ) {
+ // Daughter types agree. Find out if we have pion or kaon system
+ if ( ! nameDaug1.Contains( "pi" ) ) {
+ std::cerr << "ERROR in LauSigmaRes::checkDaughterTypes : Sigma model is using daughters \""
+ << nameDaug1 << "\" and \"" << nameDaug2 << "\", which are not pions."
+ << std::endl;
+ }
+ }
}
-LauComplex LauSigmaRes::resAmp(Double_t mass, Double_t spinTerm)
+LauComplex LauSigmaRes::resAmp( Double_t mass, Double_t spinTerm )
{
- // This function returns the complex dynamical amplitude for a Sigma distribution
- // given the invariant mass and cos(helicity) values.
-
- // First check that the appropriate daughters are either pi+pi- or K+K-
- // Check that the daughter tracks are the same type. Otherwise issue a warning
- // and set the type to be pion for the Sigma distribution. Returns the
- // integer defined by the enum LauSigmaRes::SigmaPartType.
-
- Double_t s = mass*mass; // Invariant mass squared combination for the system
- Double_t rho(0.0); // Phase-space factor
- if (s > mPiSq4_) {rho = TMath::Sqrt(1.0 - mPiSq4_/s);}
-
- const Double_t m0Val = this->getM0Value();
- const Double_t m0Sq = m0Val * m0Val;
-
- const Double_t aVal = this->getAValue();
- const Double_t b1Val = this->getB1Value();
- const Double_t b2Val = this->getB2Value();
-
- Double_t f = b2Val*s + b1Val; // f(s) function
- Double_t numerator = s - sAdler_;
- Double_t denom = m0Sq - sAdler_;
- Double_t gamma(0.0);
- if (TMath::Abs(denom) > 1e-10 && TMath::Abs(aVal) > 1e-10) {
- // Decay width of the system
- gamma = rho*(numerator/denom)*f*TMath::Exp(-(s - m0Sq)/aVal);
- }
-
- // Now form the complex amplitude - use relativistic BW form (without barrier factors)
- // Note that the M factor in the denominator is not the "pole" at ~500 MeV, but is
- // m0_ = 0.9264, the mass when the phase shift goes through 90 degrees.
-
- Double_t dMSq = m0Sq - s;
- Double_t widthTerm = gamma*m0Val;
- LauComplex resAmplitude(dMSq, widthTerm);
-
- Double_t denomFactor = dMSq*dMSq + widthTerm*widthTerm;
-
- Double_t invDenomFactor = 0.0;
- if (denomFactor > 1e-10) {invDenomFactor = 1.0/denomFactor;}
-
- resAmplitude.rescale(spinTerm*invDenomFactor);
-
- return resAmplitude;
-
+ // This function returns the complex dynamical amplitude for a Sigma distribution
+ // given the invariant mass and cos(helicity) values.
+
+ // First check that the appropriate daughters are either pi+pi- or K+K-
+ // Check that the daughter tracks are the same type. Otherwise issue a warning
+ // and set the type to be pion for the Sigma distribution. Returns the
+ // integer defined by the enum LauSigmaRes::SigmaPartType.
+
+ Double_t s = mass * mass; // Invariant mass squared combination for the system
+ Double_t rho( 0.0 ); // Phase-space factor
+ if ( s > mPiSq4_ ) {
+ rho = TMath::Sqrt( 1.0 - mPiSq4_ / s );
+ }
+
+ const Double_t m0Val = this->getM0Value();
+ const Double_t m0Sq = m0Val * m0Val;
+
+ const Double_t aVal = this->getAValue();
+ const Double_t b1Val = this->getB1Value();
+ const Double_t b2Val = this->getB2Value();
+
+ Double_t f = b2Val * s + b1Val; // f(s) function
+ Double_t numerator = s - sAdler_;
+ Double_t denom = m0Sq - sAdler_;
+ Double_t gamma( 0.0 );
+ if ( TMath::Abs( denom ) > 1e-10 && TMath::Abs( aVal ) > 1e-10 ) {
+ // Decay width of the system
+ gamma = rho * ( numerator / denom ) * f * TMath::Exp( -( s - m0Sq ) / aVal );
+ }
+
+ // Now form the complex amplitude - use relativistic BW form (without barrier factors)
+ // Note that the M factor in the denominator is not the "pole" at ~500 MeV, but is
+ // m0_ = 0.9264, the mass when the phase shift goes through 90 degrees.
+
+ Double_t dMSq = m0Sq - s;
+ Double_t widthTerm = gamma * m0Val;
+ LauComplex resAmplitude( dMSq, widthTerm );
+
+ Double_t denomFactor = dMSq * dMSq + widthTerm * widthTerm;
+
+ Double_t invDenomFactor = 0.0;
+ if ( denomFactor > 1e-10 ) {
+ invDenomFactor = 1.0 / denomFactor;
+ }
+
+ resAmplitude.rescale( spinTerm * invDenomFactor );
+
+ return resAmplitude;
}
const std::vector<LauParameter*>& LauSigmaRes::getFloatingParameters()
{
- this->clearFloatingParameters();
+ this->clearFloatingParameters();
- if ( ! this->fixB1Value() ) {
- this->addFloatingParameter( b1_ );
- }
+ if ( ! this->fixB1Value() ) {
+ this->addFloatingParameter( b1_ );
+ }
- if ( ! this->fixB2Value() ) {
- this->addFloatingParameter( b2_ );
- }
+ if ( ! this->fixB2Value() ) {
+ this->addFloatingParameter( b2_ );
+ }
- if ( ! this->fixAValue() ) {
- this->addFloatingParameter( a_ );
- }
+ if ( ! this->fixAValue() ) {
+ this->addFloatingParameter( a_ );
+ }
- if ( ! this->fixM0Value() ) {
- this->addFloatingParameter( m0_ );
- }
+ if ( ! this->fixM0Value() ) {
+ this->addFloatingParameter( m0_ );
+ }
- return this->getParameters();
+ return this->getParameters();
}
-void LauSigmaRes::setResonanceParameter(const TString& name, const Double_t value)
+void LauSigmaRes::setResonanceParameter( const TString& name, const Double_t value )
{
- // Set various parameters for the lineshape
- if (name == "b1") {
- this->setB1Value(value);
- std::cout << "INFO in LauSigmaRes::setResonanceParameter : Setting parameter b1 = " << this->getB1Value() << std::endl;
- }
- else if (name == "b2") {
- this->setB2Value(value);
- std::cout << "INFO in LauSigmaRes::setResonanceParameter : Setting parameter b2 = " << this->getB2Value() << std::endl;
- }
- else if (name == "A") {
- this->setAValue(value);
- std::cout << "INFO in LauSigmaRes::setResonanceParameter : Setting parameter A = " << this->getAValue() << std::endl;
- }
- else if (name == "m0") {
- this->setM0Value(value);
- std::cout << "INFO in LauSigmaRes::setResonanceParameter : Setting parameter m0 = " << this->getM0Value() << std::endl;
- }
- else {
- std::cerr << "WARNING in LauSigmaRes::setResonanceParameter: Parameter name not reconised. No parameter changes made." << std::endl;
- }
+ // Set various parameters for the lineshape
+ if ( name == "b1" ) {
+ this->setB1Value( value );
+ std::cout << "INFO in LauSigmaRes::setResonanceParameter : Setting parameter b1 = "
+ << this->getB1Value() << std::endl;
+ } else if ( name == "b2" ) {
+ this->setB2Value( value );
+ std::cout << "INFO in LauSigmaRes::setResonanceParameter : Setting parameter b2 = "
+ << this->getB2Value() << std::endl;
+ } else if ( name == "A" ) {
+ this->setAValue( value );
+ std::cout << "INFO in LauSigmaRes::setResonanceParameter : Setting parameter A = "
+ << this->getAValue() << std::endl;
+ } else if ( name == "m0" ) {
+ this->setM0Value( value );
+ std::cout << "INFO in LauSigmaRes::setResonanceParameter : Setting parameter m0 = "
+ << this->getM0Value() << std::endl;
+ } else {
+ std::cerr << "WARNING in LauSigmaRes::setResonanceParameter: Parameter name not reconised. No parameter changes made."
+ << std::endl;
+ }
}
-void LauSigmaRes::floatResonanceParameter(const TString& name)
+void LauSigmaRes::floatResonanceParameter( const TString& name )
{
- if (name == "b1") {
- if ( b1_->fixed() ) {
- b1_->fixed( kFALSE );
- this->addFloatingParameter( b1_ );
- } else {
- std::cerr << "WARNING in LauSigmaRes::floatResonanceParameter: Parameter already floating. No parameter changes made." << std::endl;
- }
- } else if (name == "b2") {
- if ( b2_->fixed() ) {
- b2_->fixed( kFALSE );
- this->addFloatingParameter( b2_ );
- } else {
- std::cerr << "WARNING in LauSigmaRes::floatResonanceParameter: Parameter already floating. No parameter changes made." << std::endl;
- }
- } else if (name == "A") {
- if ( a_->fixed() ) {
- a_->fixed( kFALSE );
- this->addFloatingParameter( a_ );
- } else {
- std::cerr << "WARNING in LauSigmaRes::floatResonanceParameter: Parameter already floating. No parameter changes made." << std::endl;
- }
- } else if (name == "m0") {
- if ( m0_->fixed() ) {
- m0_->fixed( kFALSE );
- this->addFloatingParameter( m0_ );
- } else {
- std::cerr << "WARNING in LauSigmaRes::floatResonanceParameter: Parameter already floating. No parameter changes made." << std::endl;
- }
- } else {
- std::cerr << "WARNING in LauSigmaRes::fixResonanceParameter: Parameter name not reconised. No parameter changes made." << std::endl;
- }
+ if ( name == "b1" ) {
+ if ( b1_->fixed() ) {
+ b1_->fixed( kFALSE );
+ this->addFloatingParameter( b1_ );
+ } else {
+ std::cerr << "WARNING in LauSigmaRes::floatResonanceParameter: Parameter already floating. No parameter changes made."
+ << std::endl;
+ }
+ } else if ( name == "b2" ) {
+ if ( b2_->fixed() ) {
+ b2_->fixed( kFALSE );
+ this->addFloatingParameter( b2_ );
+ } else {
+ std::cerr << "WARNING in LauSigmaRes::floatResonanceParameter: Parameter already floating. No parameter changes made."
+ << std::endl;
+ }
+ } else if ( name == "A" ) {
+ if ( a_->fixed() ) {
+ a_->fixed( kFALSE );
+ this->addFloatingParameter( a_ );
+ } else {
+ std::cerr << "WARNING in LauSigmaRes::floatResonanceParameter: Parameter already floating. No parameter changes made."
+ << std::endl;
+ }
+ } else if ( name == "m0" ) {
+ if ( m0_->fixed() ) {
+ m0_->fixed( kFALSE );
+ this->addFloatingParameter( m0_ );
+ } else {
+ std::cerr << "WARNING in LauSigmaRes::floatResonanceParameter: Parameter already floating. No parameter changes made."
+ << std::endl;
+ }
+ } else {
+ std::cerr << "WARNING in LauSigmaRes::fixResonanceParameter: Parameter name not reconised. No parameter changes made."
+ << std::endl;
+ }
}
-LauParameter* LauSigmaRes::getResonanceParameter(const TString& name)
+LauParameter* LauSigmaRes::getResonanceParameter( const TString& name )
{
- if (name == "b1") {
- return b1_;
- } else if (name == "b2") {
- return b2_;
- } else if (name == "A") {
- return a_;
- } else if (name == "m0") {
- return m0_;
- } else {
- std::cerr << "WARNING in LauSigmaRes::getResonanceParameter: Parameter name not reconised." << std::endl;
- return 0;
- }
+ if ( name == "b1" ) {
+ return b1_;
+ } else if ( name == "b2" ) {
+ return b2_;
+ } else if ( name == "A" ) {
+ return a_;
+ } else if ( name == "m0" ) {
+ return m0_;
+ } else {
+ std::cerr << "WARNING in LauSigmaRes::getResonanceParameter: Parameter name not reconised."
+ << std::endl;
+ return 0;
+ }
}
-void LauSigmaRes::setB1Value(const Double_t b1)
+void LauSigmaRes::setB1Value( const Double_t b1 )
{
- b1_->value( b1 );
- b1_->genValue( b1 );
- b1_->initValue( b1 );
+ b1_->value( b1 );
+ b1_->genValue( b1 );
+ b1_->initValue( b1 );
}
-void LauSigmaRes::setB2Value(const Double_t b2)
+void LauSigmaRes::setB2Value( const Double_t b2 )
{
- b2_->value( b2 );
- b2_->genValue( b2 );
- b2_->initValue( b2 );
+ b2_->value( b2 );
+ b2_->genValue( b2 );
+ b2_->initValue( b2 );
}
-void LauSigmaRes::setAValue(const Double_t A)
+void LauSigmaRes::setAValue( const Double_t A )
{
- a_->value( A );
- a_->genValue( A );
- a_->initValue( A );
+ a_->value( A );
+ a_->genValue( A );
+ a_->initValue( A );
}
-void LauSigmaRes::setM0Value(const Double_t m0)
+void LauSigmaRes::setM0Value( const Double_t m0 )
{
- m0_->value( m0 );
- m0_->genValue( m0 );
- m0_->initValue( m0 );
+ m0_->value( m0 );
+ m0_->genValue( m0 );
+ m0_->initValue( m0 );
}
-
diff --git a/src/LauSigmoidPdf.cc b/src/LauSigmoidPdf.cc
index 37bd6cd..1513940 100644
--- a/src/LauSigmoidPdf.cc
+++ b/src/LauSigmoidPdf.cc
@@ -1,157 +1,154 @@
/*
Copyright 2012 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauSigmoidPdf.cc
\brief File containing implementation of LauSigmoidPdf class.
*/
-
#include <iostream>
#include <vector>
-using std::cout;
using std::cerr;
+using std::cout;
using std::endl;
-#include "TMath.h"
-#include "TSystem.h"
-
#include "LauConstants.hh"
#include "LauSigmoidPdf.hh"
+#include "TMath.h"
+#include "TSystem.h"
-
-LauSigmoidPdf::LauSigmoidPdf(const TString& theVarName, const std::vector<LauAbsRValue*>& params, Double_t minAbscissa, Double_t maxAbscissa) :
- LauAbsPdf(theVarName, params, minAbscissa, maxAbscissa),
- a_(0),
- b_(0)
+LauSigmoidPdf::LauSigmoidPdf( const TString& theVarName,
+ const std::vector<LauAbsRValue*>& params,
+ Double_t minAbscissa,
+ Double_t maxAbscissa ) :
+ LauAbsPdf( theVarName, params, minAbscissa, maxAbscissa ),
+ a_( 0 ),
+ b_( 0 )
{
- // Constructor for the general form of a Sigmoid PDF.
- //
- // The parameters in params "a" and "b" define the steepness of the
- // slope and shift of the distribution (negative parameter "a" flips
- // the distribution around the y-axis).
- // The last two arguments specify the range in which the PDF is
- // defined, and the PDF will be normalised w.r.t. these limits.
-
- a_ = this->findParameter("a");
- b_ = this->findParameter("b");
-
- if ((this->nParameters() != 2) || (a_ == 0) || (b_ == 0)) {
- cerr<<"ERROR in LauSigmoidPdf constructor: LauSigmoidPdf requires 2 parameters: \"a\" and \"b\"."<<endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // Cache the normalisation factor
- this->calcNorm();
+ // Constructor for the general form of a Sigmoid PDF.
+ //
+ // The parameters in params "a" and "b" define the steepness of the
+ // slope and shift of the distribution (negative parameter "a" flips
+ // the distribution around the y-axis).
+ // The last two arguments specify the range in which the PDF is
+ // defined, and the PDF will be normalised w.r.t. these limits.
+
+ a_ = this->findParameter( "a" );
+ b_ = this->findParameter( "b" );
+
+ if ( ( this->nParameters() != 2 ) || ( a_ == 0 ) || ( b_ == 0 ) ) {
+ cerr << "ERROR in LauSigmoidPdf constructor: LauSigmoidPdf requires 2 parameters: \"a\" and \"b\"."
+ << endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // Cache the normalisation factor
+ this->calcNorm();
}
-LauSigmoidPdf::~LauSigmoidPdf()
+LauSigmoidPdf::~LauSigmoidPdf()
{
- // Destructor
+ // Destructor
}
-LauSigmoidPdf::LauSigmoidPdf(const LauSigmoidPdf& other) : LauAbsPdf(other.varName(), other.getParameters(), other.getMinAbscissa(), other.getMaxAbscissa())
+LauSigmoidPdf::LauSigmoidPdf( const LauSigmoidPdf& other ) :
+ LauAbsPdf( other.varName(), other.getParameters(), other.getMinAbscissa(), other.getMaxAbscissa() )
{
- // Copy constructor
- this->setRandomFun(other.getRandomFun());
- this->calcNorm();
+ // Copy constructor
+ this->setRandomFun( other.getRandomFun() );
+ this->calcNorm();
}
-void LauSigmoidPdf::calcLikelihoodInfo(const LauAbscissas& abscissas)
+void LauSigmoidPdf::calcLikelihoodInfo( const LauAbscissas& abscissas )
{
- // Check that the given abscissa is within the allowed range
- if (!this->checkRange(abscissas)) {
- gSystem->Exit(EXIT_FAILURE);
- }
+ // Check that the given abscissa is within the allowed range
+ if ( ! this->checkRange( abscissas ) ) {
+ gSystem->Exit( EXIT_FAILURE );
+ }
- // Get our abscissa
- Double_t abscissa = abscissas[0];
+ // Get our abscissa
+ Double_t abscissa = abscissas[0];
- // Get the up to date parameter values
- Double_t a = a_->unblindValue();
- Double_t b = b_->unblindValue();
+ // Get the up to date parameter values
+ Double_t a = a_->unblindValue();
+ Double_t b = b_->unblindValue();
- // Calculate the value of the exponent for the given value of the abscissa.
+ // Calculate the value of the exponent for the given value of the abscissa.
- Double_t exponent = -a*abscissa + b;
+ Double_t exponent = -a * abscissa + b;
- Double_t value = 1.0/(1.0+ TMath::Exp(exponent));
+ Double_t value = 1.0 / ( 1.0 + TMath::Exp( exponent ) );
- this->setUnNormPDFVal(value);
-
- // if the parameters are floating then we
- // need to recalculate the normalisation
- if (!this->cachePDF() && !this->withinNormCalc() && !this->withinGeneration()) {
- this->calcNorm();
- }
+ this->setUnNormPDFVal( value );
+ // if the parameters are floating then we
+ // need to recalculate the normalisation
+ if ( ! this->cachePDF() && ! this->withinNormCalc() && ! this->withinGeneration() ) {
+ this->calcNorm();
+ }
}
-void LauSigmoidPdf::calcNorm()
+void LauSigmoidPdf::calcNorm()
{
- // Get the up to date parameter values
- Double_t a = a_->unblindValue();
- Double_t b = b_->unblindValue();
-
- // Calculate the normalisation of the sigmoid and cache it.
- Double_t norm(0.0);
+ // Get the up to date parameter values
+ Double_t a = a_->unblindValue();
+ Double_t b = b_->unblindValue();
- if (TMath::Abs(a) > 1e-10) {
- Double_t expb = TMath::Exp(b);
+ // Calculate the normalisation of the sigmoid and cache it.
+ Double_t norm( 0.0 );
- norm = TMath::Log( TMath::Exp(a * this->getMaxAbscissa()) + expb ) -
- TMath::Log( TMath::Exp(a * this->getMinAbscissa()) + expb );
- norm /= a;
+ if ( TMath::Abs( a ) > 1e-10 ) {
+ Double_t expb = TMath::Exp( b );
- }
+ norm = TMath::Log( TMath::Exp( a * this->getMaxAbscissa() ) + expb ) -
+ TMath::Log( TMath::Exp( a * this->getMinAbscissa() ) + expb );
+ norm /= a;
+ }
- this->setNorm(norm);
+ this->setNorm( norm );
}
-
-void LauSigmoidPdf::calcPDFHeight(const LauKinematics* /*kinematics*/)
+void LauSigmoidPdf::calcPDFHeight( const LauKinematics* /*kinematics*/ )
{
- if (this->heightUpToDate()) {
- return;
- }
-
- // Get the up to date parameter values
- Double_t a = a_->unblindValue();
-
- LauAbscissas maxPoint(1);
- maxPoint[0] = 0;
-
- // Calculate the PDF height for the Sigmoid function.
- if (a > 0.0) {
- maxPoint[0] = this->getMaxAbscissa();
- } else {
- maxPoint[0] = this->getMinAbscissa();
- }
- this->calcLikelihoodInfo(maxPoint);
-
- Double_t height = this->getUnNormLikelihood();
- this->setMaxHeight(height);
+ if ( this->heightUpToDate() ) {
+ return;
+ }
+
+ // Get the up to date parameter values
+ Double_t a = a_->unblindValue();
+
+ LauAbscissas maxPoint( 1 );
+ maxPoint[0] = 0;
+
+ // Calculate the PDF height for the Sigmoid function.
+ if ( a > 0.0 ) {
+ maxPoint[0] = this->getMaxAbscissa();
+ } else {
+ maxPoint[0] = this->getMinAbscissa();
+ }
+ this->calcLikelihoodInfo( maxPoint );
+
+ Double_t height = this->getUnNormLikelihood();
+ this->setMaxHeight( height );
}
-
-
diff --git a/src/LauSimFitCoordinator.cc b/src/LauSimFitCoordinator.cc
index 02a487f..54cee82 100644
--- a/src/LauSimFitCoordinator.cc
+++ b/src/LauSimFitCoordinator.cc
@@ -1,1068 +1,1157 @@
/*
Copyright 2013 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauSimFitCoordinator.cc
\brief File containing implementation of LauSimFitCoordinator class.
*/
-#include <cstdlib>
-#include <iostream>
-#include <limits>
+#include "LauSimFitCoordinator.hh"
+
+#include "LauAbsFitter.hh"
+#include "LauFitNtuple.hh"
+#include "LauFitter.hh"
+#include "LauFormulaPar.hh"
+#include "LauParamFixed.hh"
+#include "LauParameter.hh"
#include "TMath.h"
#include "TMatrixD.h"
#include "TMessage.h"
#include "TMonitor.h"
#include "TObjArray.h"
#include "TObjString.h"
#include "TServerSocket.h"
#include "TSocket.h"
#include "TSystem.h"
-#include "LauAbsFitter.hh"
-#include "LauFitNtuple.hh"
-#include "LauFitter.hh"
-#include "LauFormulaPar.hh"
-#include "LauParameter.hh"
-#include "LauParamFixed.hh"
-#include "LauSimFitCoordinator.hh"
-
-
-
+#include <cstdlib>
+#include <iostream>
+#include <limits>
LauSimFitCoordinator::LauSimFitCoordinator( UInt_t numTasks, UInt_t port ) :
- nTasks_(numTasks),
- reqPort_(port),
- socketMonitor_(0),
- messageFromTask_(0),
- fitNtuple_(0)
+ nTasks_( numTasks ),
+ reqPort_( port ),
+ socketMonitor_( 0 ),
+ messageFromTask_( 0 ),
+ fitNtuple_( 0 )
{
- messagesToTasks_.resize( nTasks_ );
- for ( UInt_t iTask(0); iTask < nTasks_; ++iTask ) {
- messagesToTasks_[iTask] = new TMessage();
- }
+ messagesToTasks_.resize( nTasks_ );
+ for ( UInt_t iTask( 0 ); iTask < nTasks_; ++iTask ) {
+ messagesToTasks_[iTask] = new TMessage();
+ }
}
LauSimFitCoordinator::~LauSimFitCoordinator()
{
- delete socketMonitor_; socketMonitor_ = 0;
-
- // Tell all tasks that they are finished and delete corresponding socket
- TString msgStr("Finish");
- TMessage message( kMESS_STRING );
- message.WriteTString(msgStr);
- for ( std::vector<TSocket*>::iterator iter = socketTasks_.begin(); iter != socketTasks_.end(); ++iter ) {
- (*iter)->Send(message);
- (*iter)->Close();
- delete (*iter);
- }
- socketTasks_.clear();
-
- // Remove all fit parameters
- for ( std::vector<LauParameter*>::iterator iter = params_.begin(); iter != params_.end(); ++iter ) {
- delete *iter;
- }
- params_.clear();
-
- for ( std::vector<Double_t*>::iterator iter = vectorPar_.begin(); iter != vectorPar_.end(); ++iter ) {
- delete[] (*iter);
- }
- vectorPar_.clear();
-
- delete messageFromTask_; messageFromTask_ = 0;
-
- for ( std::vector<TMessage*>::iterator iter = messagesToTasks_.begin(); iter != messagesToTasks_.end(); ++iter ) {
- delete (*iter);
- }
- messagesToTasks_.clear();
-
- delete fitNtuple_;
+ delete socketMonitor_;
+ socketMonitor_ = 0;
+
+ // Tell all tasks that they are finished and delete corresponding socket
+ TString msgStr( "Finish" );
+ TMessage message( kMESS_STRING );
+ message.WriteTString( msgStr );
+ for ( std::vector<TSocket*>::iterator iter = socketTasks_.begin(); iter != socketTasks_.end();
+ ++iter ) {
+ ( *iter )->Send( message );
+ ( *iter )->Close();
+ delete ( *iter );
+ }
+ socketTasks_.clear();
+
+ // Remove all fit parameters
+ for ( std::vector<LauParameter*>::iterator iter = params_.begin(); iter != params_.end();
+ ++iter ) {
+ delete *iter;
+ }
+ params_.clear();
+
+ for ( std::vector<Double_t*>::iterator iter = vectorPar_.begin(); iter != vectorPar_.end();
+ ++iter ) {
+ delete[] ( *iter );
+ }
+ vectorPar_.clear();
+
+ delete messageFromTask_;
+ messageFromTask_ = 0;
+
+ for ( std::vector<TMessage*>::iterator iter = messagesToTasks_.begin();
+ iter != messagesToTasks_.end();
+ ++iter ) {
+ delete ( *iter );
+ }
+ messagesToTasks_.clear();
+
+ delete fitNtuple_;
}
void LauSimFitCoordinator::initSockets()
{
- if ( socketMonitor_ != 0 ) {
- std::cerr << "ERROR in LauSimFitCoordinator::initSockets : Sockets already initialised." << std::endl;
- return;
- }
+ if ( socketMonitor_ != 0 ) {
+ std::cerr << "ERROR in LauSimFitCoordinator::initSockets : Sockets already initialised."
+ << std::endl;
+ return;
+ }
- //initialise socket connection, then accept a connection and return a full-duplex communication socket.
- socketMonitor_ = new TMonitor();
+ //initialise socket connection, then accept a connection and return a full-duplex communication socket.
+ socketMonitor_ = new TMonitor();
- TServerSocket *ss = new TServerSocket( reqPort_, kFALSE );
- UInt_t actual_port = ss->GetLocalPort();
+ TServerSocket* ss = new TServerSocket( reqPort_, kFALSE );
+ UInt_t actual_port = ss->GetLocalPort();
- std::cout << "INFO in LauSimFitCoordinator::initSockets : Waiting for connection with " << nTasks_ << " tasks on port " << actual_port << std::endl;
+ std::cout << "INFO in LauSimFitCoordinator::initSockets : Waiting for connection with "
+ << nTasks_ << " tasks on port " << actual_port << std::endl;
- socketTasks_.resize(nTasks_);
- for ( UInt_t iTask(0); iTask<nTasks_; ++iTask ) {
- socketTasks_[iTask] = ss->Accept();
- std::cout << " : Added task " << iTask << std::endl;
- }
+ socketTasks_.resize( nTasks_ );
+ for ( UInt_t iTask( 0 ); iTask < nTasks_; ++iTask ) {
+ socketTasks_[iTask] = ss->Accept();
+ std::cout << " : Added task " << iTask << std::endl;
+ }
- // tell the clients to start
- std::cout << "INFO in LauSimFitCoordinator::initSockets : Initialising tasks" << std::endl;
- for ( UInt_t iTask(0); iTask<nTasks_; ++iTask ) {
+ // tell the clients to start
+ std::cout << "INFO in LauSimFitCoordinator::initSockets : Initialising tasks" << std::endl;
+ for ( UInt_t iTask( 0 ); iTask < nTasks_; ++iTask ) {
- TMessage message( kMESS_ANY );
- message.WriteUInt(iTask);
- message.WriteUInt(nTasks_);
- message.WriteBool(this->useAsymmFitErrors());
+ TMessage message( kMESS_ANY );
+ message.WriteUInt( iTask );
+ message.WriteUInt( nTasks_ );
+ message.WriteBool( this->useAsymmFitErrors() );
- socketTasks_[iTask]->Send(message);
+ socketTasks_[iTask]->Send( message );
- socketMonitor_->Add(socketTasks_[iTask]);
- }
- std::cout << " : Now start fit\n" << std::endl;
+ socketMonitor_->Add( socketTasks_[iTask] );
+ }
+ std::cout << " : Now start fit\n" << std::endl;
- ss->Close();
- delete ss;
+ ss->Close();
+ delete ss;
}
/*
* OLD VERSION THAT JUST GETS THE NAMES - COULD HAVE A SERIES OF EXCHANGES TO GET THE NAMES, INIT VALUES, RANGES, ETC. INSTEAD OF PASSING PARAMETERS
* THIS INCREASES THE GENERALITY OF THE CODE, I.E. THERE IS NO NEED FOR THE TASKS TO KNOW ANY LAURA++ CLASS BUT THIS ONE, BUT MAKES IT RATHER MORE DENSE
* FOR THE MOMENT I WILL STICK WITH THE METHOD OF PASSING LAUPARAMETER OBJECTS AROUND AND CONSIDER GOING BACK TO THIS GENERAL METHOD ONCE EVERYTHING IS WORKING
*
void LauSimFitCoordinator::getParametersFromTasksFirstTime()
{
- taskIndices_.resize( nTasks_ );
-
- TSocket* sActive(0);
- for ( UInt_t iTask(0); iTask<nTasks_; ++iTask ) {
- // Send a message to the task, requesting the list of parameter names
- TString msgStr = "Parameter Names";
- TMessage message( kMESS_STRING );
- message.WriteTString( msgStr );
- socketTasks_[iTask]->Send(message);
-
- // Wait to receive the response and check that it has come from the task we just requested from
- sActive = socketMonitor_->Select();
- if ( sActive != socketTasks_[iTask] ) {
- std::cerr << "ERROR in LauSimFitCoordinator::getParametersFromTasksFirstTime : Received message from a different task than expected!" << std::endl;
- gSystem->Exit(1);
- }
-
- // Read the object and extract the parameter names
- socketTasks_[iTask]->Recv( messageFromTask_ );
- TObjArray * objarray = dynamic_cast<TObjArray*>( messageFromTask_->ReadObject( messageFromTask_->GetClass() ) );
- if ( ! objarray ) {
- std::cerr << "ERROR in LauSimFitCoordinator::getParametersFromTasksFirstTime : Error reading parameter names from task" << std::endl;
- gSystem->Exit(1);
- }
-
- Int_t nPars = objarray->GetEntries();
- for ( Int_t iPar(0); iPar < nPars; ++iPar ) {
- TObjString* objstring = dynamic_cast<TObjString*>( (*objarray)[iPar] );
- if ( ! objstring ) {
- std::cerr << "ERROR in LauSimFitCoordinator::getParametersFromTasksFirstTime : Error reading parameter names from task" << std::endl;
- gSystem->Exit(1);
- }
- TString parname = objstring->GetString();
-
- std::map< TString, UInt_t >::iterator iter = parIndices_.find( parname );
- if ( iter != parIndices_.end() ) {
- UInt_t index = iter->second;
- taskIndices_[iTask].push_back( index );
- } else {
- UInt_t index = parIndices_.size();
- parIndices_.insert( std::make_pair( parname, index ) );
- parNames_.insert( std::make_pair( index, parname ) );
- taskIndices_[iTask].push_back( index );
- }
- }
-
- delete objarray; objarray = 0;
- delete messageFromTask_; messageFromTask_ = 0;
- }
-
- UInt_t nPars = parNames_.size();
- parValues_.resize( nPars );
+ taskIndices_.resize( nTasks_ );
+
+ TSocket* sActive(0);
+ for ( UInt_t iTask(0); iTask<nTasks_; ++iTask ) {
+ // Send a message to the task, requesting the list of parameter names
+ TString msgStr = "Parameter Names";
+ TMessage message( kMESS_STRING );
+ message.WriteTString( msgStr );
+ socketTasks_[iTask]->Send(message);
+
+ // Wait to receive the response and check that it has come from the task we just requested from
+ sActive = socketMonitor_->Select();
+ if ( sActive != socketTasks_[iTask] ) {
+ std::cerr << "ERROR in LauSimFitCoordinator::getParametersFromTasksFirstTime : Received message from a different task than expected!" << std::endl;
+ gSystem->Exit(1);
+ }
+
+ // Read the object and extract the parameter names
+ socketTasks_[iTask]->Recv( messageFromTask_ );
+ TObjArray * objarray = dynamic_cast<TObjArray*>( messageFromTask_->ReadObject( messageFromTask_->GetClass() ) );
+ if ( ! objarray ) {
+ std::cerr << "ERROR in LauSimFitCoordinator::getParametersFromTasksFirstTime : Error reading parameter names from task" << std::endl;
+ gSystem->Exit(1);
+ }
+
+ Int_t nPars = objarray->GetEntries();
+ for ( Int_t iPar(0); iPar < nPars; ++iPar ) {
+ TObjString* objstring = dynamic_cast<TObjString*>( (*objarray)[iPar] );
+ if ( ! objstring ) {
+ std::cerr << "ERROR in LauSimFitCoordinator::getParametersFromTasksFirstTime : Error reading parameter names from task" << std::endl;
+ gSystem->Exit(1);
+ }
+ TString parname = objstring->GetString();
+
+ std::map< TString, UInt_t >::iterator iter = parIndices_.find( parname );
+ if ( iter != parIndices_.end() ) {
+ UInt_t index = iter->second;
+ taskIndices_[iTask].push_back( index );
+ } else {
+ UInt_t index = parIndices_.size();
+ parIndices_.insert( std::make_pair( parname, index ) );
+ parNames_.insert( std::make_pair( index, parname ) );
+ taskIndices_[iTask].push_back( index );
+ }
+ }
+
+ delete objarray; objarray = 0;
+ delete messageFromTask_; messageFromTask_ = 0;
+ }
+
+ UInt_t nPars = parNames_.size();
+ parValues_.resize( nPars );
}
*/
void LauSimFitCoordinator::getParametersFromTasks()
{
- if ( socketMonitor_ == 0 ) {
- std::cerr << "ERROR in LauSimFitCoordinator::getParametersFromTasks : Sockets not initialised." << std::endl;
- return;
- }
-
- if ( params_.empty() ) {
- this->getParametersFromTasksFirstTime();
-
- // Add variables to Gaussian constrain to a list
- this->addConParameters();
- } else {
- this->updateParametersFromTasks();
- }
+ if ( socketMonitor_ == 0 ) {
+ std::cerr << "ERROR in LauSimFitCoordinator::getParametersFromTasks : Sockets not initialised."
+ << std::endl;
+ return;
+ }
+
+ if ( params_.empty() ) {
+ this->getParametersFromTasksFirstTime();
+
+ // Add variables to Gaussian constrain to a list
+ this->addConParameters();
+ } else {
+ this->updateParametersFromTasks();
+ }
}
void LauSimFitCoordinator::updateParametersFromTasks()
{
- TSocket* sActive(0);
-
- // Construct a message, requesting the list of parameter names
- TString msgStr = "Send Parameters";
- TMessage message( kMESS_STRING );
- message.WriteTString( msgStr );
-
- for ( UInt_t iTask(0); iTask<nTasks_; ++iTask ) {
- // Send the message to the task
- socketTasks_[iTask]->Send(message);
-
- // Wait to receive the response and check that it has come from the task we just requested from
- sActive = socketMonitor_->Select();
- if ( sActive != socketTasks_[iTask] ) {
- std::cerr << "ERROR in LauSimFitCoordinator::updateParametersFromTasks : Received message from a different task than expected!" << std::endl;
- gSystem->Exit(1);
- }
-
- // Read the object and extract the parameter names
- socketTasks_[iTask]->Recv( messageFromTask_ );
- TObjArray * objarray = dynamic_cast<TObjArray*>( messageFromTask_->ReadObject( messageFromTask_->GetClass() ) );
- if ( ! objarray ) {
- std::cerr << "ERROR in LauSimFitCoordinator::updateParametersFromTasks : Error reading parameter names from task" << std::endl;
- gSystem->Exit(1);
- }
-
- // We want to auto-delete the supplied parameters since we only copy their values in this case
- objarray->SetOwner(kTRUE);
-
- const UInt_t nPars = objarray->GetEntries();
- if ( nPars != taskIndices_[iTask].size() ) {
- std::cerr << "ERROR in LauSimFitCoordinator::updateParametersFromTasks : Unexpected number of parameters received from task" << std::endl;
- gSystem->Exit(1);
- }
-
- for ( UInt_t iPar(0); iPar < nPars; ++iPar ) {
- LauParameter* parameter = dynamic_cast<LauParameter*>( (*objarray)[iPar] );
- if ( ! parameter ) {
- std::cerr << "ERROR in LauSimFitCoordinator::updateParametersFromTasks : Error reading parameter from task" << std::endl;
- gSystem->Exit(1);
- }
-
- TString parname = parameter->name();
- Double_t parvalue = parameter->initValue();
-
- std::map< TString, UInt_t >::iterator iter = parIndices_.find( parname );
- if ( iter == parIndices_.end() ) {
- std::cerr << "ERROR in LauSimFitCoordinator::updateParametersFromTasks : Unexpected parameter name received from task" << std::endl;
- gSystem->Exit(1);
- }
-
- const UInt_t index = iter->second;
- if ( taskIndices_[iTask][iPar] != index ) {
- std::cerr << "ERROR in LauSimFitCoordinator::updateParametersFromTasks : Unexpected parameter received from task" << std::endl;
- gSystem->Exit(1);
- }
-
- params_[index]->initValue( parvalue );
- parValues_[index] = parvalue;
- vectorPar_[iTask][iPar] = parvalue;
- this->checkParameter( parameter, index );
- }
-
- delete objarray; objarray = 0;
- delete messageFromTask_; messageFromTask_ = 0;
- }
+ TSocket* sActive( 0 );
+
+ // Construct a message, requesting the list of parameter names
+ TString msgStr = "Send Parameters";
+ TMessage message( kMESS_STRING );
+ message.WriteTString( msgStr );
+
+ for ( UInt_t iTask( 0 ); iTask < nTasks_; ++iTask ) {
+ // Send the message to the task
+ socketTasks_[iTask]->Send( message );
+
+ // Wait to receive the response and check that it has come from the task we just requested from
+ sActive = socketMonitor_->Select();
+ if ( sActive != socketTasks_[iTask] ) {
+ std::cerr << "ERROR in LauSimFitCoordinator::updateParametersFromTasks : Received message from a different task than expected!"
+ << std::endl;
+ gSystem->Exit( 1 );
+ }
+
+ // Read the object and extract the parameter names
+ socketTasks_[iTask]->Recv( messageFromTask_ );
+ TObjArray* objarray = dynamic_cast<TObjArray*>(
+ messageFromTask_->ReadObject( messageFromTask_->GetClass() ) );
+ if ( ! objarray ) {
+ std::cerr << "ERROR in LauSimFitCoordinator::updateParametersFromTasks : Error reading parameter names from task"
+ << std::endl;
+ gSystem->Exit( 1 );
+ }
+
+ // We want to auto-delete the supplied parameters since we only copy their values in this case
+ objarray->SetOwner( kTRUE );
+
+ const UInt_t nPars = objarray->GetEntries();
+ if ( nPars != taskIndices_[iTask].size() ) {
+ std::cerr << "ERROR in LauSimFitCoordinator::updateParametersFromTasks : Unexpected number of parameters received from task"
+ << std::endl;
+ gSystem->Exit( 1 );
+ }
+
+ for ( UInt_t iPar( 0 ); iPar < nPars; ++iPar ) {
+ LauParameter* parameter = dynamic_cast<LauParameter*>( ( *objarray )[iPar] );
+ if ( ! parameter ) {
+ std::cerr << "ERROR in LauSimFitCoordinator::updateParametersFromTasks : Error reading parameter from task"
+ << std::endl;
+ gSystem->Exit( 1 );
+ }
+
+ TString parname = parameter->name();
+ Double_t parvalue = parameter->initValue();
+
+ std::map<TString, UInt_t>::iterator iter = parIndices_.find( parname );
+ if ( iter == parIndices_.end() ) {
+ std::cerr << "ERROR in LauSimFitCoordinator::updateParametersFromTasks : Unexpected parameter name received from task"
+ << std::endl;
+ gSystem->Exit( 1 );
+ }
+
+ const UInt_t index = iter->second;
+ if ( taskIndices_[iTask][iPar] != index ) {
+ std::cerr << "ERROR in LauSimFitCoordinator::updateParametersFromTasks : Unexpected parameter received from task"
+ << std::endl;
+ gSystem->Exit( 1 );
+ }
+
+ params_[index]->initValue( parvalue );
+ parValues_[index] = parvalue;
+ vectorPar_[iTask][iPar] = parvalue;
+ this->checkParameter( parameter, index );
+ }
+
+ delete objarray;
+ objarray = 0;
+ delete messageFromTask_;
+ messageFromTask_ = 0;
+ }
}
void LauSimFitCoordinator::getParametersFromTasksFirstTime()
{
- taskIndices_.resize( nTasks_ );
- taskFreeIndices_.resize( nTasks_ );
- vectorPar_.resize( nTasks_ );
- vectorRes_.resize( nTasks_ );
-
- TSocket* sActive(0);
-
- // Construct a message, requesting the list of parameter names
- TString msgStr = "Send Parameters";
- TMessage message( kMESS_STRING );
- message.WriteTString( msgStr );
-
- for ( UInt_t iTask(0); iTask<nTasks_; ++iTask ) {
- // Send the message to the task
- socketTasks_[iTask]->Send(message);
-
- // Wait to receive the response and check that it has come from the task we just requested from
- sActive = socketMonitor_->Select();
- if ( sActive != socketTasks_[iTask] ) {
- std::cerr << "ERROR in LauSimFitCoordinator::getParametersFromTasksFirstTime : Received message from a different task than expected!" << std::endl;
- gSystem->Exit(1);
- }
-
- // Read the object and extract the parameter names
- socketTasks_[iTask]->Recv( messageFromTask_ );
- TObjArray * objarray = dynamic_cast<TObjArray*>( messageFromTask_->ReadObject( messageFromTask_->GetClass() ) );
- if ( ! objarray ) {
- std::cerr << "ERROR in LauSimFitCoordinator::getParametersFromTasksFirstTime : Error reading parameters from task" << std::endl;
- gSystem->Exit(1);
- }
-
- const UInt_t nPars = objarray->GetEntries();
-
- vectorPar_[iTask] = new Double_t[nPars];
-
- for ( UInt_t iPar(0); iPar < nPars; ++iPar ) {
- LauParameter* parameter = dynamic_cast<LauParameter*>( (*objarray)[iPar] );
- if ( ! parameter ) {
- std::cerr << "ERROR in LauSimFitCoordinator::getParametersFromTasksFirstTime : Error reading parameter from task" << std::endl;
- gSystem->Exit(1);
- }
-
- TString parname = parameter->name();
- Double_t parvalue = parameter->initValue();
- Bool_t parfixed = parameter->fixed();
-
- std::map< TString, UInt_t >::iterator iter = parIndices_.find( parname );
- if ( iter != parIndices_.end() ) {
- UInt_t index = iter->second;
- taskIndices_[iTask].push_back( index );
- if ( ! parfixed ) {
- taskFreeIndices_[iTask].push_back( index );
- }
- this->checkParameter( parameter, index );
- } else {
- UInt_t index = parIndices_.size();
- parIndices_.insert( std::make_pair( parname, index ) );
- parNames_.insert( std::make_pair( index, parname ) );
- taskIndices_[iTask].push_back( index );
- if ( ! parfixed ) {
- taskFreeIndices_[iTask].push_back( index );
- }
- params_.push_back( parameter );
- parValues_.push_back( parvalue );
- }
- vectorPar_[iTask][iPar] = parvalue;
- }
-
- delete objarray; objarray = 0;
- delete messageFromTask_; messageFromTask_ = 0;
- }
+ taskIndices_.resize( nTasks_ );
+ taskFreeIndices_.resize( nTasks_ );
+ vectorPar_.resize( nTasks_ );
+ vectorRes_.resize( nTasks_ );
+
+ TSocket* sActive( 0 );
+
+ // Construct a message, requesting the list of parameter names
+ TString msgStr = "Send Parameters";
+ TMessage message( kMESS_STRING );
+ message.WriteTString( msgStr );
+
+ for ( UInt_t iTask( 0 ); iTask < nTasks_; ++iTask ) {
+ // Send the message to the task
+ socketTasks_[iTask]->Send( message );
+
+ // Wait to receive the response and check that it has come from the task we just requested from
+ sActive = socketMonitor_->Select();
+ if ( sActive != socketTasks_[iTask] ) {
+ std::cerr << "ERROR in LauSimFitCoordinator::getParametersFromTasksFirstTime : Received message from a different task than expected!"
+ << std::endl;
+ gSystem->Exit( 1 );
+ }
+
+ // Read the object and extract the parameter names
+ socketTasks_[iTask]->Recv( messageFromTask_ );
+ TObjArray* objarray = dynamic_cast<TObjArray*>(
+ messageFromTask_->ReadObject( messageFromTask_->GetClass() ) );
+ if ( ! objarray ) {
+ std::cerr << "ERROR in LauSimFitCoordinator::getParametersFromTasksFirstTime : Error reading parameters from task"
+ << std::endl;
+ gSystem->Exit( 1 );
+ }
+
+ const UInt_t nPars = objarray->GetEntries();
+
+ vectorPar_[iTask] = new Double_t[nPars];
+
+ for ( UInt_t iPar( 0 ); iPar < nPars; ++iPar ) {
+ LauParameter* parameter = dynamic_cast<LauParameter*>( ( *objarray )[iPar] );
+ if ( ! parameter ) {
+ std::cerr << "ERROR in LauSimFitCoordinator::getParametersFromTasksFirstTime : Error reading parameter from task"
+ << std::endl;
+ gSystem->Exit( 1 );
+ }
+
+ TString parname = parameter->name();
+ Double_t parvalue = parameter->initValue();
+ Bool_t parfixed = parameter->fixed();
+
+ std::map<TString, UInt_t>::iterator iter = parIndices_.find( parname );
+ if ( iter != parIndices_.end() ) {
+ UInt_t index = iter->second;
+ taskIndices_[iTask].push_back( index );
+ if ( ! parfixed ) {
+ taskFreeIndices_[iTask].push_back( index );
+ }
+ this->checkParameter( parameter, index );
+ } else {
+ UInt_t index = parIndices_.size();
+ parIndices_.insert( std::make_pair( parname, index ) );
+ parNames_.insert( std::make_pair( index, parname ) );
+ taskIndices_[iTask].push_back( index );
+ if ( ! parfixed ) {
+ taskFreeIndices_[iTask].push_back( index );
+ }
+ params_.push_back( parameter );
+ parValues_.push_back( parvalue );
+ }
+ vectorPar_[iTask][iPar] = parvalue;
+ }
+
+ delete objarray;
+ objarray = 0;
+ delete messageFromTask_;
+ messageFromTask_ = 0;
+ }
}
void LauSimFitCoordinator::printParInfo() const
{
- for ( UInt_t iTask(0); iTask<nTasks_; ++iTask ) {
- const std::vector<UInt_t>& indices = taskIndices_[iTask];
-
- std::cout << "INFO in LauSimFitCoordinator::printParInfo : Task " << iTask << " has the following parameters:\n";
- for ( std::vector<UInt_t>::const_iterator iter = indices.begin(); iter != indices.end(); ++iter ) {
- const TString& parName = parNames_.find(*iter)->second;
- Double_t parValue = parValues_[*iter];
- const LauParameter* par = params_[*iter];
- if ( par->name() != parName || par->initValue() != parValue ) {
- std::cerr << "ERROR in LauSimFitCoordinator::printParInfo : Discrepancy in parameter name and value records, this is very strange!!" << std::endl;
- }
-
- std::cout << " : " << parName << " = " << parValue << " and has index " << *iter << "\n";
- }
-
- std::cout << std::endl;
- }
-
- std::cout << "INFO in LauSimFitCoordinator::printParInfo : " << "There are " << params_.size() << " parameters in total" << std::endl;
+ for ( UInt_t iTask( 0 ); iTask < nTasks_; ++iTask ) {
+ const std::vector<UInt_t>& indices = taskIndices_[iTask];
+
+ std::cout << "INFO in LauSimFitCoordinator::printParInfo : Task " << iTask
+ << " has the following parameters:\n";
+ for ( std::vector<UInt_t>::const_iterator iter = indices.begin(); iter != indices.end();
+ ++iter ) {
+ const TString& parName = parNames_.find( *iter )->second;
+ Double_t parValue = parValues_[*iter];
+ const LauParameter* par = params_[*iter];
+ if ( par->name() != parName || par->initValue() != parValue ) {
+ std::cerr << "ERROR in LauSimFitCoordinator::printParInfo : Discrepancy in parameter name and value records, this is very strange!!"
+ << std::endl;
+ }
+
+ std::cout << " : " << parName << " = " << parValue
+ << " and has index " << *iter << "\n";
+ }
+
+ std::cout << std::endl;
+ }
+
+ std::cout << "INFO in LauSimFitCoordinator::printParInfo : "
+ << "There are " << params_.size() << " parameters in total" << std::endl;
}
void LauSimFitCoordinator::checkParameter( const LauParameter* param, UInt_t index ) const
{
- const LauParameter* storedPar = params_[index];
-
- TString parName = storedPar->name();
- if ( param->name() != parName ) {
- std::cerr << "ERROR in LauSimFitCoordinator::checkParameter : Parameter name is different!! This shouldn't happen!!" << std::endl;
- }
- if ( param->initValue() != storedPar->initValue() ) {
- std::cerr << "WARNING in LauSimFitCoordinator::checkParameter : Initial value for parameter " << parName << " is different, will use the value first set: " << storedPar->initValue() << std::endl;
- }
- if ( param->minValue() != storedPar->minValue() ) {
- std::cerr << "WARNING in LauSimFitCoordinator::checkParameter : Minimum allowed value for parameter " << parName << " is different, will use the value first set: " << storedPar->minValue() << std::endl;
- }
- if ( param->maxValue() != storedPar->maxValue() ) {
- std::cerr << "WARNING in LauSimFitCoordinator::checkParameter : Maximum allowed value for parameter " << parName << " is different, will use the value first set: " << storedPar->maxValue() << std::endl;
- }
- if ( param->fixed() != storedPar->fixed() ) {
- std::cerr << "WARNING in LauSimFitCoordinator::checkParameter : Fixed/floating property of parameter " << parName << " is different, will use the value first set: " << (storedPar->fixed() ? "fixed" : "floating") << std::endl;
- }
- if ( param->secondStage() != storedPar->secondStage() ) {
- std::cerr << "WARNING in LauSimFitCoordinator::checkParameter : Second stage property of parameter " << parName << " is different, will use the value first set: " << (storedPar->secondStage() ? "true" : "false") << std::endl;
- }
+ const LauParameter* storedPar = params_[index];
+
+ TString parName = storedPar->name();
+ if ( param->name() != parName ) {
+ std::cerr << "ERROR in LauSimFitCoordinator::checkParameter : Parameter name is different!! This shouldn't happen!!"
+ << std::endl;
+ }
+ if ( param->initValue() != storedPar->initValue() ) {
+ std::cerr << "WARNING in LauSimFitCoordinator::checkParameter : Initial value for parameter "
+ << parName
+ << " is different, will use the value first set: " << storedPar->initValue()
+ << std::endl;
+ }
+ if ( param->minValue() != storedPar->minValue() ) {
+ std::cerr << "WARNING in LauSimFitCoordinator::checkParameter : Minimum allowed value for parameter "
+ << parName
+ << " is different, will use the value first set: " << storedPar->minValue()
+ << std::endl;
+ }
+ if ( param->maxValue() != storedPar->maxValue() ) {
+ std::cerr << "WARNING in LauSimFitCoordinator::checkParameter : Maximum allowed value for parameter "
+ << parName
+ << " is different, will use the value first set: " << storedPar->maxValue()
+ << std::endl;
+ }
+ if ( param->fixed() != storedPar->fixed() ) {
+ std::cerr << "WARNING in LauSimFitCoordinator::checkParameter : Fixed/floating property of parameter "
+ << parName << " is different, will use the value first set: "
+ << ( storedPar->fixed() ? "fixed" : "floating" ) << std::endl;
+ }
+ if ( param->secondStage() != storedPar->secondStage() ) {
+ std::cerr << "WARNING in LauSimFitCoordinator::checkParameter : Second stage property of parameter "
+ << parName << " is different, will use the value first set: "
+ << ( storedPar->secondStage() ? "true" : "false" ) << std::endl;
+ }
}
void LauSimFitCoordinator::initialise()
{
- this->initSockets();
+ this->initSockets();
}
-void LauSimFitCoordinator::runSimFit( const TString& fitNtupleFileName, const Bool_t useAsymmErrors, const Bool_t doTwoStageFit )
+void LauSimFitCoordinator::runSimFit( const TString& fitNtupleFileName,
+ const Bool_t useAsymmErrors,
+ const Bool_t doTwoStageFit )
{
- // Routine to perform the total fit.
-
- // First, initialise
- this->useAsymmFitErrors(useAsymmErrors);
- this->twoStageFit(doTwoStageFit);
- this->initialise();
-
- const UInt_t nExp { this->nExpt() };
- const UInt_t firstExp { this->firstExpt() };
- const Bool_t isToy { this->toyExpts() };
-
- std::cout << "INFO in LauSimFitCoordinator::runSimFit : First experiment = " << firstExp << std::endl;
- std::cout << "INFO in LauSimFitCoordinator::runSimFit : Number of experiments = " << nExp << std::endl;
- std::cout << "INFO in LauSimFitCoordinator::runSimFit : Is toy MC = " << (isToy ? "True" : "False") << std::endl;
-
- // Start the cumulative timer
- cumulTimer_.Start();
-
- this->resetFitCounters();
-
- // Create and setup the fit results ntuple
- std::cout << "INFO in LauSimFitCoordinator::runSimFit : Creating fit ntuple." << std::endl;
- if (fitNtuple_ != 0) {delete fitNtuple_; fitNtuple_ = 0;}
- fitNtuple_ = new LauFitNtuple(fitNtupleFileName, useAsymmErrors);
-
- // Loop over the number of experiments
- for (UInt_t iExp = firstExp; iExp < (firstExp+nExp); ++iExp) {
-
- // Start the timer to see how long each fit takes
- timer_.Start();
-
- this->setCurrentExperiment( iExp );
-
- // Instruct the tasks to read the data for this experiment
- Bool_t readOK = this->readData();
- if ( ! readOK ) {
- std::cerr << "ERROR in LauSimFitCoordinator::runSimFit : One or more tasks reported problems with reading data for experiment " << iExp << ", skipping..." << std::endl;
- timer_.Stop();
- continue;
- }
-
- // Instruct the tasks to perform the caching
- this->cacheInputData();
-
- // Do the fit
- this->fitExpt();
-
- // Stop the timer and see how long the program took so far
- timer_.Stop();
- timer_.Print();
-
- // Instruct the tasks to finalise the results
- this->finalise();
- }
-
- // Print out total timing info.
- std::cout << "INFO in LauSimFitCoordinator::runSimFit : Cumulative timing:" << std::endl;
- cumulTimer_.Stop();
- cumulTimer_.Print();
-
- // Print out stats on OK fits.
- const UInt_t nOKFits = this->numberOKFits();
- const UInt_t nBadFits = this->numberBadFits();
- std::cout << "INFO in LauSimFitCoordinator::runSimFit : Number of OK Fits = " << nOKFits << std::endl;
- std::cout << "INFO in LauSimFitCoordinator::runSimFit : Number of Failed Fits = " << nBadFits << std::endl;
- Double_t fitEff(0.0);
- if (nExp != 0) {fitEff = nOKFits/(1.0*nExp);}
- std::cout << "INFO in LauSimFitCoordinator::runSimFit : Fit efficiency = " << fitEff*100.0 << "%." << std::endl;
-
- // Instruct the tasks to write out any fit results (ntuples etc...).
- this->writeOutResults();
+ // Routine to perform the total fit.
+
+ // First, initialise
+ this->useAsymmFitErrors( useAsymmErrors );
+ this->twoStageFit( doTwoStageFit );
+ this->initialise();
+
+ const UInt_t nExp { this->nExpt() };
+ const UInt_t firstExp { this->firstExpt() };
+ const Bool_t isToy { this->toyExpts() };
+
+ std::cout << "INFO in LauSimFitCoordinator::runSimFit : First experiment = " << firstExp
+ << std::endl;
+ std::cout << "INFO in LauSimFitCoordinator::runSimFit : Number of experiments = " << nExp
+ << std::endl;
+ std::cout << "INFO in LauSimFitCoordinator::runSimFit : Is toy MC = "
+ << ( isToy ? "True" : "False" ) << std::endl;
+
+ // Start the cumulative timer
+ cumulTimer_.Start();
+
+ this->resetFitCounters();
+
+ // Create and setup the fit results ntuple
+ std::cout << "INFO in LauSimFitCoordinator::runSimFit : Creating fit ntuple." << std::endl;
+ if ( fitNtuple_ != 0 ) {
+ delete fitNtuple_;
+ fitNtuple_ = 0;
+ }
+ fitNtuple_ = new LauFitNtuple( fitNtupleFileName, useAsymmErrors );
+
+ // Loop over the number of experiments
+ for ( UInt_t iExp = firstExp; iExp < ( firstExp + nExp ); ++iExp ) {
+
+ // Start the timer to see how long each fit takes
+ timer_.Start();
+
+ this->setCurrentExperiment( iExp );
+
+ // Instruct the tasks to read the data for this experiment
+ Bool_t readOK = this->readData();
+ if ( ! readOK ) {
+ std::cerr << "ERROR in LauSimFitCoordinator::runSimFit : One or more tasks reported problems with reading data for experiment "
+ << iExp << ", skipping..." << std::endl;
+ timer_.Stop();
+ continue;
+ }
+
+ // Instruct the tasks to perform the caching
+ this->cacheInputData();
+
+ // Do the fit
+ this->fitExpt();
+
+ // Stop the timer and see how long the program took so far
+ timer_.Stop();
+ timer_.Print();
+
+ // Instruct the tasks to finalise the results
+ this->finalise();
+ }
+
+ // Print out total timing info.
+ std::cout << "INFO in LauSimFitCoordinator::runSimFit : Cumulative timing:" << std::endl;
+ cumulTimer_.Stop();
+ cumulTimer_.Print();
+
+ // Print out stats on OK fits.
+ const UInt_t nOKFits = this->numberOKFits();
+ const UInt_t nBadFits = this->numberBadFits();
+ std::cout << "INFO in LauSimFitCoordinator::runSimFit : Number of OK Fits = " << nOKFits
+ << std::endl;
+ std::cout << "INFO in LauSimFitCoordinator::runSimFit : Number of Failed Fits = " << nBadFits
+ << std::endl;
+ Double_t fitEff( 0.0 );
+ if ( nExp != 0 ) {
+ fitEff = nOKFits / ( 1.0 * nExp );
+ }
+ std::cout << "INFO in LauSimFitCoordinator::runSimFit : Fit efficiency = " << fitEff * 100.0
+ << "%." << std::endl;
+
+ // Instruct the tasks to write out any fit results (ntuples etc...).
+ this->writeOutResults();
}
-void LauSimFitCoordinator::withinAsymErrorCalc(const Bool_t inAsymErrCalc)
+void LauSimFitCoordinator::withinAsymErrorCalc( const Bool_t inAsymErrCalc )
{
- this->LauFitObject::withinAsymErrorCalc(inAsymErrCalc);
-
- if ( socketMonitor_ == 0 ) {
- std::cerr << "ERROR in LauSimFitCoordinator::withinAsymErrorCalc : Sockets not initialised." << std::endl;
- return;
- }
-
- // Construct a message, informing the tasks whether or not we are now within the asymmetric error calculation
- TString msgStr("Asym Error Calc");
- const Bool_t asymErrorCalc( this->withinAsymErrorCalc() );
- TMessage message( kMESS_STRING );
- message.WriteTString( msgStr );
- message.WriteBool( asymErrorCalc );
-
- // Send the message to the tasks
- for ( UInt_t iTask(0); iTask<nTasks_; ++iTask ) {
- socketTasks_[iTask]->Send(message);
- }
-
- TSocket* sActive(0);
- UInt_t responsesReceived(0);
- while ( responsesReceived != nTasks_ ) {
-
- // Get the next queued response
- sActive = socketMonitor_->Select();
-
- // Extract from the message the ID of the task and the number of events read
- Bool_t response(kTRUE);
- UInt_t iTask(0);
- sActive->Recv( messageFromTask_ );
- messageFromTask_->ReadUInt( iTask );
- messageFromTask_->ReadBool( response );
-
- if ( response != asymErrorCalc ) {
- std::cerr << "WARNING in LauSimFitCoordinator::withinAsymErrorCalc : Problem informing task " << iTask << std::endl;
- }
-
- ++responsesReceived;
- }
-
+ this->LauFitObject::withinAsymErrorCalc( inAsymErrCalc );
+
+ if ( socketMonitor_ == 0 ) {
+ std::cerr << "ERROR in LauSimFitCoordinator::withinAsymErrorCalc : Sockets not initialised."
+ << std::endl;
+ return;
+ }
+
+ // Construct a message, informing the tasks whether or not we are now within the asymmetric error calculation
+ TString msgStr( "Asym Error Calc" );
+ const Bool_t asymErrorCalc( this->withinAsymErrorCalc() );
+ TMessage message( kMESS_STRING );
+ message.WriteTString( msgStr );
+ message.WriteBool( asymErrorCalc );
+
+ // Send the message to the tasks
+ for ( UInt_t iTask( 0 ); iTask < nTasks_; ++iTask ) {
+ socketTasks_[iTask]->Send( message );
+ }
+
+ TSocket* sActive( 0 );
+ UInt_t responsesReceived( 0 );
+ while ( responsesReceived != nTasks_ ) {
+
+ // Get the next queued response
+ sActive = socketMonitor_->Select();
+
+ // Extract from the message the ID of the task and the number of events read
+ Bool_t response( kTRUE );
+ UInt_t iTask( 0 );
+ sActive->Recv( messageFromTask_ );
+ messageFromTask_->ReadUInt( iTask );
+ messageFromTask_->ReadBool( response );
+
+ if ( response != asymErrorCalc ) {
+ std::cerr << "WARNING in LauSimFitCoordinator::withinAsymErrorCalc : Problem informing task "
+ << iTask << std::endl;
+ }
+
+ ++responsesReceived;
+ }
}
Bool_t LauSimFitCoordinator::readData()
{
- if ( socketMonitor_ == 0 ) {
- std::cerr << "ERROR in LauSimFitCoordinator::readData : Sockets not initialised." << std::endl;
- return kFALSE;
- }
-
- // Construct a message, requesting to read the data for the given experiment
- TString msgStr("Read Expt");
- const UInt_t iExp( this->iExpt() );
- TMessage message( kMESS_STRING );
- message.WriteTString( msgStr );
- message.WriteUInt( iExp );
-
- // Send the message to the tasks
- for ( UInt_t iTask(0); iTask<nTasks_; ++iTask ) {
- socketTasks_[iTask]->Send(message);
- }
-
- TSocket* sActive(0);
- UInt_t responsesReceived(0);
- Bool_t ok(kTRUE);
- while ( responsesReceived != nTasks_ ) {
-
- // Get the next queued response
- sActive = socketMonitor_->Select();
-
- // Extract from the message the ID of the task and the number of events read
- sActive->Recv( messageFromTask_ );
- UInt_t iTask(0);
- UInt_t nEvents(0);
- messageFromTask_->ReadUInt( iTask );
- messageFromTask_->ReadUInt( nEvents );
-
- if ( nEvents <= 0 ) {
- std::cerr << "ERROR in LauSimFitCoordinator::readData : Task " << iTask << " reports no events found for experiment " << iExp << std::endl;
- ok = kFALSE;
- } else {
- std::cerr << "INFO in LauSimFitCoordinator::readData : Task " << iTask << " reports " << nEvents << " events found for experiment " << iExp << std::endl;
- }
-
- ++responsesReceived;
- }
-
- return ok;
+ if ( socketMonitor_ == 0 ) {
+ std::cerr << "ERROR in LauSimFitCoordinator::readData : Sockets not initialised."
+ << std::endl;
+ return kFALSE;
+ }
+
+ // Construct a message, requesting to read the data for the given experiment
+ TString msgStr( "Read Expt" );
+ const UInt_t iExp( this->iExpt() );
+ TMessage message( kMESS_STRING );
+ message.WriteTString( msgStr );
+ message.WriteUInt( iExp );
+
+ // Send the message to the tasks
+ for ( UInt_t iTask( 0 ); iTask < nTasks_; ++iTask ) {
+ socketTasks_[iTask]->Send( message );
+ }
+
+ TSocket* sActive( 0 );
+ UInt_t responsesReceived( 0 );
+ Bool_t ok( kTRUE );
+ while ( responsesReceived != nTasks_ ) {
+
+ // Get the next queued response
+ sActive = socketMonitor_->Select();
+
+ // Extract from the message the ID of the task and the number of events read
+ sActive->Recv( messageFromTask_ );
+ UInt_t iTask( 0 );
+ UInt_t nEvents( 0 );
+ messageFromTask_->ReadUInt( iTask );
+ messageFromTask_->ReadUInt( nEvents );
+
+ if ( nEvents <= 0 ) {
+ std::cerr << "ERROR in LauSimFitCoordinator::readData : Task " << iTask
+ << " reports no events found for experiment " << iExp << std::endl;
+ ok = kFALSE;
+ } else {
+ std::cerr << "INFO in LauSimFitCoordinator::readData : Task " << iTask << " reports "
+ << nEvents << " events found for experiment " << iExp << std::endl;
+ }
+
+ ++responsesReceived;
+ }
+
+ return ok;
}
Bool_t LauSimFitCoordinator::cacheInputData()
{
- if ( socketMonitor_ == 0 ) {
- std::cerr << "ERROR in LauSimFitCoordinator::cacheInputData : Sockets not initialised." << std::endl;
- return kFALSE;
- }
-
- // Construct a message, requesting it to read the data for the given experiment
- TString msgStr("Cache");
- TMessage message( kMESS_STRING );
- message.WriteTString( msgStr );
-
- for ( UInt_t iTask(0); iTask<nTasks_; ++iTask ) {
- // Send the message to the task
- socketTasks_[iTask]->Send(message);
- }
-
- TSocket* sActive(0);
- UInt_t responsesReceived(0);
- Bool_t allOK(kTRUE);
- while ( responsesReceived != nTasks_ ) {
-
- // Get the next queued response
- sActive = socketMonitor_->Select();
-
- // Extract from the message the ID of the task and the success/failure flag
- sActive->Recv( messageFromTask_ );
- UInt_t iTask(0);
- Bool_t ok(kTRUE);
- messageFromTask_->ReadUInt( iTask );
- messageFromTask_->ReadBool( ok );
-
- if ( ! ok ) {
- std::cerr << "ERROR in LauSimFitCoordinator::cacheInputData : Task " << iTask << " reports an error performing caching" << std::endl;
- allOK = kFALSE;
- }
-
- ++responsesReceived;
- }
-
- return allOK;
+ if ( socketMonitor_ == 0 ) {
+ std::cerr << "ERROR in LauSimFitCoordinator::cacheInputData : Sockets not initialised."
+ << std::endl;
+ return kFALSE;
+ }
+
+ // Construct a message, requesting it to read the data for the given experiment
+ TString msgStr( "Cache" );
+ TMessage message( kMESS_STRING );
+ message.WriteTString( msgStr );
+
+ for ( UInt_t iTask( 0 ); iTask < nTasks_; ++iTask ) {
+ // Send the message to the task
+ socketTasks_[iTask]->Send( message );
+ }
+
+ TSocket* sActive( 0 );
+ UInt_t responsesReceived( 0 );
+ Bool_t allOK( kTRUE );
+ while ( responsesReceived != nTasks_ ) {
+
+ // Get the next queued response
+ sActive = socketMonitor_->Select();
+
+ // Extract from the message the ID of the task and the success/failure flag
+ sActive->Recv( messageFromTask_ );
+ UInt_t iTask( 0 );
+ Bool_t ok( kTRUE );
+ messageFromTask_->ReadUInt( iTask );
+ messageFromTask_->ReadBool( ok );
+
+ if ( ! ok ) {
+ std::cerr << "ERROR in LauSimFitCoordinator::cacheInputData : Task " << iTask
+ << " reports an error performing caching" << std::endl;
+ allOK = kFALSE;
+ }
+
+ ++responsesReceived;
+ }
+
+ return allOK;
}
void LauSimFitCoordinator::checkInitFitParams()
{
- this->getParametersFromTasks();
- this->printParInfo();
+ this->getParametersFromTasks();
+ this->printParInfo();
}
void LauSimFitCoordinator::fitExpt()
{
- // Routine to perform the actual fit for the given experiment
-
- // Instruct the tasks to update initial fit parameters if required (e.g. if using random numbers).
- this->checkInitFitParams();
-
- // If we're fitting toy experiments then re-generate the means of any constraints
- this->generateConstraintMeans( conVars_ );
-
- // Initialise the fitter
- LauFitter::fitter().useAsymmFitErrors( this->useAsymmFitErrors() );
- LauFitter::fitter().twoStageFit( this->twoStageFit() );
- LauFitter::fitter().initialise( this, params_ );
-
- this->startNewFit( LauFitter::fitter().nParameters(), LauFitter::fitter().nFreeParameters() );
-
- // Now ready for minimisation step
- std::cout << "\nINFO in LauSimFitCoordinator::fitExpt : Start minimisation...\n";
- LauAbsFitter::FitStatus fitResult = LauFitter::fitter().minimise();
-
- // If we're doing a two stage fit we can now release (i.e. float)
- // the 2nd stage parameters and re-fit
- if (this->twoStageFit()) {
- if ( fitResult.status != 3 ) {
- std::cerr << "ERROR in LauSimFitCoordinator:fitExpt : Not running second stage fit since first stage failed." << std::endl;
- LauFitter::fitter().releaseSecondStageParameters();
- } else {
- LauFitter::fitter().releaseSecondStageParameters();
- this->startNewFit( LauFitter::fitter().nParameters(), LauFitter::fitter().nFreeParameters() );
- fitResult = LauFitter::fitter().minimise();
- }
- }
-
- const TMatrixD& covMat = LauFitter::fitter().covarianceMatrix();
- this->storeFitStatus( fitResult, covMat );
-
- // Store the final fit results and errors into protected internal vectors that
- // all sub-classes can use within their own finalFitResults implementation
- // used below (e.g. putting them into an ntuple in a root file)
- LauFitter::fitter().updateParameters();
+ // Routine to perform the actual fit for the given experiment
+
+ // Instruct the tasks to update initial fit parameters if required (e.g. if using random numbers).
+ this->checkInitFitParams();
+
+ // If we're fitting toy experiments then re-generate the means of any constraints
+ this->generateConstraintMeans( conVars_ );
+
+ // Initialise the fitter
+ LauFitter::fitter().useAsymmFitErrors( this->useAsymmFitErrors() );
+ LauFitter::fitter().twoStageFit( this->twoStageFit() );
+ LauFitter::fitter().initialise( this, params_ );
+
+ this->startNewFit( LauFitter::fitter().nParameters(), LauFitter::fitter().nFreeParameters() );
+
+ // Now ready for minimisation step
+ std::cout << "\nINFO in LauSimFitCoordinator::fitExpt : Start minimisation...\n";
+ LauAbsFitter::FitStatus fitResult = LauFitter::fitter().minimise();
+
+ // If we're doing a two stage fit we can now release (i.e. float)
+ // the 2nd stage parameters and re-fit
+ if ( this->twoStageFit() ) {
+ if ( fitResult.status != 3 ) {
+ std::cerr << "ERROR in LauSimFitCoordinator:fitExpt : Not running second stage fit since first stage failed."
+ << std::endl;
+ LauFitter::fitter().releaseSecondStageParameters();
+ } else {
+ LauFitter::fitter().releaseSecondStageParameters();
+ this->startNewFit( LauFitter::fitter().nParameters(),
+ LauFitter::fitter().nFreeParameters() );
+ fitResult = LauFitter::fitter().minimise();
+ }
+ }
+
+ const TMatrixD& covMat = LauFitter::fitter().covarianceMatrix();
+ this->storeFitStatus( fitResult, covMat );
+
+ // Store the final fit results and errors into protected internal vectors that
+ // all sub-classes can use within their own finalFitResults implementation
+ // used below (e.g. putting them into an ntuple in a root file)
+ LauFitter::fitter().updateParameters();
}
-void LauSimFitCoordinator::setParsFromMinuit(Double_t* par, Int_t npar)
+void LauSimFitCoordinator::setParsFromMinuit( Double_t* par, Int_t npar )
{
- // This function sets the internal parameters based on the values
- // that Minuit is using when trying to minimise the total likelihood function.
-
- // MINOS reports different numbers of free parameters depending on the
- // situation, so disable this check
- if ( ! this->withinAsymErrorCalc() ) {
- const UInt_t nFreePars = this->nFreeParams();
- if (static_cast<UInt_t>(npar) != nFreePars) {
- std::cerr << "ERROR in LauSimFitCoordinator::setParsFromMinuit : Unexpected number of free parameters: " << npar << ".\n";
- std::cerr << " Expected: " << nFreePars << ".\n" << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- }
-
- // Despite npar being the number of free parameters
- // the par array actually contains all the parameters,
- // free and floating...
- // Update all the parameters with their new values.
- // Change the value in the array to be sent out to the tasks and the
- // parameters themselves (so that constraints are correctly calculated)
- for (UInt_t i(0); i<this->nTotParams(); ++i) {
- if (!params_[i]->fixed()) {
- parValues_[i] = par[i];
- params_[i]->value(par[i]);
- }
- }
+ // This function sets the internal parameters based on the values
+ // that Minuit is using when trying to minimise the total likelihood function.
+
+ // MINOS reports different numbers of free parameters depending on the
+ // situation, so disable this check
+ if ( ! this->withinAsymErrorCalc() ) {
+ const UInt_t nFreePars = this->nFreeParams();
+ if ( static_cast<UInt_t>( npar ) != nFreePars ) {
+ std::cerr << "ERROR in LauSimFitCoordinator::setParsFromMinuit : Unexpected number of free parameters: "
+ << npar << ".\n";
+ std::cerr << " Expected: " << nFreePars
+ << ".\n"
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ }
+
+ // Despite npar being the number of free parameters
+ // the par array actually contains all the parameters,
+ // free and floating...
+ // Update all the parameters with their new values.
+ // Change the value in the array to be sent out to the tasks and the
+ // parameters themselves (so that constraints are correctly calculated)
+ for ( UInt_t i( 0 ); i < this->nTotParams(); ++i ) {
+ if ( ! params_[i]->fixed() ) {
+ parValues_[i] = par[i];
+ params_[i]->value( par[i] );
+ }
+ }
}
Double_t LauSimFitCoordinator::getTotNegLogLikelihood()
{
- if ( socketMonitor_ == 0 ) {
- std::cerr << "ERROR in LauSimFitCoordinator::getTotNegLogLikelihood : Sockets not initialised." << std::endl;
- return 0.0;
- }
-
- // Send current values of the parameters to the tasks.
- for ( UInt_t iTask(0); iTask<nTasks_; ++iTask ) {
-
- std::vector<UInt_t>& indices = taskIndices_[iTask];
- std::vector<UInt_t>& freeIndices = taskFreeIndices_[iTask];
- UInt_t nPars = indices.size();
- UInt_t nFreePars = freeIndices.size();
- for ( UInt_t iPar(0); iPar < nPars; ++iPar ) {
- vectorPar_[iTask][iPar] = parValues_[ indices[iPar] ];
- }
-
- TMessage* message = messagesToTasks_[iTask];
- message->Reset( kMESS_ANY );
- message->WriteUInt( nPars );
- message->WriteUInt( nFreePars );
- message->WriteFastArray( vectorPar_[iTask], nPars );
-
- socketTasks_[iTask]->Send(*message);
- }
-
- Double_t negLogLike(0.0);
- TSocket *sActive(0);
- UInt_t responsesReceived(0);
- Bool_t allOK(kTRUE);
- while ( responsesReceived != nTasks_ ) {
-
- sActive = socketMonitor_->Select();
- sActive->Recv(messageFromTask_);
-
- messageFromTask_->ReadDouble( vectorRes_[responsesReceived] );
-
- Double_t& nLL = vectorRes_[responsesReceived];
- if ( nLL == 0.0 || TMath::IsNaN(nLL) || !TMath::Finite(nLL) ) {
- allOK = kFALSE;
- }
-
- negLogLike += vectorRes_[responsesReceived];
-
- ++responsesReceived;
- }
-
- // Calculate any penalty terms from Gaussian constrained variables
- const auto& multiDimCons = this->multiDimConstraints();
- if ( ! conVars_.empty() || ! multiDimCons.empty() ){
- negLogLike += this->getLogLikelihoodPenalty();
- }
-
- const Double_t worstNegLogLike = -1.0*this->worstLogLike();
- if ( ! allOK ) {
- std::cerr << "WARNING in LauSimFitCoordinator::getTotNegLogLikelihood : Strange NLL value returned by one or more tasks\n";
- std::cerr << " : Returning worst NLL found so far to force MINUIT out of this region." << std::endl;
- negLogLike = worstNegLogLike;
- } else if ( negLogLike > worstNegLogLike ) {
- this->worstLogLike( -negLogLike );
- }
-
- return negLogLike;
+ if ( socketMonitor_ == 0 ) {
+ std::cerr << "ERROR in LauSimFitCoordinator::getTotNegLogLikelihood : Sockets not initialised."
+ << std::endl;
+ return 0.0;
+ }
+
+ // Send current values of the parameters to the tasks.
+ for ( UInt_t iTask( 0 ); iTask < nTasks_; ++iTask ) {
+
+ std::vector<UInt_t>& indices = taskIndices_[iTask];
+ std::vector<UInt_t>& freeIndices = taskFreeIndices_[iTask];
+ UInt_t nPars = indices.size();
+ UInt_t nFreePars = freeIndices.size();
+ for ( UInt_t iPar( 0 ); iPar < nPars; ++iPar ) {
+ vectorPar_[iTask][iPar] = parValues_[indices[iPar]];
+ }
+
+ TMessage* message = messagesToTasks_[iTask];
+ message->Reset( kMESS_ANY );
+ message->WriteUInt( nPars );
+ message->WriteUInt( nFreePars );
+ message->WriteFastArray( vectorPar_[iTask], nPars );
+
+ socketTasks_[iTask]->Send( *message );
+ }
+
+ Double_t negLogLike( 0.0 );
+ TSocket* sActive( 0 );
+ UInt_t responsesReceived( 0 );
+ Bool_t allOK( kTRUE );
+ while ( responsesReceived != nTasks_ ) {
+
+ sActive = socketMonitor_->Select();
+ sActive->Recv( messageFromTask_ );
+
+ messageFromTask_->ReadDouble( vectorRes_[responsesReceived] );
+
+ Double_t& nLL = vectorRes_[responsesReceived];
+ if ( nLL == 0.0 || TMath::IsNaN( nLL ) || ! TMath::Finite( nLL ) ) {
+ allOK = kFALSE;
+ }
+
+ negLogLike += vectorRes_[responsesReceived];
+
+ ++responsesReceived;
+ }
+
+ // Calculate any penalty terms from Gaussian constrained variables
+ const auto& multiDimCons = this->multiDimConstraints();
+ if ( ! conVars_.empty() || ! multiDimCons.empty() ) {
+ negLogLike += this->getLogLikelihoodPenalty();
+ }
+
+ const Double_t worstNegLogLike = -1.0 * this->worstLogLike();
+ if ( ! allOK ) {
+ std::cerr << "WARNING in LauSimFitCoordinator::getTotNegLogLikelihood : Strange NLL value returned by one or more tasks\n";
+ std::cerr << " : Returning worst NLL found so far to force MINUIT out of this region."
+ << std::endl;
+ negLogLike = worstNegLogLike;
+ } else if ( negLogLike > worstNegLogLike ) {
+ this->worstLogLike( -negLogLike );
+ }
+
+ return negLogLike;
}
Double_t LauSimFitCoordinator::getLogLikelihoodPenalty()
{
- Double_t penalty{0.0};
+ Double_t penalty { 0.0 };
- for ( LauAbsRValue* par : conVars_ ) {
- penalty += par->constraintPenalty();
- }
+ for ( LauAbsRValue* par : conVars_ ) {
+ penalty += par->constraintPenalty();
+ }
- auto& multiDimCons = this->multiDimConstraints();
- for ( auto& constraint : multiDimCons ) {
- penalty += constraint.constraintPenalty();
- }
+ auto& multiDimCons = this->multiDimConstraints();
+ for ( auto& constraint : multiDimCons ) {
+ penalty += constraint.constraintPenalty();
+ }
- return penalty;
+ return penalty;
}
void LauSimFitCoordinator::addConParameters()
{
- // Add penalties from the constraints to fit parameters
-
- // First, constraints on the fit parameters themselves
- for ( LauParameter* param : params_ ) {
- if ( param->gaussConstraint() ) {
- conVars_.push_back( param );
- std::cout << "INFO in LauSimFitCoordinator::addConParameters : Added Gaussian constraint to parameter "<< param->name() << std::endl;
- }
- }
-
- // Second, constraints on arbitrary combinations
- auto& conStore = this->formulaConstraints();
- for ( auto& constraint : conStore ) {
- std::vector<LauParameter*> params;
- for ( const auto& name : constraint.conPars_ ) {
- for ( LauParameter* par : params_ ) {
- if ( par->name() == name ){
- params.push_back( par );
- }
- }
- }
-
- // If the parameters are not found, skip it
- if ( params.size() != constraint.conPars_.size() ) {
- std::cerr << "WARNING in LauSimFitCoordinator::addConParameters: Could not find parameters to constrain in the formula... skipping" << std::endl;
- continue;
- }
-
- constraint.formulaPar_ = std::make_unique<LauFormulaPar>( constraint.formula_, constraint.formula_, params );
- constraint.formulaPar_->addGaussianConstraint( constraint.mean_, constraint.width_ );
-
- conVars_.push_back( constraint.formulaPar_.get() );
-
- std::cout << "INFO in LauSimFitCoordinator::addConParameters : Added Gaussian constraint to formula\n";
- std::cout << " : Formula: " << constraint.formula_ << std::endl;
- for ( LauParameter* param : params ) {
- std::cout << " : Parameter: " << param->name() << std::endl;
- }
- }
-
- // Thirdly, add n-dimensional constraints
- auto& multiDimCons = this->multiDimConstraints();
- for ( auto& constraint : multiDimCons ){
- for ( auto& parname : constraint.conPars_ ){
- for ( auto& fitPar : params_ ){
- if ( parname == fitPar->name() ){
- // Check parameters do not have a 1D Gaussian constraint applied
- if ( fitPar->gaussConstraint() ){
- std::cerr << "ERROR in LauSimFitCoordinator::addConParameters: parameter in n-dimensional constraint already has a 1d constraint applied" << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- constraint.conLauPars_.push_back(fitPar);
- }
- }
- }
- if ( constraint.conLauPars_.size() != constraint.conPars_.size() ){
- std::cerr << "Error in LauSimFitCoordinator::addConParameters : Could not match parameter names for n-dimensional constraint" << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- }
+ // Add penalties from the constraints to fit parameters
+
+ // First, constraints on the fit parameters themselves
+ for ( LauParameter* param : params_ ) {
+ if ( param->gaussConstraint() ) {
+ conVars_.push_back( param );
+ std::cout << "INFO in LauSimFitCoordinator::addConParameters : Added Gaussian constraint to parameter "
+ << param->name() << std::endl;
+ }
+ }
+
+ // Second, constraints on arbitrary combinations
+ auto& conStore = this->formulaConstraints();
+ for ( auto& constraint : conStore ) {
+ std::vector<LauParameter*> params;
+ for ( const auto& name : constraint.conPars_ ) {
+ for ( LauParameter* par : params_ ) {
+ if ( par->name() == name ) {
+ params.push_back( par );
+ }
+ }
+ }
+
+ // If the parameters are not found, skip it
+ if ( params.size() != constraint.conPars_.size() ) {
+ std::cerr << "WARNING in LauSimFitCoordinator::addConParameters: Could not find parameters to constrain in the formula... skipping"
+ << std::endl;
+ continue;
+ }
+
+ constraint.formulaPar_ =
+ std::make_unique<LauFormulaPar>( constraint.formula_, constraint.formula_, params );
+ constraint.formulaPar_->addGaussianConstraint( constraint.mean_, constraint.width_ );
+
+ conVars_.push_back( constraint.formulaPar_.get() );
+
+ std::cout << "INFO in LauSimFitCoordinator::addConParameters : Added Gaussian constraint to formula\n";
+ std::cout << " : Formula: "
+ << constraint.formula_ << std::endl;
+ for ( LauParameter* param : params ) {
+ std::cout << " : Parameter: "
+ << param->name() << std::endl;
+ }
+ }
+
+ // Thirdly, add n-dimensional constraints
+ auto& multiDimCons = this->multiDimConstraints();
+ for ( auto& constraint : multiDimCons ) {
+ for ( auto& parname : constraint.conPars_ ) {
+ for ( auto& fitPar : params_ ) {
+ if ( parname == fitPar->name() ) {
+ // Check parameters do not have a 1D Gaussian constraint applied
+ if ( fitPar->gaussConstraint() ) {
+ std::cerr << "ERROR in LauSimFitCoordinator::addConParameters: parameter in n-dimensional constraint already has a 1d constraint applied"
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ constraint.conLauPars_.push_back( fitPar );
+ }
+ }
+ }
+ if ( constraint.conLauPars_.size() != constraint.conPars_.size() ) {
+ std::cerr << "Error in LauSimFitCoordinator::addConParameters : Could not match parameter names for n-dimensional constraint"
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ }
}
Bool_t LauSimFitCoordinator::finalise()
{
- if ( socketMonitor_ == 0 ) {
- std::cerr << "ERROR in LauSimFitCoordinator::finalise : Sockets not initialised." << std::endl;
- return kFALSE;
- }
-
- // Prepare the covariance matrices
- const TMatrixD& covMatrix = this->covarianceMatrix();
- covMatrices_.resize( nTasks_ );
-
- LauParamFixed pred;
-
- std::map<UInt_t,UInt_t> freeParIndices;
-
- UInt_t counter(0);
- for ( UInt_t iPar(0); iPar < this->nTotParams(); ++iPar ) {
- const LauParameter* par = params_[iPar];
- if ( ! pred(par) ) {
- freeParIndices.insert( std::make_pair(iPar,counter) );
- ++counter;
- }
- }
-
- for ( UInt_t iTask(0); iTask<nTasks_; ++iTask ) {
- const UInt_t nPar = taskIndices_[iTask].size();
-
- std::vector<UInt_t> freeIndices;
- freeIndices.reserve( nPar );
-
- for ( UInt_t iPar(0); iPar < nPar; ++iPar ) {
- UInt_t index = taskIndices_[iTask][iPar];
- std::map<UInt_t,UInt_t>::iterator freeIter = freeParIndices.find(index);
- if ( freeIter == freeParIndices.end() ) {
- continue;
- }
- UInt_t freeIndex = freeIter->second;
- freeIndices.push_back( freeIndex );
- }
-
- const UInt_t nFreePars = freeIndices.size();
- TMatrixD& covMat = covMatrices_[iTask];
- covMat.ResizeTo( nFreePars, nFreePars );
-
- for ( UInt_t iPar(0); iPar < nFreePars; ++iPar ) {
- for ( UInt_t jPar(0); jPar < nFreePars; ++jPar ) {
- UInt_t i = freeIndices[iPar];
- UInt_t j = freeIndices[jPar];
- covMat( iPar, jPar ) = covMatrix( i, j );
- }
- }
- }
-
- // The array to hold the parameters
- TObjArray array;
-
- // Send messages to all tasks containing the final parameters and fit status, NLL
- for ( UInt_t iTask(0); iTask<nTasks_; ++iTask ) {
-
- array.Clear();
-
- std::vector<UInt_t>& indices = taskIndices_[iTask];
- UInt_t nPars = indices.size();
- for ( UInt_t iPar(0); iPar < nPars; ++iPar ) {
- array.Add( params_[ indices[iPar] ] );
- }
-
- const Int_t status = this->statusCode();
- const Double_t NLL = this->nll();
- const Double_t EDM = this->edm();
- TMatrixD& covMat = covMatrices_[iTask];
-
- TMessage* message = messagesToTasks_[iTask];
- message->Reset( kMESS_OBJECT );
- message->WriteInt( status );
- message->WriteDouble( NLL );
- message->WriteDouble( EDM );
- message->WriteObject( &array );
- message->WriteObject( &covMat );
-
- socketTasks_[iTask]->Send(*message);
- }
-
- TSocket *sActive(0);
- UInt_t responsesReceived(0);
- Bool_t allOK(kTRUE);
- while ( responsesReceived != nTasks_ ) {
-
- // Get the next queued response
- sActive = socketMonitor_->Select();
-
- // Extract from the message the ID of the task and the number of events read
- sActive->Recv( messageFromTask_ );
- UInt_t iTask(0);
- Bool_t ok(kTRUE);
- messageFromTask_->ReadUInt( iTask );
- messageFromTask_->ReadBool( ok );
-
- if ( ok ) {
- TObjArray * objarray = dynamic_cast<TObjArray*>( messageFromTask_->ReadObject( messageFromTask_->GetClass() ) );
- if ( ! objarray ) {
- std::cerr << "ERROR in LauSimFitCoordinator::finalise : Error reading finalised parameters from task" << std::endl;
- allOK = kFALSE;
- } else {
- // We want to auto-delete the supplied parameters since we only copy their values in this case
- objarray->SetOwner(kTRUE);
-
- const UInt_t nPars = objarray->GetEntries();
- if ( nPars != taskIndices_[iTask].size() ) {
- std::cerr << "ERROR in LauSimFitCoordinator::finalise : Unexpected number of finalised parameters received from task" << std::endl;
- allOK = kFALSE;
- } else {
- for ( UInt_t iPar(0); iPar < nPars; ++iPar ) {
- LauParameter* parameter = dynamic_cast<LauParameter*>( (*objarray)[iPar] );
- if ( ! parameter ) {
- std::cerr << "ERROR in LauSimFitCoordinator::finalise : Error reading parameter from task" << std::endl;
- allOK = kFALSE;
- continue;
- }
-
- TString parname = parameter->name();
-
- std::map< TString, UInt_t >::iterator iter = parIndices_.find( parname );
- if ( iter == parIndices_.end() ) {
- std::cerr << "ERROR in LauSimFitCoordinator::finalise : Unexpected parameter name received from task" << std::endl;
- allOK = kFALSE;
- continue;
- }
-
- const UInt_t index = iter->second;
- if ( taskIndices_[iTask][iPar] != index ) {
- std::cerr << "ERROR in LauSimFitCoordinator::finalise : Unexpected parameter received from task" << std::endl;
- allOK = kFALSE;
- continue;
- }
-
- Double_t parvalue = parameter->value();
- params_[index]->value( parvalue );
- parValues_[index] = parvalue;
- vectorPar_[iTask][iPar] = parvalue;
- }
- }
- delete objarray;
- }
- } else {
- std::cerr << "ERROR in LauSimFitCoordinator::finalise : Task " << iTask << " reports an error performing finalisation" << std::endl;
- allOK = kFALSE;
- }
-
- ++responsesReceived;
- }
-
- // Fill our ntuple as well
- if ( fitNtuple_ != 0 ) {
- for ( std::vector<LauParameter*>::iterator iter = params_.begin(); iter != params_.end(); ++iter ) {
- if (!(*iter)->fixed()) {
- (*iter)->updatePull();
- }
- }
- fitNtuple_->storeParsAndErrors(params_, this->multiDimConstrainedPars(), {});
- fitNtuple_->storeCorrMatrix(this->iExpt(), this->fitStatus(), this->covarianceMatrix());
- fitNtuple_->updateFitNtuple();
- }
-
- return allOK;
+ if ( socketMonitor_ == 0 ) {
+ std::cerr << "ERROR in LauSimFitCoordinator::finalise : Sockets not initialised."
+ << std::endl;
+ return kFALSE;
+ }
+
+ // Prepare the covariance matrices
+ const TMatrixD& covMatrix = this->covarianceMatrix();
+ covMatrices_.resize( nTasks_ );
+
+ LauParamFixed pred;
+
+ std::map<UInt_t, UInt_t> freeParIndices;
+
+ UInt_t counter( 0 );
+ for ( UInt_t iPar( 0 ); iPar < this->nTotParams(); ++iPar ) {
+ const LauParameter* par = params_[iPar];
+ if ( ! pred( par ) ) {
+ freeParIndices.insert( std::make_pair( iPar, counter ) );
+ ++counter;
+ }
+ }
+
+ for ( UInt_t iTask( 0 ); iTask < nTasks_; ++iTask ) {
+ const UInt_t nPar = taskIndices_[iTask].size();
+
+ std::vector<UInt_t> freeIndices;
+ freeIndices.reserve( nPar );
+
+ for ( UInt_t iPar( 0 ); iPar < nPar; ++iPar ) {
+ UInt_t index = taskIndices_[iTask][iPar];
+ std::map<UInt_t, UInt_t>::iterator freeIter = freeParIndices.find( index );
+ if ( freeIter == freeParIndices.end() ) {
+ continue;
+ }
+ UInt_t freeIndex = freeIter->second;
+ freeIndices.push_back( freeIndex );
+ }
+
+ const UInt_t nFreePars = freeIndices.size();
+ TMatrixD& covMat = covMatrices_[iTask];
+ covMat.ResizeTo( nFreePars, nFreePars );
+
+ for ( UInt_t iPar( 0 ); iPar < nFreePars; ++iPar ) {
+ for ( UInt_t jPar( 0 ); jPar < nFreePars; ++jPar ) {
+ UInt_t i = freeIndices[iPar];
+ UInt_t j = freeIndices[jPar];
+ covMat( iPar, jPar ) = covMatrix( i, j );
+ }
+ }
+ }
+
+ // The array to hold the parameters
+ TObjArray array;
+
+ // Send messages to all tasks containing the final parameters and fit status, NLL
+ for ( UInt_t iTask( 0 ); iTask < nTasks_; ++iTask ) {
+
+ array.Clear();
+
+ std::vector<UInt_t>& indices = taskIndices_[iTask];
+ UInt_t nPars = indices.size();
+ for ( UInt_t iPar( 0 ); iPar < nPars; ++iPar ) {
+ array.Add( params_[indices[iPar]] );
+ }
+
+ const Int_t status = this->statusCode();
+ const Double_t NLL = this->nll();
+ const Double_t EDM = this->edm();
+ TMatrixD& covMat = covMatrices_[iTask];
+
+ TMessage* message = messagesToTasks_[iTask];
+ message->Reset( kMESS_OBJECT );
+ message->WriteInt( status );
+ message->WriteDouble( NLL );
+ message->WriteDouble( EDM );
+ message->WriteObject( &array );
+ message->WriteObject( &covMat );
+
+ socketTasks_[iTask]->Send( *message );
+ }
+
+ TSocket* sActive( 0 );
+ UInt_t responsesReceived( 0 );
+ Bool_t allOK( kTRUE );
+ while ( responsesReceived != nTasks_ ) {
+
+ // Get the next queued response
+ sActive = socketMonitor_->Select();
+
+ // Extract from the message the ID of the task and the number of events read
+ sActive->Recv( messageFromTask_ );
+ UInt_t iTask( 0 );
+ Bool_t ok( kTRUE );
+ messageFromTask_->ReadUInt( iTask );
+ messageFromTask_->ReadBool( ok );
+
+ if ( ok ) {
+ TObjArray* objarray = dynamic_cast<TObjArray*>(
+ messageFromTask_->ReadObject( messageFromTask_->GetClass() ) );
+ if ( ! objarray ) {
+ std::cerr << "ERROR in LauSimFitCoordinator::finalise : Error reading finalised parameters from task"
+ << std::endl;
+ allOK = kFALSE;
+ } else {
+ // We want to auto-delete the supplied parameters since we only copy their values in this case
+ objarray->SetOwner( kTRUE );
+
+ const UInt_t nPars = objarray->GetEntries();
+ if ( nPars != taskIndices_[iTask].size() ) {
+ std::cerr << "ERROR in LauSimFitCoordinator::finalise : Unexpected number of finalised parameters received from task"
+ << std::endl;
+ allOK = kFALSE;
+ } else {
+ for ( UInt_t iPar( 0 ); iPar < nPars; ++iPar ) {
+ LauParameter* parameter = dynamic_cast<LauParameter*>( ( *objarray )[iPar] );
+ if ( ! parameter ) {
+ std::cerr
+ << "ERROR in LauSimFitCoordinator::finalise : Error reading parameter from task"
+ << std::endl;
+ allOK = kFALSE;
+ continue;
+ }
+
+ TString parname = parameter->name();
+
+ std::map<TString, UInt_t>::iterator iter = parIndices_.find( parname );
+ if ( iter == parIndices_.end() ) {
+ std::cerr
+ << "ERROR in LauSimFitCoordinator::finalise : Unexpected parameter name received from task"
+ << std::endl;
+ allOK = kFALSE;
+ continue;
+ }
+
+ const UInt_t index = iter->second;
+ if ( taskIndices_[iTask][iPar] != index ) {
+ std::cerr
+ << "ERROR in LauSimFitCoordinator::finalise : Unexpected parameter received from task"
+ << std::endl;
+ allOK = kFALSE;
+ continue;
+ }
+
+ Double_t parvalue = parameter->value();
+ params_[index]->value( parvalue );
+ parValues_[index] = parvalue;
+ vectorPar_[iTask][iPar] = parvalue;
+ }
+ }
+ delete objarray;
+ }
+ } else {
+ std::cerr << "ERROR in LauSimFitCoordinator::finalise : Task " << iTask
+ << " reports an error performing finalisation" << std::endl;
+ allOK = kFALSE;
+ }
+
+ ++responsesReceived;
+ }
+
+ // Fill our ntuple as well
+ if ( fitNtuple_ != 0 ) {
+ for ( std::vector<LauParameter*>::iterator iter = params_.begin(); iter != params_.end();
+ ++iter ) {
+ if ( ! ( *iter )->fixed() ) {
+ ( *iter )->updatePull();
+ }
+ }
+ fitNtuple_->storeParsAndErrors( params_, this->multiDimConstrainedPars(), {} );
+ fitNtuple_->storeCorrMatrix( this->iExpt(), this->fitStatus(), this->covarianceMatrix() );
+ fitNtuple_->updateFitNtuple();
+ }
+
+ return allOK;
}
Bool_t LauSimFitCoordinator::writeOutResults()
{
- if ( socketMonitor_ == 0 ) {
- std::cerr << "ERROR in LauSimFitCoordinator::writeOutResults : Sockets not initialised." << std::endl;
- return kFALSE;
- }
-
- // Construct a message, requesting to write out the fit results
- TString msgStr("Write Results");
- TMessage message( kMESS_STRING );
- message.WriteTString( msgStr );
-
- // Send the message to the tasks
- for ( UInt_t iTask(0); iTask<nTasks_; ++iTask ) {
- socketTasks_[iTask]->Send(message);
- }
-
- TSocket *sActive(0);
- UInt_t responsesReceived(0);
- Bool_t allOK(kTRUE);
- while ( responsesReceived != nTasks_ ) {
-
- // Get the next queued response
- sActive = socketMonitor_->Select();
-
- // Extract from the message the ID of the task and the number of events read
- sActive->Recv( messageFromTask_ );
- UInt_t iTask(0);
- Bool_t ok(kTRUE);
- messageFromTask_->ReadUInt( iTask );
- messageFromTask_->ReadBool( ok );
-
- if ( ! ok ) {
- std::cerr << "ERROR in LauSimFitCoordinator::writeOutResults : Task " << iTask << " reports an error performing finalisation" << std::endl;
- allOK = kFALSE;
- }
-
- ++responsesReceived;
- }
-
- // Write out our ntuple as well
- if (fitNtuple_ != 0) {
- fitNtuple_->writeOutFitResults();
- }
-
- return allOK;
+ if ( socketMonitor_ == 0 ) {
+ std::cerr << "ERROR in LauSimFitCoordinator::writeOutResults : Sockets not initialised."
+ << std::endl;
+ return kFALSE;
+ }
+
+ // Construct a message, requesting to write out the fit results
+ TString msgStr( "Write Results" );
+ TMessage message( kMESS_STRING );
+ message.WriteTString( msgStr );
+
+ // Send the message to the tasks
+ for ( UInt_t iTask( 0 ); iTask < nTasks_; ++iTask ) {
+ socketTasks_[iTask]->Send( message );
+ }
+
+ TSocket* sActive( 0 );
+ UInt_t responsesReceived( 0 );
+ Bool_t allOK( kTRUE );
+ while ( responsesReceived != nTasks_ ) {
+
+ // Get the next queued response
+ sActive = socketMonitor_->Select();
+
+ // Extract from the message the ID of the task and the number of events read
+ sActive->Recv( messageFromTask_ );
+ UInt_t iTask( 0 );
+ Bool_t ok( kTRUE );
+ messageFromTask_->ReadUInt( iTask );
+ messageFromTask_->ReadBool( ok );
+
+ if ( ! ok ) {
+ std::cerr << "ERROR in LauSimFitCoordinator::writeOutResults : Task " << iTask
+ << " reports an error performing finalisation" << std::endl;
+ allOK = kFALSE;
+ }
+
+ ++responsesReceived;
+ }
+
+ // Write out our ntuple as well
+ if ( fitNtuple_ != 0 ) {
+ fitNtuple_->writeOutFitResults();
+ }
+
+ return allOK;
}
-
diff --git a/src/LauSimFitTask.cc b/src/LauSimFitTask.cc
index dd26f64..32dd2ba 100644
--- a/src/LauSimFitTask.cc
+++ b/src/LauSimFitTask.cc
@@ -1,313 +1,338 @@
/*
Copyright 2015 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauSimFitTask.cc
\brief File containing implementation of LauSimFitTask class.
*/
-#include <cstdlib>
-#include <iostream>
+#include "LauSimFitTask.hh"
+
+#include "LauFitNtuple.hh"
#include "TMatrixD.h"
#include "TMessage.h"
#include "TObjArray.h"
#include "TObjString.h"
#include "TSocket.h"
#include "TSystem.h"
-#include "LauSimFitTask.hh"
-#include "LauFitNtuple.hh"
-
-
-
+#include <cstdlib>
+#include <iostream>
LauSimFitTask::LauSimFitTask() :
- socketCoordinator_(0),
- messageFromCoordinator_(0),
- taskId_(0),
- nTasks_(0),
- parValues_(0),
- fitNtuple_(0)
+ socketCoordinator_( 0 ),
+ messageFromCoordinator_( 0 ),
+ taskId_( 0 ),
+ nTasks_( 0 ),
+ parValues_( 0 ),
+ fitNtuple_( 0 )
{
}
LauSimFitTask::~LauSimFitTask()
{
- delete socketCoordinator_;
- delete messageFromCoordinator_;
- delete[] parValues_;
- delete fitNtuple_;
+ delete socketCoordinator_;
+ delete messageFromCoordinator_;
+ delete[] parValues_;
+ delete fitNtuple_;
}
-void LauSimFitTask::runTask(const TString& dataFileName, const TString& dataTreeName,
- const TString& histFileName, const TString& tableFileName,
- const TString& addressCoordinator, const UInt_t portCoordinator)
+void LauSimFitTask::runTask( const TString& dataFileName,
+ const TString& dataTreeName,
+ const TString& histFileName,
+ const TString& tableFileName,
+ const TString& addressCoordinator,
+ const UInt_t portCoordinator )
{
- // Establish the connection to the coordinator process
- this->connectToCoordinator( addressCoordinator, portCoordinator );
-
- // Initialise the fit model
- this->initialise();
-
- // NB call to addConParameters() is intentionally not included here cf.
- // LauAbsFitModel::run() since this has to be dealt with by the coordinator
- // to avoid multiple inclusions of each penalty term
- // Print a warning if constraints on combinations of parameters have been specified
- const auto& storeCon = this->formulaConstraints();
- if ( ! storeCon.empty() ) {
- std::cerr << "WARNING in LauSimFitTask::runTask : Constraints have been added but these will be ignored - they should have been added to the coordinator process" << std::endl;
- }
-
- // Setup saving of fit results to ntuple/LaTeX table etc.
- this->setupResultsOutputs( histFileName, tableFileName );
-
- // This reads in the given dataFile and creates an input
- // fit data tree that stores them for all events and experiments.
- Bool_t dataOK = this->verifyFitData(dataFileName,dataTreeName);
- if (!dataOK) {
- std::cerr << "ERROR in LauSimFitTask::runTask : Problem caching the fit data." << std::endl;
- return;
- }
-
- // Now process the various requests from the coordinator
- this->processCoordinatorRequests();
-
- std::cout << "INFO in LauSimFitTask::runTask : Fit task " << this->taskId() << " has finished successfully" << std::endl;
+ // Establish the connection to the coordinator process
+ this->connectToCoordinator( addressCoordinator, portCoordinator );
+
+ // Initialise the fit model
+ this->initialise();
+
+ // NB call to addConParameters() is intentionally not included here cf.
+ // LauAbsFitModel::run() since this has to be dealt with by the coordinator
+ // to avoid multiple inclusions of each penalty term
+ // Print a warning if constraints on combinations of parameters have been specified
+ const auto& storeCon = this->formulaConstraints();
+ if ( ! storeCon.empty() ) {
+ std::cerr << "WARNING in LauSimFitTask::runTask : Constraints have been added but these will be ignored - they should have been added to the coordinator process"
+ << std::endl;
+ }
+
+ // Setup saving of fit results to ntuple/LaTeX table etc.
+ this->setupResultsOutputs( histFileName, tableFileName );
+
+ // This reads in the given dataFile and creates an input
+ // fit data tree that stores them for all events and experiments.
+ Bool_t dataOK = this->verifyFitData( dataFileName, dataTreeName );
+ if ( ! dataOK ) {
+ std::cerr << "ERROR in LauSimFitTask::runTask : Problem caching the fit data." << std::endl;
+ return;
+ }
+
+ // Now process the various requests from the coordinator
+ this->processCoordinatorRequests();
+
+ std::cout << "INFO in LauSimFitTask::runTask : Fit task " << this->taskId()
+ << " has finished successfully" << std::endl;
}
-void LauSimFitTask::setupResultsOutputs( const TString& histFileName, const TString& /*tableFileName*/ )
+void LauSimFitTask::setupResultsOutputs( const TString& histFileName,
+ const TString& /*tableFileName*/ )
{
- // Create and setup the fit results ntuple
- std::cout << "INFO in LauSimFitTask::setupResultsOutputs : Creating fit ntuple." << std::endl;
- if (fitNtuple_ != 0) {delete fitNtuple_; fitNtuple_ = 0;}
- fitNtuple_ = new LauFitNtuple(histFileName, this->useAsymmFitErrors());
+ // Create and setup the fit results ntuple
+ std::cout << "INFO in LauSimFitTask::setupResultsOutputs : Creating fit ntuple." << std::endl;
+ if ( fitNtuple_ != 0 ) {
+ delete fitNtuple_;
+ fitNtuple_ = 0;
+ }
+ fitNtuple_ = new LauFitNtuple( histFileName, this->useAsymmFitErrors() );
}
-void LauSimFitTask::connectToCoordinator( const TString& addressCoordinator, const UInt_t portCoordinator )
+void LauSimFitTask::connectToCoordinator( const TString& addressCoordinator,
+ const UInt_t portCoordinator )
{
- if ( socketCoordinator_ != 0 ) {
- std::cerr << "ERROR in LauSimFitTask::connectToCoordinator : coordinator socket already present" << std::endl;
- return;
- }
-
- // Open connection to coordinator
- socketCoordinator_ = new TSocket(addressCoordinator, portCoordinator);
- socketCoordinator_->Recv( messageFromCoordinator_ );
-
- messageFromCoordinator_->ReadUInt( taskId_ );
- messageFromCoordinator_->ReadUInt( nTasks_ );
-
- Bool_t useAsymErrs(kFALSE);
- messageFromCoordinator_->ReadBool( useAsymErrs );
- this->useAsymmFitErrors(useAsymErrs);
-
- delete messageFromCoordinator_;
- messageFromCoordinator_ = 0;
-
- std::cout << "INFO in LauSimFitTask::connectToCoordinator : Established connection to coordinator on port " << portCoordinator << std::endl;
- std::cout << " : We are task " << taskId_ << " of " << nTasks_ << std::endl;
- if ( useAsymErrs ) {
- std::cout << " : The fit will determine asymmetric errors" << std::endl;
- }
+ if ( socketCoordinator_ != 0 ) {
+ std::cerr << "ERROR in LauSimFitTask::connectToCoordinator : coordinator socket already present"
+ << std::endl;
+ return;
+ }
+
+ // Open connection to coordinator
+ socketCoordinator_ = new TSocket( addressCoordinator, portCoordinator );
+ socketCoordinator_->Recv( messageFromCoordinator_ );
+
+ messageFromCoordinator_->ReadUInt( taskId_ );
+ messageFromCoordinator_->ReadUInt( nTasks_ );
+
+ Bool_t useAsymErrs( kFALSE );
+ messageFromCoordinator_->ReadBool( useAsymErrs );
+ this->useAsymmFitErrors( useAsymErrs );
+
+ delete messageFromCoordinator_;
+ messageFromCoordinator_ = 0;
+
+ std::cout << "INFO in LauSimFitTask::connectToCoordinator : Established connection to coordinator on port "
+ << portCoordinator << std::endl;
+ std::cout << " : We are task " << taskId_ << " of "
+ << nTasks_ << std::endl;
+ if ( useAsymErrs ) {
+ std::cout << " : The fit will determine asymmetric errors"
+ << std::endl;
+ }
}
void LauSimFitTask::processCoordinatorRequests()
{
- // Listen for requests from the coordinator and act accordingly
+ // Listen for requests from the coordinator and act accordingly
- TMessage messageToCoordinator(kMESS_ANY);
+ TMessage messageToCoordinator( kMESS_ANY );
- while ( kTRUE ) {
+ while ( kTRUE ) {
- socketCoordinator_->Recv( messageFromCoordinator_ );
+ socketCoordinator_->Recv( messageFromCoordinator_ );
- if ( messageFromCoordinator_->What() == kMESS_STRING ) {
+ if ( messageFromCoordinator_->What() == kMESS_STRING ) {
- TString msgStr;
- messageFromCoordinator_->ReadTString( msgStr );
+ TString msgStr;
+ messageFromCoordinator_->ReadTString( msgStr );
- std::cout << "INFO in LauSimFitTask::processCoordinatorRequests : Received message from coordinator: " << msgStr << std::endl;
+ std::cout << "INFO in LauSimFitTask::processCoordinatorRequests : Received message from coordinator: "
+ << msgStr << std::endl;
- if ( msgStr == "Send Parameters" ) {
+ if ( msgStr == "Send Parameters" ) {
- // Send the fit parameters
+ // Send the fit parameters
- TObjArray array;
- this->prepareInitialParArray( array );
+ TObjArray array;
+ this->prepareInitialParArray( array );
- // Create array to efficiently exchange parameter values with coordinator
- if ( parValues_ != 0 ) {
- delete[] parValues_;
- parValues_ = 0;
- }
- UInt_t nPar = array.GetEntries();
- parValues_ = new Double_t[nPar];
+ // Create array to efficiently exchange parameter values with coordinator
+ if ( parValues_ != 0 ) {
+ delete[] parValues_;
+ parValues_ = 0;
+ }
+ UInt_t nPar = array.GetEntries();
+ parValues_ = new Double_t[nPar];
- messageToCoordinator.Reset( kMESS_OBJECT );
- messageToCoordinator.WriteObject( &array );
- socketCoordinator_->Send( messageToCoordinator );
+ messageToCoordinator.Reset( kMESS_OBJECT );
+ messageToCoordinator.WriteObject( &array );
+ socketCoordinator_->Send( messageToCoordinator );
- } else if ( msgStr == "Read Expt" ) {
+ } else if ( msgStr == "Read Expt" ) {
- // Read the data for this experiment
- UInt_t iExp(0);
- messageFromCoordinator_->ReadUInt( iExp );
+ // Read the data for this experiment
+ UInt_t iExp( 0 );
+ messageFromCoordinator_->ReadUInt( iExp );
- this->setCurrentExperiment( iExp );
+ this->setCurrentExperiment( iExp );
- UInt_t nEvents = this->readExperimentData();
- if ( nEvents < 1 ) {
- std::cerr << "WARNING in LauSimFitTask::processCoordinatorRequests : Zero events in experiment " << iExp << ", the coordinator should skip this experiment..." << std::endl;
- }
+ UInt_t nEvents = this->readExperimentData();
+ if ( nEvents < 1 ) {
+ std::cerr << "WARNING in LauSimFitTask::processCoordinatorRequests : Zero events in experiment "
+ << iExp << ", the coordinator should skip this experiment..."
+ << std::endl;
+ }
- messageToCoordinator.Reset( kMESS_ANY );
- messageToCoordinator.WriteUInt( taskId_ );
- messageToCoordinator.WriteUInt( nEvents );
- socketCoordinator_->Send( messageToCoordinator );
+ messageToCoordinator.Reset( kMESS_ANY );
+ messageToCoordinator.WriteUInt( taskId_ );
+ messageToCoordinator.WriteUInt( nEvents );
+ socketCoordinator_->Send( messageToCoordinator );
- } else if ( msgStr == "Cache" ) {
+ } else if ( msgStr == "Cache" ) {
- // Perform the caching
+ // Perform the caching
- this->cacheInputFitVars();
+ this->cacheInputFitVars();
- messageToCoordinator.Reset( kMESS_ANY );
- messageToCoordinator.WriteUInt( taskId_ );
- messageToCoordinator.WriteBool( kTRUE );
- socketCoordinator_->Send( messageToCoordinator );
+ messageToCoordinator.Reset( kMESS_ANY );
+ messageToCoordinator.WriteUInt( taskId_ );
+ messageToCoordinator.WriteBool( kTRUE );
+ socketCoordinator_->Send( messageToCoordinator );
- } else if ( msgStr == "Asym Error Calc" ) {
+ } else if ( msgStr == "Asym Error Calc" ) {
- Bool_t asymErrorCalc(kFALSE);
- messageFromCoordinator_->ReadBool( asymErrorCalc );
- this->withinAsymErrorCalc( asymErrorCalc );
+ Bool_t asymErrorCalc( kFALSE );
+ messageFromCoordinator_->ReadBool( asymErrorCalc );
+ this->withinAsymErrorCalc( asymErrorCalc );
- messageToCoordinator.Reset( kMESS_ANY );
- messageToCoordinator.WriteUInt( taskId_ );
- messageToCoordinator.WriteBool( asymErrorCalc );
- socketCoordinator_->Send( messageToCoordinator );
+ messageToCoordinator.Reset( kMESS_ANY );
+ messageToCoordinator.WriteUInt( taskId_ );
+ messageToCoordinator.WriteBool( asymErrorCalc );
+ socketCoordinator_->Send( messageToCoordinator );
- } else if ( msgStr == "Write Results" ) {
+ } else if ( msgStr == "Write Results" ) {
- this->writeOutAllFitResults();
+ this->writeOutAllFitResults();
- messageToCoordinator.Reset( kMESS_ANY );
- messageToCoordinator.WriteUInt( taskId_ );
- messageToCoordinator.WriteBool( kTRUE );
- socketCoordinator_->Send( messageToCoordinator );
+ messageToCoordinator.Reset( kMESS_ANY );
+ messageToCoordinator.WriteUInt( taskId_ );
+ messageToCoordinator.WriteBool( kTRUE );
+ socketCoordinator_->Send( messageToCoordinator );
- } else if ( msgStr == "Finish" ) {
+ } else if ( msgStr == "Finish" ) {
- std::cout << "INFO in LauSimFitTask::processCoordinatorRequests : Message from coordinator to finish" << std::endl;
+ std::cout << "INFO in LauSimFitTask::processCoordinatorRequests : Message from coordinator to finish"
+ << std::endl;
- delete messageFromCoordinator_;
- messageFromCoordinator_ = 0;
+ delete messageFromCoordinator_;
+ messageFromCoordinator_ = 0;
- break;
+ break;
- } else {
+ } else {
- std::cerr << "ERROR in LauSimFitTask::processCoordinatorRequests : Unexpected message from coordinator" << std::endl;
- gSystem->Exit( EXIT_FAILURE );
+ std::cerr << "ERROR in LauSimFitTask::processCoordinatorRequests : Unexpected message from coordinator"
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
- }
+ } else if ( messageFromCoordinator_->What() == kMESS_OBJECT ) {
- } else if ( messageFromCoordinator_->What() == kMESS_OBJECT ) {
+ std::cout << "INFO in LauSimFitTask::processCoordinatorRequests : Received message from coordinator: Finalise"
+ << std::endl;
- std::cout << "INFO in LauSimFitTask::processCoordinatorRequests : Received message from coordinator: Finalise" << std::endl;
+ Int_t status( 0 );
+ Double_t NLL( 0.0 );
+ Double_t EDM( 0.0 );
+ messageFromCoordinator_->ReadInt( status );
+ messageFromCoordinator_->ReadDouble( NLL );
+ messageFromCoordinator_->ReadDouble( EDM );
- Int_t status(0);
- Double_t NLL(0.0);
- Double_t EDM(0.0);
- messageFromCoordinator_->ReadInt( status );
- messageFromCoordinator_->ReadDouble( NLL );
- messageFromCoordinator_->ReadDouble( EDM );
+ TObjArray* objarray = dynamic_cast<TObjArray*>(
+ messageFromCoordinator_->ReadObject( messageFromCoordinator_->GetClass() ) );
+ if ( ! objarray ) {
+ std::cerr << "ERROR in LauSimFitTask::processCoordinatorRequests : Error reading parameters from coordinator"
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
- TObjArray * objarray = dynamic_cast<TObjArray*>( messageFromCoordinator_->ReadObject( messageFromCoordinator_->GetClass() ) );
- if ( ! objarray ) {
- std::cerr << "ERROR in LauSimFitTask::processCoordinatorRequests : Error reading parameters from coordinator" << std::endl;
- gSystem->Exit( EXIT_FAILURE );
- }
+ TMatrixD* covMat = dynamic_cast<TMatrixD*>(
+ messageFromCoordinator_->ReadObject( messageFromCoordinator_->GetClass() ) );
+ if ( ! covMat ) {
+ std::cerr << "ERROR in LauSimFitTask::processCoordinatorRequests : Error reading covariance matrix from coordinator"
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
- TMatrixD * covMat = dynamic_cast<TMatrixD*>( messageFromCoordinator_->ReadObject( messageFromCoordinator_->GetClass() ) );
- if ( ! covMat ) {
- std::cerr << "ERROR in LauSimFitTask::processCoordinatorRequests : Error reading covariance matrix from coordinator" << std::endl;
- gSystem->Exit( EXIT_FAILURE );
- }
+ TObjArray array;
+ LauAbsFitter::FitStatus fitStat { status, NLL, EDM };
+ this->finaliseExperiment( fitStat, objarray, covMat, array );
- TObjArray array;
- LauAbsFitter::FitStatus fitStat { status, NLL, EDM };
- this->finaliseExperiment( fitStat, objarray, covMat, array );
+ delete objarray;
+ objarray = 0;
+ delete covMat;
+ covMat = 0;
- delete objarray; objarray = 0;
- delete covMat; covMat = 0;
+ // Send the finalised parameters back to the coordinator
+ messageToCoordinator.Reset( kMESS_ANY );
+ messageToCoordinator.WriteUInt( taskId_ );
+ messageToCoordinator.WriteBool( kTRUE );
+ messageToCoordinator.WriteObject( &array );
+ socketCoordinator_->Send( messageToCoordinator );
- // Send the finalised parameters back to the coordinator
- messageToCoordinator.Reset( kMESS_ANY );
- messageToCoordinator.WriteUInt( taskId_ );
- messageToCoordinator.WriteBool( kTRUE );
- messageToCoordinator.WriteObject( &array );
- socketCoordinator_->Send( messageToCoordinator );
+ } else if ( messageFromCoordinator_->What() == kMESS_ANY ) {
- } else if ( messageFromCoordinator_->What() == kMESS_ANY ) {
+ UInt_t nPars( 0 );
+ UInt_t nFreePars( 0 );
+ messageFromCoordinator_->ReadUInt( nPars );
+ messageFromCoordinator_->ReadUInt( nFreePars );
- UInt_t nPars(0);
- UInt_t nFreePars(0);
- messageFromCoordinator_->ReadUInt( nPars );
- messageFromCoordinator_->ReadUInt( nFreePars );
+ if ( nPars != this->nTotParams() ) {
+ std::cerr << "ERROR in LauSimFitTask::processCoordinatorRequests : Unexpected number of parameters received from coordinator"
+ << std::endl;
+ std::cerr << " : Received " << nPars
+ << " when expecting " << this->nTotParams() << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ messageFromCoordinator_->ReadFastArray( parValues_, nPars );
- if ( nPars != this->nTotParams() ) {
- std::cerr << "ERROR in LauSimFitTask::processCoordinatorRequests : Unexpected number of parameters received from coordinator" << std::endl;
- std::cerr << " : Received " << nPars << " when expecting " << this->nTotParams() << std::endl;
- gSystem->Exit( EXIT_FAILURE );
- }
+ this->setParsFromMinuit( parValues_, nFreePars );
- messageFromCoordinator_->ReadFastArray( parValues_, nPars );
+ Double_t negLogLike = this->getTotNegLogLikelihood();
- this->setParsFromMinuit( parValues_, nFreePars );
+ messageToCoordinator.Reset( kMESS_ANY );
+ messageToCoordinator.WriteDouble( negLogLike );
+ socketCoordinator_->Send( messageToCoordinator );
- Double_t negLogLike = this->getTotNegLogLikelihood();
-
- messageToCoordinator.Reset( kMESS_ANY );
- messageToCoordinator.WriteDouble( negLogLike );
- socketCoordinator_->Send( messageToCoordinator );
-
- } else {
- std::cerr << "ERROR in LauSimFitTask::processCoordinatorRequests : Unexpected message type" << std::endl;
- gSystem->Exit( EXIT_FAILURE );
- }
-
- delete messageFromCoordinator_;
- messageFromCoordinator_ = 0;
- }
+ } else {
+ std::cerr << "ERROR in LauSimFitTask::processCoordinatorRequests : Unexpected message type"
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ delete messageFromCoordinator_;
+ messageFromCoordinator_ = 0;
+ }
}
void LauSimFitTask::writeOutAllFitResults()
{
- // Write out histograms at end
- if (fitNtuple_ != 0) {
- fitNtuple_->writeOutFitResults();
- }
+ // Write out histograms at end
+ if ( fitNtuple_ != 0 ) {
+ fitNtuple_->writeOutFitResults();
+ }
}
-
diff --git a/src/LauSimpleFitModel.cc b/src/LauSimpleFitModel.cc
index e8a8b86..28a31a7 100644
--- a/src/LauSimpleFitModel.cc
+++ b/src/LauSimpleFitModel.cc
@@ -1,2396 +1,2546 @@
/*
Copyright 2004 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauSimpleFitModel.cc
- \brief File containing implementation of LauSimpleFitModel class.
- */
-
-#include <iostream>
-#include <iomanip>
-#include <fstream>
-#include <typeinfo>
+ \brief File containing implementation of LauSimpleFitModel class.
+*/
-#include "TFile.h"
-#include "TH2.h"
-#include "TMinuit.h"
-#include "TRandom.h"
-#include "TSystem.h"
-#include "TVirtualFitter.h"
+#include "LauSimpleFitModel.hh"
#include "LauAbsBkgndDPModel.hh"
#include "LauAbsCoeffSet.hh"
-#include "LauIsobarDynamics.hh"
#include "LauAbsPdf.hh"
#include "LauComplex.hh"
#include "LauConstants.hh"
#include "LauDaughters.hh"
-#include "LauEmbeddedData.hh"
#include "LauEffModel.hh"
+#include "LauEmbeddedData.hh"
#include "LauFitNtuple.hh"
#include "LauGenNtuple.hh"
+#include "LauIsobarDynamics.hh"
#include "LauKinematics.hh"
#include "LauPrint.hh"
#include "LauRandom.hh"
#include "LauScfMap.hh"
-#include "LauSimpleFitModel.hh"
-#include "TGraph2D.h"
+
+#include "TCanvas.h"
+#include "TFile.h"
#include "TGraph.h"
+#include "TGraph2D.h"
+#include "TH2.h"
+#include "TMinuit.h"
+#include "TRandom.h"
#include "TStyle.h"
-#include "TCanvas.h"
-
+#include "TSystem.h"
+#include "TVirtualFitter.h"
+#include <fstream>
+#include <iomanip>
+#include <iostream>
+#include <typeinfo>
-LauSimpleFitModel::LauSimpleFitModel(LauIsobarDynamics* sigModel) : LauAbsFitModel(),
- sigDPModel_(sigModel),
- kinematics_(sigModel ? sigModel->getKinematics() : 0),
- usingBkgnd_(kFALSE),
- nSigComp_(0),
- nSigDPPar_(0),
- nExtraPdfPar_(0),
- nNormPar_(0),
- meanEff_("meanEff",0.0,0.0,1.0),
- dpRate_("dpRate",0.0,0.0,100.0),
- //signalEvents_("signalEvents",1.0,0.0,1.0),
- signalEvents_(0),
- useSCF_(kFALSE),
- useSCFHist_(kFALSE),
- scfFrac_("scfFrac",0.0,0.0,1.0),
- scfFracHist_(0),
- scfMap_(0),
- compareFitData_(kFALSE),
- signalTree_(0),
- reuseSignal_(kFALSE),
- useReweighting_(kFALSE),
- sigDPLike_(0.0),
- scfDPLike_(0.0),
- sigExtraLike_(0.0),
- scfExtraLike_(0.0),
- sigTotalLike_(0.0),
- scfTotalLike_(0.0)
+LauSimpleFitModel::LauSimpleFitModel( LauIsobarDynamics* sigModel ) :
+ LauAbsFitModel(),
+ sigDPModel_( sigModel ),
+ kinematics_( sigModel ? sigModel->getKinematics() : 0 ),
+ usingBkgnd_( kFALSE ),
+ nSigComp_( 0 ),
+ nSigDPPar_( 0 ),
+ nExtraPdfPar_( 0 ),
+ nNormPar_( 0 ),
+ meanEff_( "meanEff", 0.0, 0.0, 1.0 ),
+ dpRate_( "dpRate", 0.0, 0.0, 100.0 ),
+ //signalEvents_("signalEvents",1.0,0.0,1.0),
+ signalEvents_( 0 ),
+ useSCF_( kFALSE ),
+ useSCFHist_( kFALSE ),
+ scfFrac_( "scfFrac", 0.0, 0.0, 1.0 ),
+ scfFracHist_( 0 ),
+ scfMap_( 0 ),
+ compareFitData_( kFALSE ),
+ signalTree_( 0 ),
+ reuseSignal_( kFALSE ),
+ useReweighting_( kFALSE ),
+ sigDPLike_( 0.0 ),
+ scfDPLike_( 0.0 ),
+ sigExtraLike_( 0.0 ),
+ scfExtraLike_( 0.0 ),
+ sigTotalLike_( 0.0 ),
+ scfTotalLike_( 0.0 )
{
}
LauSimpleFitModel::~LauSimpleFitModel()
{
- delete signalTree_;
- for (LauBkgndEmbDataList::iterator iter = bkgndTree_.begin(); iter != bkgndTree_.end(); ++iter) {
- delete (*iter);
- }
- delete scfFracHist_;
+ delete signalTree_;
+ for ( LauBkgndEmbDataList::iterator iter = bkgndTree_.begin(); iter != bkgndTree_.end(); ++iter ) {
+ delete ( *iter );
+ }
+ delete scfFracHist_;
}
void LauSimpleFitModel::setupBkgndVectors()
{
- UInt_t nBkgnds = this->nBkgndClasses();
- bkgndDPModels_.resize( nBkgnds );
- bkgndPdfs_.resize( nBkgnds );
- bkgndEvents_.resize( nBkgnds );
- bkgndTree_.resize( nBkgnds );
- reuseBkgnd_.resize( nBkgnds );
- bkgndDPLike_.resize( nBkgnds );
- bkgndExtraLike_.resize( nBkgnds );
- bkgndTotalLike_.resize( nBkgnds );
+ UInt_t nBkgnds = this->nBkgndClasses();
+ bkgndDPModels_.resize( nBkgnds );
+ bkgndPdfs_.resize( nBkgnds );
+ bkgndEvents_.resize( nBkgnds );
+ bkgndTree_.resize( nBkgnds );
+ reuseBkgnd_.resize( nBkgnds );
+ bkgndDPLike_.resize( nBkgnds );
+ bkgndExtraLike_.resize( nBkgnds );
+ bkgndTotalLike_.resize( nBkgnds );
}
-void LauSimpleFitModel::setNSigEvents(LauParameter* nSigEvents)
+void LauSimpleFitModel::setNSigEvents( LauParameter* nSigEvents )
{
- if ( nSigEvents == 0 ) {
- std::cerr << "ERROR in LauSimpleFitModel::setNSigEvents : The signal yield LauParameter pointer is null." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- if ( signalEvents_ != 0 ) {
- std::cerr << "ERROR in LauSimpleFitModel::setNSigEvents : You are trying to overwrite the signal yield." << std::endl;
- return;
- }
-
- signalEvents_ = nSigEvents;
- TString name = signalEvents_->name();
- if ( ! name.Contains("signalEvents") && !( name.BeginsWith("signal") && name.EndsWith("Events") ) ) {
- signalEvents_->name("signalEvents");
- }
- Double_t value = nSigEvents->value();
- signalEvents_->range(-2.0*(TMath::Abs(value)+1.0), 2.0*(TMath::Abs(value)+1.0));
+ if ( nSigEvents == 0 ) {
+ std::cerr << "ERROR in LauSimpleFitModel::setNSigEvents : The signal yield LauParameter pointer is null."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ if ( signalEvents_ != 0 ) {
+ std::cerr << "ERROR in LauSimpleFitModel::setNSigEvents : You are trying to overwrite the signal yield."
+ << std::endl;
+ return;
+ }
+
+ signalEvents_ = nSigEvents;
+ TString name = signalEvents_->name();
+ if ( ! name.Contains( "signalEvents" ) &&
+ ! ( name.BeginsWith( "signal" ) && name.EndsWith( "Events" ) ) ) {
+ signalEvents_->name( "signalEvents" );
+ }
+ Double_t value = nSigEvents->value();
+ signalEvents_->range( -2.0 * ( TMath::Abs( value ) + 1.0 ), 2.0 * ( TMath::Abs( value ) + 1.0 ) );
}
-void LauSimpleFitModel::setNBkgndEvents(LauAbsRValue* nBkgndEvents)
+void LauSimpleFitModel::setNBkgndEvents( LauAbsRValue* nBkgndEvents )
{
- if ( nBkgndEvents == 0 ) {
- std::cerr << "ERROR in LauSimpleFitModel::setNBkgndEvents : The background yield LauParameter pointer is null." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- if ( ! this->validBkgndClass( nBkgndEvents->name() ) ) {
- std::cerr << "ERROR in LauSimpleFitModel::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;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- UInt_t bkgndID = this->bkgndClassID( nBkgndEvents->name() );
-
- if ( bkgndEvents_[bkgndID] != 0 ) {
- std::cerr << "ERROR in LauSimpleFitModel::setNBkgndEvents : You are trying to overwrite the background yield." << std::endl;
- return;
- }
-
- nBkgndEvents->name( nBkgndEvents->name()+"Events" );
- if ( nBkgndEvents->isLValue() ) {
- Double_t value = nBkgndEvents->value();
- LauParameter* yield = dynamic_cast<LauParameter*>( nBkgndEvents );
- yield->range(-2.0*(TMath::Abs(value)+1.0), 2.0*(TMath::Abs(value)+1.0));
- }
- bkgndEvents_[bkgndID] = nBkgndEvents;
+ if ( nBkgndEvents == 0 ) {
+ std::cerr << "ERROR in LauSimpleFitModel::setNBkgndEvents : The background yield LauParameter pointer is null."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ if ( ! this->validBkgndClass( nBkgndEvents->name() ) ) {
+ std::cerr << "ERROR in LauSimpleFitModel::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;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ UInt_t bkgndID = this->bkgndClassID( nBkgndEvents->name() );
+
+ if ( bkgndEvents_[bkgndID] != 0 ) {
+ std::cerr << "ERROR in LauSimpleFitModel::setNBkgndEvents : You are trying to overwrite the background yield."
+ << std::endl;
+ return;
+ }
+
+ nBkgndEvents->name( nBkgndEvents->name() + "Events" );
+ if ( nBkgndEvents->isLValue() ) {
+ Double_t value = nBkgndEvents->value();
+ LauParameter* yield = dynamic_cast<LauParameter*>( nBkgndEvents );
+ yield->range( -2.0 * ( TMath::Abs( value ) + 1.0 ), 2.0 * ( TMath::Abs( value ) + 1.0 ) );
+ }
+ bkgndEvents_[bkgndID] = nBkgndEvents;
}
-void LauSimpleFitModel::splitSignalComponent( const TH2* dpHisto, const Bool_t upperHalf, const Bool_t fluctuateBins, LauScfMap* scfMap )
+void LauSimpleFitModel::splitSignalComponent( const TH2* dpHisto,
+ const Bool_t upperHalf,
+ const Bool_t fluctuateBins,
+ LauScfMap* scfMap )
{
- if ( useSCF_ == kTRUE ) {
- std::cerr << "ERROR in LauSimpleFitModel::splitSignalComponent : Have already setup SCF." << std::endl;
- return;
- }
-
- if ( dpHisto == 0 ) {
- std::cerr << "ERROR in LauSimpleFitModel::splitSignalComponent : The histogram pointer is null." << std::endl;
- return;
- }
-
- const LauDaughters* daughters = sigDPModel_->getDaughters();
- scfFracHist_ = new LauEffModel( daughters, 0 );
- scfFracHist_->setEffHisto( dpHisto, kTRUE, fluctuateBins, 0.0, 0.0, upperHalf, daughters->squareDP() );
-
- scfMap_ = scfMap;
-
- useSCF_ = kTRUE;
- useSCFHist_ = kTRUE;
+ if ( useSCF_ == kTRUE ) {
+ std::cerr << "ERROR in LauSimpleFitModel::splitSignalComponent : Have already setup SCF."
+ << std::endl;
+ return;
+ }
+
+ if ( dpHisto == 0 ) {
+ std::cerr << "ERROR in LauSimpleFitModel::splitSignalComponent : The histogram pointer is null."
+ << std::endl;
+ return;
+ }
+
+ const LauDaughters* daughters = sigDPModel_->getDaughters();
+ scfFracHist_ = new LauEffModel( daughters, 0 );
+ scfFracHist_
+ ->setEffHisto( dpHisto, kTRUE, fluctuateBins, 0.0, 0.0, upperHalf, daughters->squareDP() );
+
+ scfMap_ = scfMap;
+
+ useSCF_ = kTRUE;
+ useSCFHist_ = kTRUE;
}
void LauSimpleFitModel::splitSignalComponent( const Double_t scfFrac, const Bool_t fixed )
{
- if ( useSCF_ == kTRUE ) {
- std::cerr << "ERROR in LauSimpleFitModel::splitSignalComponent : Have already setup SCF." << std::endl;
- return;
- }
-
- scfFrac_.range( 0.0, 1.0 );
- scfFrac_.value( scfFrac ); scfFrac_.initValue( scfFrac ); scfFrac_.genValue( scfFrac );
- scfFrac_.fixed( fixed );
-
- useSCF_ = kTRUE;
- useSCFHist_ = kFALSE;
+ if ( useSCF_ == kTRUE ) {
+ std::cerr << "ERROR in LauSimpleFitModel::splitSignalComponent : Have already setup SCF."
+ << std::endl;
+ return;
+ }
+
+ scfFrac_.range( 0.0, 1.0 );
+ scfFrac_.value( scfFrac );
+ scfFrac_.initValue( scfFrac );
+ scfFrac_.genValue( scfFrac );
+ scfFrac_.fixed( fixed );
+
+ useSCF_ = kTRUE;
+ useSCFHist_ = kFALSE;
}
-void LauSimpleFitModel::setBkgndDPModel(const TString& bkgndClass, LauAbsBkgndDPModel* bkgndDPModel)
+void LauSimpleFitModel::setBkgndDPModel( const TString& bkgndClass, LauAbsBkgndDPModel* bkgndDPModel )
{
- if (bkgndDPModel == 0) {
- std::cerr << "ERROR in LauSimpleFitModel::setBkgndDPModel : The model pointer is null." << std::endl;
- return;
- }
-
- // check that this background name is valid
- if ( ! this->validBkgndClass( bkgndClass ) ) {
- std::cerr << "ERROR in LauSimpleFitModel::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;
- return;
- }
-
- UInt_t bkgndID = this->bkgndClassID( bkgndClass );
- bkgndDPModels_[bkgndID] = bkgndDPModel;
-
- usingBkgnd_ = kTRUE;
+ if ( bkgndDPModel == 0 ) {
+ std::cerr << "ERROR in LauSimpleFitModel::setBkgndDPModel : The model pointer is null."
+ << std::endl;
+ return;
+ }
+
+ // check that this background name is valid
+ if ( ! this->validBkgndClass( bkgndClass ) ) {
+ std::cerr << "ERROR in LauSimpleFitModel::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;
+ return;
+ }
+
+ UInt_t bkgndID = this->bkgndClassID( bkgndClass );
+ bkgndDPModels_[bkgndID] = bkgndDPModel;
+
+ usingBkgnd_ = kTRUE;
}
-void LauSimpleFitModel::setSignalPdf(LauAbsPdf* pdf)
+void LauSimpleFitModel::setSignalPdf( LauAbsPdf* pdf )
{
- if (pdf==0) {
- std::cerr << "ERROR in LauSimpleFitModel::setSignalPdf : The PDF pointer is null." << std::endl;
- return;
- }
- signalPdfs_.push_back(pdf);
+ if ( pdf == 0 ) {
+ std::cerr << "ERROR in LauSimpleFitModel::setSignalPdf : The PDF pointer is null."
+ << std::endl;
+ return;
+ }
+ signalPdfs_.push_back( pdf );
}
-void LauSimpleFitModel::setSCFPdf(LauAbsPdf* pdf)
+void LauSimpleFitModel::setSCFPdf( LauAbsPdf* pdf )
{
- if (pdf==0) {
- std::cerr << "ERROR in LauSimpleFitModel::setSCFPdf : The PDF pointer is null." << std::endl;
- return;
- }
- scfPdfs_.push_back(pdf);
+ if ( pdf == 0 ) {
+ std::cerr << "ERROR in LauSimpleFitModel::setSCFPdf : The PDF pointer is null." << std::endl;
+ return;
+ }
+ scfPdfs_.push_back( pdf );
}
-void LauSimpleFitModel::setBkgndPdf(const TString& bkgndClass, LauAbsPdf* pdf)
+void LauSimpleFitModel::setBkgndPdf( const TString& bkgndClass, LauAbsPdf* pdf )
{
- if (pdf == 0) {
- std::cerr << "ERROR in LauSimpleFitModel::setBkgndPdf : The PDF pointer is null." << std::endl;
- return;
- }
-
- // check that this background name is valid
- if ( ! this->validBkgndClass( bkgndClass ) ) {
- std::cerr << "ERROR in LauSimpleFitModel::setBkgndPdf : 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;
- return;
- }
-
- UInt_t bkgndID = this->bkgndClassID( bkgndClass );
- bkgndPdfs_[bkgndID].push_back(pdf);
-
- usingBkgnd_ = kTRUE;
+ if ( pdf == 0 ) {
+ std::cerr << "ERROR in LauSimpleFitModel::setBkgndPdf : The PDF pointer is null."
+ << std::endl;
+ return;
+ }
+
+ // check that this background name is valid
+ if ( ! this->validBkgndClass( bkgndClass ) ) {
+ std::cerr << "ERROR in LauSimpleFitModel::setBkgndPdf : 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;
+ return;
+ }
+
+ UInt_t bkgndID = this->bkgndClassID( bkgndClass );
+ bkgndPdfs_[bkgndID].push_back( pdf );
+
+ usingBkgnd_ = kTRUE;
}
-void LauSimpleFitModel::setAmpCoeffSet(LauAbsCoeffSet* coeffSet)
+void LauSimpleFitModel::setAmpCoeffSet( LauAbsCoeffSet* coeffSet )
{
- // Resize the coeffPars vector if not already done
- if ( coeffPars_.empty() ) {
- coeffPars_.resize( sigDPModel_->getnTotAmp() );
- for (std::vector<LauAbsCoeffSet*>::iterator iter = coeffPars_.begin(); iter != coeffPars_.end(); ++iter) {
- (*iter) = 0;
- }
- }
-
- // Is there a component called compName in the signal model?
- TString compName(coeffSet->name());
- const Int_t index = sigDPModel_->resonanceIndex(compName);
- if ( index < 0 ) {
- std::cerr << "ERROR in LauSimpleFitModel::setAmpCoeffSet : Signal DP model doesn't contain component \"" << compName << "\"." << std::endl;
- return;
- }
-
- // Do we already have it in our list of names?
- if ( coeffPars_[index] != 0 && coeffPars_[index]->name() == compName) {
- std::cerr << "ERROR in LauSimpleFitModel::setAmpCoeffSet : Have already set coefficients for \"" << compName << "\"." << std::endl;
- return;
- }
-
- coeffSet->index(index);
- coeffPars_[index] = coeffSet;
-
- ++nSigComp_;
-
- std::cout << "INFO in LauSimpleFitModel::setAmpCoeffSet : Added coefficients for component A"<< index << ": \"" << compName << "\" to the fit model." << std::endl;
- coeffSet->printParValues();
+ // Resize the coeffPars vector if not already done
+ if ( coeffPars_.empty() ) {
+ coeffPars_.resize( sigDPModel_->getnTotAmp() );
+ for ( std::vector<LauAbsCoeffSet*>::iterator iter = coeffPars_.begin();
+ iter != coeffPars_.end();
+ ++iter ) {
+ ( *iter ) = 0;
+ }
+ }
+
+ // Is there a component called compName in the signal model?
+ TString compName( coeffSet->name() );
+ const Int_t index = sigDPModel_->resonanceIndex( compName );
+ if ( index < 0 ) {
+ std::cerr << "ERROR in LauSimpleFitModel::setAmpCoeffSet : Signal DP model doesn't contain component \""
+ << compName << "\"." << std::endl;
+ return;
+ }
+
+ // Do we already have it in our list of names?
+ if ( coeffPars_[index] != 0 && coeffPars_[index]->name() == compName ) {
+ std::cerr << "ERROR in LauSimpleFitModel::setAmpCoeffSet : Have already set coefficients for \""
+ << compName << "\"." << std::endl;
+ return;
+ }
+
+ coeffSet->index( index );
+ coeffPars_[index] = coeffSet;
+
+ ++nSigComp_;
+
+ std::cout << "INFO in LauSimpleFitModel::setAmpCoeffSet : Added coefficients for component A"
+ << index << ": \"" << compName << "\" to the fit model." << std::endl;
+ coeffSet->printParValues();
}
-
void LauSimpleFitModel::initialise()
{
- // Initialisation
- if (!this->useDP() && signalPdfs_.empty()) {
- std::cerr << "ERROR in LauSimpleFitModel::initialise : Signal model doesn't exist for any variable." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- if (this->useDP()) {
- // Check that we have all the Dalitz-plot models
- if ( sigDPModel_ == 0 ) {
- std::cerr << "ERROR in LauSimpleFitModel::initialise : The pointer to the signal DP model is null.\n";
- std::cerr << " : Removing the Dalitz Plot from the model." << std::endl;
- this->useDP(kFALSE);
- }
- if ( usingBkgnd_ ) {
- for (LauBkgndDPModelList::const_iterator dpmodel_iter = bkgndDPModels_.begin(); dpmodel_iter != bkgndDPModels_.end(); ++dpmodel_iter ) {
- if ( (*dpmodel_iter) == 0 ) {
- std::cerr << "ERROR in LauSimpleFitModel::initialise : The pointer to one of the background DP models is null.\n";
- std::cerr << " : Removing the Dalitz Plot from the model." << std::endl;
- this->useDP(kFALSE);
- break;
- }
- }
- }
-
- // Need to check that the number of components we have and that the dynamics has matches up
- UInt_t nAmp = sigDPModel_->getnTotAmp();
- if (nAmp != nSigComp_) {
- std::cerr << "ERROR in LauSimpleFitModel::initialise : Number of signal DP components with magnitude and phase set not right." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // From the initial parameter values calculate the coefficients
- // so they can be passed to the signal model
- this->updateCoeffs();
-
- // If all is well, go ahead and initialise them
- this->initialiseDPModels();
- }
-
- // Next check that, if a given component is being used we've got the
- // right number of PDFs for all the variables involved
- // TODO - should probably check variable names and so on as well
-
- UInt_t nsigpdfvars(0);
- for ( LauPdfPList::const_iterator pdf_iter = signalPdfs_.begin(); pdf_iter != signalPdfs_.end(); ++pdf_iter ) {
- std::vector<TString> varNames = (*pdf_iter)->varNames();
- for ( std::vector<TString>::const_iterator var_iter = varNames.begin(); var_iter != varNames.end(); ++var_iter ) {
- if ( (*var_iter) != "m13Sq" && (*var_iter) != "m23Sq" ) {
- ++nsigpdfvars;
- }
- }
- }
- if (useSCF_) {
- UInt_t nscfpdfvars(0);
- for ( LauPdfPList::const_iterator pdf_iter = scfPdfs_.begin(); pdf_iter != scfPdfs_.end(); ++pdf_iter ) {
- std::vector<TString> varNames = (*pdf_iter)->varNames();
- for ( std::vector<TString>::const_iterator var_iter = varNames.begin(); var_iter != varNames.end(); ++var_iter ) {
- if ( (*var_iter) != "m13Sq" && (*var_iter) != "m23Sq" ) {
- ++nscfpdfvars;
- }
- }
- }
- if (nscfpdfvars != nsigpdfvars) {
- std::cerr << "ERROR in LauSimpleFitModel::initialise : There are " << nsigpdfvars << " TM signal PDF variables but " << nscfpdfvars << " SCF signal PDF variables." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- }
- if (usingBkgnd_) {
- for (LauBkgndPdfsList::const_iterator bgclass_iter = bkgndPdfs_.begin(); bgclass_iter != bkgndPdfs_.end(); ++bgclass_iter) {
- UInt_t nbkgndpdfvars(0);
- const LauPdfPList& pdfList = (*bgclass_iter);
- for ( LauPdfPList::const_iterator pdf_iter = pdfList.begin(); pdf_iter != pdfList.end(); ++pdf_iter ) {
- std::vector<TString> varNames = (*pdf_iter)->varNames();
- for ( std::vector<TString>::const_iterator var_iter = varNames.begin(); var_iter != varNames.end(); ++var_iter ) {
- if ( (*var_iter) != "m13Sq" && (*var_iter) != "m23Sq" ) {
- ++nbkgndpdfvars;
- }
- }
- }
- if (nbkgndpdfvars != nsigpdfvars) {
- std::cerr << "ERROR in LauSimpleFitModel::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
- const LauParameterPList& fitVars = this->fitPars();
- if (fitVars.size() != (nSigDPPar_ + nExtraPdfPar_ + nNormPar_)) {
- std::cerr << "ERROR in LauSimpleFitModel::initialise : Number of fit parameters not of expected size." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- this->setExtraNtupleVars();
+ // Initialisation
+ if ( ! this->useDP() && signalPdfs_.empty() ) {
+ std::cerr << "ERROR in LauSimpleFitModel::initialise : Signal model doesn't exist for any variable."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ if ( this->useDP() ) {
+ // Check that we have all the Dalitz-plot models
+ if ( sigDPModel_ == 0 ) {
+ std::cerr << "ERROR in LauSimpleFitModel::initialise : The pointer to the signal DP model is null.\n";
+ std::cerr << " : Removing the Dalitz Plot from the model."
+ << std::endl;
+ this->useDP( kFALSE );
+ }
+ if ( usingBkgnd_ ) {
+ for ( LauBkgndDPModelList::const_iterator dpmodel_iter = bkgndDPModels_.begin();
+ dpmodel_iter != bkgndDPModels_.end();
+ ++dpmodel_iter ) {
+ if ( ( *dpmodel_iter ) == 0 ) {
+ std::cerr << "ERROR in LauSimpleFitModel::initialise : The pointer to one of the background DP models is null.\n";
+ std::cerr << " : Removing the Dalitz Plot from the model."
+ << std::endl;
+ this->useDP( kFALSE );
+ break;
+ }
+ }
+ }
+
+ // Need to check that the number of components we have and that the dynamics has matches up
+ UInt_t nAmp = sigDPModel_->getnTotAmp();
+ if ( nAmp != nSigComp_ ) {
+ std::cerr << "ERROR in LauSimpleFitModel::initialise : Number of signal DP components with magnitude and phase set not right."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // From the initial parameter values calculate the coefficients
+ // so they can be passed to the signal model
+ this->updateCoeffs();
+
+ // If all is well, go ahead and initialise them
+ this->initialiseDPModels();
+ }
+
+ // Next check that, if a given component is being used we've got the
+ // right number of PDFs for all the variables involved
+ // TODO - should probably check variable names and so on as well
+
+ UInt_t nsigpdfvars( 0 );
+ for ( LauPdfPList::const_iterator pdf_iter = signalPdfs_.begin(); pdf_iter != signalPdfs_.end();
+ ++pdf_iter ) {
+ std::vector<TString> varNames = ( *pdf_iter )->varNames();
+ for ( std::vector<TString>::const_iterator var_iter = varNames.begin();
+ var_iter != varNames.end();
+ ++var_iter ) {
+ if ( ( *var_iter ) != "m13Sq" && ( *var_iter ) != "m23Sq" ) {
+ ++nsigpdfvars;
+ }
+ }
+ }
+ if ( useSCF_ ) {
+ UInt_t nscfpdfvars( 0 );
+ for ( LauPdfPList::const_iterator pdf_iter = scfPdfs_.begin(); pdf_iter != scfPdfs_.end();
+ ++pdf_iter ) {
+ std::vector<TString> varNames = ( *pdf_iter )->varNames();
+ for ( std::vector<TString>::const_iterator var_iter = varNames.begin();
+ var_iter != varNames.end();
+ ++var_iter ) {
+ if ( ( *var_iter ) != "m13Sq" && ( *var_iter ) != "m23Sq" ) {
+ ++nscfpdfvars;
+ }
+ }
+ }
+ if ( nscfpdfvars != nsigpdfvars ) {
+ std::cerr << "ERROR in LauSimpleFitModel::initialise : There are " << nsigpdfvars
+ << " TM signal PDF variables but " << nscfpdfvars
+ << " SCF signal PDF variables." << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ }
+ if ( usingBkgnd_ ) {
+ for ( LauBkgndPdfsList::const_iterator bgclass_iter = bkgndPdfs_.begin();
+ bgclass_iter != bkgndPdfs_.end();
+ ++bgclass_iter ) {
+ UInt_t nbkgndpdfvars( 0 );
+ const LauPdfPList& pdfList = ( *bgclass_iter );
+ for ( LauPdfPList::const_iterator pdf_iter = pdfList.begin(); pdf_iter != pdfList.end();
+ ++pdf_iter ) {
+ std::vector<TString> varNames = ( *pdf_iter )->varNames();
+ for ( std::vector<TString>::const_iterator var_iter = varNames.begin();
+ var_iter != varNames.end();
+ ++var_iter ) {
+ if ( ( *var_iter ) != "m13Sq" && ( *var_iter ) != "m23Sq" ) {
+ ++nbkgndpdfvars;
+ }
+ }
+ }
+ if ( nbkgndpdfvars != nsigpdfvars ) {
+ std::cerr << "ERROR in LauSimpleFitModel::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
+ const LauParameterPList& fitVars = this->fitPars();
+ if ( fitVars.size() != ( nSigDPPar_ + nExtraPdfPar_ + nNormPar_ ) ) {
+ std::cerr << "ERROR in LauSimpleFitModel::initialise : Number of fit parameters not of expected size."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ this->setExtraNtupleVars();
}
void LauSimpleFitModel::initialiseDPModels()
{
- std::cout << "INFO in LauSimpleFitModel::initialiseDPModels : Initialising DP models" << std::endl;
-
- sigDPModel_->initialise(coeffs_);
-
- if (usingBkgnd_ == kTRUE) {
- for (LauBkgndDPModelList::iterator iter = bkgndDPModels_.begin(); iter != bkgndDPModels_.end(); ++iter) {
- (*iter)->initialise();
- }
- }
+ std::cout << "INFO in LauSimpleFitModel::initialiseDPModels : Initialising DP models"
+ << std::endl;
+
+ sigDPModel_->initialise( coeffs_ );
+
+ if ( usingBkgnd_ == kTRUE ) {
+ for ( LauBkgndDPModelList::iterator iter = bkgndDPModels_.begin();
+ iter != bkgndDPModels_.end();
+ ++iter ) {
+ ( *iter )->initialise();
+ }
+ }
}
void LauSimpleFitModel::recalculateNormalisation()
{
- //std::cout << "INFO in LauSimpleFitModel::recalculateNormalizationInDPModels : Recalc Norm in DP model" << std::endl;
- sigDPModel_->recalculateNormalisation();
- sigDPModel_->modifyDataTree();
+ //std::cout << "INFO in LauSimpleFitModel::recalculateNormalizationInDPModels : Recalc Norm in DP model" << std::endl;
+ sigDPModel_->recalculateNormalisation();
+ sigDPModel_->modifyDataTree();
}
void LauSimpleFitModel::setSignalDPParameters()
{
- // Set the fit parameters for the signal model.
+ // Set the fit parameters for the signal model.
- nSigDPPar_ = 0;
- if ( ! this->useDP() ) {
- return;
- }
+ nSigDPPar_ = 0;
+ if ( ! this->useDP() ) {
+ return;
+ }
- std::cout << "INFO in LauSimpleFitModel::setSignalDPParameters : Setting the initial fit parameters for the signal DP model." << std::endl;
+ std::cout << "INFO in LauSimpleFitModel::setSignalDPParameters : Setting the initial fit parameters for the signal DP model."
+ << std::endl;
- // Place isobar coefficient parameters in vector of fit variables
- for (UInt_t i = 0; i < nSigComp_; i++) {
- LauParameterPList pars = coeffPars_[i]->getParameters();
- nSigDPPar_ += this->addFitParameters( pars, kTRUE );
- }
+ // Place isobar coefficient parameters in vector of fit variables
+ for ( UInt_t i = 0; i < nSigComp_; i++ ) {
+ LauParameterPList pars = coeffPars_[i]->getParameters();
+ nSigDPPar_ += this->addFitParameters( pars, kTRUE );
+ }
- // Obtain the resonance parameters and place them in the vector of fit variables and in a separate vector
- LauParameterPList& sigDPPars = sigDPModel_->getFloatingParameters();
- nSigDPPar_ += this->addResonanceParameters( sigDPPars );
+ // Obtain the resonance parameters and place them in the vector of fit variables and in a separate vector
+ LauParameterPList& sigDPPars = sigDPModel_->getFloatingParameters();
+ nSigDPPar_ += this->addResonanceParameters( sigDPPars );
}
void LauSimpleFitModel::setExtraPdfParameters()
{
- // Include all the parameters of the various PDFs in the fit
- // NB all of them are passed to the fit, even though some have been fixed through parameter.fixed(kTRUE)
- // With the new "cloned parameter" scheme only "original" parameters are passed to the fit.
- // Their clones are updated automatically when the originals are updated.
+ // Include all the parameters of the various PDFs in the fit
+ // NB all of them are passed to the fit, even though some have been fixed through parameter.fixed(kTRUE)
+ // With the new "cloned parameter" scheme only "original" parameters are passed to the fit.
+ // Their clones are updated automatically when the originals are updated.
- nExtraPdfPar_ = 0;
+ nExtraPdfPar_ = 0;
- nExtraPdfPar_ += this->addFitParameters(signalPdfs_);
+ nExtraPdfPar_ += this->addFitParameters( signalPdfs_ );
- if (useSCF_ == kTRUE) {
- nExtraPdfPar_ += this->addFitParameters(scfPdfs_);
- }
+ if ( useSCF_ == kTRUE ) {
+ nExtraPdfPar_ += this->addFitParameters( scfPdfs_ );
+ }
- if (usingBkgnd_ == kTRUE) {
- for (LauBkgndPdfsList::iterator iter = bkgndPdfs_.begin(); iter != bkgndPdfs_.end(); ++iter) {
- nExtraPdfPar_ += this->addFitParameters(*iter);
- }
- }
+ if ( usingBkgnd_ == kTRUE ) {
+ for ( LauBkgndPdfsList::iterator iter = bkgndPdfs_.begin(); iter != bkgndPdfs_.end();
+ ++iter ) {
+ nExtraPdfPar_ += this->addFitParameters( *iter );
+ }
+ }
}
void LauSimpleFitModel::setFitNEvents()
{
- if ( signalEvents_ == 0 ) {
- std::cerr << "ERROR in LauSimpleFitModel::setFitNEvents : Signal yield not defined." << std::endl;
- return;
- }
- nNormPar_ = 0;
-
- // initialise the total number of events to be the sum of all the hypotheses
- Double_t nTotEvts = signalEvents_->value();
- for (LauBkgndYieldList::const_iterator iter = bkgndEvents_.begin(); iter != bkgndEvents_.end(); ++iter) {
- nTotEvts += (*iter)->value();
- if ( (*iter) == 0 ) {
- std::cerr << "ERROR in LauSimpleFitModel::setFitNEvents : Background yield not defined." << std::endl;
- return;
- }
- }
- this->eventsPerExpt(TMath::FloorNint(nTotEvts));
-
- // if doing an extended ML fit add the number of signal events into the fit parameters
- if (this->doEMLFit()) {
- std::cout << "INFO in LauSimpleFitModel::setFitNEvents : Initialising number of events for signal and background components..." << std::endl;
- // add the signal events to the list of fit parameters
- nNormPar_ += this->addFitParameters( signalEvents_ );
- } else {
- std::cout << "INFO in LauSimpleFitModel::setFitNEvents : Initialising number of events for background components (and hence signal)..." << std::endl;
- }
-
- if (useSCF_ && !useSCFHist_) {
- nNormPar_ += this->addFitParameters( &scfFrac_ );
- }
-
- if (usingBkgnd_ == kTRUE) {
- nNormPar_ += this->addFitParameters( bkgndEvents_ );
- }
+ if ( signalEvents_ == 0 ) {
+ std::cerr << "ERROR in LauSimpleFitModel::setFitNEvents : Signal yield not defined."
+ << std::endl;
+ return;
+ }
+ nNormPar_ = 0;
+
+ // initialise the total number of events to be the sum of all the hypotheses
+ Double_t nTotEvts = signalEvents_->value();
+ for ( LauBkgndYieldList::const_iterator iter = bkgndEvents_.begin(); iter != bkgndEvents_.end();
+ ++iter ) {
+ nTotEvts += ( *iter )->value();
+ if ( ( *iter ) == 0 ) {
+ std::cerr << "ERROR in LauSimpleFitModel::setFitNEvents : Background yield not defined."
+ << std::endl;
+ return;
+ }
+ }
+ this->eventsPerExpt( TMath::FloorNint( nTotEvts ) );
+
+ // if doing an extended ML fit add the number of signal events into the fit parameters
+ if ( this->doEMLFit() ) {
+ std::cout << "INFO in LauSimpleFitModel::setFitNEvents : Initialising number of events for signal and background components..."
+ << std::endl;
+ // add the signal events to the list of fit parameters
+ nNormPar_ += this->addFitParameters( signalEvents_ );
+ } else {
+ std::cout << "INFO in LauSimpleFitModel::setFitNEvents : Initialising number of events for background components (and hence signal)..."
+ << std::endl;
+ }
+
+ if ( useSCF_ && ! useSCFHist_ ) {
+ nNormPar_ += this->addFitParameters( &scfFrac_ );
+ }
+
+ if ( usingBkgnd_ == kTRUE ) {
+ nNormPar_ += this->addFitParameters( bkgndEvents_ );
+ }
}
void LauSimpleFitModel::setExtraNtupleVars()
{
- // Set-up other parameters derived from the fit results, e.g. fit fractions.
- if (this->useDP() != kTRUE) {
- return;
- }
-
- // First clear the vectors so we start from scratch
- this->clearExtraVarVectors();
-
- LauParameterList& extraVars = this->extraPars();
-
- // Add a fit fraction for each signal component
- fitFrac_ = sigDPModel_->getFitFractions();
- if (fitFrac_.size() != nSigComp_) {
- std::cerr << "ERROR in LauSimpleFitModel::setExtraNtupleVars : Initial Fit Fraction array of unexpected dimension: " << fitFrac_.size() << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- for (UInt_t i(0); i<nSigComp_; ++i) {
- if (fitFrac_[i].size() != nSigComp_) {
- std::cerr << "ERROR in LauSimpleFitModel::setExtraNtupleVars : Initial Fit Fraction array of unexpected dimension: " << fitFrac_[i].size() << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- }
-
- // Add the fit fraction that has not been corrected for the efficiency for each signal component
- fitFracEffUnCorr_ = sigDPModel_->getFitFractionsEfficiencyUncorrected();
- if (fitFracEffUnCorr_.size() != nSigComp_) {
- std::cerr << "ERROR in LauSimpleFitModel::setExtraNtupleVars : Initial Fit Fraction array of unexpected dimension: " << fitFracEffUnCorr_.size() << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- for (UInt_t i(0); i<nSigComp_; ++i) {
- if (fitFracEffUnCorr_[i].size() != nSigComp_) {
- std::cerr << "ERROR in LauSimpleFitModel::setExtraNtupleVars : Initial Fit Fraction array of unexpected dimension: " << fitFracEffUnCorr_[i].size() << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- }
-
- for (UInt_t i = 0; i < nSigComp_; i++) {
- for (UInt_t j = i; j < nSigComp_; j++) {
- extraVars.push_back(fitFrac_[i][j]);
- extraVars.push_back(fitFracEffUnCorr_[i][j]);
- }
- }
-
- // Store any extra parameters/quantities from the DP model (e.g. K-matrix total fit fractions)
- std::vector<LauParameter> extraParams = sigDPModel_->getExtraParameters();
- std::vector<LauParameter>::iterator extraIter;
- for (extraIter = extraParams.begin(); extraIter != extraParams.end(); ++extraIter) {
- LauParameter extraParameter = (*extraIter);
- extraVars.push_back(extraParameter);
- }
-
- // Now add in the DP efficiency value
- Double_t initMeanEff = sigDPModel_->getMeanEff().initValue();
- meanEff_.value(initMeanEff); meanEff_.initValue(initMeanEff); meanEff_.genValue(initMeanEff);
- extraVars.push_back(meanEff_);
-
- // Also add in the DP rate
- Double_t initDPRate = sigDPModel_->getDPRate().initValue();
- dpRate_.value(initDPRate); dpRate_.initValue(initDPRate); dpRate_.genValue(initDPRate);
- extraVars.push_back(dpRate_);
+ // Set-up other parameters derived from the fit results, e.g. fit fractions.
+ if ( this->useDP() != kTRUE ) {
+ return;
+ }
+
+ // First clear the vectors so we start from scratch
+ this->clearExtraVarVectors();
+
+ LauParameterList& extraVars = this->extraPars();
+
+ // Add a fit fraction for each signal component
+ fitFrac_ = sigDPModel_->getFitFractions();
+ if ( fitFrac_.size() != nSigComp_ ) {
+ std::cerr << "ERROR in LauSimpleFitModel::setExtraNtupleVars : Initial Fit Fraction array of unexpected dimension: "
+ << fitFrac_.size() << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ for ( UInt_t i( 0 ); i < nSigComp_; ++i ) {
+ if ( fitFrac_[i].size() != nSigComp_ ) {
+ std::cerr << "ERROR in LauSimpleFitModel::setExtraNtupleVars : Initial Fit Fraction array of unexpected dimension: "
+ << fitFrac_[i].size() << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ }
+
+ // Add the fit fraction that has not been corrected for the efficiency for each signal component
+ fitFracEffUnCorr_ = sigDPModel_->getFitFractionsEfficiencyUncorrected();
+ if ( fitFracEffUnCorr_.size() != nSigComp_ ) {
+ std::cerr << "ERROR in LauSimpleFitModel::setExtraNtupleVars : Initial Fit Fraction array of unexpected dimension: "
+ << fitFracEffUnCorr_.size() << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ for ( UInt_t i( 0 ); i < nSigComp_; ++i ) {
+ if ( fitFracEffUnCorr_[i].size() != nSigComp_ ) {
+ std::cerr << "ERROR in LauSimpleFitModel::setExtraNtupleVars : Initial Fit Fraction array of unexpected dimension: "
+ << fitFracEffUnCorr_[i].size() << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ }
+
+ for ( UInt_t i = 0; i < nSigComp_; i++ ) {
+ for ( UInt_t j = i; j < nSigComp_; j++ ) {
+ extraVars.push_back( fitFrac_[i][j] );
+ extraVars.push_back( fitFracEffUnCorr_[i][j] );
+ }
+ }
+
+ // Store any extra parameters/quantities from the DP model (e.g. K-matrix total fit fractions)
+ std::vector<LauParameter> extraParams = sigDPModel_->getExtraParameters();
+ std::vector<LauParameter>::iterator extraIter;
+ for ( extraIter = extraParams.begin(); extraIter != extraParams.end(); ++extraIter ) {
+ LauParameter extraParameter = ( *extraIter );
+ extraVars.push_back( extraParameter );
+ }
+
+ // Now add in the DP efficiency value
+ Double_t initMeanEff = sigDPModel_->getMeanEff().initValue();
+ meanEff_.value( initMeanEff );
+ meanEff_.initValue( initMeanEff );
+ meanEff_.genValue( initMeanEff );
+ extraVars.push_back( meanEff_ );
+
+ // Also add in the DP rate
+ Double_t initDPRate = sigDPModel_->getDPRate().initValue();
+ dpRate_.value( initDPRate );
+ dpRate_.initValue( initDPRate );
+ dpRate_.genValue( initDPRate );
+ extraVars.push_back( dpRate_ );
}
-void LauSimpleFitModel::finaliseFitResults(const TString& tablePrefixName)
+void LauSimpleFitModel::finaliseFitResults( const TString& tablePrefixName )
{
- // Retrieve parameters from the fit results for calculations and toy generation
- // and eventually store these in output root ntuples/text files
-
- // Now take the fit parameters and update them as necessary
- // e.g. to make mag > 0.0 and phase in the right range.
- // This function will also calculate any other values, such as the
- // fit fractions, using any errors provided by fitParErrors as appropriate.
- // Also obtain the pull values: (measured - generated)/(average error)
-
- if (this->useDP() == kTRUE) {
- for (UInt_t i = 0; i < nSigComp_; i++) {
- // Check whether we have mag > 0.0, and phase in the right range
- coeffPars_[i]->finaliseValues();
- }
- }
-
- // update the pulls on the events
- if (this->doEMLFit()) {
- signalEvents_->updatePull();
- }
- if (useSCF_ && !useSCFHist_) {
- scfFrac_.updatePull();
- }
- if (usingBkgnd_ == kTRUE) {
- for (LauBkgndYieldList::iterator iter = bkgndEvents_.begin(); iter != bkgndEvents_.end(); ++iter) {
- std::vector<LauParameter*> parameters = (*iter)->getPars();
- for ( LauParameter* parameter : parameters ) {
- parameter->updatePull();
- }
- }
- }
-
- // Update the pulls on all the extra PDFs' parameters
- this->updateFitParameters(signalPdfs_);
- if (useSCF_ == kTRUE) {
- this->updateFitParameters(scfPdfs_);
- }
- if (usingBkgnd_ == kTRUE) {
- for (LauBkgndPdfsList::iterator iter = bkgndPdfs_.begin(); iter != bkgndPdfs_.end(); ++iter) {
- this->updateFitParameters(*iter);
- }
- }
-
- // Fill the fit results to the ntuple for current experiment
-
- // update the coefficients and then calculate the fit fractions
- if (this->useDP() == kTRUE) {
- this->updateCoeffs();
- sigDPModel_->updateCoeffs(coeffs_);
- sigDPModel_->calcExtraInfo();
-
- LauParArray fitFrac = sigDPModel_->getFitFractions();
- if (fitFrac.size() != nSigComp_) {
- std::cerr << "ERROR in LauSimpleFitModel::finaliseFitResults : Fit Fraction array of unexpected dimension: " << fitFrac.size() << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- for (UInt_t i(0); i<nSigComp_; ++i) {
- if (fitFrac[i].size() != nSigComp_) {
- std::cerr << "ERROR in LauSimpleFitModel::finaliseFitResults : Fit Fraction array of unexpected dimension: " << fitFrac[i].size() << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- }
-
- LauParArray fitFracEffUnCorr = sigDPModel_->getFitFractionsEfficiencyUncorrected();
- if (fitFracEffUnCorr.size() != nSigComp_) {
- std::cerr << "ERROR in LauSimpleFitModel::finaliseFitResults : Fit Fraction array of unexpected dimension: " << fitFracEffUnCorr.size() << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- for (UInt_t i(0); i<nSigComp_; ++i) {
- if (fitFracEffUnCorr[i].size() != nSigComp_) {
- std::cerr << "ERROR in LauSimpleFitModel::finaliseFitResults : Fit Fraction array of unexpected dimension: " << fitFracEffUnCorr[i].size() << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- }
-
- for (UInt_t i(0); i<nSigComp_; ++i) {
- for (UInt_t j(i); j<nSigComp_; ++j) {
- fitFrac_[i][j].value(fitFrac[i][j].value());
- fitFracEffUnCorr_[i][j].value(fitFracEffUnCorr[i][j].value());
- }
- }
-
- meanEff_.value(sigDPModel_->getMeanEff().value());
- dpRate_.value(sigDPModel_->getDPRate().value());
-
- this->clearExtraVarVectors();
- LauParameterList& extraVars = this->extraPars();
-
- // Then store the final fit parameters, and any extra parameters for
- // the signal model (e.g. fit fractions)
- for (UInt_t i(0); i<nSigComp_; ++i) {
- for (UInt_t j(i); j<nSigComp_; ++j) {
- extraVars.push_back(fitFrac_[i][j]);
- extraVars.push_back(fitFracEffUnCorr_[i][j]);
- }
- }
-
- // Store any extra parameters/quantities from the DP model (e.g. K-matrix total fit fractions)
- std::vector<LauParameter> extraParams = sigDPModel_->getExtraParameters();
- std::vector<LauParameter>::iterator extraIter;
- for (extraIter = extraParams.begin(); extraIter != extraParams.end(); ++extraIter) {
- LauParameter extraParameter = (*extraIter);
- extraVars.push_back(extraParameter);
- }
-
- // Now add in the DP efficiency value
- extraVars.push_back(meanEff_);
-
- // Also add in the DP rate
- extraVars.push_back(dpRate_);
-
- this->printFitFractions(std::cout);
- }
-
- LauFitNtuple* ntuple = this->fitNtuple();
- ntuple->storeParsAndErrors(this->fitPars(), this->multiDimConstrainedPars(), this->extraPars());
-
- // find out the correlation matrix for the parameters
- ntuple->storeCorrMatrix(this->iExpt(), this->fitStatus(), this->covarianceMatrix());
-
- // Fill the data into ntuple
- ntuple->updateFitNtuple();
-
- // Print out the partial fit fractions, phases and the
- // averaged efficiency, reweighted by the dynamics (and anything else)
- if (this->writeLatexTable()) {
- TString sigOutFileName(tablePrefixName);
- sigOutFileName += "_"; sigOutFileName += this->iExpt(); sigOutFileName += "Expt.tex";
- this->writeOutTable(sigOutFileName);
- }
+ // Retrieve parameters from the fit results for calculations and toy generation
+ // and eventually store these in output root ntuples/text files
+
+ // Now take the fit parameters and update them as necessary
+ // e.g. to make mag > 0.0 and phase in the right range.
+ // This function will also calculate any other values, such as the
+ // fit fractions, using any errors provided by fitParErrors as appropriate.
+ // Also obtain the pull values: (measured - generated)/(average error)
+
+ if ( this->useDP() == kTRUE ) {
+ for ( UInt_t i = 0; i < nSigComp_; i++ ) {
+ // Check whether we have mag > 0.0, and phase in the right range
+ coeffPars_[i]->finaliseValues();
+ }
+ }
+
+ // update the pulls on the events
+ if ( this->doEMLFit() ) {
+ signalEvents_->updatePull();
+ }
+ if ( useSCF_ && ! useSCFHist_ ) {
+ scfFrac_.updatePull();
+ }
+ if ( usingBkgnd_ == kTRUE ) {
+ for ( LauBkgndYieldList::iterator iter = bkgndEvents_.begin(); iter != bkgndEvents_.end();
+ ++iter ) {
+ std::vector<LauParameter*> parameters = ( *iter )->getPars();
+ for ( LauParameter* parameter : parameters ) {
+ parameter->updatePull();
+ }
+ }
+ }
+
+ // Update the pulls on all the extra PDFs' parameters
+ this->updateFitParameters( signalPdfs_ );
+ if ( useSCF_ == kTRUE ) {
+ this->updateFitParameters( scfPdfs_ );
+ }
+ if ( usingBkgnd_ == kTRUE ) {
+ for ( LauBkgndPdfsList::iterator iter = bkgndPdfs_.begin(); iter != bkgndPdfs_.end();
+ ++iter ) {
+ this->updateFitParameters( *iter );
+ }
+ }
+
+ // Fill the fit results to the ntuple for current experiment
+
+ // update the coefficients and then calculate the fit fractions
+ if ( this->useDP() == kTRUE ) {
+ this->updateCoeffs();
+ sigDPModel_->updateCoeffs( coeffs_ );
+ sigDPModel_->calcExtraInfo();
+
+ LauParArray fitFrac = sigDPModel_->getFitFractions();
+ if ( fitFrac.size() != nSigComp_ ) {
+ std::cerr << "ERROR in LauSimpleFitModel::finaliseFitResults : Fit Fraction array of unexpected dimension: "
+ << fitFrac.size() << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ for ( UInt_t i( 0 ); i < nSigComp_; ++i ) {
+ if ( fitFrac[i].size() != nSigComp_ ) {
+ std::cerr << "ERROR in LauSimpleFitModel::finaliseFitResults : Fit Fraction array of unexpected dimension: "
+ << fitFrac[i].size() << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ }
+
+ LauParArray fitFracEffUnCorr = sigDPModel_->getFitFractionsEfficiencyUncorrected();
+ if ( fitFracEffUnCorr.size() != nSigComp_ ) {
+ std::cerr << "ERROR in LauSimpleFitModel::finaliseFitResults : Fit Fraction array of unexpected dimension: "
+ << fitFracEffUnCorr.size() << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ for ( UInt_t i( 0 ); i < nSigComp_; ++i ) {
+ if ( fitFracEffUnCorr[i].size() != nSigComp_ ) {
+ std::cerr << "ERROR in LauSimpleFitModel::finaliseFitResults : Fit Fraction array of unexpected dimension: "
+ << fitFracEffUnCorr[i].size() << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ }
+
+ for ( UInt_t i( 0 ); i < nSigComp_; ++i ) {
+ for ( UInt_t j( i ); j < nSigComp_; ++j ) {
+ fitFrac_[i][j].value( fitFrac[i][j].value() );
+ fitFracEffUnCorr_[i][j].value( fitFracEffUnCorr[i][j].value() );
+ }
+ }
+
+ meanEff_.value( sigDPModel_->getMeanEff().value() );
+ dpRate_.value( sigDPModel_->getDPRate().value() );
+
+ this->clearExtraVarVectors();
+ LauParameterList& extraVars = this->extraPars();
+
+ // Then store the final fit parameters, and any extra parameters for
+ // the signal model (e.g. fit fractions)
+ for ( UInt_t i( 0 ); i < nSigComp_; ++i ) {
+ for ( UInt_t j( i ); j < nSigComp_; ++j ) {
+ extraVars.push_back( fitFrac_[i][j] );
+ extraVars.push_back( fitFracEffUnCorr_[i][j] );
+ }
+ }
+
+ // Store any extra parameters/quantities from the DP model (e.g. K-matrix total fit fractions)
+ std::vector<LauParameter> extraParams = sigDPModel_->getExtraParameters();
+ std::vector<LauParameter>::iterator extraIter;
+ for ( extraIter = extraParams.begin(); extraIter != extraParams.end(); ++extraIter ) {
+ LauParameter extraParameter = ( *extraIter );
+ extraVars.push_back( extraParameter );
+ }
+
+ // Now add in the DP efficiency value
+ extraVars.push_back( meanEff_ );
+
+ // Also add in the DP rate
+ extraVars.push_back( dpRate_ );
+
+ this->printFitFractions( std::cout );
+ }
+
+ LauFitNtuple* ntuple = this->fitNtuple();
+ ntuple->storeParsAndErrors( this->fitPars(), this->multiDimConstrainedPars(), this->extraPars() );
+
+ // find out the correlation matrix for the parameters
+ ntuple->storeCorrMatrix( this->iExpt(), this->fitStatus(), this->covarianceMatrix() );
+
+ // Fill the data into ntuple
+ ntuple->updateFitNtuple();
+
+ // Print out the partial fit fractions, phases and the
+ // averaged efficiency, reweighted by the dynamics (and anything else)
+ if ( this->writeLatexTable() ) {
+ TString sigOutFileName( tablePrefixName );
+ sigOutFileName += "_";
+ sigOutFileName += this->iExpt();
+ sigOutFileName += "Expt.tex";
+ this->writeOutTable( sigOutFileName );
+ }
}
-void LauSimpleFitModel::printFitFractions(std::ostream& output)
+void LauSimpleFitModel::printFitFractions( std::ostream& output )
{
- // Print out Fit Fractions, total DP rate and mean efficiency
- for (UInt_t i = 0; i < nSigComp_; i++) {
- output << "FitFraction for component " << i << " (" << coeffPars_[i]->name() << ") = " << fitFrac_[i][i] << std::endl;
- }
- output << "Overall DP rate (integral of matrix element squared) = " << dpRate_ << std::endl;
- output << "Average efficiency weighted by whole DP dynamics = " << meanEff_ << std::endl;
+ // Print out Fit Fractions, total DP rate and mean efficiency
+ for ( UInt_t i = 0; i < nSigComp_; i++ ) {
+ output << "FitFraction for component " << i << " (" << coeffPars_[i]->name()
+ << ") = " << fitFrac_[i][i] << std::endl;
+ }
+ output << "Overall DP rate (integral of matrix element squared) = " << dpRate_ << std::endl;
+ output << "Average efficiency weighted by whole DP dynamics = " << meanEff_ << std::endl;
}
-void LauSimpleFitModel::writeOutTable(const TString& outputFile)
+void LauSimpleFitModel::writeOutTable( const TString& outputFile )
{
- // Write out the results of the fit to a tex-readable table
- // TODO - need to include the yields in this table
- std::ofstream fout(outputFile);
- LauPrint print;
-
- std::cout << "INFO in LauSimpleFitModel::writeOutTable : Writing out results of the fit to the tex file " << outputFile << std::endl;
-
- if (this->useDP() == kTRUE) {
- // print the fit coefficients in one table
- coeffPars_.front()->printTableHeading(fout);
- for (UInt_t i = 0; i < nSigComp_; i++) {
- coeffPars_[i]->printTableRow(fout);
- }
- fout << "\\hline" << std::endl;
- fout << "\\end{tabular}" << std::endl << std::endl;
-
- // print the fit fractions in another
- fout << "\\begin{tabular}{|l|c|}" << std::endl;
- fout << "\\hline" << std::endl;
- fout << "Component & FitFraction \\\\" << std::endl;
- fout << "\\hline" << std::endl;
- Double_t fitFracSum(0.0);
- for (UInt_t i = 0; i < nSigComp_; i++) {
- TString resName = coeffPars_[i]->name();
- resName = resName.ReplaceAll("_", "\\_");
- fout << resName << " & $";
- Double_t fitFrac = fitFrac_[i][i].value();
- fitFracSum += fitFrac;
- print.printFormat(fout, fitFrac);
- fout << "$ \\\\" << std::endl;
- }
- fout << "\\hline" << std::endl;
-
- // Also print out sum of fit fractions
- fout << "Fit Fraction Sum & $";
- print.printFormat(fout, fitFracSum);
- fout << "$ \\\\" << std::endl;
- fout << "\\hline" << std::endl;
-
- fout << "DP rate & $";
- print.printFormat(fout, dpRate_.value());
- fout << "$ \\\\" << std::endl;
- fout << "\\hline" << std::endl;
-
- fout << "$< \\varepsilon >$ & $";
- print.printFormat(fout, meanEff_.value());
- fout << "$ \\\\" << std::endl;
- fout << "\\hline" << std::endl;
- fout << "\\end{tabular}" << std::endl << std::endl;
- }
-
- if (!signalPdfs_.empty()) {
- fout << "\\begin{tabular}{|l|c|}" << std::endl;
- fout << "\\hline" << std::endl;
- if (useSCF_ == kTRUE) {
- fout << "\\Extra TM Signal PDFs' Parameters: & \\\\" << std::endl;
- } else {
- fout << "\\Extra Signal PDFs' Parameters: & \\\\" << std::endl;
- }
- this->printFitParameters(signalPdfs_, fout);
- if (useSCF_ == kTRUE && !scfPdfs_.empty()) {
- fout << "\\hline" << std::endl;
- fout << "\\Extra SCF Signal PDFs' Parameters: & \\\\" << std::endl;
- this->printFitParameters(scfPdfs_, fout);
- }
- if (usingBkgnd_ == kTRUE && !bkgndPdfs_.empty()) {
- fout << "\\hline" << std::endl;
- fout << "\\Extra Background PDFs' Parameters: & \\\\" << std::endl;
- for (LauBkgndPdfsList::const_iterator iter = bkgndPdfs_.begin(); iter != bkgndPdfs_.end(); ++iter) {
- this->printFitParameters(*iter, fout);
- }
- }
- fout << "\\hline \n\\end{tabular}" << std::endl << std::endl;
- }
+ // Write out the results of the fit to a tex-readable table
+ // TODO - need to include the yields in this table
+ std::ofstream fout( outputFile );
+ LauPrint print;
+
+ std::cout << "INFO in LauSimpleFitModel::writeOutTable : Writing out results of the fit to the tex file "
+ << outputFile << std::endl;
+
+ if ( this->useDP() == kTRUE ) {
+ // print the fit coefficients in one table
+ coeffPars_.front()->printTableHeading( fout );
+ for ( UInt_t i = 0; i < nSigComp_; i++ ) {
+ coeffPars_[i]->printTableRow( fout );
+ }
+ fout << "\\hline" << std::endl;
+ fout << "\\end{tabular}" << std::endl << std::endl;
+
+ // print the fit fractions in another
+ fout << "\\begin{tabular}{|l|c|}" << std::endl;
+ fout << "\\hline" << std::endl;
+ fout << "Component & FitFraction \\\\" << std::endl;
+ fout << "\\hline" << std::endl;
+ Double_t fitFracSum( 0.0 );
+ for ( UInt_t i = 0; i < nSigComp_; i++ ) {
+ TString resName = coeffPars_[i]->name();
+ resName = resName.ReplaceAll( "_", "\\_" );
+ fout << resName << " & $";
+ Double_t fitFrac = fitFrac_[i][i].value();
+ fitFracSum += fitFrac;
+ print.printFormat( fout, fitFrac );
+ fout << "$ \\\\" << std::endl;
+ }
+ fout << "\\hline" << std::endl;
+
+ // Also print out sum of fit fractions
+ fout << "Fit Fraction Sum & $";
+ print.printFormat( fout, fitFracSum );
+ fout << "$ \\\\" << std::endl;
+ fout << "\\hline" << std::endl;
+
+ fout << "DP rate & $";
+ print.printFormat( fout, dpRate_.value() );
+ fout << "$ \\\\" << std::endl;
+ fout << "\\hline" << std::endl;
+
+ fout << "$< \\varepsilon >$ & $";
+ print.printFormat( fout, meanEff_.value() );
+ fout << "$ \\\\" << std::endl;
+ fout << "\\hline" << std::endl;
+ fout << "\\end{tabular}" << std::endl << std::endl;
+ }
+
+ if ( ! signalPdfs_.empty() ) {
+ fout << "\\begin{tabular}{|l|c|}" << std::endl;
+ fout << "\\hline" << std::endl;
+ if ( useSCF_ == kTRUE ) {
+ fout << "\\Extra TM Signal PDFs' Parameters: & \\\\" << std::endl;
+ } else {
+ fout << "\\Extra Signal PDFs' Parameters: & \\\\" << std::endl;
+ }
+ this->printFitParameters( signalPdfs_, fout );
+ if ( useSCF_ == kTRUE && ! scfPdfs_.empty() ) {
+ fout << "\\hline" << std::endl;
+ fout << "\\Extra SCF Signal PDFs' Parameters: & \\\\" << std::endl;
+ this->printFitParameters( scfPdfs_, fout );
+ }
+ if ( usingBkgnd_ == kTRUE && ! bkgndPdfs_.empty() ) {
+ fout << "\\hline" << std::endl;
+ fout << "\\Extra Background PDFs' Parameters: & \\\\" << std::endl;
+ for ( LauBkgndPdfsList::const_iterator iter = bkgndPdfs_.begin();
+ iter != bkgndPdfs_.end();
+ ++iter ) {
+ this->printFitParameters( *iter, fout );
+ }
+ }
+ fout << "\\hline \n\\end{tabular}" << std::endl << std::endl;
+ }
}
void LauSimpleFitModel::checkInitFitParams()
{
- // Update the number of signal events to be total-sum(background events)
- this->updateSigEvents();
-
- // Check whether we want to have randomised initial fit parameters for the signal model
- if (this->useRandomInitFitPars() == kTRUE) {
- std::cout << "INFO in LauSimpleFitModel::checkInitFitParams : Setting random parameters for the signal DP model" << std::endl;
- this->randomiseInitFitPars();
- }
+ // Update the number of signal events to be total-sum(background events)
+ this->updateSigEvents();
+
+ // Check whether we want to have randomised initial fit parameters for the signal model
+ if ( this->useRandomInitFitPars() == kTRUE ) {
+ std::cout << "INFO in LauSimpleFitModel::checkInitFitParams : Setting random parameters for the signal DP model"
+ << std::endl;
+ this->randomiseInitFitPars();
+ }
}
void LauSimpleFitModel::randomiseInitFitPars()
{
- // Only randomise those parameters that are not fixed!
- std::cout << "INFO in LauSimpleFitModel::randomiseInitFitPars : Randomising the initial fit magnitudes and phases of the resonances..." << std::endl;
+ // Only randomise those parameters that are not fixed!
+ std::cout << "INFO in LauSimpleFitModel::randomiseInitFitPars : Randomising the initial fit magnitudes and phases of the resonances..."
+ << std::endl;
- for (UInt_t i = 0; i < nSigComp_; i++) {
- coeffPars_[i]->randomiseInitValues();
- }
+ for ( UInt_t i = 0; i < nSigComp_; i++ ) {
+ coeffPars_[i]->randomiseInitValues();
+ }
}
-std::pair<LauSimpleFitModel::LauGenInfo,Bool_t> LauSimpleFitModel::eventsToGenerate()
+std::pair<LauSimpleFitModel::LauGenInfo, Bool_t> LauSimpleFitModel::eventsToGenerate()
{
- // Determine the number of events to generate for each hypothesis
- // If we're smearing then smear each one individually
-
- LauGenInfo nEvtsGen;
-
- // Keep track of whether any yield or asymmetry parameters are blinded
- Bool_t blind = kFALSE;
-
- // Signal
- if ( signalEvents_->blind() ) {
- blind = kTRUE;
- }
-
- Double_t evtWeight(1.0);
- Double_t nEvts = signalEvents_->genValue();
- if ( nEvts < 0 ) {
- evtWeight = -1.0;
- nEvts = TMath::Abs( nEvts );
- }
-
- Int_t nEvtsToGen { static_cast<Int_t>(nEvts) };
- if (this->doPoissonSmearing()) {
- nEvtsToGen = LauRandom::randomFun()->Poisson(nEvts);
- }
-
- nEvtsGen["signal"] = std::make_pair( nEvtsToGen, evtWeight );
-
- // Backgrounds
- const UInt_t nBkgnds = this->nBkgndClasses();
- for ( UInt_t bkgndID(0); bkgndID < nBkgnds; ++bkgndID ) {
- const LauAbsRValue* evtsPar = bkgndEvents_[bkgndID];
- if ( evtsPar->blind() ) {
- blind = kTRUE;
- }
-
- evtWeight = 1.0;
- nEvts = evtsPar->genValue();
- if ( nEvts < 0 ) {
- evtWeight = -1.0;
- nEvts = TMath::Abs( nEvts );
- }
-
- nEvtsToGen = static_cast<Int_t>(nEvts);
- if (this->doPoissonSmearing()) {
- nEvtsToGen = LauRandom::randomFun()->Poisson(nEvts);
- }
-
- const TString& bkgndClass = this->bkgndClassName(bkgndID);
- nEvtsGen[bkgndClass] = std::make_pair( nEvtsToGen, evtWeight );
- }
-
- return std::make_pair( nEvtsGen, blind );
+ // Determine the number of events to generate for each hypothesis
+ // If we're smearing then smear each one individually
+
+ LauGenInfo nEvtsGen;
+
+ // Keep track of whether any yield or asymmetry parameters are blinded
+ Bool_t blind = kFALSE;
+
+ // Signal
+ if ( signalEvents_->blind() ) {
+ blind = kTRUE;
+ }
+
+ Double_t evtWeight( 1.0 );
+ Double_t nEvts = signalEvents_->genValue();
+ if ( nEvts < 0 ) {
+ evtWeight = -1.0;
+ nEvts = TMath::Abs( nEvts );
+ }
+
+ Int_t nEvtsToGen { static_cast<Int_t>( nEvts ) };
+ if ( this->doPoissonSmearing() ) {
+ nEvtsToGen = LauRandom::randomFun()->Poisson( nEvts );
+ }
+
+ nEvtsGen["signal"] = std::make_pair( nEvtsToGen, evtWeight );
+
+ // Backgrounds
+ const UInt_t nBkgnds = this->nBkgndClasses();
+ for ( UInt_t bkgndID( 0 ); bkgndID < nBkgnds; ++bkgndID ) {
+ const LauAbsRValue* evtsPar = bkgndEvents_[bkgndID];
+ if ( evtsPar->blind() ) {
+ blind = kTRUE;
+ }
+
+ evtWeight = 1.0;
+ nEvts = evtsPar->genValue();
+ if ( nEvts < 0 ) {
+ evtWeight = -1.0;
+ nEvts = TMath::Abs( nEvts );
+ }
+
+ nEvtsToGen = static_cast<Int_t>( nEvts );
+ if ( this->doPoissonSmearing() ) {
+ nEvtsToGen = LauRandom::randomFun()->Poisson( nEvts );
+ }
+
+ const TString& bkgndClass = this->bkgndClassName( bkgndID );
+ nEvtsGen[bkgndClass] = std::make_pair( nEvtsToGen, evtWeight );
+ }
+
+ return std::make_pair( nEvtsGen, blind );
}
Bool_t LauSimpleFitModel::genExpt()
{
- // Routine to generate toy Monte Carlo events according to the various models we have defined.
-
- // Determine the number of events to generate for each hypothesis
- std::pair<LauGenInfo,Bool_t> info = this->eventsToGenerate();
- LauGenInfo nEvts = info.first;
- const Bool_t blind = info.second;
-
- Bool_t genOK(kTRUE);
- Int_t evtNum(0);
-
- const UInt_t nBkgnds = this->nBkgndClasses();
- std::vector<TString> bkgndClassNames(nBkgnds);
- std::vector<TString> bkgndClassNamesGen(nBkgnds);
- for ( UInt_t iBkgnd(0); iBkgnd < nBkgnds; ++iBkgnd ) {
- TString name( this->bkgndClassName(iBkgnd) );
- bkgndClassNames[iBkgnd] = name;
- bkgndClassNamesGen[iBkgnd] = "gen"+name;
- }
-
- const Bool_t storeSCFTruthInfo = ( useSCF_ || ( this->enableEmbedding() && signalTree_ != 0 && signalTree_->haveBranch("mcMatch") ) );
-
- // Loop over the hypotheses and generate the requested number of events for each one
- for (LauGenInfo::const_iterator iter = nEvts.begin(); iter != nEvts.end(); ++iter) {
-
- const TString& type(iter->first);
- Int_t nEvtsGen( iter->second.first );
- Double_t evtWeight( iter->second.second );
-
- for (Int_t iEvt(0); iEvt<nEvtsGen; ++iEvt) {
-
- this->setGenNtupleDoubleBranchValue( "evtWeight", evtWeight );
- // Add efficiency information
- this->setGenNtupleDoubleBranchValue( "efficiency", 1 );
-
- if (type == "signal") {
- this->setGenNtupleIntegerBranchValue("genSig",1);
- for ( UInt_t iBkgnd(0); iBkgnd < nBkgnds; ++iBkgnd ) {
- this->setGenNtupleIntegerBranchValue( bkgndClassNamesGen[iBkgnd], 0 );
- }
- genOK = this->generateSignalEvent();
- this->setGenNtupleDoubleBranchValue( "efficiency", sigDPModel_->getEvtEff() );
- } else {
- this->setGenNtupleIntegerBranchValue("genSig",0);
- if ( storeSCFTruthInfo ) {
- this->setGenNtupleIntegerBranchValue("genTMSig",0);
- this->setGenNtupleIntegerBranchValue("genSCFSig",0);
- }
- UInt_t bkgndID(0);
- for ( UInt_t iBkgnd(0); iBkgnd < nBkgnds; ++iBkgnd ) {
- Int_t gen(0);
- if ( bkgndClassNames[iBkgnd] == type ) {
- gen = 1;
- bkgndID = iBkgnd;
- }
- this->setGenNtupleIntegerBranchValue( bkgndClassNamesGen[iBkgnd], gen );
- }
- genOK = this->generateBkgndEvent(bkgndID);
- }
-
- if (!genOK) {
- // If there was a problem with the generation then break out and return.
- // The problem model will have adjusted itself so that all should be OK next time.
- break;
- }
-
- if (this->useDP() == kTRUE) {
- this->setDPBranchValues();
- }
-
- // Store the event number (within this experiment)
- this->setGenNtupleIntegerBranchValue("iEvtWithinExpt",evtNum);
- // and then increment it
- ++evtNum;
-
- this->fillGenNtupleBranches();
- if ( !blind && (iEvt%500 == 0) ) {
- std::cout << "INFO in LauSimpleFitModel::genExpt : Generated event number " << iEvt << " out of " << nEvtsGen << " " << type << " events." << std::endl;
- }
- }
-
- if (!genOK) {
- break;
- }
- }
-
- if (this->useDP() && genOK) {
-
- sigDPModel_->checkToyMC(kTRUE,kTRUE);
-
- // Get the fit fractions if they're to be written into the latex table
- if (this->writeLatexTable()) {
- LauParArray fitFrac = sigDPModel_->getFitFractions();
- if (fitFrac.size() != nSigComp_) {
- std::cerr << "ERROR in LauSimpleFitModel::genExpt : Fit Fraction array of unexpected dimension: " << fitFrac.size() << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- for (UInt_t i(0); i<nSigComp_; ++i) {
- if (fitFrac[i].size() != nSigComp_) {
- std::cerr << "ERROR in LauSimpleFitModel::genExpt : Fit Fraction array of unexpected dimension: " << fitFrac[i].size() << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- }
-
- for (UInt_t i(0); i<nSigComp_; ++i) {
- for (UInt_t j = i; j < nSigComp_; j++) {
- fitFrac_[i][j].value(fitFrac[i][j].value());
- }
- }
- meanEff_.value(sigDPModel_->getMeanEff().value());
- dpRate_.value(sigDPModel_->getDPRate().value());
- }
- }
-
- // If we're reusing embedded events or if the generation is being
- // reset then clear the lists of used events
- if (reuseSignal_ || !genOK) {
- if (signalTree_) {
- signalTree_->clearUsedList();
- }
- }
- for ( UInt_t bkgndID(0); bkgndID < nBkgnds; ++bkgndID ) {
- LauEmbeddedData* data = bkgndTree_[bkgndID];
- if (reuseBkgnd_[bkgndID] || !genOK) {
- if (data) {
- data->clearUsedList();
- }
- }
- }
-
- return genOK;
+ // Routine to generate toy Monte Carlo events according to the various models we have defined.
+
+ // Determine the number of events to generate for each hypothesis
+ std::pair<LauGenInfo, Bool_t> info = this->eventsToGenerate();
+ LauGenInfo nEvts = info.first;
+ const Bool_t blind = info.second;
+
+ Bool_t genOK( kTRUE );
+ Int_t evtNum( 0 );
+
+ const UInt_t nBkgnds = this->nBkgndClasses();
+ std::vector<TString> bkgndClassNames( nBkgnds );
+ std::vector<TString> bkgndClassNamesGen( nBkgnds );
+ for ( UInt_t iBkgnd( 0 ); iBkgnd < nBkgnds; ++iBkgnd ) {
+ TString name( this->bkgndClassName( iBkgnd ) );
+ bkgndClassNames[iBkgnd] = name;
+ bkgndClassNamesGen[iBkgnd] = "gen" + name;
+ }
+
+ const Bool_t storeSCFTruthInfo = ( useSCF_ || ( this->enableEmbedding() && signalTree_ != 0 &&
+ signalTree_->haveBranch( "mcMatch" ) ) );
+
+ // Loop over the hypotheses and generate the requested number of events for each one
+ for ( LauGenInfo::const_iterator iter = nEvts.begin(); iter != nEvts.end(); ++iter ) {
+
+ const TString& type( iter->first );
+ Int_t nEvtsGen( iter->second.first );
+ Double_t evtWeight( iter->second.second );
+
+ for ( Int_t iEvt( 0 ); iEvt < nEvtsGen; ++iEvt ) {
+
+ this->setGenNtupleDoubleBranchValue( "evtWeight", evtWeight );
+ // Add efficiency information
+ this->setGenNtupleDoubleBranchValue( "efficiency", 1 );
+
+ if ( type == "signal" ) {
+ this->setGenNtupleIntegerBranchValue( "genSig", 1 );
+ for ( UInt_t iBkgnd( 0 ); iBkgnd < nBkgnds; ++iBkgnd ) {
+ this->setGenNtupleIntegerBranchValue( bkgndClassNamesGen[iBkgnd], 0 );
+ }
+ genOK = this->generateSignalEvent();
+ this->setGenNtupleDoubleBranchValue( "efficiency", sigDPModel_->getEvtEff() );
+ } else {
+ this->setGenNtupleIntegerBranchValue( "genSig", 0 );
+ if ( storeSCFTruthInfo ) {
+ this->setGenNtupleIntegerBranchValue( "genTMSig", 0 );
+ this->setGenNtupleIntegerBranchValue( "genSCFSig", 0 );
+ }
+ UInt_t bkgndID( 0 );
+ for ( UInt_t iBkgnd( 0 ); iBkgnd < nBkgnds; ++iBkgnd ) {
+ Int_t gen( 0 );
+ if ( bkgndClassNames[iBkgnd] == type ) {
+ gen = 1;
+ bkgndID = iBkgnd;
+ }
+ this->setGenNtupleIntegerBranchValue( bkgndClassNamesGen[iBkgnd], gen );
+ }
+ genOK = this->generateBkgndEvent( bkgndID );
+ }
+
+ if ( ! genOK ) {
+ // If there was a problem with the generation then break out and return.
+ // The problem model will have adjusted itself so that all should be OK next time.
+ break;
+ }
+
+ if ( this->useDP() == kTRUE ) {
+ this->setDPBranchValues();
+ }
+
+ // Store the event number (within this experiment)
+ this->setGenNtupleIntegerBranchValue( "iEvtWithinExpt", evtNum );
+ // and then increment it
+ ++evtNum;
+
+ this->fillGenNtupleBranches();
+ if ( ! blind && ( iEvt % 500 == 0 ) ) {
+ std::cout << "INFO in LauSimpleFitModel::genExpt : Generated event number " << iEvt
+ << " out of " << nEvtsGen << " " << type << " events." << std::endl;
+ }
+ }
+
+ if ( ! genOK ) {
+ break;
+ }
+ }
+
+ if ( this->useDP() && genOK ) {
+
+ sigDPModel_->checkToyMC( kTRUE, kTRUE );
+
+ // Get the fit fractions if they're to be written into the latex table
+ if ( this->writeLatexTable() ) {
+ LauParArray fitFrac = sigDPModel_->getFitFractions();
+ if ( fitFrac.size() != nSigComp_ ) {
+ std::cerr << "ERROR in LauSimpleFitModel::genExpt : Fit Fraction array of unexpected dimension: "
+ << fitFrac.size() << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ for ( UInt_t i( 0 ); i < nSigComp_; ++i ) {
+ if ( fitFrac[i].size() != nSigComp_ ) {
+ std::cerr << "ERROR in LauSimpleFitModel::genExpt : Fit Fraction array of unexpected dimension: "
+ << fitFrac[i].size() << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ }
+
+ for ( UInt_t i( 0 ); i < nSigComp_; ++i ) {
+ for ( UInt_t j = i; j < nSigComp_; j++ ) {
+ fitFrac_[i][j].value( fitFrac[i][j].value() );
+ }
+ }
+ meanEff_.value( sigDPModel_->getMeanEff().value() );
+ dpRate_.value( sigDPModel_->getDPRate().value() );
+ }
+ }
+
+ // If we're reusing embedded events or if the generation is being
+ // reset then clear the lists of used events
+ if ( reuseSignal_ || ! genOK ) {
+ if ( signalTree_ ) {
+ signalTree_->clearUsedList();
+ }
+ }
+ for ( UInt_t bkgndID( 0 ); bkgndID < nBkgnds; ++bkgndID ) {
+ LauEmbeddedData* data = bkgndTree_[bkgndID];
+ if ( reuseBkgnd_[bkgndID] || ! genOK ) {
+ if ( data ) {
+ data->clearUsedList();
+ }
+ }
+ }
+
+ return genOK;
}
Bool_t LauSimpleFitModel::generateSignalEvent()
{
- // Generate signal event
- Bool_t genOK(kTRUE);
- Bool_t genSCF(kFALSE);
-
- if (this->useDP()) {
- if (this->enableEmbedding() && signalTree_) {
- if (useReweighting_) {
- // Select a (random) event from the generated data. Then store the
- // reconstructed DP co-ords, together with other pdf information,
- // as the embedded data.
- genOK = signalTree_->getReweightedEvent(sigDPModel_);
- } else {
-
- signalTree_->getEmbeddedEvent(kinematics_);
- }
- if (signalTree_->haveBranch("mcMatch")) {
- Int_t match = static_cast<Int_t>(signalTree_->getValue("mcMatch"));
- if (match) {
- this->setGenNtupleIntegerBranchValue("genTMSig",1);
- this->setGenNtupleIntegerBranchValue("genSCFSig",0);
- genSCF = kFALSE;
- } else {
- this->setGenNtupleIntegerBranchValue("genTMSig",0);
- this->setGenNtupleIntegerBranchValue("genSCFSig",1);
- genSCF = kTRUE;
- }
- }
- } else {
- genOK = sigDPModel_->generate();
- if ( genOK && useSCF_ ) {
- Double_t frac(0.0);
- if ( useSCFHist_ ) {
- frac = scfFracHist_->calcEfficiency( kinematics_ );
- } else {
- frac = scfFrac_.genValue();
- }
- if ( frac < LauRandom::randomFun()->Rndm() ) {
- this->setGenNtupleIntegerBranchValue("genTMSig",1);
- this->setGenNtupleIntegerBranchValue("genSCFSig",0);
- genSCF = kFALSE;
- } else {
- this->setGenNtupleIntegerBranchValue("genTMSig",0);
- this->setGenNtupleIntegerBranchValue("genSCFSig",1);
- genSCF = kTRUE;
-
- // Optionally smear the DP position
- // of the SCF event
- if ( scfMap_ != 0 ) {
- Double_t xCoord(0.0), yCoord(0.0);
- if ( kinematics_->squareDP() ) {
- xCoord = kinematics_->getmPrime();
- yCoord = kinematics_->getThetaPrime();
- } else {
- xCoord = kinematics_->getm13Sq();
- yCoord = kinematics_->getm23Sq();
- }
-
- // Find the bin number where this event is generated
- Int_t binNo = scfMap_->binNumber( xCoord, yCoord );
-
- // Retrieve the migration histogram
- TH2* histo = scfMap_->trueHist( binNo );
-
- const LauAbsEffModel * effModel = sigDPModel_->getEffModel();
- do {
- // Get a random point from the histogram
- histo->GetRandom2( xCoord, yCoord );
-
- // Update the kinematics
- if ( kinematics_->squareDP() ) {
- kinematics_->updateSqDPKinematics( xCoord, yCoord );
- } else {
- kinematics_->updateKinematics( xCoord, yCoord );
- }
- } while ( ! effModel->passVeto( kinematics_ ) );
- }
- }
- }
- }
- } else {
- if (this->enableEmbedding() && signalTree_) {
- signalTree_->getEmbeddedEvent(0);
- if (signalTree_->haveBranch("mcMatch")) {
- Int_t match = static_cast<Int_t>(signalTree_->getValue("mcMatch"));
- if (match) {
- this->setGenNtupleIntegerBranchValue("genTMSig",1);
- this->setGenNtupleIntegerBranchValue("genSCFSig",0);
- genSCF = kFALSE;
- } else {
- this->setGenNtupleIntegerBranchValue("genTMSig",0);
- this->setGenNtupleIntegerBranchValue("genSCFSig",1);
- genSCF = kTRUE;
- }
- }
- } else if ( useSCF_ ) {
- Double_t frac = scfFrac_.genValue();
- if ( frac < LauRandom::randomFun()->Rndm() ) {
- this->setGenNtupleIntegerBranchValue("genTMSig",1);
- this->setGenNtupleIntegerBranchValue("genSCFSig",0);
- genSCF = kFALSE;
- } else {
- this->setGenNtupleIntegerBranchValue("genTMSig",0);
- this->setGenNtupleIntegerBranchValue("genSCFSig",1);
- genSCF = kTRUE;
- }
- }
- }
- if (genOK) {
- if ( useSCF_ ) {
- if ( genSCF ) {
- this->generateExtraPdfValues(&scfPdfs_, signalTree_);
- } else {
- this->generateExtraPdfValues(&signalPdfs_, signalTree_);
- }
- } else {
- this->generateExtraPdfValues(&signalPdfs_, signalTree_);
- }
- }
- // Check for problems with the embedding
- if (this->enableEmbedding() && signalTree_ && (signalTree_->nEvents() == signalTree_->nUsedEvents())) {
- std::cerr << "WARNING in LauSimpleFitModel::generateSignalEvent : Source of embedded signal events used up, clearing the list of used events." << std::endl;
- signalTree_->clearUsedList();
- }
- return genOK;
+ // Generate signal event
+ Bool_t genOK( kTRUE );
+ Bool_t genSCF( kFALSE );
+
+ if ( this->useDP() ) {
+ if ( this->enableEmbedding() && signalTree_ ) {
+ if ( useReweighting_ ) {
+ // Select a (random) event from the generated data. Then store the
+ // reconstructed DP co-ords, together with other pdf information,
+ // as the embedded data.
+ genOK = signalTree_->getReweightedEvent( sigDPModel_ );
+ } else {
+
+ signalTree_->getEmbeddedEvent( kinematics_ );
+ }
+ if ( signalTree_->haveBranch( "mcMatch" ) ) {
+ Int_t match = static_cast<Int_t>( signalTree_->getValue( "mcMatch" ) );
+ if ( match ) {
+ this->setGenNtupleIntegerBranchValue( "genTMSig", 1 );
+ this->setGenNtupleIntegerBranchValue( "genSCFSig", 0 );
+ genSCF = kFALSE;
+ } else {
+ this->setGenNtupleIntegerBranchValue( "genTMSig", 0 );
+ this->setGenNtupleIntegerBranchValue( "genSCFSig", 1 );
+ genSCF = kTRUE;
+ }
+ }
+ } else {
+ genOK = sigDPModel_->generate();
+ if ( genOK && useSCF_ ) {
+ Double_t frac( 0.0 );
+ if ( useSCFHist_ ) {
+ frac = scfFracHist_->calcEfficiency( kinematics_ );
+ } else {
+ frac = scfFrac_.genValue();
+ }
+ if ( frac < LauRandom::randomFun()->Rndm() ) {
+ this->setGenNtupleIntegerBranchValue( "genTMSig", 1 );
+ this->setGenNtupleIntegerBranchValue( "genSCFSig", 0 );
+ genSCF = kFALSE;
+ } else {
+ this->setGenNtupleIntegerBranchValue( "genTMSig", 0 );
+ this->setGenNtupleIntegerBranchValue( "genSCFSig", 1 );
+ genSCF = kTRUE;
+
+ // Optionally smear the DP position
+ // of the SCF event
+ if ( scfMap_ != 0 ) {
+ Double_t xCoord( 0.0 ), yCoord( 0.0 );
+ if ( kinematics_->squareDP() ) {
+ xCoord = kinematics_->getmPrime();
+ yCoord = kinematics_->getThetaPrime();
+ } else {
+ xCoord = kinematics_->getm13Sq();
+ yCoord = kinematics_->getm23Sq();
+ }
+
+ // Find the bin number where this event is generated
+ Int_t binNo = scfMap_->binNumber( xCoord, yCoord );
+
+ // Retrieve the migration histogram
+ TH2* histo = scfMap_->trueHist( binNo );
+
+ const LauAbsEffModel* effModel = sigDPModel_->getEffModel();
+ do {
+ // Get a random point from the histogram
+ histo->GetRandom2( xCoord, yCoord );
+
+ // Update the kinematics
+ if ( kinematics_->squareDP() ) {
+ kinematics_->updateSqDPKinematics( xCoord, yCoord );
+ } else {
+ kinematics_->updateKinematics( xCoord, yCoord );
+ }
+ } while ( ! effModel->passVeto( kinematics_ ) );
+ }
+ }
+ }
+ }
+ } else {
+ if ( this->enableEmbedding() && signalTree_ ) {
+ signalTree_->getEmbeddedEvent( 0 );
+ if ( signalTree_->haveBranch( "mcMatch" ) ) {
+ Int_t match = static_cast<Int_t>( signalTree_->getValue( "mcMatch" ) );
+ if ( match ) {
+ this->setGenNtupleIntegerBranchValue( "genTMSig", 1 );
+ this->setGenNtupleIntegerBranchValue( "genSCFSig", 0 );
+ genSCF = kFALSE;
+ } else {
+ this->setGenNtupleIntegerBranchValue( "genTMSig", 0 );
+ this->setGenNtupleIntegerBranchValue( "genSCFSig", 1 );
+ genSCF = kTRUE;
+ }
+ }
+ } else if ( useSCF_ ) {
+ Double_t frac = scfFrac_.genValue();
+ if ( frac < LauRandom::randomFun()->Rndm() ) {
+ this->setGenNtupleIntegerBranchValue( "genTMSig", 1 );
+ this->setGenNtupleIntegerBranchValue( "genSCFSig", 0 );
+ genSCF = kFALSE;
+ } else {
+ this->setGenNtupleIntegerBranchValue( "genTMSig", 0 );
+ this->setGenNtupleIntegerBranchValue( "genSCFSig", 1 );
+ genSCF = kTRUE;
+ }
+ }
+ }
+ if ( genOK ) {
+ if ( useSCF_ ) {
+ if ( genSCF ) {
+ this->generateExtraPdfValues( &scfPdfs_, signalTree_ );
+ } else {
+ this->generateExtraPdfValues( &signalPdfs_, signalTree_ );
+ }
+ } else {
+ this->generateExtraPdfValues( &signalPdfs_, signalTree_ );
+ }
+ }
+ // Check for problems with the embedding
+ if ( this->enableEmbedding() && signalTree_ &&
+ ( signalTree_->nEvents() == signalTree_->nUsedEvents() ) ) {
+ std::cerr << "WARNING in LauSimpleFitModel::generateSignalEvent : Source of embedded signal events used up, clearing the list of used events."
+ << std::endl;
+ signalTree_->clearUsedList();
+ }
+ return genOK;
}
-Bool_t LauSimpleFitModel::generateBkgndEvent(UInt_t bkgndID)
+Bool_t LauSimpleFitModel::generateBkgndEvent( UInt_t bkgndID )
{
- // Generate background event
- Bool_t genOK(kTRUE);
-
- LauAbsBkgndDPModel* model = bkgndDPModels_[bkgndID];
- LauEmbeddedData* embeddedData(0);
- if (this->enableEmbedding()) {
- embeddedData = bkgndTree_[bkgndID];
- }
- LauPdfPList* extraPdfs = &bkgndPdfs_[bkgndID];
- if (this->useDP()) {
- if (embeddedData) {
- embeddedData->getEmbeddedEvent(kinematics_);
- } else {
- if (model == 0) {
- std::cerr << "ERROR in LauSimpleFitModel::generateBkgndEvent : Can't find the DP model for background class \"" << this->bkgndClassName(bkgndID) << "\"." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- genOK = model->generate();
- }
- } else {
- if (embeddedData) {
- embeddedData->getEmbeddedEvent(0);
- }
- }
- if (genOK) {
- this->generateExtraPdfValues(extraPdfs, embeddedData);
- }
- // Check for problems with the embedding
- if (embeddedData && (embeddedData->nEvents() == embeddedData->nUsedEvents())) {
- std::cerr << "WARNING in LauSimpleFitModel::generateBkgndEvent : Source of embedded " << this->bkgndClassName(bkgndID) << " events used up, clearing the list of used events." << std::endl;
- embeddedData->clearUsedList();
- }
- return genOK;
+ // Generate background event
+ Bool_t genOK( kTRUE );
+
+ LauAbsBkgndDPModel* model = bkgndDPModels_[bkgndID];
+ LauEmbeddedData* embeddedData( 0 );
+ if ( this->enableEmbedding() ) {
+ embeddedData = bkgndTree_[bkgndID];
+ }
+ LauPdfPList* extraPdfs = &bkgndPdfs_[bkgndID];
+ if ( this->useDP() ) {
+ if ( embeddedData ) {
+ embeddedData->getEmbeddedEvent( kinematics_ );
+ } else {
+ if ( model == 0 ) {
+ std::cerr << "ERROR in LauSimpleFitModel::generateBkgndEvent : Can't find the DP model for background class \""
+ << this->bkgndClassName( bkgndID ) << "\"." << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ genOK = model->generate();
+ }
+ } else {
+ if ( embeddedData ) {
+ embeddedData->getEmbeddedEvent( 0 );
+ }
+ }
+ if ( genOK ) {
+ this->generateExtraPdfValues( extraPdfs, embeddedData );
+ }
+ // Check for problems with the embedding
+ if ( embeddedData && ( embeddedData->nEvents() == embeddedData->nUsedEvents() ) ) {
+ std::cerr << "WARNING in LauSimpleFitModel::generateBkgndEvent : Source of embedded "
+ << this->bkgndClassName( bkgndID )
+ << " events used up, clearing the list of used events." << std::endl;
+ embeddedData->clearUsedList();
+ }
+ return genOK;
}
void LauSimpleFitModel::setupGenNtupleBranches()
{
- // Setup the required ntuple branches
- this->addGenNtupleDoubleBranch("evtWeight");
- this->addGenNtupleIntegerBranch("genSig");
- this->addGenNtupleDoubleBranch("efficiency");
- if ( useSCF_ || ( this->enableEmbedding() && signalTree_ != 0 && signalTree_->haveBranch("mcMatch") ) ) {
- this->addGenNtupleIntegerBranch("genTMSig");
- this->addGenNtupleIntegerBranch("genSCFSig");
- }
- const UInt_t nBkgnds = this->nBkgndClasses();
- for ( UInt_t iBkgnd(0); iBkgnd < nBkgnds; ++iBkgnd ) {
- TString name( this->bkgndClassName(iBkgnd) );
- name.Prepend("gen");
- this->addGenNtupleIntegerBranch(name);
- }
- if (this->useDP() == kTRUE) {
- this->addGenNtupleDoubleBranch("m12");
- this->addGenNtupleDoubleBranch("m23");
- this->addGenNtupleDoubleBranch("m13");
- this->addGenNtupleDoubleBranch("m12Sq");
- this->addGenNtupleDoubleBranch("m23Sq");
- this->addGenNtupleDoubleBranch("m13Sq");
- this->addGenNtupleDoubleBranch("cosHel12");
- this->addGenNtupleDoubleBranch("cosHel23");
- this->addGenNtupleDoubleBranch("cosHel13");
- if (kinematics_->squareDP()) {
- this->addGenNtupleDoubleBranch("mPrime");
- this->addGenNtupleDoubleBranch("thPrime");
- }
- }
- for (LauPdfPList::const_iterator pdf_iter = signalPdfs_.begin(); pdf_iter != signalPdfs_.end(); ++pdf_iter) {
- std::vector<TString> varNames = (*pdf_iter)->varNames();
- for ( std::vector<TString>::const_iterator var_iter = varNames.begin(); var_iter != varNames.end(); ++var_iter ) {
- if ( (*var_iter) != "m13Sq" && (*var_iter) != "m23Sq" ) {
- this->addGenNtupleDoubleBranch( (*var_iter) );
- }
- }
- }
+ // Setup the required ntuple branches
+ this->addGenNtupleDoubleBranch( "evtWeight" );
+ this->addGenNtupleIntegerBranch( "genSig" );
+ this->addGenNtupleDoubleBranch( "efficiency" );
+ if ( useSCF_ ||
+ ( this->enableEmbedding() && signalTree_ != 0 && signalTree_->haveBranch( "mcMatch" ) ) ) {
+ this->addGenNtupleIntegerBranch( "genTMSig" );
+ this->addGenNtupleIntegerBranch( "genSCFSig" );
+ }
+ const UInt_t nBkgnds = this->nBkgndClasses();
+ for ( UInt_t iBkgnd( 0 ); iBkgnd < nBkgnds; ++iBkgnd ) {
+ TString name( this->bkgndClassName( iBkgnd ) );
+ name.Prepend( "gen" );
+ this->addGenNtupleIntegerBranch( name );
+ }
+ if ( this->useDP() == kTRUE ) {
+ this->addGenNtupleDoubleBranch( "m12" );
+ this->addGenNtupleDoubleBranch( "m23" );
+ this->addGenNtupleDoubleBranch( "m13" );
+ this->addGenNtupleDoubleBranch( "m12Sq" );
+ this->addGenNtupleDoubleBranch( "m23Sq" );
+ this->addGenNtupleDoubleBranch( "m13Sq" );
+ this->addGenNtupleDoubleBranch( "cosHel12" );
+ this->addGenNtupleDoubleBranch( "cosHel23" );
+ this->addGenNtupleDoubleBranch( "cosHel13" );
+ if ( kinematics_->squareDP() ) {
+ this->addGenNtupleDoubleBranch( "mPrime" );
+ this->addGenNtupleDoubleBranch( "thPrime" );
+ }
+ }
+ for ( LauPdfPList::const_iterator pdf_iter = signalPdfs_.begin(); pdf_iter != signalPdfs_.end();
+ ++pdf_iter ) {
+ std::vector<TString> varNames = ( *pdf_iter )->varNames();
+ for ( std::vector<TString>::const_iterator var_iter = varNames.begin();
+ var_iter != varNames.end();
+ ++var_iter ) {
+ if ( ( *var_iter ) != "m13Sq" && ( *var_iter ) != "m23Sq" ) {
+ this->addGenNtupleDoubleBranch( ( *var_iter ) );
+ }
+ }
+ }
}
void LauSimpleFitModel::setDPBranchValues()
{
- // Store all the DP information
- this->setGenNtupleDoubleBranchValue("m12", kinematics_->getm12());
- this->setGenNtupleDoubleBranchValue("m23", kinematics_->getm23());
- this->setGenNtupleDoubleBranchValue("m13", kinematics_->getm13());
- this->setGenNtupleDoubleBranchValue("m12Sq", kinematics_->getm12Sq());
- this->setGenNtupleDoubleBranchValue("m23Sq", kinematics_->getm23Sq());
- this->setGenNtupleDoubleBranchValue("m13Sq", kinematics_->getm13Sq());
- this->setGenNtupleDoubleBranchValue("cosHel12", kinematics_->getc12());
- this->setGenNtupleDoubleBranchValue("cosHel23", kinematics_->getc23());
- this->setGenNtupleDoubleBranchValue("cosHel13", kinematics_->getc13());
- if (kinematics_->squareDP()) {
- this->setGenNtupleDoubleBranchValue("mPrime", kinematics_->getmPrime());
- this->setGenNtupleDoubleBranchValue("thPrime", kinematics_->getThetaPrime());
- }
+ // Store all the DP information
+ this->setGenNtupleDoubleBranchValue( "m12", kinematics_->getm12() );
+ this->setGenNtupleDoubleBranchValue( "m23", kinematics_->getm23() );
+ this->setGenNtupleDoubleBranchValue( "m13", kinematics_->getm13() );
+ this->setGenNtupleDoubleBranchValue( "m12Sq", kinematics_->getm12Sq() );
+ this->setGenNtupleDoubleBranchValue( "m23Sq", kinematics_->getm23Sq() );
+ this->setGenNtupleDoubleBranchValue( "m13Sq", kinematics_->getm13Sq() );
+ this->setGenNtupleDoubleBranchValue( "cosHel12", kinematics_->getc12() );
+ this->setGenNtupleDoubleBranchValue( "cosHel23", kinematics_->getc23() );
+ this->setGenNtupleDoubleBranchValue( "cosHel13", kinematics_->getc13() );
+ if ( kinematics_->squareDP() ) {
+ this->setGenNtupleDoubleBranchValue( "mPrime", kinematics_->getmPrime() );
+ this->setGenNtupleDoubleBranchValue( "thPrime", kinematics_->getThetaPrime() );
+ }
}
-void LauSimpleFitModel::generateExtraPdfValues(LauPdfPList* extraPdfs, LauEmbeddedData* embeddedData)
+void LauSimpleFitModel::generateExtraPdfValues( LauPdfPList* extraPdfs, LauEmbeddedData* embeddedData )
{
- // Generate from the extra PDFs
- if (extraPdfs) {
- for (LauPdfPList::iterator pdf_iter = extraPdfs->begin(); pdf_iter != extraPdfs->end(); ++pdf_iter) {
- LauFitData genValues;
- if (embeddedData) {
- genValues = embeddedData->getValues( (*pdf_iter)->varNames() );
- } else {
- genValues = (*pdf_iter)->generate(kinematics_);
- }
- for ( LauFitData::const_iterator var_iter = genValues.begin(); var_iter != genValues.end(); ++var_iter ) {
- TString varName = var_iter->first;
- if ( varName != "m13Sq" && varName != "m23Sq" ) {
- Double_t value = var_iter->second;
- this->setGenNtupleDoubleBranchValue(varName,value);
- }
- }
- }
- }
+ // Generate from the extra PDFs
+ if ( extraPdfs ) {
+ for ( LauPdfPList::iterator pdf_iter = extraPdfs->begin(); pdf_iter != extraPdfs->end();
+ ++pdf_iter ) {
+ LauFitData genValues;
+ if ( embeddedData ) {
+ genValues = embeddedData->getValues( ( *pdf_iter )->varNames() );
+ } else {
+ genValues = ( *pdf_iter )->generate( kinematics_ );
+ }
+ for ( LauFitData::const_iterator var_iter = genValues.begin();
+ var_iter != genValues.end();
+ ++var_iter ) {
+ TString varName = var_iter->first;
+ if ( varName != "m13Sq" && varName != "m23Sq" ) {
+ Double_t value = var_iter->second;
+ this->setGenNtupleDoubleBranchValue( varName, value );
+ }
+ }
+ }
+ }
}
void LauSimpleFitModel::propagateParUpdates()
{
- // Update the total normalisation for the signal likelihood
- if (this->useDP() == kTRUE) {
- this->updateCoeffs();
- sigDPModel_->updateCoeffs(coeffs_);
- }
-
- // Update the signal events from the background events if not doing an extended fit
- if ( !this->doEMLFit() && !signalEvents_->fixed() ) {
- this->updateSigEvents();
- }
+ // Update the total normalisation for the signal likelihood
+ if ( this->useDP() == kTRUE ) {
+ this->updateCoeffs();
+ sigDPModel_->updateCoeffs( coeffs_ );
+ }
+
+ // Update the signal events from the background events if not doing an extended fit
+ if ( ! this->doEMLFit() && ! signalEvents_->fixed() ) {
+ this->updateSigEvents();
+ }
}
void LauSimpleFitModel::updateSigEvents()
{
- // The background parameters will have been set from Minuit.
- // We need to update the signal events using these.
- Double_t nTotEvts = this->eventsPerExpt();
-
- signalEvents_->range(-2.0*nTotEvts,2.0*nTotEvts);
- for (LauBkgndYieldList::iterator iter = bkgndEvents_.begin(); iter != bkgndEvents_.end(); ++iter) {
- LauAbsRValue* nBkgndEvents = (*iter);
- if ( nBkgndEvents->isLValue() ) {
- LauParameter* yield = dynamic_cast<LauParameter*>( nBkgndEvents );
- yield->range(-2.0*nTotEvts,2.0*nTotEvts);
- }
- }
-
- if ( signalEvents_->fixed() ) {
- return;
- }
-
- // Subtract background events (if any) from signal.
- Double_t signalEvents = nTotEvts;
- if ( usingBkgnd_ == kTRUE ) {
- for (LauBkgndYieldList::const_iterator iter = bkgndEvents_.begin(); iter != bkgndEvents_.end(); ++iter) {
- signalEvents -= (*iter)->value();
- }
- }
- signalEvents_->value(signalEvents);
+ // The background parameters will have been set from Minuit.
+ // We need to update the signal events using these.
+ Double_t nTotEvts = this->eventsPerExpt();
+
+ signalEvents_->range( -2.0 * nTotEvts, 2.0 * nTotEvts );
+ for ( LauBkgndYieldList::iterator iter = bkgndEvents_.begin(); iter != bkgndEvents_.end();
+ ++iter ) {
+ LauAbsRValue* nBkgndEvents = ( *iter );
+ if ( nBkgndEvents->isLValue() ) {
+ LauParameter* yield = dynamic_cast<LauParameter*>( nBkgndEvents );
+ yield->range( -2.0 * nTotEvts, 2.0 * nTotEvts );
+ }
+ }
+
+ if ( signalEvents_->fixed() ) {
+ return;
+ }
+
+ // Subtract background events (if any) from signal.
+ Double_t signalEvents = nTotEvts;
+ if ( usingBkgnd_ == kTRUE ) {
+ for ( LauBkgndYieldList::const_iterator iter = bkgndEvents_.begin();
+ iter != bkgndEvents_.end();
+ ++iter ) {
+ signalEvents -= ( *iter )->value();
+ }
+ }
+ signalEvents_->value( signalEvents );
}
void LauSimpleFitModel::cacheInputFitVars()
{
- // Fill the internal data trees of the signal and backgrond models.
-
- LauFitDataTree* inputFitData = this->fitData();
-
- // First the Dalitz plot variables (m_ij^2)
- if (this->useDP() == kTRUE) {
-
- // need to append SCF smearing bins before caching DP amplitudes
- if ( scfMap_ != 0 ) {
- this->appendBinCentres( inputFitData );
- }
- sigDPModel_->fillDataTree(*inputFitData);
-
- if (usingBkgnd_ == kTRUE) {
- for (LauBkgndDPModelList::iterator iter = bkgndDPModels_.begin(); iter != bkgndDPModels_.end(); ++iter) {
- (*iter)->fillDataTree(*inputFitData);
- }
- }
- }
-
- // ...and then the extra PDFs
- this->cacheInfo(signalPdfs_, *inputFitData);
- this->cacheInfo(scfPdfs_, *inputFitData);
- for (LauBkgndPdfsList::iterator iter = bkgndPdfs_.begin(); iter != bkgndPdfs_.end(); ++iter) {
- this->cacheInfo((*iter), *inputFitData);
- }
-
- // and finally the SCF fractions and jacobians
- if ( useSCF_ && useSCFHist_ ) {
- if ( !inputFitData->haveBranch( "m13Sq" ) || !inputFitData->haveBranch( "m23Sq" ) ) {
- std::cerr << "ERROR in LauSimpleFitModel::cacheInputFitVars : Input data does not contain DP branches and so can't cache the SCF fraction." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- UInt_t nEvents = inputFitData->nEvents();
- recoSCFFracs_.clear();
- recoSCFFracs_.reserve( nEvents );
- if ( kinematics_->squareDP() ) {
- recoJacobians_.clear();
- recoJacobians_.reserve( nEvents );
- }
- for (UInt_t iEvt = 0; iEvt < nEvents; iEvt++) {
- const LauFitData& dataValues = inputFitData->getData(iEvt);
- LauFitData::const_iterator m13_iter = dataValues.find("m13Sq");
- LauFitData::const_iterator m23_iter = dataValues.find("m23Sq");
- kinematics_->updateKinematics( m13_iter->second, m23_iter->second );
- Double_t scfFrac = scfFracHist_->calcEfficiency( kinematics_ );
- recoSCFFracs_.push_back( scfFrac );
- if ( kinematics_->squareDP() ) {
- recoJacobians_.push_back( kinematics_->calcSqDPJacobian() );
- }
- }
- }
+ // Fill the internal data trees of the signal and backgrond models.
+
+ LauFitDataTree* inputFitData = this->fitData();
+
+ // First the Dalitz plot variables (m_ij^2)
+ if ( this->useDP() == kTRUE ) {
+
+ // need to append SCF smearing bins before caching DP amplitudes
+ if ( scfMap_ != 0 ) {
+ this->appendBinCentres( inputFitData );
+ }
+ sigDPModel_->fillDataTree( *inputFitData );
+
+ if ( usingBkgnd_ == kTRUE ) {
+ for ( LauBkgndDPModelList::iterator iter = bkgndDPModels_.begin();
+ iter != bkgndDPModels_.end();
+ ++iter ) {
+ ( *iter )->fillDataTree( *inputFitData );
+ }
+ }
+ }
+
+ // ...and then the extra PDFs
+ this->cacheInfo( signalPdfs_, *inputFitData );
+ this->cacheInfo( scfPdfs_, *inputFitData );
+ for ( LauBkgndPdfsList::iterator iter = bkgndPdfs_.begin(); iter != bkgndPdfs_.end(); ++iter ) {
+ this->cacheInfo( ( *iter ), *inputFitData );
+ }
+
+ // and finally the SCF fractions and jacobians
+ if ( useSCF_ && useSCFHist_ ) {
+ if ( ! inputFitData->haveBranch( "m13Sq" ) || ! inputFitData->haveBranch( "m23Sq" ) ) {
+ std::cerr << "ERROR in LauSimpleFitModel::cacheInputFitVars : Input data does not contain DP branches and so can't cache the SCF fraction."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ UInt_t nEvents = inputFitData->nEvents();
+ recoSCFFracs_.clear();
+ recoSCFFracs_.reserve( nEvents );
+ if ( kinematics_->squareDP() ) {
+ recoJacobians_.clear();
+ recoJacobians_.reserve( nEvents );
+ }
+ for ( UInt_t iEvt = 0; iEvt < nEvents; iEvt++ ) {
+ const LauFitData& dataValues = inputFitData->getData( iEvt );
+ LauFitData::const_iterator m13_iter = dataValues.find( "m13Sq" );
+ LauFitData::const_iterator m23_iter = dataValues.find( "m23Sq" );
+ kinematics_->updateKinematics( m13_iter->second, m23_iter->second );
+ Double_t scfFrac = scfFracHist_->calcEfficiency( kinematics_ );
+ recoSCFFracs_.push_back( scfFrac );
+ if ( kinematics_->squareDP() ) {
+ recoJacobians_.push_back( kinematics_->calcSqDPJacobian() );
+ }
+ }
+ }
}
void LauSimpleFitModel::appendBinCentres( LauFitDataTree* inputData )
{
- // We'll be caching the DP amplitudes and efficiencies of the centres of the true bins.
- // To do so, we attach some fake points at the end of inputData, the number of the entry
- // minus the total number of events corresponding to the number of the histogram for that
- // given true bin in the LauScfMap object. (What this means is that when Laura is provided with
- // the LauScfMap object by the user, it's the latter who has to make sure that it contains the
- // right number of histograms and in exactly the right order!)
-
- // Get the x and y co-ordinates of the bin centres
- std::vector<Double_t> binCentresXCoords;
- std::vector<Double_t> binCentresYCoords;
- scfMap_->listBinCentres(binCentresXCoords, binCentresYCoords);
-
- // The SCF histograms could be in square Dalitz plot histograms.
- // The dynamics takes normal Dalitz plot coords, so we might have to convert them back.
- Bool_t sqDP = kinematics_->squareDP();
- UInt_t nBins = binCentresXCoords.size();
- fakeSCFFracs_.clear();
- fakeSCFFracs_.reserve( nBins );
- if ( sqDP ) {
- fakeJacobians_.clear();
- fakeJacobians_.reserve( nBins );
- }
-
- for (UInt_t iBin = 0; iBin < nBins; ++iBin) {
-
- if ( sqDP ) {
- kinematics_->updateSqDPKinematics(binCentresXCoords[iBin],binCentresYCoords[iBin]);
- binCentresXCoords[iBin] = kinematics_->getm13Sq();
- binCentresYCoords[iBin] = kinematics_->getm23Sq();
- fakeJacobians_.push_back( kinematics_->calcSqDPJacobian() );
- } else {
- kinematics_->updateKinematics(binCentresXCoords[iBin],binCentresYCoords[iBin]);
- }
-
- fakeSCFFracs_.push_back( scfFracHist_->calcEfficiency( kinematics_ ) );
- }
-
- // Set up inputFitVars_ object to hold the fake events
- inputData->appendFakePoints(binCentresXCoords,binCentresYCoords);
+ // We'll be caching the DP amplitudes and efficiencies of the centres of the true bins.
+ // To do so, we attach some fake points at the end of inputData, the number of the entry
+ // minus the total number of events corresponding to the number of the histogram for that
+ // given true bin in the LauScfMap object. (What this means is that when Laura is provided with
+ // the LauScfMap object by the user, it's the latter who has to make sure that it contains the
+ // right number of histograms and in exactly the right order!)
+
+ // Get the x and y co-ordinates of the bin centres
+ std::vector<Double_t> binCentresXCoords;
+ std::vector<Double_t> binCentresYCoords;
+ scfMap_->listBinCentres( binCentresXCoords, binCentresYCoords );
+
+ // The SCF histograms could be in square Dalitz plot histograms.
+ // The dynamics takes normal Dalitz plot coords, so we might have to convert them back.
+ Bool_t sqDP = kinematics_->squareDP();
+ UInt_t nBins = binCentresXCoords.size();
+ fakeSCFFracs_.clear();
+ fakeSCFFracs_.reserve( nBins );
+ if ( sqDP ) {
+ fakeJacobians_.clear();
+ fakeJacobians_.reserve( nBins );
+ }
+
+ for ( UInt_t iBin = 0; iBin < nBins; ++iBin ) {
+
+ if ( sqDP ) {
+ kinematics_->updateSqDPKinematics( binCentresXCoords[iBin], binCentresYCoords[iBin] );
+ binCentresXCoords[iBin] = kinematics_->getm13Sq();
+ binCentresYCoords[iBin] = kinematics_->getm23Sq();
+ fakeJacobians_.push_back( kinematics_->calcSqDPJacobian() );
+ } else {
+ kinematics_->updateKinematics( binCentresXCoords[iBin], binCentresYCoords[iBin] );
+ }
+
+ fakeSCFFracs_.push_back( scfFracHist_->calcEfficiency( kinematics_ ) );
+ }
+
+ // Set up inputFitVars_ object to hold the fake events
+ inputData->appendFakePoints( binCentresXCoords, binCentresYCoords );
}
-Double_t LauSimpleFitModel::getTotEvtLikelihood(UInt_t iEvt)
+Double_t LauSimpleFitModel::getTotEvtLikelihood( UInt_t iEvt )
{
- // Get the DP likelihood for signal and backgrounds
- this->getEvtDPLikelihood(iEvt);
-
- // Get the combined extra PDFs likelihood for signal and backgrounds
- this->getEvtExtraLikelihoods(iEvt);
-
- // If appropriate, combine the TM and SCF likelihoods
- Double_t sigLike = sigDPLike_ * sigExtraLike_;
- if ( useSCF_ ) {
- Double_t scfFrac(0.0);
- if (useSCFHist_) {
- scfFrac = recoSCFFracs_[iEvt];
- } else {
- scfFrac = scfFrac_.unblindValue();
- }
- sigLike *= (1.0 - scfFrac);
- if ( (scfMap_ != 0) && (this->useDP() == kTRUE) ) {
- // if we're smearing the SCF DP PDF then the SCF frac
- // is already included in the SCF DP likelihood
- sigLike += (scfDPLike_ * scfExtraLike_);
- } else {
- sigLike += (scfFrac * scfDPLike_ * scfExtraLike_);
- }
- }
-
- // Construct the total event likelihood
- Double_t likelihood = signalEvents_->unblindValue() * sigLike;
- const UInt_t nBkgnds = this->nBkgndClasses();
- for ( UInt_t bkgndID(0); bkgndID < nBkgnds; ++bkgndID ) {
- likelihood += (bkgndEvents_[bkgndID]->unblindValue() * bkgndDPLike_[bkgndID] * bkgndExtraLike_[bkgndID]);
- }
-
- return likelihood;
+ // Get the DP likelihood for signal and backgrounds
+ this->getEvtDPLikelihood( iEvt );
+
+ // Get the combined extra PDFs likelihood for signal and backgrounds
+ this->getEvtExtraLikelihoods( iEvt );
+
+ // If appropriate, combine the TM and SCF likelihoods
+ Double_t sigLike = sigDPLike_ * sigExtraLike_;
+ if ( useSCF_ ) {
+ Double_t scfFrac( 0.0 );
+ if ( useSCFHist_ ) {
+ scfFrac = recoSCFFracs_[iEvt];
+ } else {
+ scfFrac = scfFrac_.unblindValue();
+ }
+ sigLike *= ( 1.0 - scfFrac );
+ if ( ( scfMap_ != 0 ) && ( this->useDP() == kTRUE ) ) {
+ // if we're smearing the SCF DP PDF then the SCF frac
+ // is already included in the SCF DP likelihood
+ sigLike += ( scfDPLike_ * scfExtraLike_ );
+ } else {
+ sigLike += ( scfFrac * scfDPLike_ * scfExtraLike_ );
+ }
+ }
+
+ // Construct the total event likelihood
+ Double_t likelihood = signalEvents_->unblindValue() * sigLike;
+ const UInt_t nBkgnds = this->nBkgndClasses();
+ for ( UInt_t bkgndID( 0 ); bkgndID < nBkgnds; ++bkgndID ) {
+ likelihood += ( bkgndEvents_[bkgndID]->unblindValue() * bkgndDPLike_[bkgndID] *
+ bkgndExtraLike_[bkgndID] );
+ }
+
+ return likelihood;
}
Double_t LauSimpleFitModel::getEventSum() const
{
- Double_t eventSum(0.0);
- eventSum += signalEvents_->unblindValue();
- for (LauBkgndYieldList::const_iterator iter = bkgndEvents_.begin(); iter != bkgndEvents_.end(); ++iter) {
- eventSum += (*iter)->unblindValue();
- }
- return eventSum;
+ Double_t eventSum( 0.0 );
+ eventSum += signalEvents_->unblindValue();
+ for ( LauBkgndYieldList::const_iterator iter = bkgndEvents_.begin(); iter != bkgndEvents_.end();
+ ++iter ) {
+ eventSum += ( *iter )->unblindValue();
+ }
+ return eventSum;
}
-void LauSimpleFitModel::getEvtDPLikelihood(UInt_t iEvt)
+void LauSimpleFitModel::getEvtDPLikelihood( UInt_t iEvt )
{
- // Function to return the signal and background likelihoods for the
- // Dalitz plot for the given event evtNo.
-
- if (this->useDP() == kTRUE) {
- sigDPModel_->calcLikelihoodInfo(iEvt);
- sigDPLike_ = sigDPModel_->getEvtLikelihood();
-
- if ( useSCF_ == kTRUE ) {
- if ( scfMap_ == 0 ) {
- // we're not smearing the SCF DP position
- // so the likelihood is the same as the TM
- scfDPLike_ = sigDPLike_;
- } else {
- // calculate the smeared SCF DP likelihood
- scfDPLike_ = this->getEvtSCFDPLikelihood(iEvt);
- }
- }
-
- const UInt_t nBkgnds = this->nBkgndClasses();
- for ( UInt_t bkgndID(0); bkgndID < nBkgnds; ++bkgndID ) {
- if (usingBkgnd_ == kTRUE) {
- bkgndDPLike_[bkgndID] = bkgndDPModels_[bkgndID]->getLikelihood(iEvt);
- } else {
- bkgndDPLike_[bkgndID] = 0.0;
- }
- }
- } else {
- // There's always going to be a term in the likelihood for the
- // signal, so we'd better not zero it.
- sigDPLike_ = 1.0;
- scfDPLike_ = 1.0;
-
- const UInt_t nBkgnds = this->nBkgndClasses();
- for ( UInt_t bkgndID(0); bkgndID < nBkgnds; ++bkgndID ) {
- if (usingBkgnd_ == kTRUE) {
- bkgndDPLike_[bkgndID] = 1.0;
- } else {
- bkgndDPLike_[bkgndID] = 0.0;
- }
- }
- }
+ // Function to return the signal and background likelihoods for the
+ // Dalitz plot for the given event evtNo.
+
+ if ( this->useDP() == kTRUE ) {
+ sigDPModel_->calcLikelihoodInfo( iEvt );
+ sigDPLike_ = sigDPModel_->getEvtLikelihood();
+
+ if ( useSCF_ == kTRUE ) {
+ if ( scfMap_ == 0 ) {
+ // we're not smearing the SCF DP position
+ // so the likelihood is the same as the TM
+ scfDPLike_ = sigDPLike_;
+ } else {
+ // calculate the smeared SCF DP likelihood
+ scfDPLike_ = this->getEvtSCFDPLikelihood( iEvt );
+ }
+ }
+
+ const UInt_t nBkgnds = this->nBkgndClasses();
+ for ( UInt_t bkgndID( 0 ); bkgndID < nBkgnds; ++bkgndID ) {
+ if ( usingBkgnd_ == kTRUE ) {
+ bkgndDPLike_[bkgndID] = bkgndDPModels_[bkgndID]->getLikelihood( iEvt );
+ } else {
+ bkgndDPLike_[bkgndID] = 0.0;
+ }
+ }
+ } else {
+ // There's always going to be a term in the likelihood for the
+ // signal, so we'd better not zero it.
+ sigDPLike_ = 1.0;
+ scfDPLike_ = 1.0;
+
+ const UInt_t nBkgnds = this->nBkgndClasses();
+ for ( UInt_t bkgndID( 0 ); bkgndID < nBkgnds; ++bkgndID ) {
+ if ( usingBkgnd_ == kTRUE ) {
+ bkgndDPLike_[bkgndID] = 1.0;
+ } else {
+ bkgndDPLike_[bkgndID] = 0.0;
+ }
+ }
+ }
}
-Double_t LauSimpleFitModel::getEvtSCFDPLikelihood(UInt_t iEvt)
+Double_t LauSimpleFitModel::getEvtSCFDPLikelihood( UInt_t iEvt )
{
- Double_t scfDPLike(0.0);
-
- Double_t recoJacobian(1.0);
- Double_t xCoord(0.0);
- Double_t yCoord(0.0);
- Bool_t squareDP = kinematics_->squareDP();
- if ( squareDP ) {
- xCoord = sigDPModel_->getEvtmPrime();
- yCoord = sigDPModel_->getEvtthPrime();
- recoJacobian = recoJacobians_[iEvt];
- } else {
- xCoord = sigDPModel_->getEvtm13Sq();
- yCoord = sigDPModel_->getEvtm23Sq();
- }
-
- // Find the bin that our reco event falls in
- Int_t recoBin = scfMap_->binNumber( xCoord, yCoord );
-
- // Find out which true Bins contribute to the given reco bin
- const std::vector<Int_t>* trueBins = scfMap_->trueBins(recoBin);
-
- Int_t nDataEvents = this->eventsPerExpt();
-
- // Loop over the true bins
- for (std::vector<Int_t>::const_iterator iter = trueBins->begin(); iter != trueBins->end(); ++iter)
- {
- Int_t trueBin = (*iter);
-
- // prob of a true event in the given true bin migrating to the reco bin
- Double_t pRecoGivenTrue = scfMap_->prob( recoBin, trueBin );
-
- // We've cached the DP amplitudes and the efficiency for the
- // true bin centres, just after the data points
- sigDPModel_->calcLikelihoodInfo( nDataEvents + trueBin );
- Double_t pTrue = sigDPModel_->getEvtLikelihood();
-
- // Get the cached SCF fraction (and jacobian if we're using the square DP)
- Double_t scfFraction = fakeSCFFracs_[ trueBin ];
- Double_t jacobian(1.0);
- if ( squareDP ) {
- jacobian = fakeJacobians_[ trueBin ];
- }
-
- scfDPLike += pTrue * jacobian * scfFraction * pRecoGivenTrue;
-
- }
-
- // Divide by the reco jacobian
- scfDPLike /= recoJacobian;
-
- return scfDPLike;
+ Double_t scfDPLike( 0.0 );
+
+ Double_t recoJacobian( 1.0 );
+ Double_t xCoord( 0.0 );
+ Double_t yCoord( 0.0 );
+ Bool_t squareDP = kinematics_->squareDP();
+ if ( squareDP ) {
+ xCoord = sigDPModel_->getEvtmPrime();
+ yCoord = sigDPModel_->getEvtthPrime();
+ recoJacobian = recoJacobians_[iEvt];
+ } else {
+ xCoord = sigDPModel_->getEvtm13Sq();
+ yCoord = sigDPModel_->getEvtm23Sq();
+ }
+
+ // Find the bin that our reco event falls in
+ Int_t recoBin = scfMap_->binNumber( xCoord, yCoord );
+
+ // Find out which true Bins contribute to the given reco bin
+ const std::vector<Int_t>* trueBins = scfMap_->trueBins( recoBin );
+
+ Int_t nDataEvents = this->eventsPerExpt();
+
+ // Loop over the true bins
+ for ( std::vector<Int_t>::const_iterator iter = trueBins->begin(); iter != trueBins->end();
+ ++iter ) {
+ Int_t trueBin = ( *iter );
+
+ // prob of a true event in the given true bin migrating to the reco bin
+ Double_t pRecoGivenTrue = scfMap_->prob( recoBin, trueBin );
+
+ // We've cached the DP amplitudes and the efficiency for the
+ // true bin centres, just after the data points
+ sigDPModel_->calcLikelihoodInfo( nDataEvents + trueBin );
+ Double_t pTrue = sigDPModel_->getEvtLikelihood();
+
+ // Get the cached SCF fraction (and jacobian if we're using the square DP)
+ Double_t scfFraction = fakeSCFFracs_[trueBin];
+ Double_t jacobian( 1.0 );
+ if ( squareDP ) {
+ jacobian = fakeJacobians_[trueBin];
+ }
+
+ scfDPLike += pTrue * jacobian * scfFraction * pRecoGivenTrue;
+ }
+
+ // Divide by the reco jacobian
+ scfDPLike /= recoJacobian;
+
+ return scfDPLike;
}
-void LauSimpleFitModel::getEvtExtraLikelihoods(UInt_t iEvt)
+void LauSimpleFitModel::getEvtExtraLikelihoods( UInt_t iEvt )
{
- // Function to return the signal and background likelihoods for the
- // extra variables for the given event evtNo.
-
- sigExtraLike_ = 1.0;
-
- for (LauPdfPList::iterator iter = signalPdfs_.begin(); iter != signalPdfs_.end(); ++iter) {
- (*iter)->calcLikelihoodInfo(iEvt);
- sigExtraLike_ *= (*iter)->getLikelihood();
- }
- if (useSCF_) {
- scfExtraLike_ = 1.0;
- for (LauPdfPList::iterator iter = scfPdfs_.begin(); iter != scfPdfs_.end(); ++iter) {
- (*iter)->calcLikelihoodInfo(iEvt);
- scfExtraLike_ *= (*iter)->getLikelihood();
- }
- }
-
- const UInt_t nBkgnds = this->nBkgndClasses();
- for ( UInt_t bkgndID(0); bkgndID < nBkgnds; ++bkgndID ) {
- if (usingBkgnd_) {
- bkgndExtraLike_[bkgndID] = 1.0;
- LauPdfPList& pdfList = bkgndPdfs_[bkgndID];
- for (LauPdfPList::iterator pdf_iter = pdfList.begin(); pdf_iter != pdfList.end(); ++pdf_iter) {
- (*pdf_iter)->calcLikelihoodInfo(iEvt);
- bkgndExtraLike_[bkgndID] *= (*pdf_iter)->getLikelihood();
- }
- } else {
- bkgndExtraLike_[bkgndID] = 0.0;
- }
- }
+ // Function to return the signal and background likelihoods for the
+ // extra variables for the given event evtNo.
+
+ sigExtraLike_ = 1.0;
+
+ for ( LauPdfPList::iterator iter = signalPdfs_.begin(); iter != signalPdfs_.end(); ++iter ) {
+ ( *iter )->calcLikelihoodInfo( iEvt );
+ sigExtraLike_ *= ( *iter )->getLikelihood();
+ }
+ if ( useSCF_ ) {
+ scfExtraLike_ = 1.0;
+ for ( LauPdfPList::iterator iter = scfPdfs_.begin(); iter != scfPdfs_.end(); ++iter ) {
+ ( *iter )->calcLikelihoodInfo( iEvt );
+ scfExtraLike_ *= ( *iter )->getLikelihood();
+ }
+ }
+
+ const UInt_t nBkgnds = this->nBkgndClasses();
+ for ( UInt_t bkgndID( 0 ); bkgndID < nBkgnds; ++bkgndID ) {
+ if ( usingBkgnd_ ) {
+ bkgndExtraLike_[bkgndID] = 1.0;
+ LauPdfPList& pdfList = bkgndPdfs_[bkgndID];
+ for ( LauPdfPList::iterator pdf_iter = pdfList.begin(); pdf_iter != pdfList.end();
+ ++pdf_iter ) {
+ ( *pdf_iter )->calcLikelihoodInfo( iEvt );
+ bkgndExtraLike_[bkgndID] *= ( *pdf_iter )->getLikelihood();
+ }
+ } else {
+ bkgndExtraLike_[bkgndID] = 0.0;
+ }
+ }
}
-void LauSimpleFitModel::updateCoeffs()
+void LauSimpleFitModel::updateCoeffs()
{
- coeffs_.clear();
- coeffs_.reserve(nSigComp_);
- for (UInt_t i = 0; i < nSigComp_; i++) {
- coeffs_.push_back(coeffPars_[i]->particleCoeff());
- }
+ coeffs_.clear();
+ coeffs_.reserve( nSigComp_ );
+ for ( UInt_t i = 0; i < nSigComp_; i++ ) {
+ coeffs_.push_back( coeffPars_[i]->particleCoeff() );
+ }
}
void LauSimpleFitModel::setupSPlotNtupleBranches()
{
- // add branches for storing the experiment number and the number of
- // the event within the current experiment
- this->addSPlotNtupleIntegerBranch("iExpt");
- this->addSPlotNtupleIntegerBranch("iEvtWithinExpt");
-
- // Store the efficiency of the event (for inclusive BF calculations).
- if (this->storeDPEff()) {
- this->addSPlotNtupleDoubleBranch("efficiency");
- if ( sigDPModel_->usingScfModel() ) {
- this->addSPlotNtupleDoubleBranch("scffraction");
- }
- }
-
- // Store the total event likelihood for each species.
- if (useSCF_) {
- this->addSPlotNtupleDoubleBranch("sigTMTotalLike");
- this->addSPlotNtupleDoubleBranch("sigSCFTotalLike");
- this->addSPlotNtupleDoubleBranch("sigSCFFrac");
- } else {
- this->addSPlotNtupleDoubleBranch("sigTotalLike");
- }
- if (usingBkgnd_) {
- const UInt_t nBkgnds = this->nBkgndClasses();
- for ( UInt_t iBkgnd(0); iBkgnd < nBkgnds; ++iBkgnd ) {
- TString name( this->bkgndClassName(iBkgnd) );
- name += "TotalLike";
- this->addSPlotNtupleDoubleBranch(name);
- }
- }
-
- // Store the DP likelihoods
- if (this->useDP()) {
- if (useSCF_) {
- this->addSPlotNtupleDoubleBranch("sigTMDPLike");
- this->addSPlotNtupleDoubleBranch("sigSCFDPLike");
- } else {
- this->addSPlotNtupleDoubleBranch("sigDPLike");
- }
- if (usingBkgnd_) {
- const UInt_t nBkgnds = this->nBkgndClasses();
- for ( UInt_t iBkgnd(0); iBkgnd < nBkgnds; ++iBkgnd ) {
- TString name( this->bkgndClassName(iBkgnd) );
- name += "DPLike";
- this->addSPlotNtupleDoubleBranch(name);
- }
- }
- }
-
- // Store the likelihoods for each extra PDF
- if (useSCF_) {
- this->addSPlotNtupleBranches(&signalPdfs_, "sigTM");
- this->addSPlotNtupleBranches(&scfPdfs_, "sigSCF");
- } else {
- this->addSPlotNtupleBranches(&signalPdfs_, "sig");
- }
- if (usingBkgnd_) {
- const UInt_t nBkgnds = this->nBkgndClasses();
- for ( UInt_t iBkgnd(0); iBkgnd < nBkgnds; ++iBkgnd ) {
- const TString& bkgndClass = this->bkgndClassName(iBkgnd);
- const LauPdfPList* pdfList = &(bkgndPdfs_[iBkgnd]);
- this->addSPlotNtupleBranches(pdfList, bkgndClass);
- }
- }
+ // add branches for storing the experiment number and the number of
+ // the event within the current experiment
+ this->addSPlotNtupleIntegerBranch( "iExpt" );
+ this->addSPlotNtupleIntegerBranch( "iEvtWithinExpt" );
+
+ // Store the efficiency of the event (for inclusive BF calculations).
+ if ( this->storeDPEff() ) {
+ this->addSPlotNtupleDoubleBranch( "efficiency" );
+ if ( sigDPModel_->usingScfModel() ) {
+ this->addSPlotNtupleDoubleBranch( "scffraction" );
+ }
+ }
+
+ // Store the total event likelihood for each species.
+ if ( useSCF_ ) {
+ this->addSPlotNtupleDoubleBranch( "sigTMTotalLike" );
+ this->addSPlotNtupleDoubleBranch( "sigSCFTotalLike" );
+ this->addSPlotNtupleDoubleBranch( "sigSCFFrac" );
+ } else {
+ this->addSPlotNtupleDoubleBranch( "sigTotalLike" );
+ }
+ if ( usingBkgnd_ ) {
+ const UInt_t nBkgnds = this->nBkgndClasses();
+ for ( UInt_t iBkgnd( 0 ); iBkgnd < nBkgnds; ++iBkgnd ) {
+ TString name( this->bkgndClassName( iBkgnd ) );
+ name += "TotalLike";
+ this->addSPlotNtupleDoubleBranch( name );
+ }
+ }
+
+ // Store the DP likelihoods
+ if ( this->useDP() ) {
+ if ( useSCF_ ) {
+ this->addSPlotNtupleDoubleBranch( "sigTMDPLike" );
+ this->addSPlotNtupleDoubleBranch( "sigSCFDPLike" );
+ } else {
+ this->addSPlotNtupleDoubleBranch( "sigDPLike" );
+ }
+ if ( usingBkgnd_ ) {
+ const UInt_t nBkgnds = this->nBkgndClasses();
+ for ( UInt_t iBkgnd( 0 ); iBkgnd < nBkgnds; ++iBkgnd ) {
+ TString name( this->bkgndClassName( iBkgnd ) );
+ name += "DPLike";
+ this->addSPlotNtupleDoubleBranch( name );
+ }
+ }
+ }
+
+ // Store the likelihoods for each extra PDF
+ if ( useSCF_ ) {
+ this->addSPlotNtupleBranches( &signalPdfs_, "sigTM" );
+ this->addSPlotNtupleBranches( &scfPdfs_, "sigSCF" );
+ } else {
+ this->addSPlotNtupleBranches( &signalPdfs_, "sig" );
+ }
+ if ( usingBkgnd_ ) {
+ const UInt_t nBkgnds = this->nBkgndClasses();
+ for ( UInt_t iBkgnd( 0 ); iBkgnd < nBkgnds; ++iBkgnd ) {
+ const TString& bkgndClass = this->bkgndClassName( iBkgnd );
+ const LauPdfPList* pdfList = &( bkgndPdfs_[iBkgnd] );
+ this->addSPlotNtupleBranches( pdfList, bkgndClass );
+ }
+ }
}
-void LauSimpleFitModel::addSPlotNtupleBranches(const LauPdfPList* extraPdfs, const TString& prefix)
+void LauSimpleFitModel::addSPlotNtupleBranches( const LauPdfPList* extraPdfs, const TString& prefix )
{
- if (extraPdfs) {
- // Loop through each of the PDFs
- for (LauPdfPList::const_iterator pdf_iter = extraPdfs->begin(); pdf_iter != extraPdfs->end(); ++pdf_iter) {
-
- // Count the number of input variables that are not
- // DP variables (used in the case where there is DP
- // dependence for e.g. MVA)
- UInt_t nVars(0);
- std::vector<TString> varNames = (*pdf_iter)->varNames();
- for ( std::vector<TString>::const_iterator var_iter = varNames.begin(); var_iter != varNames.end(); ++var_iter ) {
- if ( (*var_iter) != "m13Sq" && (*var_iter) != "m23Sq" ) {
- ++nVars;
- }
- }
-
- if ( nVars == 1 ) {
- // If the PDF only has one variable then
- // simply add one branch for that variable
- TString varName = (*pdf_iter)->varName();
- TString name(prefix);
- name += varName;
- name += "Like";
- this->addSPlotNtupleDoubleBranch(name);
- } else if ( nVars == 2 ) {
- // If the PDF has two variables then we
- // need a branch for them both together and
- // branches for each
- TString allVars("");
- for ( std::vector<TString>::const_iterator var_iter = varNames.begin(); var_iter != varNames.end(); ++var_iter ) {
- allVars += (*var_iter);
- TString name(prefix);
- name += (*var_iter);
- name += "Like";
- this->addSPlotNtupleDoubleBranch(name);
- }
- TString name(prefix);
- name += allVars;
- name += "Like";
- this->addSPlotNtupleDoubleBranch(name);
- } else {
- std::cerr << "WARNING in LauSimpleFitModel::addSPlotNtupleBranches : Can't yet deal with 3D PDFs." << std::endl;
- }
- }
- }
+ if ( extraPdfs ) {
+ // Loop through each of the PDFs
+ for ( LauPdfPList::const_iterator pdf_iter = extraPdfs->begin(); pdf_iter != extraPdfs->end();
+ ++pdf_iter ) {
+
+ // Count the number of input variables that are not
+ // DP variables (used in the case where there is DP
+ // dependence for e.g. MVA)
+ UInt_t nVars( 0 );
+ std::vector<TString> varNames = ( *pdf_iter )->varNames();
+ for ( std::vector<TString>::const_iterator var_iter = varNames.begin();
+ var_iter != varNames.end();
+ ++var_iter ) {
+ if ( ( *var_iter ) != "m13Sq" && ( *var_iter ) != "m23Sq" ) {
+ ++nVars;
+ }
+ }
+
+ if ( nVars == 1 ) {
+ // If the PDF only has one variable then
+ // simply add one branch for that variable
+ TString varName = ( *pdf_iter )->varName();
+ TString name( prefix );
+ name += varName;
+ name += "Like";
+ this->addSPlotNtupleDoubleBranch( name );
+ } else if ( nVars == 2 ) {
+ // If the PDF has two variables then we
+ // need a branch for them both together and
+ // branches for each
+ TString allVars( "" );
+ for ( std::vector<TString>::const_iterator var_iter = varNames.begin();
+ var_iter != varNames.end();
+ ++var_iter ) {
+ allVars += ( *var_iter );
+ TString name( prefix );
+ name += ( *var_iter );
+ name += "Like";
+ this->addSPlotNtupleDoubleBranch( name );
+ }
+ TString name( prefix );
+ name += allVars;
+ name += "Like";
+ this->addSPlotNtupleDoubleBranch( name );
+ } else {
+ std::cerr << "WARNING in LauSimpleFitModel::addSPlotNtupleBranches : Can't yet deal with 3D PDFs."
+ << std::endl;
+ }
+ }
+ }
}
-Double_t LauSimpleFitModel::setSPlotNtupleBranchValues(LauPdfPList* extraPdfs, const TString& prefix, UInt_t iEvt)
+Double_t LauSimpleFitModel::setSPlotNtupleBranchValues( LauPdfPList* extraPdfs,
+ const TString& prefix,
+ UInt_t iEvt )
{
- // Store the PDF value for each variable in the list
- Double_t totalLike(1.0);
- Double_t extraLike(0.0);
- if (extraPdfs) {
- for (LauPdfPList::iterator pdf_iter = extraPdfs->begin(); pdf_iter != extraPdfs->end(); ++pdf_iter) {
-
- // calculate the likelihood for this event
- (*pdf_iter)->calcLikelihoodInfo(iEvt);
- extraLike = (*pdf_iter)->getLikelihood();
- totalLike *= extraLike;
-
- // Count the number of input variables that are not
- // DP variables (used in the case where there is DP
- // dependence for e.g. MVA)
- UInt_t nVars(0);
- std::vector<TString> varNames = (*pdf_iter)->varNames();
- for ( std::vector<TString>::const_iterator var_iter = varNames.begin(); var_iter != varNames.end(); ++var_iter ) {
- if ( (*var_iter) != "m13Sq" && (*var_iter) != "m23Sq" ) {
- ++nVars;
- }
- }
-
- if ( nVars == 1 ) {
- // If the PDF only has one variable then
- // simply store the value for that variable
- TString varName = (*pdf_iter)->varName();
- TString name(prefix);
- name += varName;
- name += "Like";
- this->setSPlotNtupleDoubleBranchValue(name, extraLike);
- } else if ( nVars == 2 ) {
- // If the PDF has two variables then we
- // store the value for them both together
- // and for each on their own
- TString allVars("");
- for ( std::vector<TString>::const_iterator var_iter = varNames.begin(); var_iter != varNames.end(); ++var_iter ) {
- allVars += (*var_iter);
- TString name(prefix);
- name += (*var_iter);
- name += "Like";
- Double_t indivLike = (*pdf_iter)->getLikelihood( (*var_iter) );
- this->setSPlotNtupleDoubleBranchValue(name, indivLike);
- }
- TString name(prefix);
- name += allVars;
- name += "Like";
- this->setSPlotNtupleDoubleBranchValue(name, extraLike);
- } else {
- std::cerr << "WARNING in LauSimpleFitModel::setSPlotNtupleBranchValues : Can't yet deal with 3D PDFs." << std::endl;
- }
- }
- }
- return totalLike;
+ // Store the PDF value for each variable in the list
+ Double_t totalLike( 1.0 );
+ Double_t extraLike( 0.0 );
+ if ( extraPdfs ) {
+ for ( LauPdfPList::iterator pdf_iter = extraPdfs->begin(); pdf_iter != extraPdfs->end();
+ ++pdf_iter ) {
+
+ // calculate the likelihood for this event
+ ( *pdf_iter )->calcLikelihoodInfo( iEvt );
+ extraLike = ( *pdf_iter )->getLikelihood();
+ totalLike *= extraLike;
+
+ // Count the number of input variables that are not
+ // DP variables (used in the case where there is DP
+ // dependence for e.g. MVA)
+ UInt_t nVars( 0 );
+ std::vector<TString> varNames = ( *pdf_iter )->varNames();
+ for ( std::vector<TString>::const_iterator var_iter = varNames.begin();
+ var_iter != varNames.end();
+ ++var_iter ) {
+ if ( ( *var_iter ) != "m13Sq" && ( *var_iter ) != "m23Sq" ) {
+ ++nVars;
+ }
+ }
+
+ if ( nVars == 1 ) {
+ // If the PDF only has one variable then
+ // simply store the value for that variable
+ TString varName = ( *pdf_iter )->varName();
+ TString name( prefix );
+ name += varName;
+ name += "Like";
+ this->setSPlotNtupleDoubleBranchValue( name, extraLike );
+ } else if ( nVars == 2 ) {
+ // If the PDF has two variables then we
+ // store the value for them both together
+ // and for each on their own
+ TString allVars( "" );
+ for ( std::vector<TString>::const_iterator var_iter = varNames.begin();
+ var_iter != varNames.end();
+ ++var_iter ) {
+ allVars += ( *var_iter );
+ TString name( prefix );
+ name += ( *var_iter );
+ name += "Like";
+ Double_t indivLike = ( *pdf_iter )->getLikelihood( ( *var_iter ) );
+ this->setSPlotNtupleDoubleBranchValue( name, indivLike );
+ }
+ TString name( prefix );
+ name += allVars;
+ name += "Like";
+ this->setSPlotNtupleDoubleBranchValue( name, extraLike );
+ } else {
+ std::cerr << "WARNING in LauSimpleFitModel::setSPlotNtupleBranchValues : Can't yet deal with 3D PDFs."
+ << std::endl;
+ }
+ }
+ }
+ return totalLike;
}
LauSPlot::NameSet LauSimpleFitModel::variableNames() const
{
- LauSPlot::NameSet nameSet;
- if (this->useDP()) {
- nameSet.insert("DP");
- }
- // Loop through all the signal PDFs
- for (LauPdfPList::const_iterator pdf_iter = signalPdfs_.begin(); pdf_iter != signalPdfs_.end(); ++pdf_iter) {
- // Loop over the variables involved in each PDF
- std::vector<TString> varNames = (*pdf_iter)->varNames();
- for ( std::vector<TString>::const_iterator var_iter = varNames.begin(); var_iter != varNames.end(); ++var_iter ) {
- // If they are not DP coordinates then add them
- if ( (*var_iter) != "m13Sq" && (*var_iter) != "m23Sq" ) {
- nameSet.insert( (*var_iter) );
- }
- }
- }
- return nameSet;
+ LauSPlot::NameSet nameSet;
+ if ( this->useDP() ) {
+ nameSet.insert( "DP" );
+ }
+ // Loop through all the signal PDFs
+ for ( LauPdfPList::const_iterator pdf_iter = signalPdfs_.begin(); pdf_iter != signalPdfs_.end();
+ ++pdf_iter ) {
+ // Loop over the variables involved in each PDF
+ std::vector<TString> varNames = ( *pdf_iter )->varNames();
+ for ( std::vector<TString>::const_iterator var_iter = varNames.begin();
+ var_iter != varNames.end();
+ ++var_iter ) {
+ // If they are not DP coordinates then add them
+ if ( ( *var_iter ) != "m13Sq" && ( *var_iter ) != "m23Sq" ) {
+ nameSet.insert( ( *var_iter ) );
+ }
+ }
+ }
+ return nameSet;
}
LauSPlot::NumbMap LauSimpleFitModel::freeSpeciesNames() const
{
- LauSPlot::NumbMap numbMap;
- if (!signalEvents_->fixed() && this->doEMLFit()) {
- numbMap["sig"] = signalEvents_->genValue();
- }
- if ( usingBkgnd_ ) {
- const UInt_t nBkgnds = this->nBkgndClasses();
- for ( UInt_t iBkgnd(0); iBkgnd < nBkgnds; ++iBkgnd ) {
- const TString& bkgndClass = this->bkgndClassName(iBkgnd);
- const LauAbsRValue* par = bkgndEvents_[iBkgnd];
- if (!par->fixed()) {
- numbMap[bkgndClass] = par->genValue();
- if ( ! par->isLValue() ) {
- std::cerr << "WARNING in LauSimpleFitModel::freeSpeciesNames : \"" << par->name() << "\" is a LauFormulaPar, which implies it is perhaps not entirely free to float in the fit, so the sWeight calculation may not be reliable" << std::endl;
- }
- }
- }
- }
- return numbMap;
+ LauSPlot::NumbMap numbMap;
+ if ( ! signalEvents_->fixed() && this->doEMLFit() ) {
+ numbMap["sig"] = signalEvents_->genValue();
+ }
+ if ( usingBkgnd_ ) {
+ const UInt_t nBkgnds = this->nBkgndClasses();
+ for ( UInt_t iBkgnd( 0 ); iBkgnd < nBkgnds; ++iBkgnd ) {
+ const TString& bkgndClass = this->bkgndClassName( iBkgnd );
+ const LauAbsRValue* par = bkgndEvents_[iBkgnd];
+ if ( ! par->fixed() ) {
+ numbMap[bkgndClass] = par->genValue();
+ if ( ! par->isLValue() ) {
+ std::cerr << "WARNING in LauSimpleFitModel::freeSpeciesNames : \"" << par->name()
+ << "\" is a LauFormulaPar, which implies it is perhaps not entirely free to float in the fit, so the sWeight calculation may not be reliable"
+ << std::endl;
+ }
+ }
+ }
+ }
+ return numbMap;
}
LauSPlot::NumbMap LauSimpleFitModel::fixdSpeciesNames() const
{
- LauSPlot::NumbMap numbMap;
- if (signalEvents_->fixed() && this->doEMLFit()) {
- numbMap["sig"] = signalEvents_->genValue();
- }
- if ( usingBkgnd_ ) {
- const UInt_t nBkgnds = this->nBkgndClasses();
- for ( UInt_t iBkgnd(0); iBkgnd < nBkgnds; ++iBkgnd ) {
- const TString& bkgndClass = this->bkgndClassName(iBkgnd);
- const LauAbsRValue* par = bkgndEvents_[iBkgnd];
- if (par->fixed()) {
- numbMap[bkgndClass] = par->genValue();
- }
- }
- }
- return numbMap;
+ LauSPlot::NumbMap numbMap;
+ if ( signalEvents_->fixed() && this->doEMLFit() ) {
+ numbMap["sig"] = signalEvents_->genValue();
+ }
+ if ( usingBkgnd_ ) {
+ const UInt_t nBkgnds = this->nBkgndClasses();
+ for ( UInt_t iBkgnd( 0 ); iBkgnd < nBkgnds; ++iBkgnd ) {
+ const TString& bkgndClass = this->bkgndClassName( iBkgnd );
+ const LauAbsRValue* par = bkgndEvents_[iBkgnd];
+ if ( par->fixed() ) {
+ numbMap[bkgndClass] = par->genValue();
+ }
+ }
+ }
+ return numbMap;
}
LauSPlot::TwoDMap LauSimpleFitModel::twodimPDFs() const
{
- LauSPlot::TwoDMap twodimMap;
-
- for (LauPdfPList::const_iterator pdf_iter = signalPdfs_.begin(); pdf_iter != signalPdfs_.end(); ++pdf_iter) {
- // Count the number of input variables that are not DP variables
- UInt_t nVars(0);
- std::vector<TString> varNames = (*pdf_iter)->varNames();
- for ( std::vector<TString>::const_iterator var_iter = varNames.begin(); var_iter != varNames.end(); ++var_iter ) {
- if ( (*var_iter) != "m13Sq" && (*var_iter) != "m23Sq" ) {
- ++nVars;
- }
- }
- if ( nVars == 2 ) {
- if (useSCF_) {
- twodimMap.insert( std::make_pair( "sigTM", std::make_pair( varNames[0], varNames[1] ) ) );
- } else {
- twodimMap.insert( std::make_pair( "sig", std::make_pair( varNames[0], varNames[1] ) ) );
- }
- }
- }
-
- if ( useSCF_ ) {
- for (LauPdfPList::const_iterator pdf_iter = scfPdfs_.begin(); pdf_iter != scfPdfs_.end(); ++pdf_iter) {
- // Count the number of input variables that are not DP variables
- UInt_t nVars(0);
- std::vector<TString> varNames = (*pdf_iter)->varNames();
- for ( std::vector<TString>::const_iterator var_iter = varNames.begin(); var_iter != varNames.end(); ++var_iter ) {
- if ( (*var_iter) != "m13Sq" && (*var_iter) != "m23Sq" ) {
- ++nVars;
- }
- }
- if ( nVars == 2 ) {
- twodimMap.insert( std::make_pair( "sigSCF", std::make_pair( varNames[0], varNames[1] ) ) );
- }
- }
- }
-
- if (usingBkgnd_) {
- const UInt_t nBkgnds = this->nBkgndClasses();
- for ( UInt_t iBkgnd(0); iBkgnd < nBkgnds; ++iBkgnd ) {
- const TString& bkgndClass = this->bkgndClassName(iBkgnd);
- const LauPdfPList& pdfList = bkgndPdfs_[iBkgnd];
- for (LauPdfPList::const_iterator pdf_iter = pdfList.begin(); pdf_iter != pdfList.end(); ++pdf_iter) {
- // Count the number of input variables that are not DP variables
- UInt_t nVars(0);
- std::vector<TString> varNames = (*pdf_iter)->varNames();
- for ( std::vector<TString>::const_iterator var_iter = varNames.begin(); var_iter != varNames.end(); ++var_iter ) {
- if ( (*var_iter) != "m13Sq" && (*var_iter) != "m23Sq" ) {
- ++nVars;
- }
- }
- if ( nVars == 2 ) {
- twodimMap.insert( std::make_pair( bkgndClass, std::make_pair( varNames[0], varNames[1] ) ) );
- }
- }
- }
- }
-
- return twodimMap;
+ LauSPlot::TwoDMap twodimMap;
+
+ for ( LauPdfPList::const_iterator pdf_iter = signalPdfs_.begin(); pdf_iter != signalPdfs_.end();
+ ++pdf_iter ) {
+ // Count the number of input variables that are not DP variables
+ UInt_t nVars( 0 );
+ std::vector<TString> varNames = ( *pdf_iter )->varNames();
+ for ( std::vector<TString>::const_iterator var_iter = varNames.begin();
+ var_iter != varNames.end();
+ ++var_iter ) {
+ if ( ( *var_iter ) != "m13Sq" && ( *var_iter ) != "m23Sq" ) {
+ ++nVars;
+ }
+ }
+ if ( nVars == 2 ) {
+ if ( useSCF_ ) {
+ twodimMap.insert(
+ std::make_pair( "sigTM", std::make_pair( varNames[0], varNames[1] ) ) );
+ } else {
+ twodimMap.insert(
+ std::make_pair( "sig", std::make_pair( varNames[0], varNames[1] ) ) );
+ }
+ }
+ }
+
+ if ( useSCF_ ) {
+ for ( LauPdfPList::const_iterator pdf_iter = scfPdfs_.begin(); pdf_iter != scfPdfs_.end();
+ ++pdf_iter ) {
+ // Count the number of input variables that are not DP variables
+ UInt_t nVars( 0 );
+ std::vector<TString> varNames = ( *pdf_iter )->varNames();
+ for ( std::vector<TString>::const_iterator var_iter = varNames.begin();
+ var_iter != varNames.end();
+ ++var_iter ) {
+ if ( ( *var_iter ) != "m13Sq" && ( *var_iter ) != "m23Sq" ) {
+ ++nVars;
+ }
+ }
+ if ( nVars == 2 ) {
+ twodimMap.insert(
+ std::make_pair( "sigSCF", std::make_pair( varNames[0], varNames[1] ) ) );
+ }
+ }
+ }
+
+ if ( usingBkgnd_ ) {
+ const UInt_t nBkgnds = this->nBkgndClasses();
+ for ( UInt_t iBkgnd( 0 ); iBkgnd < nBkgnds; ++iBkgnd ) {
+ const TString& bkgndClass = this->bkgndClassName( iBkgnd );
+ const LauPdfPList& pdfList = bkgndPdfs_[iBkgnd];
+ for ( LauPdfPList::const_iterator pdf_iter = pdfList.begin(); pdf_iter != pdfList.end();
+ ++pdf_iter ) {
+ // Count the number of input variables that are not DP variables
+ UInt_t nVars( 0 );
+ std::vector<TString> varNames = ( *pdf_iter )->varNames();
+ for ( std::vector<TString>::const_iterator var_iter = varNames.begin();
+ var_iter != varNames.end();
+ ++var_iter ) {
+ if ( ( *var_iter ) != "m13Sq" && ( *var_iter ) != "m23Sq" ) {
+ ++nVars;
+ }
+ }
+ if ( nVars == 2 ) {
+ twodimMap.insert(
+ std::make_pair( bkgndClass, std::make_pair( varNames[0], varNames[1] ) ) );
+ }
+ }
+ }
+ }
+
+ return twodimMap;
}
void LauSimpleFitModel::storePerEvtLlhds()
{
- std::cout << "INFO in LauSimpleFitModel::storePerEvtLlhds : Storing per-event likelihood values..." << std::endl;
-
- // if we've not been using the DP model then we need to cache all
- // the info here so that we can get the efficiency from it
-
- LauFitDataTree* inputFitData = this->fitData();
-
- if (!this->useDP() && this->storeDPEff()) {
- sigDPModel_->initialise(coeffs_);
- sigDPModel_->fillDataTree(*inputFitData);
- }
-
- UInt_t evtsPerExpt(this->eventsPerExpt());
-
- for (UInt_t iEvt = 0; iEvt < evtsPerExpt; ++iEvt) {
-
- this->setSPlotNtupleIntegerBranchValue("iExpt",this->iExpt());
- this->setSPlotNtupleIntegerBranchValue("iEvtWithinExpt",iEvt);
-
- // the DP information
- this->getEvtDPLikelihood(iEvt);
- if (this->storeDPEff()) {
- if (!this->useDP()) {
- sigDPModel_->calcLikelihoodInfo(iEvt);
- }
- this->setSPlotNtupleDoubleBranchValue("efficiency",sigDPModel_->getEvtEff());
- if ( sigDPModel_->usingScfModel() ) {
- this->setSPlotNtupleDoubleBranchValue("scffraction",sigDPModel_->getEvtScfFraction());
- }
- }
- if (this->useDP()) {
- sigTotalLike_ = sigDPLike_;
- if (useSCF_) {
- scfTotalLike_ = scfDPLike_;
- this->setSPlotNtupleDoubleBranchValue("sigTMDPLike",sigDPLike_);
- this->setSPlotNtupleDoubleBranchValue("sigSCFDPLike",scfDPLike_);
- } else {
- this->setSPlotNtupleDoubleBranchValue("sigDPLike",sigDPLike_);
- }
- if (usingBkgnd_) {
- const UInt_t nBkgnds = this->nBkgndClasses();
- for ( UInt_t iBkgnd(0); iBkgnd < nBkgnds; ++iBkgnd ) {
- TString name = this->bkgndClassName(iBkgnd);
- name += "DPLike";
- this->setSPlotNtupleDoubleBranchValue(name,bkgndDPLike_[iBkgnd]);
- }
- }
- } else {
- sigTotalLike_ = 1.0;
- if (useSCF_) {
- scfTotalLike_ = 1.0;
- }
- if (usingBkgnd_) {
- const UInt_t nBkgnds = this->nBkgndClasses();
- for ( UInt_t iBkgnd(0); iBkgnd < nBkgnds; ++iBkgnd ) {
- bkgndTotalLike_[iBkgnd] = 1.0;
- }
- }
- }
-
- // the signal PDF values
- if ( useSCF_ ) {
- sigTotalLike_ *= this->setSPlotNtupleBranchValues(&signalPdfs_, "sigTM", iEvt);
- scfTotalLike_ *= this->setSPlotNtupleBranchValues(&scfPdfs_, "sigSCF", iEvt);
- } else {
- sigTotalLike_ *= this->setSPlotNtupleBranchValues(&signalPdfs_, "sig", iEvt);
- }
-
- // the background PDF values
- if (usingBkgnd_) {
- const UInt_t nBkgnds = this->nBkgndClasses();
- for ( UInt_t iBkgnd(0); iBkgnd < nBkgnds; ++iBkgnd ) {
- const TString& bkgndClass = this->bkgndClassName(iBkgnd);
- LauPdfPList& pdfs = bkgndPdfs_[iBkgnd];
- bkgndTotalLike_[iBkgnd] *= this->setSPlotNtupleBranchValues(&(pdfs), bkgndClass, iEvt);
- }
- }
-
- // the total likelihoods
- if (useSCF_) {
- Double_t scfFrac(0.0);
- if ( useSCFHist_ ) {
- scfFrac = recoSCFFracs_[iEvt];
- } else {
- scfFrac = scfFrac_.unblindValue();
- }
- this->setSPlotNtupleDoubleBranchValue("sigSCFFrac",scfFrac);
- sigTotalLike_ *= ( 1.0 - scfFrac );
- if ( scfMap_ == 0 ) {
- scfTotalLike_ *= scfFrac;
- }
- this->setSPlotNtupleDoubleBranchValue("sigTMTotalLike",sigTotalLike_);
- this->setSPlotNtupleDoubleBranchValue("sigSCFTotalLike",scfTotalLike_);
- } else {
- this->setSPlotNtupleDoubleBranchValue("sigTotalLike",sigTotalLike_);
- }
- if (usingBkgnd_) {
- const UInt_t nBkgnds = this->nBkgndClasses();
- for ( UInt_t iBkgnd(0); iBkgnd < nBkgnds; ++iBkgnd ) {
- TString name = this->bkgndClassName(iBkgnd);
- name += "TotalLike";
- this->setSPlotNtupleDoubleBranchValue(name,bkgndTotalLike_[iBkgnd]);
- }
- }
- // fill the tree
- this->fillSPlotNtupleBranches();
- }
- std::cout << "INFO in LauSimpleFitModel::storePerEvtLlhds : Finished storing per-event likelihood values." << std::endl;
+ std::cout << "INFO in LauSimpleFitModel::storePerEvtLlhds : Storing per-event likelihood values..."
+ << std::endl;
+
+ // if we've not been using the DP model then we need to cache all
+ // the info here so that we can get the efficiency from it
+
+ LauFitDataTree* inputFitData = this->fitData();
+
+ if ( ! this->useDP() && this->storeDPEff() ) {
+ sigDPModel_->initialise( coeffs_ );
+ sigDPModel_->fillDataTree( *inputFitData );
+ }
+
+ UInt_t evtsPerExpt( this->eventsPerExpt() );
+
+ for ( UInt_t iEvt = 0; iEvt < evtsPerExpt; ++iEvt ) {
+
+ this->setSPlotNtupleIntegerBranchValue( "iExpt", this->iExpt() );
+ this->setSPlotNtupleIntegerBranchValue( "iEvtWithinExpt", iEvt );
+
+ // the DP information
+ this->getEvtDPLikelihood( iEvt );
+ if ( this->storeDPEff() ) {
+ if ( ! this->useDP() ) {
+ sigDPModel_->calcLikelihoodInfo( iEvt );
+ }
+ this->setSPlotNtupleDoubleBranchValue( "efficiency", sigDPModel_->getEvtEff() );
+ if ( sigDPModel_->usingScfModel() ) {
+ this->setSPlotNtupleDoubleBranchValue( "scffraction",
+ sigDPModel_->getEvtScfFraction() );
+ }
+ }
+ if ( this->useDP() ) {
+ sigTotalLike_ = sigDPLike_;
+ if ( useSCF_ ) {
+ scfTotalLike_ = scfDPLike_;
+ this->setSPlotNtupleDoubleBranchValue( "sigTMDPLike", sigDPLike_ );
+ this->setSPlotNtupleDoubleBranchValue( "sigSCFDPLike", scfDPLike_ );
+ } else {
+ this->setSPlotNtupleDoubleBranchValue( "sigDPLike", sigDPLike_ );
+ }
+ if ( usingBkgnd_ ) {
+ const UInt_t nBkgnds = this->nBkgndClasses();
+ for ( UInt_t iBkgnd( 0 ); iBkgnd < nBkgnds; ++iBkgnd ) {
+ TString name = this->bkgndClassName( iBkgnd );
+ name += "DPLike";
+ this->setSPlotNtupleDoubleBranchValue( name, bkgndDPLike_[iBkgnd] );
+ }
+ }
+ } else {
+ sigTotalLike_ = 1.0;
+ if ( useSCF_ ) {
+ scfTotalLike_ = 1.0;
+ }
+ if ( usingBkgnd_ ) {
+ const UInt_t nBkgnds = this->nBkgndClasses();
+ for ( UInt_t iBkgnd( 0 ); iBkgnd < nBkgnds; ++iBkgnd ) {
+ bkgndTotalLike_[iBkgnd] = 1.0;
+ }
+ }
+ }
+
+ // the signal PDF values
+ if ( useSCF_ ) {
+ sigTotalLike_ *= this->setSPlotNtupleBranchValues( &signalPdfs_, "sigTM", iEvt );
+ scfTotalLike_ *= this->setSPlotNtupleBranchValues( &scfPdfs_, "sigSCF", iEvt );
+ } else {
+ sigTotalLike_ *= this->setSPlotNtupleBranchValues( &signalPdfs_, "sig", iEvt );
+ }
+
+ // the background PDF values
+ if ( usingBkgnd_ ) {
+ const UInt_t nBkgnds = this->nBkgndClasses();
+ for ( UInt_t iBkgnd( 0 ); iBkgnd < nBkgnds; ++iBkgnd ) {
+ const TString& bkgndClass = this->bkgndClassName( iBkgnd );
+ LauPdfPList& pdfs = bkgndPdfs_[iBkgnd];
+ bkgndTotalLike_[iBkgnd] *=
+ this->setSPlotNtupleBranchValues( &( pdfs ), bkgndClass, iEvt );
+ }
+ }
+
+ // the total likelihoods
+ if ( useSCF_ ) {
+ Double_t scfFrac( 0.0 );
+ if ( useSCFHist_ ) {
+ scfFrac = recoSCFFracs_[iEvt];
+ } else {
+ scfFrac = scfFrac_.unblindValue();
+ }
+ this->setSPlotNtupleDoubleBranchValue( "sigSCFFrac", scfFrac );
+ sigTotalLike_ *= ( 1.0 - scfFrac );
+ if ( scfMap_ == 0 ) {
+ scfTotalLike_ *= scfFrac;
+ }
+ this->setSPlotNtupleDoubleBranchValue( "sigTMTotalLike", sigTotalLike_ );
+ this->setSPlotNtupleDoubleBranchValue( "sigSCFTotalLike", scfTotalLike_ );
+ } else {
+ this->setSPlotNtupleDoubleBranchValue( "sigTotalLike", sigTotalLike_ );
+ }
+ if ( usingBkgnd_ ) {
+ const UInt_t nBkgnds = this->nBkgndClasses();
+ for ( UInt_t iBkgnd( 0 ); iBkgnd < nBkgnds; ++iBkgnd ) {
+ TString name = this->bkgndClassName( iBkgnd );
+ name += "TotalLike";
+ this->setSPlotNtupleDoubleBranchValue( name, bkgndTotalLike_[iBkgnd] );
+ }
+ }
+ // fill the tree
+ this->fillSPlotNtupleBranches();
+ }
+ std::cout << "INFO in LauSimpleFitModel::storePerEvtLlhds : Finished storing per-event likelihood values."
+ << std::endl;
}
-std::map<TString, LauComplex> LauSimpleFitModel::getDPAmps(const Double_t m13Sq, const Double_t m23Sq)
+std::map<TString, LauComplex> LauSimpleFitModel::getDPAmps( const Double_t m13Sq,
+ const Double_t m23Sq )
{
- // Initialise the DP model, if not already done
- if ( coeffs_.empty() ) {
- this->updateCoeffs();
- this->initialiseDPModels();
- }
-
- if ( ! kinematics_->withinDPLimits( m13Sq, m23Sq ) ) {
- return { { "signal", {} } };
- }
-
- sigDPModel_->calcLikelihoodInfo( m13Sq, m23Sq );
-
- return { { "signal", sigDPModel_->getEvtDPAmp() } };
+ // Initialise the DP model, if not already done
+ if ( coeffs_.empty() ) {
+ this->updateCoeffs();
+ this->initialiseDPModels();
+ }
+
+ if ( ! kinematics_->withinDPLimits( m13Sq, m23Sq ) ) {
+ return {
+ {"signal", {}}
+ };
+ }
+
+ sigDPModel_->calcLikelihoodInfo( m13Sq, m23Sq );
+
+ return {
+ {"signal", sigDPModel_->getEvtDPAmp()}
+ };
}
-std::map<TString, Double_t> LauSimpleFitModel::getDPLikelihoods(const Double_t m13Sq, const Double_t m23Sq)
+std::map<TString, Double_t> LauSimpleFitModel::getDPLikelihoods( const Double_t m13Sq,
+ const Double_t m23Sq )
{
- // Initialise the DP model, if not already done
- if ( coeffs_.empty() ) {
- this->updateCoeffs();
- this->initialiseDPModels();
- }
-
- std::map<TString, Double_t> likelihoods;
-
- if ( ! kinematics_->withinDPLimits( m13Sq, m23Sq ) ) {
- likelihoods.emplace( "signal", 0.0 );
- if ( usingBkgnd_ ) {
- const UInt_t nBkgnds { this->nBkgndClasses() };
- for ( UInt_t bkgndID( 0 ); bkgndID < nBkgnds; ++bkgndID ) {
- likelihoods.emplace( this->bkgndClassName( bkgndID ), 0.0 );
- }
- }
- return likelihoods;
- }
-
- sigDPModel_->calcLikelihoodInfo( m13Sq, m23Sq );
- likelihoods.emplace( "signal", sigDPModel_->getEvtLikelihood() );
-
- // TODO - SCF signal
- static bool warningIssued { false };
- if ( useSCF_ && ! warningIssued ) {
- warningIssued = true;
- std::cerr << "WARNING in LauSimpleFitModel::getDPLikelihoods : calculation of SCF likelihoods not currently implemented in this function\n";
- std::cerr << " : signal likelihood will just be the truth-matched value";
- std::cerr << std::endl;
- }
-
- if ( usingBkgnd_ ) {
- const UInt_t nBkgnds { this->nBkgndClasses() };
- for ( UInt_t bkgndID( 0 ); bkgndID < nBkgnds; ++bkgndID ) {
- likelihoods.emplace( this->bkgndClassName( bkgndID ),
- bkgndDPModels_[bkgndID]->getLikelihood( m13Sq, m23Sq ) );
- }
- }
-
- return likelihoods;
+ // Initialise the DP model, if not already done
+ if ( coeffs_.empty() ) {
+ this->updateCoeffs();
+ this->initialiseDPModels();
+ }
+
+ std::map<TString, Double_t> likelihoods;
+
+ if ( ! kinematics_->withinDPLimits( m13Sq, m23Sq ) ) {
+ likelihoods.emplace( "signal", 0.0 );
+ if ( usingBkgnd_ ) {
+ const UInt_t nBkgnds { this->nBkgndClasses() };
+ for ( UInt_t bkgndID( 0 ); bkgndID < nBkgnds; ++bkgndID ) {
+ likelihoods.emplace( this->bkgndClassName( bkgndID ), 0.0 );
+ }
+ }
+ return likelihoods;
+ }
+
+ sigDPModel_->calcLikelihoodInfo( m13Sq, m23Sq );
+ likelihoods.emplace( "signal", sigDPModel_->getEvtLikelihood() );
+
+ // TODO - SCF signal
+ static bool warningIssued { false };
+ if ( useSCF_ && ! warningIssued ) {
+ warningIssued = true;
+ std::cerr << "WARNING in LauSimpleFitModel::getDPLikelihoods : calculation of SCF likelihoods not currently implemented in this function\n";
+ std::cerr << " : signal likelihood will just be the truth-matched value";
+ std::cerr << std::endl;
+ }
+
+ if ( usingBkgnd_ ) {
+ const UInt_t nBkgnds { this->nBkgndClasses() };
+ for ( UInt_t bkgndID( 0 ); bkgndID < nBkgnds; ++bkgndID ) {
+ likelihoods.emplace( this->bkgndClassName( bkgndID ),
+ bkgndDPModels_[bkgndID]->getLikelihood( m13Sq, m23Sq ) );
+ }
+ }
+
+ return likelihoods;
}
-void LauSimpleFitModel::embedSignal(const TString& fileName, const TString& treeName,
- Bool_t reuseEventsWithinEnsemble, Bool_t reuseEventsWithinExperiment,
- Bool_t useReweighting)
+void LauSimpleFitModel::embedSignal( const TString& fileName,
+ const TString& treeName,
+ Bool_t reuseEventsWithinEnsemble,
+ Bool_t reuseEventsWithinExperiment,
+ Bool_t useReweighting )
{
- if (signalTree_) {
- std::cerr << "ERROR in LauSimpleFitModel::embedSignal : Already embedding signal from a file." << std::endl;
- return;
- }
-
- signalTree_ = new LauEmbeddedData(fileName,treeName,reuseEventsWithinExperiment);
-
- Bool_t dataOK = signalTree_->findBranches();
- if (!dataOK) {
- delete signalTree_; signalTree_ = 0;
- std::cerr << "ERROR in LauSimpleFitModel::embedSignal : Problem creating data tree for embedding." << std::endl;
- return;
- }
-
- reuseSignal_ = reuseEventsWithinEnsemble;
- useReweighting_ = useReweighting;
-
- if (this->enableEmbedding() == kFALSE) {
- this->enableEmbedding(kTRUE);
- }
+ if ( signalTree_ ) {
+ std::cerr << "ERROR in LauSimpleFitModel::embedSignal : Already embedding signal from a file."
+ << std::endl;
+ return;
+ }
+
+ signalTree_ = new LauEmbeddedData( fileName, treeName, reuseEventsWithinExperiment );
+
+ Bool_t dataOK = signalTree_->findBranches();
+ if ( ! dataOK ) {
+ delete signalTree_;
+ signalTree_ = 0;
+ std::cerr << "ERROR in LauSimpleFitModel::embedSignal : Problem creating data tree for embedding."
+ << std::endl;
+ return;
+ }
+
+ reuseSignal_ = reuseEventsWithinEnsemble;
+ useReweighting_ = useReweighting;
+
+ if ( this->enableEmbedding() == kFALSE ) {
+ this->enableEmbedding( kTRUE );
+ }
}
-void LauSimpleFitModel::embedBkgnd(const TString& bkgndClass, const TString& fileName, const TString& treeName,
- Bool_t reuseEventsWithinEnsemble, Bool_t reuseEventsWithinExperiment)
+void LauSimpleFitModel::embedBkgnd( const TString& bkgndClass,
+ const TString& fileName,
+ const TString& treeName,
+ Bool_t reuseEventsWithinEnsemble,
+ Bool_t reuseEventsWithinExperiment )
{
- if ( ! this->validBkgndClass( bkgndClass ) ) {
- std::cerr << "ERROR in LauSimpleFitModel::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;
- return;
- }
-
- UInt_t bkgndID = this->bkgndClassID( bkgndClass );
-
- if (bkgndTree_[bkgndID]) {
- std::cerr << "ERROR in LauSimpleFitModel::embedBkgnd : Already embedding background from a file." << std::endl;
- return;
- }
-
- bkgndTree_[bkgndID] = new LauEmbeddedData(fileName,treeName,reuseEventsWithinExperiment);
-
- Bool_t dataOK = bkgndTree_[bkgndID]->findBranches();
- if (!dataOK) {
- delete bkgndTree_[bkgndID]; bkgndTree_[bkgndID] = 0;
- std::cerr << "ERROR in LauSimpleFitModel::embedBkgnd : Problem creating data tree for embedding." << std::endl;
- return;
- }
-
- reuseBkgnd_[bkgndID] = reuseEventsWithinEnsemble;
-
- if (this->enableEmbedding() == kFALSE) {
- this->enableEmbedding(kTRUE);
- }
+ if ( ! this->validBkgndClass( bkgndClass ) ) {
+ std::cerr << "ERROR in LauSimpleFitModel::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;
+ return;
+ }
+
+ UInt_t bkgndID = this->bkgndClassID( bkgndClass );
+
+ if ( bkgndTree_[bkgndID] ) {
+ std::cerr << "ERROR in LauSimpleFitModel::embedBkgnd : Already embedding background from a file."
+ << std::endl;
+ return;
+ }
+
+ bkgndTree_[bkgndID] = new LauEmbeddedData( fileName, treeName, reuseEventsWithinExperiment );
+
+ Bool_t dataOK = bkgndTree_[bkgndID]->findBranches();
+ if ( ! dataOK ) {
+ delete bkgndTree_[bkgndID];
+ bkgndTree_[bkgndID] = 0;
+ std::cerr << "ERROR in LauSimpleFitModel::embedBkgnd : Problem creating data tree for embedding."
+ << std::endl;
+ return;
+ }
+
+ reuseBkgnd_[bkgndID] = reuseEventsWithinEnsemble;
+
+ if ( this->enableEmbedding() == kFALSE ) {
+ this->enableEmbedding( kTRUE );
+ }
}
void LauSimpleFitModel::weightEvents( const TString& dataFileName, const TString& dataTreeName )
{
- // Routine to provide weights for events that are uniformly distributed
- // in the DP (or square DP) so as to reproduce the given DP model
-
- const Bool_t squareDP { kinematics_->squareDP() };
- if ( squareDP ) {
- std::cout << "INFO in LauSimpleFitModel::weightEvents : will store DP model weights and the square DP jacobian\n";
- std::cout << " : the DP model weights can be used on their own to weight events that were generated flat in phase space\n";
- std::cout << " : or they can be multiplied by the jacobian to weight events that were generated flat in the square DP\n";
- std::cout << " : or they can be multiplied by max(1.0, jacobian) to weight events that were generated quasi-flat in the square DP" << std::endl;
- } else {
- std::cout << "INFO in LauSimpleFitModel::weightEvents : will store DP model weights suitable for weighting events that were generated flat in phase space" << std::endl;
- }
-
- // This reads in the given dataFile and creates an input
- // fit data tree that stores them for all events and experiments.
- const Bool_t dataOK { this->verifyFitData( dataFileName, dataTreeName ) };
- if ( ! dataOK ) {
- std::cerr << "ERROR in LauSimpleFitModel::weightEvents : Problem caching the data." << std::endl;
- return;
- }
-
- LauFitDataTree* inputFitData { this->fitData() };
-
- if ( ! inputFitData->haveBranch( "m13Sq_MC" ) || ! inputFitData->haveBranch( "m23Sq_MC" ) ) {
- std::cerr << "ERROR in LauSimpleFitModel::weightEvents : Cannot find MC truth DP coordinate branches in supplied data, aborting." << std::endl;
- return;
- }
-
- // Create the ntuple to hold the DP weights
- TString weightsFileName{ dataFileName };
- const Ssiz_t index { weightsFileName.Last( '.' ) };
- weightsFileName.Insert( index, "_DPweights" );
-
- LauGenNtuple weightsTuple{ weightsFileName, dataTreeName };
- weightsTuple.addIntegerBranch( "iExpt" );
- weightsTuple.addIntegerBranch( "iEvtWithinExpt" );
- weightsTuple.addDoubleBranch( "dpModelWeight" );
- if ( squareDP ) {
- weightsTuple.addDoubleBranch( "sqDPJacobian" );
- }
-
- const UInt_t nExpmt { this->nExpt() };
- const UInt_t firstExpmt { this->firstExpt() };
- for (UInt_t iExpmt {firstExpmt}; iExpmt < (firstExpmt+nExpmt); ++iExpmt) {
-
- inputFitData->readExperimentData(iExpmt);
-
- const UInt_t nEvents { inputFitData->nEvents() };
- if ( nEvents < 1 ) {
- std::cerr << "WARNING in LauSimpleFitModel::weightEvents : Zero events in experiment " << iExpmt << ", skipping..." << std::endl;
- continue;
- }
-
- weightsTuple.setIntegerBranchValue( "iExpt", iExpmt );
-
- // Calculate and store the weights for the events in this experiment
- for ( UInt_t iEvent{0}; iEvent < nEvents; ++iEvent ) {
-
- weightsTuple.setIntegerBranchValue( "iEvtWithinExpt", iEvent );
-
- const LauFitData& evtData { inputFitData->getData( iEvent ) };
-
- const Double_t m13Sq_MC { evtData.at( "m13Sq_MC" ) };
- const Double_t m23Sq_MC { evtData.at( "m23Sq_MC" ) };
-
- Double_t dpModelWeight{0.0};
- Double_t jacobian{1.0};
-
- if ( kinematics_->withinDPLimits( m13Sq_MC, m23Sq_MC ) ) {
-
- kinematics_->updateKinematics( m13Sq_MC, m23Sq_MC );
- dpModelWeight = sigDPModel_->getEventWeight();
-
- if ( squareDP ) {
- jacobian = kinematics_->calcSqDPJacobian();
- }
-
- dpModelWeight /= sigDPModel_->getDPNorm();
- }
-
- weightsTuple.setDoubleBranchValue( "dpModelWeight", dpModelWeight );
- if ( squareDP ) {
- weightsTuple.setDoubleBranchValue( "sqDPJacobian", jacobian );
- }
- weightsTuple.fillBranches();
- }
-
- }
-
- weightsTuple.buildIndex( "iExpt", "iEvtWithinExpt" );
- weightsTuple.addFriendTree( dataFileName, dataTreeName );
- weightsTuple.writeOutGenResults();
+ // Routine to provide weights for events that are uniformly distributed
+ // in the DP (or square DP) so as to reproduce the given DP model
+
+ const Bool_t squareDP { kinematics_->squareDP() };
+ if ( squareDP ) {
+ std::cout << "INFO in LauSimpleFitModel::weightEvents : will store DP model weights and the square DP jacobian\n";
+ std::cout << " : the DP model weights can be used on their own to weight events that were generated flat in phase space\n";
+ std::cout << " : or they can be multiplied by the jacobian to weight events that were generated flat in the square DP\n";
+ std::cout << " : or they can be multiplied by max(1.0, jacobian) to weight events that were generated quasi-flat in the square DP"
+ << std::endl;
+ } else {
+ std::cout << "INFO in LauSimpleFitModel::weightEvents : will store DP model weights suitable for weighting events that were generated flat in phase space"
+ << std::endl;
+ }
+
+ // This reads in the given dataFile and creates an input
+ // fit data tree that stores them for all events and experiments.
+ const Bool_t dataOK { this->verifyFitData( dataFileName, dataTreeName ) };
+ if ( ! dataOK ) {
+ std::cerr << "ERROR in LauSimpleFitModel::weightEvents : Problem caching the data."
+ << std::endl;
+ return;
+ }
+
+ LauFitDataTree* inputFitData { this->fitData() };
+
+ if ( ! inputFitData->haveBranch( "m13Sq_MC" ) || ! inputFitData->haveBranch( "m23Sq_MC" ) ) {
+ std::cerr << "ERROR in LauSimpleFitModel::weightEvents : Cannot find MC truth DP coordinate branches in supplied data, aborting."
+ << std::endl;
+ return;
+ }
+
+ // Create the ntuple to hold the DP weights
+ TString weightsFileName { dataFileName };
+ const Ssiz_t index { weightsFileName.Last( '.' ) };
+ weightsFileName.Insert( index, "_DPweights" );
+
+ LauGenNtuple weightsTuple { weightsFileName, dataTreeName };
+ weightsTuple.addIntegerBranch( "iExpt" );
+ weightsTuple.addIntegerBranch( "iEvtWithinExpt" );
+ weightsTuple.addDoubleBranch( "dpModelWeight" );
+ if ( squareDP ) {
+ weightsTuple.addDoubleBranch( "sqDPJacobian" );
+ }
+
+ const UInt_t nExpmt { this->nExpt() };
+ const UInt_t firstExpmt { this->firstExpt() };
+ for ( UInt_t iExpmt { firstExpmt }; iExpmt < ( firstExpmt + nExpmt ); ++iExpmt ) {
+
+ inputFitData->readExperimentData( iExpmt );
+
+ const UInt_t nEvents { inputFitData->nEvents() };
+ if ( nEvents < 1 ) {
+ std::cerr << "WARNING in LauSimpleFitModel::weightEvents : Zero events in experiment "
+ << iExpmt << ", skipping..." << std::endl;
+ continue;
+ }
+
+ weightsTuple.setIntegerBranchValue( "iExpt", iExpmt );
+
+ // Calculate and store the weights for the events in this experiment
+ for ( UInt_t iEvent { 0 }; iEvent < nEvents; ++iEvent ) {
+
+ weightsTuple.setIntegerBranchValue( "iEvtWithinExpt", iEvent );
+
+ const LauFitData& evtData { inputFitData->getData( iEvent ) };
+
+ const Double_t m13Sq_MC { evtData.at( "m13Sq_MC" ) };
+ const Double_t m23Sq_MC { evtData.at( "m23Sq_MC" ) };
+
+ Double_t dpModelWeight { 0.0 };
+ Double_t jacobian { 1.0 };
+
+ if ( kinematics_->withinDPLimits( m13Sq_MC, m23Sq_MC ) ) {
+
+ kinematics_->updateKinematics( m13Sq_MC, m23Sq_MC );
+ dpModelWeight = sigDPModel_->getEventWeight();
+
+ if ( squareDP ) {
+ jacobian = kinematics_->calcSqDPJacobian();
+ }
+
+ dpModelWeight /= sigDPModel_->getDPNorm();
+ }
+
+ weightsTuple.setDoubleBranchValue( "dpModelWeight", dpModelWeight );
+ if ( squareDP ) {
+ weightsTuple.setDoubleBranchValue( "sqDPJacobian", jacobian );
+ }
+ weightsTuple.fillBranches();
+ }
+ }
+
+ weightsTuple.buildIndex( "iExpt", "iEvtWithinExpt" );
+ weightsTuple.addFriendTree( dataFileName, dataTreeName );
+ weightsTuple.writeOutGenResults();
}
-void LauSimpleFitModel::savePDFPlots(const TString& label)
+void LauSimpleFitModel::savePDFPlots( const TString& label )
{
- savePDFPlotsWave(label, 0);
- savePDFPlotsWave(label, 1);
- savePDFPlotsWave(label, 2);
-
- std::cout << "LauCPFitModel::plot" << std::endl;
-// ((LauIsobarDynamics*)sigDPModel_)->plot();
-
-
-
- //Double_t minm13 = sigDPModel_->getKinematics()->getm13Min();
- Double_t minm13 = 0.0;
- Double_t maxm13 = sigDPModel_->getKinematics()->getm13Max();
- //Double_t minm23 = sigDPModel_->getKinematics()->getm23Min();
- Double_t minm23 = 0.0;
- Double_t maxm23 = sigDPModel_->getKinematics()->getm23Max();
-
- Double_t mins13 = minm13*minm13;
- Double_t maxs13 = maxm13*maxm13;
- Double_t mins23 = minm23*minm23;
- Double_t maxs23 = maxm23*maxm23;
-
- Double_t s13, s23, chPdf;
-
- Int_t n13=200.00, n23=200.00;
- Double_t delta13, delta23;
- delta13 = (maxs13 - mins13)/n13;
- delta23 = (maxs23 - mins23)/n23;
- UInt_t nAmp = sigDPModel_->getnCohAmp();
- for (UInt_t resID = 0; resID <= nAmp; ++resID)
- {
- TGraph2D *dt = new TGraph2D();
- TString resName = "TotalAmp";
- if (resID != nAmp){
- TString tStrResID = Form("%d", resID);
- const LauIsobarDynamics* model = sigDPModel_;
- const LauAbsResonance* resonance = model->getResonance(resID);
- resName = resonance->getResonanceName();
- std::cout << "resName = " << resName << std::endl;
- }
-
-
- resName.ReplaceAll("(", "");
- resName.ReplaceAll(")", "");
- resName.ReplaceAll("*", "Star");
-
- TCanvas *c = new TCanvas("c"+resName+label,resName+" ("+label+")",0,0,600,400);
- dt->SetName(resName+label);
- dt->SetTitle(resName+" ("+label+")");
- Int_t count=0;
- for (Int_t i=0; i<n13; i++) {
- s13 = mins13 + i*delta13;
- for (Int_t j=0; j<n23; j++) {
- s23 = mins23 + j*delta23;
- if (sigDPModel_->getKinematics()->withinDPLimits2(s23, s13))
- {
- //if (s13 > 4) continue;
- sigDPModel_->calcLikelihoodInfo(s13, s23);
- LauComplex chAmp = sigDPModel_->getEvtDPAmp();
- if (resID != nAmp){
- chAmp = sigDPModel_->getFullAmplitude(resID);
- }
- chPdf = chAmp.abs2();
- //if ((z > 0.04)||(z < -0.03)) continue;
- //z = TMath::Log(z);
- if (sigDPModel_->getDaughters()->gotSymmetricalDP()){
- Double_t sLow = s13;
- Double_t sHigh = s23;
- if (sLow>sHigh) {
- continue;
- //sLow = s23;
- //sHigh = s13;
- }
-
- //if (sLow > 3.5) continue;
- //if (i<10) std::cout << "SymmetricalDP" << std::endl;
- //if (z>0.02) z = 0.02;
- //if (z<-0.02) z = -0.02;
-
- dt->SetPoint(count,sHigh,sLow,chPdf);
- count++;
- }
- else {
- dt->SetPoint(count,s13,s23,chPdf);
- count++;
-
- }
-
- }
- }
- }
- gStyle->SetPalette(1);
- dt->GetXaxis()->SetTitle("m_{K#pi}(low)");
- dt->GetYaxis()->SetTitle("m_{K#pi}(high)");
- dt->Draw("SURF1");
- dt->GetXaxis()->SetTitle("m_{K#pi}(low)");
- dt->GetYaxis()->SetTitle("m_{K#pi}(high)");
- c->SaveAs("plot_2D_"+resName + "_"+label+".C");
-
- }
+ savePDFPlotsWave( label, 0 );
+ savePDFPlotsWave( label, 1 );
+ savePDFPlotsWave( label, 2 );
+
+ std::cout << "LauCPFitModel::plot" << std::endl;
+ // ((LauIsobarDynamics*)sigDPModel_)->plot();
+
+ //Double_t minm13 = sigDPModel_->getKinematics()->getm13Min();
+ Double_t minm13 = 0.0;
+ Double_t maxm13 = sigDPModel_->getKinematics()->getm13Max();
+ //Double_t minm23 = sigDPModel_->getKinematics()->getm23Min();
+ Double_t minm23 = 0.0;
+ Double_t maxm23 = sigDPModel_->getKinematics()->getm23Max();
+
+ Double_t mins13 = minm13 * minm13;
+ Double_t maxs13 = maxm13 * maxm13;
+ Double_t mins23 = minm23 * minm23;
+ Double_t maxs23 = maxm23 * maxm23;
+
+ Double_t s13, s23, chPdf;
+
+ Int_t n13 = 200.00, n23 = 200.00;
+ Double_t delta13, delta23;
+ delta13 = ( maxs13 - mins13 ) / n13;
+ delta23 = ( maxs23 - mins23 ) / n23;
+ UInt_t nAmp = sigDPModel_->getnCohAmp();
+ for ( UInt_t resID = 0; resID <= nAmp; ++resID ) {
+ TGraph2D* dt = new TGraph2D();
+ TString resName = "TotalAmp";
+ if ( resID != nAmp ) {
+ TString tStrResID = Form( "%d", resID );
+ const LauIsobarDynamics* model = sigDPModel_;
+ const LauAbsResonance* resonance = model->getResonance( resID );
+ resName = resonance->getResonanceName();
+ std::cout << "resName = " << resName << std::endl;
+ }
+
+ resName.ReplaceAll( "(", "" );
+ resName.ReplaceAll( ")", "" );
+ resName.ReplaceAll( "*", "Star" );
+
+ TCanvas* c = new TCanvas( "c" + resName + label, resName + " (" + label + ")", 0, 0, 600, 400 );
+ dt->SetName( resName + label );
+ dt->SetTitle( resName + " (" + label + ")" );
+ Int_t count = 0;
+ for ( Int_t i = 0; i < n13; i++ ) {
+ s13 = mins13 + i * delta13;
+ for ( Int_t j = 0; j < n23; j++ ) {
+ s23 = mins23 + j * delta23;
+ if ( sigDPModel_->getKinematics()->withinDPLimits2( s23, s13 ) ) {
+ //if (s13 > 4) continue;
+ sigDPModel_->calcLikelihoodInfo( s13, s23 );
+ LauComplex chAmp = sigDPModel_->getEvtDPAmp();
+ if ( resID != nAmp ) {
+ chAmp = sigDPModel_->getFullAmplitude( resID );
+ }
+ chPdf = chAmp.abs2();
+ //if ((z > 0.04)||(z < -0.03)) continue;
+ //z = TMath::Log(z);
+ if ( sigDPModel_->getDaughters()->gotSymmetricalDP() ) {
+ Double_t sLow = s13;
+ Double_t sHigh = s23;
+ if ( sLow > sHigh ) {
+ continue;
+ //sLow = s23;
+ //sHigh = s13;
+ }
+
+ //if (sLow > 3.5) continue;
+ //if (i<10) std::cout << "SymmetricalDP" << std::endl;
+ //if (z>0.02) z = 0.02;
+ //if (z<-0.02) z = -0.02;
+
+ dt->SetPoint( count, sHigh, sLow, chPdf );
+ count++;
+ } else {
+ dt->SetPoint( count, s13, s23, chPdf );
+ count++;
+ }
+ }
+ }
+ }
+ gStyle->SetPalette( 1 );
+ dt->GetXaxis()->SetTitle( "m_{K#pi}(low)" );
+ dt->GetYaxis()->SetTitle( "m_{K#pi}(high)" );
+ dt->Draw( "SURF1" );
+ dt->GetXaxis()->SetTitle( "m_{K#pi}(low)" );
+ dt->GetYaxis()->SetTitle( "m_{K#pi}(high)" );
+ c->SaveAs( "plot_2D_" + resName + "_" + label + ".C" );
+ }
}
-void LauSimpleFitModel::savePDFPlotsWave(const TString& label, const Int_t& spin)
+void LauSimpleFitModel::savePDFPlotsWave( const TString& label, const Int_t& spin )
{
- std::cout << "label = "<< label << ", spin = "<< spin << std::endl;
-
- TString tStrResID = "S_Wave";
- if (spin == 1) tStrResID = "P_Wave";
- if (spin == 2) tStrResID = "D_Wave";
-
- std::cout << "LauSimpleFitModel::savePDFPlotsWave: "<< tStrResID << std::endl;
-
- TCanvas *c = new TCanvas("c"+tStrResID+label,tStrResID+" ("+label+")",0,0,600,400);
-
- Double_t minm13 = 0.0;
- Double_t maxm13 = sigDPModel_->getKinematics()->getm13Max();
- Double_t minm23 = 0.0;
- Double_t maxm23 = sigDPModel_->getKinematics()->getm23Max();
-
- Double_t mins13 = minm13*minm13;
- Double_t maxs13 = maxm13*maxm13;
- Double_t mins23 = minm23*minm23;
- Double_t maxs23 = maxm23*maxm23;
-
- Double_t s13, s23, chPdf;
- TGraph2D *dt = new TGraph2D();
- dt->SetName(tStrResID+label);
- dt->SetTitle(tStrResID+" ("+label+")");
-
- Int_t n13=200.00, n23=200.00;
- Double_t delta13, delta23;
- delta13 = (maxs13 - mins13)/n13;
- delta23 = (maxs23 - mins23)/n23;
- UInt_t nAmp = sigDPModel_->getnCohAmp();
-
- Int_t count=0;
- for (Int_t i=0; i<n13; i++) {
- s13 = mins13 + i*delta13;
- for (Int_t j=0; j<n23; j++) {
- s23 = mins23 + j*delta23;
- if (sigDPModel_->getKinematics()->withinDPLimits2(s23, s13))
- {
- //if (s13 > 4) continue;
- LauComplex chAmp(0,0);
- Bool_t noWaveRes = kTRUE;
- sigDPModel_->calcLikelihoodInfo(s13, s23);
- for (UInt_t resID = 0; resID < nAmp; ++resID)
- {
- const LauIsobarDynamics* model = sigDPModel_;
- const LauAbsResonance* resonance = model->getResonance(resID);
- Int_t spin_res = resonance->getSpin();
- if (spin != spin_res) continue;
- noWaveRes = kFALSE;
- chAmp += sigDPModel_->getFullAmplitude(resID);
- }
-
- if (noWaveRes) return;
-
- chPdf = chAmp.abs2();
- if (sigDPModel_->getDaughters()->gotSymmetricalDP()){
- Double_t sLow = s13;
- Double_t sHigh = s23;
- if (sLow>sHigh) {
- continue;
- //sLow = s23;
- //sHigh = s13;
- }
- dt->SetPoint(count,sHigh,sLow,chPdf);
- count++;
- }
- else {
- dt->SetPoint(count,s13,s23,chPdf);
- count++;
-
- }
-
- }
- }
- }
- gStyle->SetPalette(1);
- dt->GetXaxis()->SetTitle("pipi");
- dt->GetYaxis()->SetTitle("pipi");
- dt->Draw("SURF1");
- dt->GetXaxis()->SetTitle("pipi");
- dt->GetYaxis()->SetTitle("pipi");
- c->SaveAs("plot_2D_"+tStrResID+"_"+label+".C");
+ std::cout << "label = " << label << ", spin = " << spin << std::endl;
+
+ TString tStrResID = "S_Wave";
+ if ( spin == 1 )
+ tStrResID = "P_Wave";
+ if ( spin == 2 )
+ tStrResID = "D_Wave";
+
+ std::cout << "LauSimpleFitModel::savePDFPlotsWave: " << tStrResID << std::endl;
+
+ TCanvas* c = new TCanvas( "c" + tStrResID + label, tStrResID + " (" + label + ")", 0, 0, 600, 400 );
+
+ Double_t minm13 = 0.0;
+ Double_t maxm13 = sigDPModel_->getKinematics()->getm13Max();
+ Double_t minm23 = 0.0;
+ Double_t maxm23 = sigDPModel_->getKinematics()->getm23Max();
+
+ Double_t mins13 = minm13 * minm13;
+ Double_t maxs13 = maxm13 * maxm13;
+ Double_t mins23 = minm23 * minm23;
+ Double_t maxs23 = maxm23 * maxm23;
+
+ Double_t s13, s23, chPdf;
+ TGraph2D* dt = new TGraph2D();
+ dt->SetName( tStrResID + label );
+ dt->SetTitle( tStrResID + " (" + label + ")" );
+
+ Int_t n13 = 200.00, n23 = 200.00;
+ Double_t delta13, delta23;
+ delta13 = ( maxs13 - mins13 ) / n13;
+ delta23 = ( maxs23 - mins23 ) / n23;
+ UInt_t nAmp = sigDPModel_->getnCohAmp();
+
+ Int_t count = 0;
+ for ( Int_t i = 0; i < n13; i++ ) {
+ s13 = mins13 + i * delta13;
+ for ( Int_t j = 0; j < n23; j++ ) {
+ s23 = mins23 + j * delta23;
+ if ( sigDPModel_->getKinematics()->withinDPLimits2( s23, s13 ) ) {
+ //if (s13 > 4) continue;
+ LauComplex chAmp( 0, 0 );
+ Bool_t noWaveRes = kTRUE;
+ sigDPModel_->calcLikelihoodInfo( s13, s23 );
+ for ( UInt_t resID = 0; resID < nAmp; ++resID ) {
+ const LauIsobarDynamics* model = sigDPModel_;
+ const LauAbsResonance* resonance = model->getResonance( resID );
+ Int_t spin_res = resonance->getSpin();
+ if ( spin != spin_res )
+ continue;
+ noWaveRes = kFALSE;
+ chAmp += sigDPModel_->getFullAmplitude( resID );
+ }
+
+ if ( noWaveRes )
+ return;
+
+ chPdf = chAmp.abs2();
+ if ( sigDPModel_->getDaughters()->gotSymmetricalDP() ) {
+ Double_t sLow = s13;
+ Double_t sHigh = s23;
+ if ( sLow > sHigh ) {
+ continue;
+ //sLow = s23;
+ //sHigh = s13;
+ }
+ dt->SetPoint( count, sHigh, sLow, chPdf );
+ count++;
+ } else {
+ dt->SetPoint( count, s13, s23, chPdf );
+ count++;
+ }
+ }
+ }
+ }
+ gStyle->SetPalette( 1 );
+ dt->GetXaxis()->SetTitle( "pipi" );
+ dt->GetYaxis()->SetTitle( "pipi" );
+ dt->Draw( "SURF1" );
+ dt->GetXaxis()->SetTitle( "pipi" );
+ dt->GetYaxis()->SetTitle( "pipi" );
+ c->SaveAs( "plot_2D_" + tStrResID + "_" + label + ".C" );
}
-
-
-
-
diff --git a/src/LauString.cc b/src/LauString.cc
index cebfa49..edf406a 100644
--- a/src/LauString.cc
+++ b/src/LauString.cc
@@ -1,144 +1,153 @@
/*
Copyright 2008 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauString.cc
\brief File containing implementation of LauString class.
*/
#include "LauString.hh"
#include <iostream>
#include <sstream>
using std::cout;
using std::endl;
-LauString::LauString() : theString_("")
+LauString::LauString() :
+ theString_( "" )
{
}
-LauString::LauString(const char* s) : theString_(s)
+LauString::LauString( const char* s ) :
+ theString_( s )
{
}
-LauString::LauString(const std::string& s) : theString_(s)
+LauString::LauString( const std::string& s ) :
+ theString_( s )
{
}
-LauString::LauString(const TString& s) : theString_(s.Data())
+LauString::LauString( const TString& s ) :
+ theString_( s.Data() )
{
}
-LauString::LauString(const LauString& s) : theString_(s.theString_)
+LauString::LauString( const LauString& s ) :
+ theString_( s.theString_ )
{
}
-LauString& LauString::operator=(const LauString& s)
+LauString& LauString::operator=( const LauString& s )
{
- if ( this != &s ) {
- theString_ = s.theString_;
- }
- return *this;
+ if ( this != &s ) {
+ theString_ = s.theString_;
+ }
+ return *this;
}
-LauString::~LauString()
+LauString::~LauString()
{
}
-void LauString::addInteger(int integer)
+void LauString::addInteger( int integer )
{
- std::ostringstream o;
- o << integer;
- theString_ += o.str();
+ std::ostringstream o;
+ o << integer;
+ theString_ += o.str();
}
-void LauString::addDouble(double value)
+void LauString::addDouble( double value )
{
- std::ostringstream o;
- o << value;
- theString_ += o.str();
+ std::ostringstream o;
+ o << value;
+ theString_ += o.str();
}
-LauString LauString::operator += (int integer)
+LauString LauString::operator+=( int integer )
{
- this->addInteger(integer);
- return (*this);
+ this->addInteger( integer );
+ return ( *this );
}
-LauString LauString::operator += (double value)
+LauString LauString::operator+=( double value )
{
- this->addDouble(value);
- return (*this);
+ this->addDouble( value );
+ return ( *this );
}
-LauString LauString::operator += (const char* text)
+LauString LauString::operator+=( const char* text )
{
- this->addText(text);
- return (*this);
+ this->addText( text );
+ return ( *this );
}
-LauString LauString::operator += (const std::string &text)
+LauString LauString::operator+=( const std::string& text )
{
- this->addText(text);
- return (*this);
+ this->addText( text );
+ return ( *this );
}
-LauString LauString::operator += (const TString &text)
+LauString LauString::operator+=( const TString& text )
{
- this->addText(text.Data());
- return (*this);
+ this->addText( text.Data() );
+ return ( *this );
}
-std::vector<std::string> LauString::split(const LauString& splitter) const
+std::vector<std::string> LauString::split( const LauString& splitter ) const
{
- std::string splitString = splitter.getString();
- std::vector<std::string> result = this->split(splitString);
- return result;
+ std::string splitString = splitter.getString();
+ std::vector<std::string> result = this->split( splitString );
+ return result;
}
-std::vector<std::string> LauString::split(const std::string& splitter) const
+std::vector<std::string> LauString::split( const std::string& splitter ) const
{
- // Code from STLplus
- std::vector<std::string> result;
+ // Code from STLplus
+ std::vector<std::string> result;
- if (!theString_.empty() && !splitter.empty()) {
+ if ( ! theString_.empty() && ! splitter.empty() ) {
- for (std::string::size_type offset = 0;;) {
+ for ( std::string::size_type offset = 0;; ) {
- std::string::size_type found = theString_.find(splitter, offset);
+ std::string::size_type found = theString_.find( splitter, offset );
- if (found != std::string::npos) {
- std::string tmpString = theString_.substr(offset, found-offset);
- if (tmpString.size() > 0) {result.push_back(tmpString);}
- offset = found + splitter.size();
- } else {
- std::string tmpString = theString_.substr(offset, theString_.size()-offset);
- if (tmpString.size() > 0) {result.push_back(tmpString);}
- break;
- }
- }
- }
+ if ( found != std::string::npos ) {
+ std::string tmpString = theString_.substr( offset, found - offset );
+ if ( tmpString.size() > 0 ) {
+ result.push_back( tmpString );
+ }
+ offset = found + splitter.size();
+ } else {
+ std::string tmpString = theString_.substr( offset, theString_.size() - offset );
+ if ( tmpString.size() > 0 ) {
+ result.push_back( tmpString );
+ }
+ break;
+ }
+ }
+ }
- return result;
+ return result;
}
diff --git a/src/LauSumPdf.cc b/src/LauSumPdf.cc
index 0b93e83..9d27f7e 100644
--- a/src/LauSumPdf.cc
+++ b/src/LauSumPdf.cc
@@ -1,210 +1,218 @@
/*
Copyright 2006 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauSumPdf.cc
\brief File containing implementation of LauSumPdf class.
*/
-#include <iostream>
-#include <vector>
-
-#include "TMath.h"
-#include "TSystem.h"
+#include "LauSumPdf.hh"
#include "LauConstants.hh"
#include "LauParameter.hh"
-#include "LauSumPdf.hh"
+#include "TMath.h"
+#include "TSystem.h"
+#include <iostream>
+#include <vector>
-LauSumPdf::LauSumPdf(LauAbsPdf* pdf1, LauAbsPdf* pdf2, LauParameter* frac) :
- LauAbsPdf(pdf1 ? pdf1->varNames() : std::vector<TString>(), std::vector<LauAbsRValue*>(), pdf1 ? pdf1->getMinAbscissas() : LauFitData(), pdf1 ? pdf1->getMaxAbscissas() : LauFitData()),
- pdf1_(pdf1),
- pdf2_(pdf2),
- frac_(frac)
+LauSumPdf::LauSumPdf( LauAbsPdf* pdf1, LauAbsPdf* pdf2, LauParameter* frac ) :
+ LauAbsPdf( pdf1 ? pdf1->varNames() : std::vector<TString>(),
+ std::vector<LauAbsRValue*>(),
+ pdf1 ? pdf1->getMinAbscissas() : LauFitData(),
+ pdf1 ? pdf1->getMaxAbscissas() : LauFitData() ),
+ pdf1_( pdf1 ),
+ pdf2_( pdf2 ),
+ frac_( frac )
{
- // Constructor for the sum PDF.
- // We are defining the sum as:
- // f x (PDF1/S(PDF1)) + (1-f) x (PDF2/S(PDF2))
- // where f is the fraction, x is multiplication, PDFi is the i'th PDF,
- // and S(PDFi) is the integral of the i'th PDF.
- //
- // The last two arguments specify the range in which the PDF is defined, and the PDF
- // will be normalised w.r.t. these limits.
-
- // So the first thing we have to do is check the pointers are all valid.
- if (!frac || !pdf1 || !pdf2) {
- std::cerr << "ERROR in LauSumPdf constructor : one of the 3 pointers is null." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // Next check that the abscissa ranges are the same for each PDF
- if (pdf1->getMinAbscissa() != pdf2->getMinAbscissa()) {
- std::cerr << "ERROR in LauSumPdf constructor : minimum abscissa values not the same for the two PDFs." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
- if (pdf1->getMaxAbscissa() != pdf2->getMaxAbscissa()) {
- std::cerr << "ERROR in LauSumPdf constructor : maximum abscissa values not the same for the two PDFs." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // Also check that both PDFs are expecting the same number of input variables
- if (pdf1->nInputVars() != pdf2->nInputVars()) {
- std::cerr << "ERROR in LauSumPdf constructor : number of input variables not the same for the two PDFs." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // Also check that both PDFs are expecting the same variable name
- if (pdf1->varNames() != pdf2->varNames()) {
- std::cerr << "ERROR in LauSumPdf constructor : variable name not the same for the two PDFs." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // Then we need to grab all the parameters and pass them to the base class.
- // This is so that when we are asked for them they can be put into the fit.
- // The number of parameters is the number in PDF1 + the number in PDF2 + 1 for the fraction.
- UInt_t nPar(pdf1->nParameters()+pdf2->nParameters()+1);
- std::vector<LauAbsRValue*> params; params.reserve(nPar);
- std::vector<LauAbsRValue*>& pdf1pars = pdf1->getParameters();
- std::vector<LauAbsRValue*>& pdf2pars = pdf2->getParameters();
- params.push_back(frac);
- for (std::vector<LauAbsRValue*>::iterator iter = pdf1pars.begin(); iter != pdf1pars.end(); ++iter) {
- params.push_back(*iter);
- }
- for (std::vector<LauAbsRValue*>::iterator iter = pdf2pars.begin(); iter != pdf2pars.end(); ++iter) {
- params.push_back(*iter);
- }
- this->addParameters(params);
-
- // Now check that we can find the fraction parameter ok
- frac_ = this->findParameter("frac");
- if (frac_ == 0) {
- std::cerr << "ERROR in LauSumPdf constructor : parameter \"frac\" not found." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // Cache the normalisation factor
- this->calcNorm();
+ // Constructor for the sum PDF.
+ // We are defining the sum as:
+ // f x (PDF1/S(PDF1)) + (1-f) x (PDF2/S(PDF2))
+ // where f is the fraction, x is multiplication, PDFi is the i'th PDF,
+ // and S(PDFi) is the integral of the i'th PDF.
+ //
+ // The last two arguments specify the range in which the PDF is defined, and the PDF
+ // will be normalised w.r.t. these limits.
+
+ // So the first thing we have to do is check the pointers are all valid.
+ if ( ! frac || ! pdf1 || ! pdf2 ) {
+ std::cerr << "ERROR in LauSumPdf constructor : one of the 3 pointers is null." << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // Next check that the abscissa ranges are the same for each PDF
+ if ( pdf1->getMinAbscissa() != pdf2->getMinAbscissa() ) {
+ std::cerr << "ERROR in LauSumPdf constructor : minimum abscissa values not the same for the two PDFs."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+ if ( pdf1->getMaxAbscissa() != pdf2->getMaxAbscissa() ) {
+ std::cerr << "ERROR in LauSumPdf constructor : maximum abscissa values not the same for the two PDFs."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // Also check that both PDFs are expecting the same number of input variables
+ if ( pdf1->nInputVars() != pdf2->nInputVars() ) {
+ std::cerr << "ERROR in LauSumPdf constructor : number of input variables not the same for the two PDFs."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // Also check that both PDFs are expecting the same variable name
+ if ( pdf1->varNames() != pdf2->varNames() ) {
+ std::cerr << "ERROR in LauSumPdf constructor : variable name not the same for the two PDFs."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // Then we need to grab all the parameters and pass them to the base class.
+ // This is so that when we are asked for them they can be put into the fit.
+ // The number of parameters is the number in PDF1 + the number in PDF2 + 1 for the fraction.
+ UInt_t nPar( pdf1->nParameters() + pdf2->nParameters() + 1 );
+ std::vector<LauAbsRValue*> params;
+ params.reserve( nPar );
+ std::vector<LauAbsRValue*>& pdf1pars = pdf1->getParameters();
+ std::vector<LauAbsRValue*>& pdf2pars = pdf2->getParameters();
+ params.push_back( frac );
+ for ( std::vector<LauAbsRValue*>::iterator iter = pdf1pars.begin(); iter != pdf1pars.end();
+ ++iter ) {
+ params.push_back( *iter );
+ }
+ for ( std::vector<LauAbsRValue*>::iterator iter = pdf2pars.begin(); iter != pdf2pars.end();
+ ++iter ) {
+ params.push_back( *iter );
+ }
+ this->addParameters( params );
+
+ // Now check that we can find the fraction parameter ok
+ frac_ = this->findParameter( "frac" );
+ if ( frac_ == 0 ) {
+ std::cerr << "ERROR in LauSumPdf constructor : parameter \"frac\" not found." << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // Cache the normalisation factor
+ this->calcNorm();
}
-LauSumPdf::~LauSumPdf()
+LauSumPdf::~LauSumPdf()
{
- // Destructor
+ // Destructor
}
-void LauSumPdf::calcLikelihoodInfo(const LauAbscissas& abscissas)
+void LauSumPdf::calcLikelihoodInfo( const LauAbscissas& abscissas )
{
- // Check that the given abscissa is within the allowed range
- if (!this->checkRange(abscissas)) {
- gSystem->Exit(EXIT_FAILURE);
- }
-
- // Get the up to date parameter values
- Double_t frac = frac_->unblindValue();
-
- // Evaluate the normalised PDF values
- pdf1_->calcLikelihoodInfo(abscissas);
- pdf2_->calcLikelihoodInfo(abscissas);
- Double_t result1 = pdf1_->getLikelihood();
- Double_t result2 = pdf2_->getLikelihood();
-
- // Add them together
- Double_t result = frac * result1 + (1.0-frac) * result2;
- this->setUnNormPDFVal(result);
+ // Check that the given abscissa is within the allowed range
+ if ( ! this->checkRange( abscissas ) ) {
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ // Get the up to date parameter values
+ Double_t frac = frac_->unblindValue();
+
+ // Evaluate the normalised PDF values
+ pdf1_->calcLikelihoodInfo( abscissas );
+ pdf2_->calcLikelihoodInfo( abscissas );
+ Double_t result1 = pdf1_->getLikelihood();
+ Double_t result2 = pdf2_->getLikelihood();
+
+ // Add them together
+ Double_t result = frac * result1 + ( 1.0 - frac ) * result2;
+ this->setUnNormPDFVal( result );
}
-void LauSumPdf::calcNorm()
+void LauSumPdf::calcNorm()
{
- // Nothing to do here, since it is already normalized
- this->setNorm(1.0);
+ // Nothing to do here, since it is already normalized
+ this->setNorm( 1.0 );
}
void LauSumPdf::calcPDFHeight( const LauKinematics* kinematics )
{
- if ( this->heightUpToDate() && ! this->isDPDependent() ) {
- return;
- }
+ if ( this->heightUpToDate() && ! this->isDPDependent() ) {
+ return;
+ }
- // This method gives you the maximum possible height of the PDF.
- // It combines the maximum heights of the two individual PDFs.
- // So it would give the true maximum if the two individual maxima coincided.
- // It is guaranteed to always be >= the true maximum.
+ // This method gives you the maximum possible height of the PDF.
+ // It combines the maximum heights of the two individual PDFs.
+ // So it would give the true maximum if the two individual maxima coincided.
+ // It is guaranteed to always be >= the true maximum.
- // Update the heights of the individual PDFs
- pdf1_->calcPDFHeight( kinematics );
- pdf2_->calcPDFHeight( kinematics );
+ // Update the heights of the individual PDFs
+ pdf1_->calcPDFHeight( kinematics );
+ pdf2_->calcPDFHeight( kinematics );
- // Get the up to date parameter values
- Double_t frac = frac_->unblindValue();
+ // Get the up to date parameter values
+ Double_t frac = frac_->unblindValue();
- // Find the (un-normalised) individual PDF maxima
- Double_t height1 = pdf1_->getMaxHeight();
- Double_t height2 = pdf2_->getMaxHeight();
+ // Find the (un-normalised) individual PDF maxima
+ Double_t height1 = pdf1_->getMaxHeight();
+ Double_t height2 = pdf2_->getMaxHeight();
- // Get the individual PDF normalisation factors
- Double_t norm1 = pdf1_->getNorm();
- Double_t norm2 = pdf2_->getNorm();
+ // Get the individual PDF normalisation factors
+ Double_t norm1 = pdf1_->getNorm();
+ Double_t norm2 = pdf2_->getNorm();
- // Calculate the normalised individual PDF maxima
- height1 /= norm1;
- height2 /= norm2;
+ // Calculate the normalised individual PDF maxima
+ height1 /= norm1;
+ height2 /= norm2;
- // Combine these heights together
- Double_t height = frac * height1 + (1-frac) * height2;
- this->setMaxHeight(height);
+ // Combine these heights together
+ Double_t height = frac * height1 + ( 1 - frac ) * height2;
+ this->setMaxHeight( height );
}
// Override the base class methods for cacheInfo and calcLikelihoodInfo(UInt_t iEvt).
// For both of these we delegate to the two constituent PDFs.
-void LauSumPdf::cacheInfo(const LauFitDataTree& inputData)
+void LauSumPdf::cacheInfo( const LauFitDataTree& inputData )
{
- pdf1_->cacheInfo(inputData);
- pdf2_->cacheInfo(inputData);
+ pdf1_->cacheInfo( inputData );
+ pdf2_->cacheInfo( inputData );
- // determine whether we are caching our PDF value
- Bool_t doCaching ( this->nFixedParameters() == this->nParameters() );
- this->cachePDF( doCaching );
+ // determine whether we are caching our PDF value
+ Bool_t doCaching( this->nFixedParameters() == this->nParameters() );
+ this->cachePDF( doCaching );
- // Set whether the height is up-to-date only if it is true for both of the sub-PDFs
- Bool_t hutd = pdf1_->heightUpToDate() && pdf2_->heightUpToDate();
- this->heightUpToDate(hutd);
+ // Set whether the height is up-to-date only if it is true for both of the sub-PDFs
+ Bool_t hutd = pdf1_->heightUpToDate() && pdf2_->heightUpToDate();
+ this->heightUpToDate( hutd );
}
-void LauSumPdf::calcLikelihoodInfo(UInt_t iEvt)
+void LauSumPdf::calcLikelihoodInfo( UInt_t iEvt )
{
- // Get the up to date parameter values
- Double_t frac = frac_->unblindValue();
-
- // Evaluate the normalised PDF values
- pdf1_->calcLikelihoodInfo(iEvt);
- pdf2_->calcLikelihoodInfo(iEvt);
- Double_t result1 = pdf1_->getLikelihood();
- Double_t result2 = pdf2_->getLikelihood();
-
- // Add them together
- Double_t result = frac * result1 + (1.0-frac) * result2;
- this->setUnNormPDFVal(result);
+ // Get the up to date parameter values
+ Double_t frac = frac_->unblindValue();
+
+ // Evaluate the normalised PDF values
+ pdf1_->calcLikelihoodInfo( iEvt );
+ pdf2_->calcLikelihoodInfo( iEvt );
+ Double_t result1 = pdf1_->getLikelihood();
+ Double_t result2 = pdf2_->getLikelihood();
+
+ // Add them together
+ Double_t result = frac * result1 + ( 1.0 - frac ) * result2;
+ this->setUnNormPDFVal( result );
}
-
diff --git a/src/LauTextFileParser.cc b/src/LauTextFileParser.cc
index f3fe7bb..ce6ef88 100644
--- a/src/LauTextFileParser.cc
+++ b/src/LauTextFileParser.cc
@@ -1,154 +1,158 @@
/*
Copyright 2008 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauTextFileParser.cc
\brief File containing implementation of LauTextFileParser class.
*/
// Class for defining strings that can also handle numbers
// Useful for writing lines of output text that has a combination of
// words and numbers
#include "LauTextFileParser.hh"
+
#include "LauString.hh"
#include <fstream>
-using std::cout;
using std::cerr;
+using std::cout;
using std::endl;
-LauTextFileParser::LauTextFileParser(const char* s) :
- theFile_(s),
- totalLines_(0),
- lineNumber_(0)
+LauTextFileParser::LauTextFileParser( const char* s ) :
+ theFile_( s ),
+ totalLines_( 0 ),
+ lineNumber_( 0 )
{
}
-LauTextFileParser::LauTextFileParser(const std::string& s) :
- theFile_(s),
- totalLines_(0),
- lineNumber_(0)
+LauTextFileParser::LauTextFileParser( const std::string& s ) :
+ theFile_( s ),
+ totalLines_( 0 ),
+ lineNumber_( 0 )
{
}
-LauTextFileParser::LauTextFileParser(const TString& s) :
- theFile_(s.Data()),
- totalLines_(0),
- lineNumber_(0)
+LauTextFileParser::LauTextFileParser( const TString& s ) :
+ theFile_( s.Data() ),
+ totalLines_( 0 ),
+ lineNumber_( 0 )
{
}
-LauTextFileParser::~LauTextFileParser()
+LauTextFileParser::~LauTextFileParser()
{
- LineMap::iterator mapIter;
- for (mapIter = lineMap_.begin(); mapIter != lineMap_.end(); ++mapIter) {
- std::vector<std::string> line = mapIter->second;
- line.clear();
- }
- lineMap_.clear();
+ LineMap::iterator mapIter;
+ for ( mapIter = lineMap_.begin(); mapIter != lineMap_.end(); ++mapIter ) {
+ std::vector<std::string> line = mapIter->second;
+ line.clear();
+ }
+ lineMap_.clear();
}
void LauTextFileParser::processFile()
{
- // Read the input file and store each (non-comment) line in the internal map.
- // Store the strings/numbers from each line in a vector, using a whitespace
- // separator to get each value.
+ // Read the input file and store each (non-comment) line in the internal map.
+ // Store the strings/numbers from each line in a vector, using a whitespace
+ // separator to get each value.
- std::ifstream getData(theFile_.c_str());
+ std::ifstream getData( theFile_.c_str() );
- std::string whiteSpace(" ");
- UInt_t lineNo(0);
+ std::string whiteSpace( " " );
+ UInt_t lineNo( 0 );
- cout<<"Processing input file "<<theFile_<<endl;
+ cout << "Processing input file " << theFile_ << endl;
- // Loop while the input file is readable
- while (getData.good()) {
+ // Loop while the input file is readable
+ while ( getData.good() ) {
- if (getData.peek() == '\n') {
+ if ( getData.peek() == '\n' ) {
- // Finish reading line
- char c;
- getData.get(c);
+ // Finish reading line
+ char c;
+ getData.get( c );
- // Stop while loop if we have reached the end of the file
- if (getData.eof()) {break;}
+ // Stop while loop if we have reached the end of the file
+ if ( getData.eof() ) {
+ break;
+ }
- } else if (getData.peek() == '#') {
+ } else if ( getData.peek() == '#' ) {
- // Skip comment line
- getData.ignore(1000, '\n');
- getData.putback('\n');
+ // Skip comment line
+ getData.ignore( 1000, '\n' );
+ getData.putback( '\n' );
- // Stop while loop if we have reached the end of the file
- if (getData.eof()) {break;}
+ // Stop while loop if we have reached the end of the file
+ if ( getData.eof() ) {
+ break;
+ }
- } else {
+ } else {
- // Read data line
- char line[100];
- getData.getline(line, 100);
+ // Read data line
+ char line[100];
+ getData.getline( line, 100 );
- // Stop while loop if we have reached the end of the file
- if (getData.eof()) {break;}
+ // Stop while loop if we have reached the end of the file
+ if ( getData.eof() ) {
+ break;
+ }
- LauString lineString(line);
- // Split up the line according to white spaces
- std::vector<std::string> lineVect = lineString.split(whiteSpace);
+ LauString lineString( line );
+ // Split up the line according to white spaces
+ std::vector<std::string> lineVect = lineString.split( whiteSpace );
- // Store this line in the internal map
- lineMap_[lineNo] = lineVect;
- lineNo++;
+ // Store this line in the internal map
+ lineMap_[lineNo] = lineVect;
+ lineNo++;
+ }
+ }
- }
-
- }
-
- totalLines_ = lineNo;
- cout<<"Finished storing "<<totalLines_<<" lines from "<<theFile_<<endl;
+ totalLines_ = lineNo;
+ cout << "Finished storing " << totalLines_ << " lines from " << theFile_ << endl;
}
std::vector<std::string> LauTextFileParser::getNextLine()
{
- // Get the next line of white-space separated strings/numbers
- ++lineNumber_;
+ // Get the next line of white-space separated strings/numbers
+ ++lineNumber_;
- std::vector<std::string> theLine = this->getLine(lineNumber_);
- return theLine;
+ std::vector<std::string> theLine = this->getLine( lineNumber_ );
+ return theLine;
}
-std::vector<std::string> LauTextFileParser::getLine(UInt_t lineNo)
+std::vector<std::string> LauTextFileParser::getLine( UInt_t lineNo )
{
- // Retrieve the vector of white-space separated strings/numbers
- // for the given (non-commented) line number
- std::vector<std::string> line;
+ // Retrieve the vector of white-space separated strings/numbers
+ // for the given (non-commented) line number
+ std::vector<std::string> line;
- LineMap::iterator mapIter = lineMap_.find(lineNo-1);
- if (mapIter != lineMap_.end()) {
- line = mapIter->second;
- }
+ LineMap::iterator mapIter = lineMap_.find( lineNo - 1 );
+ if ( mapIter != lineMap_.end() ) {
+ line = mapIter->second;
+ }
- return line;
+ return line;
}
-
diff --git a/src/LauVetoes.cc b/src/LauVetoes.cc
index 5c9aabf..630c8d0 100644
--- a/src/LauVetoes.cc
+++ b/src/LauVetoes.cc
@@ -1,214 +1,226 @@
/*
Copyright 2004 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauVetoes.cc
\brief File containing implementation of LauVetoes class.
*/
-#include <iostream>
-
-#include "LauKinematics.hh"
#include "LauVetoes.hh"
+#include "LauKinematics.hh"
+#include <iostream>
LauVetoes::LauVetoes() :
- nVetoes_(0)
+ nVetoes_( 0 )
{
}
LauVetoes::~LauVetoes()
{
}
-LauVetoes::LauVetoes(const LauVetoes& other) :
- nVetoes_(other.nVetoes_),
- vetoPair_(other.vetoPair_),
- vetoMinMass_(other.vetoMinMass_),
- vetoMaxMass_(other.vetoMaxMass_)
+LauVetoes::LauVetoes( const LauVetoes& other ) :
+ nVetoes_( other.nVetoes_ ),
+ vetoPair_( other.vetoPair_ ),
+ vetoMinMass_( other.vetoMinMass_ ),
+ vetoMaxMass_( other.vetoMaxMass_ )
{
}
-LauVetoes& LauVetoes::operator=(const LauVetoes& other)
+LauVetoes& LauVetoes::operator=( const LauVetoes& other )
{
- if ( &other != this ) {
- nVetoes_ = other.nVetoes_;
- vetoPair_ = other.vetoPair_;
- vetoMinMass_ = other.vetoMinMass_;
- vetoMaxMass_ = other.vetoMaxMass_;
- }
- return *this;
+ if ( &other != this ) {
+ nVetoes_ = other.nVetoes_;
+ vetoPair_ = other.vetoPair_;
+ vetoMinMass_ = other.vetoMinMass_;
+ vetoMaxMass_ = other.vetoMaxMass_;
+ }
+ return *this;
}
-void LauVetoes::addMassVeto(const Int_t resPairAmpInt, const Double_t minMass, const Double_t maxMass)
+void LauVetoes::addMassVeto( const Int_t resPairAmpInt, const Double_t minMass, const Double_t maxMass )
{
- const Double_t minMassSq = minMass*minMass;
- const Double_t maxMassSq = maxMass*maxMass;
+ const Double_t minMassSq = minMass * minMass;
+ const Double_t maxMassSq = maxMass * maxMass;
- this->addMassSqVeto(resPairAmpInt, minMassSq, maxMassSq);
+ this->addMassSqVeto( resPairAmpInt, minMassSq, maxMassSq );
}
-void LauVetoes::addMassSqVeto(const Int_t resPairAmpInt, const Double_t minMassSq, const Double_t maxMassSq)
+void LauVetoes::addMassSqVeto( const Int_t resPairAmpInt,
+ const Double_t minMassSq,
+ const Double_t maxMassSq )
{
- // Routine to add a veto in the Dalitz plot. The function takes as input the
- // bachelor track number (1, 2 or 3) and the mass-squared range of the veto.
+ // Routine to add a veto in the Dalitz plot. The function takes as input the
+ // bachelor track number (1, 2 or 3) and the mass-squared range of the veto.
- if (resPairAmpInt == 1) {
+ if ( resPairAmpInt == 1 ) {
- // The bachelor track is the first track
- std::cout << "INFO in LauVetoes::addMassSqVeto : Adding the veto for resPairAmpInt = 1, with " << minMassSq << " < m^2_23 < " << maxMassSq << std::endl;
+ // The bachelor track is the first track
+ std::cout << "INFO in LauVetoes::addMassSqVeto : Adding the veto for resPairAmpInt = 1, with "
+ << minMassSq << " < m^2_23 < " << maxMassSq << std::endl;
- } else if (resPairAmpInt == 2) {
+ } else if ( resPairAmpInt == 2 ) {
- // The bachelor track is the second track
- std::cout << "INFO in LauVetoes::addMassSqVeto : Adding the veto for resPairAmpInt = 2, with " << minMassSq << " < m^2_13 < " << maxMassSq << std::endl;
+ // The bachelor track is the second track
+ std::cout << "INFO in LauVetoes::addMassSqVeto : Adding the veto for resPairAmpInt = 2, with "
+ << minMassSq << " < m^2_13 < " << maxMassSq << std::endl;
- } else if (resPairAmpInt == 3) {
+ } else if ( resPairAmpInt == 3 ) {
- // The bachelor track is the third track
- std::cout << "INFO in LauVetoes::addMassSqVeto : Adding the veto for resPairAmpInt = 3, with " << minMassSq << " < m^2_12 < " << maxMassSq << std::endl;
+ // The bachelor track is the third track
+ std::cout << "INFO in LauVetoes::addMassSqVeto : Adding the veto for resPairAmpInt = 3, with "
+ << minMassSq << " < m^2_12 < " << maxMassSq << std::endl;
- } else if (resPairAmpInt == 4) {
+ } else if ( resPairAmpInt == 4 ) {
- // Special case for symmetric DPs - the veto will be applied on the minimum of m13Sq and m23Sq
- std::cout << "INFO in LauVetoes::addMassSqVeto : Adding the veto for resPairAmpInt = 4, with " << minMassSq << " < m^2_min < " << maxMassSq << std::endl;
+ // Special case for symmetric DPs - the veto will be applied on the minimum of m13Sq and m23Sq
+ std::cout << "INFO in LauVetoes::addMassSqVeto : Adding the veto for resPairAmpInt = 4, with "
+ << minMassSq << " < m^2_min < " << maxMassSq << std::endl;
- } else if (resPairAmpInt == 5) {
+ } else if ( resPairAmpInt == 5 ) {
- // Special case for symmetric DPs - the veto will be applied on the maximum of m13Sq and m23Sq
- std::cout << "INFO in LauVetoes::addMassSqVeto : Adding the veto for resPairAmpInt = 5, with " << minMassSq << " < m^2_max < " << maxMassSq << std::endl;
+ // Special case for symmetric DPs - the veto will be applied on the maximum of m13Sq and m23Sq
+ std::cout << "INFO in LauVetoes::addMassSqVeto : Adding the veto for resPairAmpInt = 5, with "
+ << minMassSq << " < m^2_max < " << maxMassSq << std::endl;
- } else {
- std::cerr << "ERROR in LauVetoes::addMassSqVeto : Invalid resPairAmpInt. Please use 1, 2 or 3 to specify bachelor daughter track (or 4 or 5 to specify a veto on mMinSq or mMaxSq in a symmetric DP). Veto is not added." << std::endl;
- return;
- }
+ } else {
+ std::cerr << "ERROR in LauVetoes::addMassSqVeto : Invalid resPairAmpInt. Please use 1, 2 or 3 to specify bachelor daughter track (or 4 or 5 to specify a veto on mMinSq or mMaxSq in a symmetric DP). Veto is not added."
+ << std::endl;
+ return;
+ }
- // Set the veto limits
- vetoPair_.push_back(resPairAmpInt);
- vetoMinMass_.push_back(minMassSq);
- vetoMaxMass_.push_back(maxMassSq);
+ // Set the veto limits
+ vetoPair_.push_back( resPairAmpInt );
+ vetoMinMass_.push_back( minMassSq );
+ vetoMaxMass_.push_back( maxMassSq );
- // Keep track of how many vetoes we have
- ++nVetoes_;
+ // Keep track of how many vetoes we have
+ ++nVetoes_;
}
-Bool_t LauVetoes::passVeto(const LauKinematics* kinematics) const
+Bool_t LauVetoes::passVeto( const LauKinematics* kinematics ) const
{
- // Routine to ask whether the given Dalitz plot point passes any specified vetoes.
- if (kinematics == 0) {
- std::cerr << "ERROR in LauVetoes::passVeto : LauKinematics object is null." << std::endl;
- return kFALSE;
- }
-
- const Double_t m12Sq = kinematics->getm12Sq();
- const Double_t m23Sq = kinematics->getm23Sq();
- const Double_t m13Sq = kinematics->getm13Sq();
- const Bool_t symmetricDP = kinematics->gotSymmetricalDP();
- const Bool_t fullySymmetricDP = kinematics->gotFullySymmetricDP();
-
- return this->passVeto(m12Sq, m23Sq, m13Sq, symmetricDP, fullySymmetricDP);
+ // Routine to ask whether the given Dalitz plot point passes any specified vetoes.
+ if ( kinematics == 0 ) {
+ std::cerr << "ERROR in LauVetoes::passVeto : LauKinematics object is null." << std::endl;
+ return kFALSE;
+ }
+
+ const Double_t m12Sq = kinematics->getm12Sq();
+ const Double_t m23Sq = kinematics->getm23Sq();
+ const Double_t m13Sq = kinematics->getm13Sq();
+ const Bool_t symmetricDP = kinematics->gotSymmetricalDP();
+ const Bool_t fullySymmetricDP = kinematics->gotFullySymmetricDP();
+
+ return this->passVeto( m12Sq, m23Sq, m13Sq, symmetricDP, fullySymmetricDP );
}
-Bool_t LauVetoes::passVeto(const Double_t m12Sq, const Double_t m23Sq, const Double_t m13Sq, const Bool_t symmetricDP, const Bool_t fullySymmetricDP) const
+Bool_t LauVetoes::passVeto( const Double_t m12Sq,
+ const Double_t m23Sq,
+ const Double_t m13Sq,
+ const Bool_t symmetricDP,
+ const Bool_t fullySymmetricDP ) const
{
- // Routine to ask whether the given Dalitz plot point passes any specified vetoes.
-
- // Loop over the number of possible vetoes
- for ( UInt_t i(0); i < nVetoes_; ++i) {
-
- if (vetoPair_[i] == 1) {
- // Veto m23 combination
- if (m23Sq > vetoMinMass_[i] && m23Sq < vetoMaxMass_[i]) {
- return kFALSE;
- }
- // If the DP is symmetric we need to test m13 combination as well
- if ( symmetricDP || fullySymmetricDP ) {
- if (m13Sq > vetoMinMass_[i] && m13Sq < vetoMaxMass_[i]) {
- return kFALSE;
- }
- }
- // If it's fully symmetric we need to check all 3 combinations
- if ( fullySymmetricDP ) {
- if (m12Sq > vetoMinMass_[i] && m12Sq < vetoMaxMass_[i]) {
- return kFALSE;
- }
- }
- } else if (vetoPair_[i] == 2) {
- // Veto m13 combination
- if (m13Sq > vetoMinMass_[i] && m13Sq < vetoMaxMass_[i]) {
- return kFALSE;
- }
- // If the DP is symmetric we need to test m23 combination as well
- if ( symmetricDP || fullySymmetricDP ) {
- if (m23Sq > vetoMinMass_[i] && m23Sq < vetoMaxMass_[i]) {
- return kFALSE;
- }
- }
- // If it's fully symmetric we need to check all 3 combinations
- if ( fullySymmetricDP ) {
- if (m12Sq > vetoMinMass_[i] && m12Sq < vetoMaxMass_[i]) {
- return kFALSE;
- }
- }
- } else if (vetoPair_[i] == 3) {
- // Veto m12 combination
- if (m12Sq > vetoMinMass_[i] && m12Sq < vetoMaxMass_[i]) {
- return kFALSE;
- }
- // If it's fully symmetric we need to check all 3 combinations
- if ( fullySymmetricDP ) {
- if (m13Sq > vetoMinMass_[i] && m13Sq < vetoMaxMass_[i]) {
- return kFALSE;
- }
- if (m23Sq > vetoMinMass_[i] && m23Sq < vetoMaxMass_[i]) {
- return kFALSE;
- }
- }
- } else if (vetoPair_[i] == 4) {
- if (!symmetricDP) {
- std::cerr << "WARNING in LauVetoes::passVeto : resPairAmpInt of 4 is only valid for symmetric DPs, will ignore this veto" << std::endl;
- continue;
- }
- // Veto mMin combination
- const Double_t mMinSq = TMath::Min( m13Sq, m23Sq );
- if (mMinSq > vetoMinMass_[i] && mMinSq < vetoMaxMass_[i]) {
- return kFALSE;
- }
- } else if (vetoPair_[i] == 5) {
- if (!symmetricDP) {
- std::cerr << "WARNING in LauVetoes::passVeto : resPairAmpInt of 5 is only valid for symmetric DPs, will ignore this veto" << std::endl;
- continue;
- }
- // Veto mMax combination
- const Double_t mMaxSq = TMath::Max( m13Sq, m23Sq );
- if (mMaxSq > vetoMinMass_[i] && mMaxSq < vetoMaxMass_[i]) {
- return kFALSE;
- }
- }
- }
-
- return kTRUE;
+ // Routine to ask whether the given Dalitz plot point passes any specified vetoes.
+
+ // Loop over the number of possible vetoes
+ for ( UInt_t i( 0 ); i < nVetoes_; ++i ) {
+
+ if ( vetoPair_[i] == 1 ) {
+ // Veto m23 combination
+ if ( m23Sq > vetoMinMass_[i] && m23Sq < vetoMaxMass_[i] ) {
+ return kFALSE;
+ }
+ // If the DP is symmetric we need to test m13 combination as well
+ if ( symmetricDP || fullySymmetricDP ) {
+ if ( m13Sq > vetoMinMass_[i] && m13Sq < vetoMaxMass_[i] ) {
+ return kFALSE;
+ }
+ }
+ // If it's fully symmetric we need to check all 3 combinations
+ if ( fullySymmetricDP ) {
+ if ( m12Sq > vetoMinMass_[i] && m12Sq < vetoMaxMass_[i] ) {
+ return kFALSE;
+ }
+ }
+ } else if ( vetoPair_[i] == 2 ) {
+ // Veto m13 combination
+ if ( m13Sq > vetoMinMass_[i] && m13Sq < vetoMaxMass_[i] ) {
+ return kFALSE;
+ }
+ // If the DP is symmetric we need to test m23 combination as well
+ if ( symmetricDP || fullySymmetricDP ) {
+ if ( m23Sq > vetoMinMass_[i] && m23Sq < vetoMaxMass_[i] ) {
+ return kFALSE;
+ }
+ }
+ // If it's fully symmetric we need to check all 3 combinations
+ if ( fullySymmetricDP ) {
+ if ( m12Sq > vetoMinMass_[i] && m12Sq < vetoMaxMass_[i] ) {
+ return kFALSE;
+ }
+ }
+ } else if ( vetoPair_[i] == 3 ) {
+ // Veto m12 combination
+ if ( m12Sq > vetoMinMass_[i] && m12Sq < vetoMaxMass_[i] ) {
+ return kFALSE;
+ }
+ // If it's fully symmetric we need to check all 3 combinations
+ if ( fullySymmetricDP ) {
+ if ( m13Sq > vetoMinMass_[i] && m13Sq < vetoMaxMass_[i] ) {
+ return kFALSE;
+ }
+ if ( m23Sq > vetoMinMass_[i] && m23Sq < vetoMaxMass_[i] ) {
+ return kFALSE;
+ }
+ }
+ } else if ( vetoPair_[i] == 4 ) {
+ if ( ! symmetricDP ) {
+ std::cerr << "WARNING in LauVetoes::passVeto : resPairAmpInt of 4 is only valid for symmetric DPs, will ignore this veto"
+ << std::endl;
+ continue;
+ }
+ // Veto mMin combination
+ const Double_t mMinSq = TMath::Min( m13Sq, m23Sq );
+ if ( mMinSq > vetoMinMass_[i] && mMinSq < vetoMaxMass_[i] ) {
+ return kFALSE;
+ }
+ } else if ( vetoPair_[i] == 5 ) {
+ if ( ! symmetricDP ) {
+ std::cerr << "WARNING in LauVetoes::passVeto : resPairAmpInt of 5 is only valid for symmetric DPs, will ignore this veto"
+ << std::endl;
+ continue;
+ }
+ // Veto mMax combination
+ const Double_t mMaxSq = TMath::Max( m13Sq, m23Sq );
+ if ( mMaxSq > vetoMinMass_[i] && mMaxSq < vetoMaxMass_[i] ) {
+ return kFALSE;
+ }
+ }
+ }
+
+ return kTRUE;
}
-
diff --git a/src/LauWeightedSumEffModel.cc b/src/LauWeightedSumEffModel.cc
index 99a6d21..94d79af 100644
--- a/src/LauWeightedSumEffModel.cc
+++ b/src/LauWeightedSumEffModel.cc
@@ -1,122 +1,130 @@
/*
Copyright 2014 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
/*! \file LauWeightedSumEffModel.cc
\brief File containing implementation of LauWeightedSumEffModel class.
*/
-#include <cstdlib>
-#include <iostream>
+#include "LauWeightedSumEffModel.hh"
-#include "TSystem.h"
#include "Lau2DHistDP.hh"
#include "Lau2DSplineDP.hh"
#include "LauDaughters.hh"
-#include "LauWeightedSumEffModel.hh"
#include "LauKinematics.hh"
#include "LauVetoes.hh"
+#include "TSystem.h"
+#include <cstdlib>
+#include <iostream>
-LauWeightedSumEffModel::LauWeightedSumEffModel(const LauDaughters* daughters) :
- daughters_( daughters ),
- effModel_( 0 ),
- fluctuateEffHisto_( kFALSE ),
- lowBinWarningIssued_( kFALSE ),
- highBinWarningIssued_( kFALSE )
+LauWeightedSumEffModel::LauWeightedSumEffModel( const LauDaughters* daughters ) :
+ daughters_( daughters ),
+ effModel_( 0 ),
+ fluctuateEffHisto_( kFALSE ),
+ lowBinWarningIssued_( kFALSE ),
+ highBinWarningIssued_( kFALSE )
{
- if ( daughters_ == 0 ) {
- std::cerr << "ERROR in LauWeightedSumEffModel Constructor : invalid pointer to daughters object supplied." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
+ if ( daughters_ == 0 ) {
+ std::cerr << "ERROR in LauWeightedSumEffModel Constructor : invalid pointer to daughters object supplied."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
}
-void LauWeightedSumEffModel::addEffModel(const LauAbsEffModel* effModel, Double_t coeff)
+void LauWeightedSumEffModel::addEffModel( const LauAbsEffModel* effModel, Double_t coeff )
{
- const LauDaughters* otherDaughters = effModel->getDaughters();
- if( otherDaughters->getTypeDaug1()!=daughters_->getTypeDaug1() ||
- otherDaughters->getTypeDaug2()!=daughters_->getTypeDaug2() ||
- otherDaughters->getTypeDaug3()!=daughters_->getTypeDaug3() ||
- otherDaughters->getTypeParent()!=daughters_->getTypeParent() ) {
- std::cerr << "ERROR in LauWeightedSumEffModel::addEffModel : daughters of provided efficiency model do not match those expected." << std::endl;
- gSystem->Exit(EXIT_FAILURE);
- }
-
- effModel_.push_back(effModel);
- coeff_.push_back(coeff);
-
- if ( effModel->fluctuateEffHisto() ) {
- fluctuateEffHisto_ = kTRUE;
- }
+ const LauDaughters* otherDaughters = effModel->getDaughters();
+ if ( otherDaughters->getTypeDaug1() != daughters_->getTypeDaug1() ||
+ otherDaughters->getTypeDaug2() != daughters_->getTypeDaug2() ||
+ otherDaughters->getTypeDaug3() != daughters_->getTypeDaug3() ||
+ otherDaughters->getTypeParent() != daughters_->getTypeParent() ) {
+ std::cerr << "ERROR in LauWeightedSumEffModel::addEffModel : daughters of provided efficiency model do not match those expected."
+ << std::endl;
+ gSystem->Exit( EXIT_FAILURE );
+ }
+
+ effModel_.push_back( effModel );
+ coeff_.push_back( coeff );
+
+ if ( effModel->fluctuateEffHisto() ) {
+ fluctuateEffHisto_ = kTRUE;
+ }
}
Double_t LauWeightedSumEffModel::calcEfficiency( const LauKinematics* kinematics ) const
{
- // Routine to calculate the efficiency for the given event/point in
- // the Dalitz plot. This routine uses the models set by the
- // addEffModel() function.
- Double_t eff(0.0);
-
- std::vector<const LauAbsEffModel*>::const_iterator it = effModel_.begin();
- std::vector<const LauAbsEffModel*>::const_iterator end = effModel_.end();
-
- std::vector<Double_t>::const_iterator coeffIt = coeff_.begin();
-
- for( ; it!=end; ++it) {
- eff += (*coeffIt)*(*it)->calcEfficiency( kinematics );
- ++coeffIt;
- }
-
- // Check that the efficiency is in the allowed range (0-1)
- // Out of range efficiencies could be caused by incorrect coefficients.
- if ( eff < 0.0 ) {
- if(!lowBinWarningIssued_) {
- std::cerr << "WARNING in LauWeightedSumEffModel::calcEfficiency : Efficiency " << eff << " is less than 0 - setting to 0. You may want to check your coefficients!" << std::endl
- << " : Further warnings will be suppressed." << std::endl;
- lowBinWarningIssued_=kTRUE;
- }
- eff = 0.0;
- } else if ( eff > 1.0 ) {
- if(!highBinWarningIssued_) {
- std::cerr << "WARNING in LauWeightedSumEffModel::calcEfficiency : Efficiency " << eff << " is greater than 1 - setting to 1. You may want to check your coefficients!" << std::endl
- << " : Further warnings will be suppressed." << std::endl;
- highBinWarningIssued_=kTRUE;
- }
- eff = 1.0;
- }
-
- return eff;
+ // Routine to calculate the efficiency for the given event/point in
+ // the Dalitz plot. This routine uses the models set by the
+ // addEffModel() function.
+ Double_t eff( 0.0 );
+
+ std::vector<const LauAbsEffModel*>::const_iterator it = effModel_.begin();
+ std::vector<const LauAbsEffModel*>::const_iterator end = effModel_.end();
+
+ std::vector<Double_t>::const_iterator coeffIt = coeff_.begin();
+
+ for ( ; it != end; ++it ) {
+ eff += ( *coeffIt ) * ( *it )->calcEfficiency( kinematics );
+ ++coeffIt;
+ }
+
+ // Check that the efficiency is in the allowed range (0-1)
+ // Out of range efficiencies could be caused by incorrect coefficients.
+ if ( eff < 0.0 ) {
+ if ( ! lowBinWarningIssued_ ) {
+ std::cerr << "WARNING in LauWeightedSumEffModel::calcEfficiency : Efficiency " << eff
+ << " is less than 0 - setting to 0. You may want to check your coefficients!"
+ << std::endl
+ << " : Further warnings will be suppressed."
+ << std::endl;
+ lowBinWarningIssued_ = kTRUE;
+ }
+ eff = 0.0;
+ } else if ( eff > 1.0 ) {
+ if ( ! highBinWarningIssued_ ) {
+ std::cerr << "WARNING in LauWeightedSumEffModel::calcEfficiency : Efficiency " << eff
+ << " is greater than 1 - setting to 1. You may want to check your coefficients!"
+ << std::endl
+ << " : Further warnings will be suppressed."
+ << std::endl;
+ highBinWarningIssued_ = kTRUE;
+ }
+ eff = 1.0;
+ }
+
+ return eff;
}
Bool_t LauWeightedSumEffModel::passVeto( const LauKinematics* kinematics ) const
{
- std::vector<const LauAbsEffModel*>::const_iterator it = effModel_.begin();
- std::vector<const LauAbsEffModel*>::const_iterator end = effModel_.end();
-
- for( ; it!=end; ++it) {
- if(!(*it)->passVeto( kinematics )) return kFALSE;
- }
- return kTRUE;
+ std::vector<const LauAbsEffModel*>::const_iterator it = effModel_.begin();
+ std::vector<const LauAbsEffModel*>::const_iterator end = effModel_.end();
+
+ for ( ; it != end; ++it ) {
+ if ( ! ( *it )->passVeto( kinematics ) )
+ return kFALSE;
+ }
+ return kTRUE;
}
-
diff --git a/test/TestCovariant.cc b/test/TestCovariant.cc
index 131693b..2ab1792 100644
--- a/test/TestCovariant.cc
+++ b/test/TestCovariant.cc
@@ -1,163 +1,164 @@
/*
Copyright 2017 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
-#include <cstdlib>
-#include <iostream>
-#include <vector>
-
-#include "TFile.h"
-#include "TH2.h"
-#include "TString.h"
-#include "TTree.h"
-
-#include "LauSimpleFitModel.hh"
+#include "LauBelleNR.hh"
#include "LauBkgndDPModel.hh"
#include "LauDaughters.hh"
#include "LauEffModel.hh"
#include "LauIsobarDynamics.hh"
#include "LauMagPhaseCoeffSet.hh"
-#include "LauBelleNR.hh"
#include "LauResonanceMaker.hh"
+#include "LauSimpleFitModel.hh"
#include "LauVetoes.hh"
+#include "TFile.h"
+#include "TH2.h"
+#include "TString.h"
+#include "TTree.h"
+
+#include <cstdlib>
+#include <iostream>
+#include <vector>
+
void usage( std::ostream& out, const TString& progName )
{
- out<<"Usage:\n";
- out<<progName<<" <spin>"<<std::endl;
+ out << "Usage:\n";
+ out << progName << " <spin>" << std::endl;
}
int main( int argc, char** argv )
{
- // Process command-line arguments
- // Usage:
- // ./TestCovariant <spin>
- if ( argc < 2 ) {
- usage( std::cerr, argv[0] );
- return EXIT_FAILURE;
- }
-
- const Int_t spin = atoi(argv[1]);
- if ( spin < 0 || spin > 3 ) {
- std::cerr << "Only valid for spin 0, 1, 2 or 3" << std::endl;
- return EXIT_FAILURE;
- }
-
- // If you want to use square DP histograms for efficiency,
- // backgrounds or you just want the square DP co-ordinates
- // stored in the toy MC ntuple then set this to kTRUE
- Bool_t squareDP = kFALSE;
-
- // This defines the DP => decay is B+ -> K+ pi+ pi-
- // Particle 1 = K+
- // Particle 2 = pi+
- // Particle 3 = pi-
- // The DP is defined in terms of m13Sq and m23Sq
- LauDaughters* daughters = new LauDaughters("B+", "K+", "pi+", "pi-", squareDP);
-
- // Optionally apply some vetoes to the DP
- LauVetoes* vetoes = new LauVetoes();
-
- // Define the efficiency model (defaults to unity everywhere)
- // Can optionally provide a histogram to model variation over DP
- // (example syntax given in commented-out section)
- LauEffModel* effModel = new LauEffModel(daughters, vetoes);
-
- // Create the isobar model
-
- // Set the values of the Blatt-Weisskopf barrier radii and whether they are fixed or floating
- LauResonanceMaker& resMaker = LauResonanceMaker::get();
- resMaker.setSpinFormalism( LauAbsResonance::Covariant );
- resMaker.setDefaultBWRadius( LauBlattWeisskopfFactor::Parent, 5.0 );
- resMaker.setDefaultBWRadius( LauBlattWeisskopfFactor::Light, 4.0 );
- resMaker.fixBWRadius( LauBlattWeisskopfFactor::Parent, kTRUE );
- resMaker.fixBWRadius( LauBlattWeisskopfFactor::Light, kFALSE );
-
- LauIsobarDynamics* sigModel = new LauIsobarDynamics(daughters, effModel);
- LauAbsResonance* reson(0);
- std::map<Int_t,TString> waves;
- waves[0] = "S";
- waves[1] = "P";
- waves[2] = "D";
- waves[3] = "F";
- const TString nrName = TString::Format( "BelleNR_%swave", waves[spin].Data() );
- reson = sigModel->addResonance(nrName, 2, LauAbsResonance::BelleNR);
- reson->setResonanceParameter("alpha", 0.0);
- LauBelleNR* belleNR = dynamic_cast<LauBelleNR*>( reson );
- belleNR->enforceLegendreSpinFactors(kFALSE);
-
- // Reset the maximum signal DP ASq value
- // This will be automatically adjusted to avoid bias or extreme
- // inefficiency if you get the value wrong but best to set this by
- // hand once you've found the right value through some trial and
- // error.
- sigModel->setASqMaxValue(0.32);
-
- // Create the fit model
- LauSimpleFitModel* fitModel = new LauSimpleFitModel(sigModel);
-
- // Create the complex coefficients for the isobar model
- // Here we're using the magnitude and phase form:
- // c_j = a_j exp(i*delta_j)
- std::vector<LauAbsCoeffSet*> coeffset;
- coeffset.push_back( new LauMagPhaseCoeffSet(nrName, 1.00, 0.00, kTRUE, kTRUE) );
- for (std::vector<LauAbsCoeffSet*>::iterator iter=coeffset.begin(); iter!=coeffset.end(); ++iter) {
- fitModel->setAmpCoeffSet(*iter);
- }
-
- // Set the signal yield and define whether it is fixed or floated
- const Double_t nSig = 100000.0;
- LauParameter * nSigEvents = new LauParameter("nSigEvents",nSig,-2.0*nSig,2.0*nSig,kFALSE);
- fitModel->setNSigEvents(nSigEvents);
-
- // Set the number of experiments to generate or fit and which
- // experiment to start with
- Int_t nExpt(1);
- Int_t firstExpt(0);
- fitModel->setNExpts( nExpt, firstExpt, kTRUE );
-
- // Switch on/off calculation of asymmetric errors.
- fitModel->useAsymmFitErrors(kFALSE);
-
- // Randomise initial fit values for the signal mode
- fitModel->useRandomInitFitPars(kTRUE);
-
- const Bool_t haveBkgd = ( fitModel->nBkgndClasses() > 0 );
-
- // Switch on/off Poissonian smearing of total number of events
- fitModel->doPoissonSmearing(haveBkgd);
-
- // Switch on/off Extended ML Fit option
- fitModel->doEMLFit(haveBkgd);
-
- // Set the names of the files to read/write
- TString dataFile = TString::Format("gen-covtest-spin%d.root", spin);
- TString treeName("genResults");
- TString rootFileName("dummy.root");
- TString tableFileName("genResults");
-
- // Execute the generation/fit
- fitModel->run( "gen", dataFile, treeName, rootFileName, tableFileName );
-
- return EXIT_SUCCESS;
+ // Process command-line arguments
+ // Usage:
+ // ./TestCovariant <spin>
+ if ( argc < 2 ) {
+ usage( std::cerr, argv[0] );
+ return EXIT_FAILURE;
+ }
+
+ const Int_t spin = atoi( argv[1] );
+ if ( spin < 0 || spin > 3 ) {
+ std::cerr << "Only valid for spin 0, 1, 2 or 3" << std::endl;
+ return EXIT_FAILURE;
+ }
+
+ // If you want to use square DP histograms for efficiency,
+ // backgrounds or you just want the square DP co-ordinates
+ // stored in the toy MC ntuple then set this to kTRUE
+ Bool_t squareDP = kFALSE;
+
+ // This defines the DP => decay is B+ -> K+ pi+ pi-
+ // Particle 1 = K+
+ // Particle 2 = pi+
+ // Particle 3 = pi-
+ // The DP is defined in terms of m13Sq and m23Sq
+ LauDaughters* daughters = new LauDaughters( "B+", "K+", "pi+", "pi-", squareDP );
+
+ // Optionally apply some vetoes to the DP
+ LauVetoes* vetoes = new LauVetoes();
+
+ // Define the efficiency model (defaults to unity everywhere)
+ // Can optionally provide a histogram to model variation over DP
+ // (example syntax given in commented-out section)
+ LauEffModel* effModel = new LauEffModel( daughters, vetoes );
+
+ // Create the isobar model
+
+ // Set the values of the Blatt-Weisskopf barrier radii and whether they are fixed or floating
+ LauResonanceMaker& resMaker = LauResonanceMaker::get();
+ resMaker.setSpinFormalism( LauAbsResonance::Covariant );
+ resMaker.setDefaultBWRadius( LauBlattWeisskopfFactor::Parent, 5.0 );
+ resMaker.setDefaultBWRadius( LauBlattWeisskopfFactor::Light, 4.0 );
+ resMaker.fixBWRadius( LauBlattWeisskopfFactor::Parent, kTRUE );
+ resMaker.fixBWRadius( LauBlattWeisskopfFactor::Light, kFALSE );
+
+ LauIsobarDynamics* sigModel = new LauIsobarDynamics( daughters, effModel );
+ LauAbsResonance* reson( 0 );
+ std::map<Int_t, TString> waves;
+ waves[0] = "S";
+ waves[1] = "P";
+ waves[2] = "D";
+ waves[3] = "F";
+ const TString nrName = TString::Format( "BelleNR_%swave", waves[spin].Data() );
+ reson = sigModel->addResonance( nrName, 2, LauAbsResonance::BelleNR );
+ reson->setResonanceParameter( "alpha", 0.0 );
+ LauBelleNR* belleNR = dynamic_cast<LauBelleNR*>( reson );
+ belleNR->enforceLegendreSpinFactors( kFALSE );
+
+ // Reset the maximum signal DP ASq value
+ // This will be automatically adjusted to avoid bias or extreme
+ // inefficiency if you get the value wrong but best to set this by
+ // hand once you've found the right value through some trial and
+ // error.
+ sigModel->setASqMaxValue( 0.32 );
+
+ // Create the fit model
+ LauSimpleFitModel* fitModel = new LauSimpleFitModel( sigModel );
+
+ // Create the complex coefficients for the isobar model
+ // Here we're using the magnitude and phase form:
+ // c_j = a_j exp(i*delta_j)
+ std::vector<LauAbsCoeffSet*> coeffset;
+ coeffset.push_back( new LauMagPhaseCoeffSet( nrName, 1.00, 0.00, kTRUE, kTRUE ) );
+ for ( std::vector<LauAbsCoeffSet*>::iterator iter = coeffset.begin(); iter != coeffset.end();
+ ++iter ) {
+ fitModel->setAmpCoeffSet( *iter );
+ }
+
+ // Set the signal yield and define whether it is fixed or floated
+ const Double_t nSig = 100000.0;
+ LauParameter* nSigEvents = new LauParameter( "nSigEvents", nSig, -2.0 * nSig, 2.0 * nSig, kFALSE );
+ fitModel->setNSigEvents( nSigEvents );
+
+ // Set the number of experiments to generate or fit and which
+ // experiment to start with
+ Int_t nExpt( 1 );
+ Int_t firstExpt( 0 );
+ fitModel->setNExpts( nExpt, firstExpt, kTRUE );
+
+ // Switch on/off calculation of asymmetric errors.
+ fitModel->useAsymmFitErrors( kFALSE );
+
+ // Randomise initial fit values for the signal mode
+ fitModel->useRandomInitFitPars( kTRUE );
+
+ const Bool_t haveBkgd = ( fitModel->nBkgndClasses() > 0 );
+
+ // Switch on/off Poissonian smearing of total number of events
+ fitModel->doPoissonSmearing( haveBkgd );
+
+ // Switch on/off Extended ML Fit option
+ fitModel->doEMLFit( haveBkgd );
+
+ // Set the names of the files to read/write
+ TString dataFile = TString::Format( "gen-covtest-spin%d.root", spin );
+ TString treeName( "genResults" );
+ TString rootFileName( "dummy.root" );
+ TString tableFileName( "genResults" );
+
+ // Execute the generation/fit
+ fitModel->run( "gen", dataFile, treeName, rootFileName, tableFileName );
+
+ return EXIT_SUCCESS;
}
diff --git a/test/TestCovariant2.cc b/test/TestCovariant2.cc
index 7110c20..9d37697 100644
--- a/test/TestCovariant2.cc
+++ b/test/TestCovariant2.cc
@@ -1,195 +1,199 @@
/*
Copyright 2017 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
-#include <cstdlib>
-#include <iostream>
-#include <vector>
-
-#include "TFile.h"
-#include "TH2.h"
-#include "TString.h"
-#include "TTree.h"
-
-#include "LauSimpleFitModel.hh"
#include "LauBkgndDPModel.hh"
#include "LauDaughters.hh"
#include "LauEffModel.hh"
#include "LauIsobarDynamics.hh"
#include "LauMagPhaseCoeffSet.hh"
#include "LauResonanceMaker.hh"
+#include "LauSimpleFitModel.hh"
#include "LauVetoes.hh"
+#include "TFile.h"
+#include "TH2.h"
+#include "TString.h"
+#include "TTree.h"
+
+#include <cstdlib>
+#include <iostream>
+#include <vector>
+
void usage( std::ostream& out, const TString& progName )
{
- out<<"Usage:\n";
- out<<progName<<" <resname> <formalism> <barrier>\n";
+ out << "Usage:\n";
+ out << progName << " <resname> <formalism> <barrier>\n";
}
int main( int argc, char** argv )
{
- // Process command-line arguments
- // Usage:
- // ./TestCovariant2 <resname> <formalism> <barrier>
- if ( argc < 4 ) {
- usage( std::cerr, argv[0] );
- return EXIT_FAILURE;
- }
-
- TString resName = argv[1];
- TString formalism = argv[2];
- TString barrier = argv[3];
-
- // If you want to use square DP histograms for efficiency,
- // backgrounds or you just want the square DP co-ordinates
- // stored in the toy MC ntuple then set this to kTRUE
- Bool_t squareDP = kFALSE;
-
- // This defines the DP => decay is B+ -> K+ pi+ pi-
- // Particle 1 = K+
- // Particle 2 = pi+
- // Particle 3 = pi-
- // The DP is defined in terms of m13Sq and m23Sq
- LauDaughters* daughters = new LauDaughters("B+", "K+", "pi+", "pi-", squareDP);
-
- // Optionally apply some vetoes to the DP
- LauVetoes* vetoes = new LauVetoes();
-
- // Define the efficiency model (defaults to unity everywhere)
- // Can optionally provide a histogram to model variation over DP
- // (example syntax given in commented-out section)
- LauEffModel* effModel = new LauEffModel(daughters, vetoes);
-
- // Create the isobar model
-
- // Set the values of the Blatt-Weisskopf barrier radii and whether they are fixed or floating
- LauResonanceMaker& resMaker = LauResonanceMaker::get();
-
- if ( formalism == "Covariant" ) {
- resMaker.setSpinFormalism( LauAbsResonance::Covariant );
- } else if ( formalism == "Zemach_P" ) {
- resMaker.setSpinFormalism( LauAbsResonance::Zemach_P );
- } else if ( formalism == "Zemach_Pstar" ) {
- resMaker.setSpinFormalism( LauAbsResonance::Zemach_Pstar );
- } else if ( formalism == "Legendre" ) {
- resMaker.setSpinFormalism( LauAbsResonance::Legendre );
- } else {
- std::cerr << "Unknown formalism: " << formalism << std::endl;
- return EXIT_FAILURE;
- }
-
- resMaker.setBWBachelorRestFrame( LauBlattWeisskopfFactor::ResonanceFrame );
-
- if ( barrier == "noBWfactors" ) {
- resMaker.setDefaultBWRadius( LauBlattWeisskopfFactor::Parent, 0.0 );
- resMaker.setDefaultBWRadius( LauBlattWeisskopfFactor::Light, 0.0 );
- } else if ( barrier == "noNumeratorBWfactors" ) {
- resMaker.setDefaultBWRadius( LauBlattWeisskopfFactor::Parent, 0.0 );
- resMaker.setDefaultBWRadius( LauBlattWeisskopfFactor::Light, 4.0 );
- } else if ( barrier == "noParentNumeratorBWfactor" ) {
- resMaker.setDefaultBWRadius( LauBlattWeisskopfFactor::Parent, 0.0 );
- resMaker.setDefaultBWRadius( LauBlattWeisskopfFactor::Light, 4.0 );
- } else if ( barrier == "pParentNumeratorBWfactor" ) {
- resMaker.setDefaultBWRadius( LauBlattWeisskopfFactor::Parent, 4.0 );
- resMaker.setDefaultBWRadius( LauBlattWeisskopfFactor::Light, 4.0 );
- } else if ( barrier == "pstarParentNumeratorBWfactor" ) {
- resMaker.setBWBachelorRestFrame( LauBlattWeisskopfFactor::ParentFrame );
- resMaker.setDefaultBWRadius( LauBlattWeisskopfFactor::Parent, 4.0 );
- resMaker.setDefaultBWRadius( LauBlattWeisskopfFactor::Light, 4.0 );
- } else if ( barrier == "covParentNumeratorBWfactor" ) {
- resMaker.setBWBachelorRestFrame( LauBlattWeisskopfFactor::Covariant );
- resMaker.setDefaultBWRadius( LauBlattWeisskopfFactor::Parent, 4.0 );
- resMaker.setDefaultBWRadius( LauBlattWeisskopfFactor::Light, 4.0 );
- } else {
- std::cerr << "Unknown barrier: " << barrier << std::endl;
- return EXIT_FAILURE;
- }
-
- LauIsobarDynamics* sigModel = new LauIsobarDynamics(daughters, effModel);
- LauAbsResonance* reson(0);
- Int_t resPairAmpInt(1);
- if ( resName.Contains("K*") ) {
- resPairAmpInt = 2;
- }
- reson = sigModel->addResonance(resName, resPairAmpInt, LauAbsResonance::RelBW);
- //reson->ignoreMomenta(kTRUE);// this is for turning off the mass-dependent width
- if ( barrier == "noBWfactors" || barrier == "noNumeratorBWfactors" ) {
- reson->ignoreBarrierScaling(kTRUE);
- }
- const TString sanitisedName = reson->getSanitisedName();
-
- // Reset the maximum signal DP ASq value
- // This will be automatically adjusted to avoid bias or extreme
- // inefficiency if you get the value wrong but best to set this by
- // hand once you've found the right value through some trial and
- // error.
- sigModel->setASqMaxValue(0.45);
-
- // Create the fit model
- LauSimpleFitModel* fitModel = new LauSimpleFitModel(sigModel);
-
- // Create the complex coefficients for the isobar model
- // Here we're using the magnitude and phase form:
- // c_j = a_j exp(i*delta_j)
- std::vector<LauAbsCoeffSet*> coeffset;
- coeffset.push_back( new LauMagPhaseCoeffSet(resName, 1.00, 0.00, kTRUE, kTRUE) );
- for (std::vector<LauAbsCoeffSet*>::iterator iter=coeffset.begin(); iter!=coeffset.end(); ++iter) {
- fitModel->setAmpCoeffSet(*iter);
- }
-
- // Set the signal yield and define whether it is fixed or floated
- const Double_t nSig = 100000.0;
- LauParameter * nSigEvents = new LauParameter("nSigEvents",nSig,-2.0*nSig,2.0*nSig,kFALSE);
- fitModel->setNSigEvents(nSigEvents);
-
- // Set the number of experiments to generate or fit and which
- // experiment to start with
- Int_t nExpt(1);
- Int_t firstExpt(0);
- fitModel->setNExpts( nExpt, firstExpt, kTRUE );
-
- // Switch on/off calculation of asymmetric errors.
- fitModel->useAsymmFitErrors(kFALSE);
-
- // Randomise initial fit values for the signal mode
- fitModel->useRandomInitFitPars(kTRUE);
-
- const Bool_t haveBkgd = ( fitModel->nBkgndClasses() > 0 );
-
- // Switch on/off Poissonian smearing of total number of events
- fitModel->doPoissonSmearing(haveBkgd);
-
- // Switch on/off Extended ML Fit option
- fitModel->doEMLFit(haveBkgd);
-
- // Set the names of the files to read/write
- TString dataFile = TString::Format( "%s/gen-covtest-%s-withMassDepWidth-%s.root", sanitisedName.Data(), barrier.Data(), formalism.Data() );
- TString treeName("genResults");
- TString rootFileName("dummy.root");
- TString tableFileName("genResults");
-
- // Execute the generation/fit
- fitModel->run( "gen", dataFile, treeName, rootFileName, tableFileName );
-
- return EXIT_SUCCESS;
+ // Process command-line arguments
+ // Usage:
+ // ./TestCovariant2 <resname> <formalism> <barrier>
+ if ( argc < 4 ) {
+ usage( std::cerr, argv[0] );
+ return EXIT_FAILURE;
+ }
+
+ TString resName = argv[1];
+ TString formalism = argv[2];
+ TString barrier = argv[3];
+
+ // If you want to use square DP histograms for efficiency,
+ // backgrounds or you just want the square DP co-ordinates
+ // stored in the toy MC ntuple then set this to kTRUE
+ Bool_t squareDP = kFALSE;
+
+ // This defines the DP => decay is B+ -> K+ pi+ pi-
+ // Particle 1 = K+
+ // Particle 2 = pi+
+ // Particle 3 = pi-
+ // The DP is defined in terms of m13Sq and m23Sq
+ LauDaughters* daughters = new LauDaughters( "B+", "K+", "pi+", "pi-", squareDP );
+
+ // Optionally apply some vetoes to the DP
+ LauVetoes* vetoes = new LauVetoes();
+
+ // Define the efficiency model (defaults to unity everywhere)
+ // Can optionally provide a histogram to model variation over DP
+ // (example syntax given in commented-out section)
+ LauEffModel* effModel = new LauEffModel( daughters, vetoes );
+
+ // Create the isobar model
+
+ // Set the values of the Blatt-Weisskopf barrier radii and whether they are fixed or floating
+ LauResonanceMaker& resMaker = LauResonanceMaker::get();
+
+ if ( formalism == "Covariant" ) {
+ resMaker.setSpinFormalism( LauAbsResonance::Covariant );
+ } else if ( formalism == "Zemach_P" ) {
+ resMaker.setSpinFormalism( LauAbsResonance::Zemach_P );
+ } else if ( formalism == "Zemach_Pstar" ) {
+ resMaker.setSpinFormalism( LauAbsResonance::Zemach_Pstar );
+ } else if ( formalism == "Legendre" ) {
+ resMaker.setSpinFormalism( LauAbsResonance::Legendre );
+ } else {
+ std::cerr << "Unknown formalism: " << formalism << std::endl;
+ return EXIT_FAILURE;
+ }
+
+ resMaker.setBWBachelorRestFrame( LauBlattWeisskopfFactor::ResonanceFrame );
+
+ if ( barrier == "noBWfactors" ) {
+ resMaker.setDefaultBWRadius( LauBlattWeisskopfFactor::Parent, 0.0 );
+ resMaker.setDefaultBWRadius( LauBlattWeisskopfFactor::Light, 0.0 );
+ } else if ( barrier == "noNumeratorBWfactors" ) {
+ resMaker.setDefaultBWRadius( LauBlattWeisskopfFactor::Parent, 0.0 );
+ resMaker.setDefaultBWRadius( LauBlattWeisskopfFactor::Light, 4.0 );
+ } else if ( barrier == "noParentNumeratorBWfactor" ) {
+ resMaker.setDefaultBWRadius( LauBlattWeisskopfFactor::Parent, 0.0 );
+ resMaker.setDefaultBWRadius( LauBlattWeisskopfFactor::Light, 4.0 );
+ } else if ( barrier == "pParentNumeratorBWfactor" ) {
+ resMaker.setDefaultBWRadius( LauBlattWeisskopfFactor::Parent, 4.0 );
+ resMaker.setDefaultBWRadius( LauBlattWeisskopfFactor::Light, 4.0 );
+ } else if ( barrier == "pstarParentNumeratorBWfactor" ) {
+ resMaker.setBWBachelorRestFrame( LauBlattWeisskopfFactor::ParentFrame );
+ resMaker.setDefaultBWRadius( LauBlattWeisskopfFactor::Parent, 4.0 );
+ resMaker.setDefaultBWRadius( LauBlattWeisskopfFactor::Light, 4.0 );
+ } else if ( barrier == "covParentNumeratorBWfactor" ) {
+ resMaker.setBWBachelorRestFrame( LauBlattWeisskopfFactor::Covariant );
+ resMaker.setDefaultBWRadius( LauBlattWeisskopfFactor::Parent, 4.0 );
+ resMaker.setDefaultBWRadius( LauBlattWeisskopfFactor::Light, 4.0 );
+ } else {
+ std::cerr << "Unknown barrier: " << barrier << std::endl;
+ return EXIT_FAILURE;
+ }
+
+ LauIsobarDynamics* sigModel = new LauIsobarDynamics( daughters, effModel );
+ LauAbsResonance* reson( 0 );
+ Int_t resPairAmpInt( 1 );
+ if ( resName.Contains( "K*" ) ) {
+ resPairAmpInt = 2;
+ }
+ reson = sigModel->addResonance( resName, resPairAmpInt, LauAbsResonance::RelBW );
+ //reson->ignoreMomenta(kTRUE);// this is for turning off the mass-dependent width
+ if ( barrier == "noBWfactors" || barrier == "noNumeratorBWfactors" ) {
+ reson->ignoreBarrierScaling( kTRUE );
+ }
+ const TString sanitisedName = reson->getSanitisedName();
+
+ // Reset the maximum signal DP ASq value
+ // This will be automatically adjusted to avoid bias or extreme
+ // inefficiency if you get the value wrong but best to set this by
+ // hand once you've found the right value through some trial and
+ // error.
+ sigModel->setASqMaxValue( 0.45 );
+
+ // Create the fit model
+ LauSimpleFitModel* fitModel = new LauSimpleFitModel( sigModel );
+
+ // Create the complex coefficients for the isobar model
+ // Here we're using the magnitude and phase form:
+ // c_j = a_j exp(i*delta_j)
+ std::vector<LauAbsCoeffSet*> coeffset;
+ coeffset.push_back( new LauMagPhaseCoeffSet( resName, 1.00, 0.00, kTRUE, kTRUE ) );
+ for ( std::vector<LauAbsCoeffSet*>::iterator iter = coeffset.begin(); iter != coeffset.end();
+ ++iter ) {
+ fitModel->setAmpCoeffSet( *iter );
+ }
+
+ // Set the signal yield and define whether it is fixed or floated
+ const Double_t nSig = 100000.0;
+ LauParameter* nSigEvents = new LauParameter( "nSigEvents", nSig, -2.0 * nSig, 2.0 * nSig, kFALSE );
+ fitModel->setNSigEvents( nSigEvents );
+
+ // Set the number of experiments to generate or fit and which
+ // experiment to start with
+ Int_t nExpt( 1 );
+ Int_t firstExpt( 0 );
+ fitModel->setNExpts( nExpt, firstExpt, kTRUE );
+
+ // Switch on/off calculation of asymmetric errors.
+ fitModel->useAsymmFitErrors( kFALSE );
+
+ // Randomise initial fit values for the signal mode
+ fitModel->useRandomInitFitPars( kTRUE );
+
+ const Bool_t haveBkgd = ( fitModel->nBkgndClasses() > 0 );
+
+ // Switch on/off Poissonian smearing of total number of events
+ fitModel->doPoissonSmearing( haveBkgd );
+
+ // Switch on/off Extended ML Fit option
+ fitModel->doEMLFit( haveBkgd );
+
+ // Set the names of the files to read/write
+ TString dataFile = TString::Format( "%s/gen-covtest-%s-withMassDepWidth-%s.root",
+ sanitisedName.Data(),
+ barrier.Data(),
+ formalism.Data() );
+ TString treeName( "genResults" );
+ TString rootFileName( "dummy.root" );
+ TString tableFileName( "genResults" );
+
+ // Execute the generation/fit
+ fitModel->run( "gen", dataFile, treeName, rootFileName, tableFileName );
+
+ return EXIT_SUCCESS;
}
diff --git a/test/TestNewKinematicsMethods.cc b/test/TestNewKinematicsMethods.cc
index d12526a..d90bdbd 100644
--- a/test/TestNewKinematicsMethods.cc
+++ b/test/TestNewKinematicsMethods.cc
@@ -1,327 +1,326 @@
/*
Copyright 2017 University of Warwick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Laura++ package authors:
John Back
Paul Harrison
Thomas Latham
*/
-#include <cstdlib>
-#include <iostream>
-#include <vector>
+#include "LauDaughters.hh"
+#include "LauKinematics.hh"
+#include "LauRandom.hh"
#include "TFile.h"
#include "TRandom.h"
#include "TTree.h"
-#include "LauDaughters.hh"
-#include "LauKinematics.hh"
-#include "LauRandom.hh"
+#include <cstdlib>
+#include <iostream>
+#include <vector>
struct DPpoint {
- DPpoint();
- DPpoint(const LauKinematics* kine);
- void reset();
- void set(const LauKinematics* kine);
- bool operator==(const DPpoint& rhs) const;
- Double_t m12Sq;
- Double_t m13Sq;
- Double_t m23Sq;
- Double_t m12;
- Double_t m13;
- Double_t m23;
- Double_t c12;
- Double_t c13;
- Double_t c23;
- Double_t mPrime;
- Double_t thPrime;
- Double_t p1_12;
- Double_t p3_12;
- Double_t p2_23;
- Double_t p1_23;
- Double_t p1_13;
- Double_t p2_13;
- Double_t p1_Parent;
- Double_t p2_Parent;
- Double_t p3_Parent;
+ DPpoint();
+ DPpoint( const LauKinematics* kine );
+ void reset();
+ void set( const LauKinematics* kine );
+ bool operator==( const DPpoint& rhs ) const;
+ Double_t m12Sq;
+ Double_t m13Sq;
+ Double_t m23Sq;
+ Double_t m12;
+ Double_t m13;
+ Double_t m23;
+ Double_t c12;
+ Double_t c13;
+ Double_t c23;
+ Double_t mPrime;
+ Double_t thPrime;
+ Double_t p1_12;
+ Double_t p3_12;
+ Double_t p2_23;
+ Double_t p1_23;
+ Double_t p1_13;
+ Double_t p2_13;
+ Double_t p1_Parent;
+ Double_t p2_Parent;
+ Double_t p3_Parent;
};
DPpoint::DPpoint() :
- m12Sq(0.0),
- m13Sq(0.0),
- m23Sq(0.0),
- m12(0.0),
- m13(0.0),
- m23(0.0),
- c12(0.0),
- c13(0.0),
- c23(0.0),
- mPrime(0.0),
- thPrime(0.0),
- p1_12(0.0),
- p3_12(0.0),
- p2_23(0.0),
- p1_23(0.0),
- p1_13(0.0),
- p2_13(0.0),
- p1_Parent(0.0),
- p2_Parent(0.0),
- p3_Parent(0.0)
+ m12Sq( 0.0 ),
+ m13Sq( 0.0 ),
+ m23Sq( 0.0 ),
+ m12( 0.0 ),
+ m13( 0.0 ),
+ m23( 0.0 ),
+ c12( 0.0 ),
+ c13( 0.0 ),
+ c23( 0.0 ),
+ mPrime( 0.0 ),
+ thPrime( 0.0 ),
+ p1_12( 0.0 ),
+ p3_12( 0.0 ),
+ p2_23( 0.0 ),
+ p1_23( 0.0 ),
+ p1_13( 0.0 ),
+ p2_13( 0.0 ),
+ p1_Parent( 0.0 ),
+ p2_Parent( 0.0 ),
+ p3_Parent( 0.0 )
{
}
DPpoint::DPpoint( const LauKinematics* kine ) :
- m12Sq(kine->getm12Sq()),
- m13Sq(kine->getm13Sq()),
- m23Sq(kine->getm23Sq()),
- m12(kine->getm12()),
- m13(kine->getm13()),
- m23(kine->getm23()),
- c12(kine->getc12()),
- c13(kine->getc13()),
- c23(kine->getc23()),
- mPrime(kine->getmPrime()),
- thPrime(kine->getThetaPrime()),
- p1_12(kine->getp1_12()),
- p3_12(kine->getp3_12()),
- p2_23(kine->getp2_23()),
- p1_23(kine->getp1_23()),
- p1_13(kine->getp1_13()),
- p2_13(kine->getp2_13()),
- p1_Parent(kine->getp1_Parent()),
- p2_Parent(kine->getp2_Parent()),
- p3_Parent(kine->getp3_Parent())
+ m12Sq( kine->getm12Sq() ),
+ m13Sq( kine->getm13Sq() ),
+ m23Sq( kine->getm23Sq() ),
+ m12( kine->getm12() ),
+ m13( kine->getm13() ),
+ m23( kine->getm23() ),
+ c12( kine->getc12() ),
+ c13( kine->getc13() ),
+ c23( kine->getc23() ),
+ mPrime( kine->getmPrime() ),
+ thPrime( kine->getThetaPrime() ),
+ p1_12( kine->getp1_12() ),
+ p3_12( kine->getp3_12() ),
+ p2_23( kine->getp2_23() ),
+ p1_23( kine->getp1_23() ),
+ p1_13( kine->getp1_13() ),
+ p2_13( kine->getp2_13() ),
+ p1_Parent( kine->getp1_Parent() ),
+ p2_Parent( kine->getp2_Parent() ),
+ p3_Parent( kine->getp3_Parent() )
{
}
void DPpoint::reset()
{
- m12Sq = 0.0;
- m13Sq = 0.0;
- m23Sq = 0.0;
- m12 = 0.0;
- m13 = 0.0;
- m23 = 0.0;
- c12 = 0.0;
- c13 = 0.0;
- c23 = 0.0;
- mPrime = 0.0;
- thPrime = 0.0;
- p1_12 = 0.0;
- p3_12 = 0.0;
- p2_23 = 0.0;
- p1_23 = 0.0;
- p1_13 = 0.0;
- p2_13 = 0.0;
- p1_Parent = 0.0;
- p2_Parent = 0.0;
- p3_Parent = 0.0;
+ m12Sq = 0.0;
+ m13Sq = 0.0;
+ m23Sq = 0.0;
+ m12 = 0.0;
+ m13 = 0.0;
+ m23 = 0.0;
+ c12 = 0.0;
+ c13 = 0.0;
+ c23 = 0.0;
+ mPrime = 0.0;
+ thPrime = 0.0;
+ p1_12 = 0.0;
+ p3_12 = 0.0;
+ p2_23 = 0.0;
+ p1_23 = 0.0;
+ p1_13 = 0.0;
+ p2_13 = 0.0;
+ p1_Parent = 0.0;
+ p2_Parent = 0.0;
+ p3_Parent = 0.0;
}
void DPpoint::set( const LauKinematics* kine )
{
- m12Sq = kine->getm12Sq();
- m13Sq = kine->getm13Sq();
- m23Sq = kine->getm23Sq();
- m12 = kine->getm12();
- m13 = kine->getm13();
- m23 = kine->getm23();
- c12 = kine->getc12();
- c13 = kine->getc13();
- c23 = kine->getc23();
- mPrime = kine->getmPrime();
- thPrime = kine->getThetaPrime();
- p1_12 = kine->getp1_12();
- p3_12 = kine->getp3_12();
- p2_23 = kine->getp2_23();
- p1_23 = kine->getp1_23();
- p1_13 = kine->getp1_13();
- p2_13 = kine->getp2_13();
- p1_Parent = kine->getp1_Parent();
- p2_Parent = kine->getp2_Parent();
- p3_Parent = kine->getp3_Parent();
+ m12Sq = kine->getm12Sq();
+ m13Sq = kine->getm13Sq();
+ m23Sq = kine->getm23Sq();
+ m12 = kine->getm12();
+ m13 = kine->getm13();
+ m23 = kine->getm23();
+ c12 = kine->getc12();
+ c13 = kine->getc13();
+ c23 = kine->getc23();
+ mPrime = kine->getmPrime();
+ thPrime = kine->getThetaPrime();
+ p1_12 = kine->getp1_12();
+ p3_12 = kine->getp3_12();
+ p2_23 = kine->getp2_23();
+ p1_23 = kine->getp1_23();
+ p1_13 = kine->getp1_13();
+ p2_13 = kine->getp2_13();
+ p1_Parent = kine->getp1_Parent();
+ p2_Parent = kine->getp2_Parent();
+ p3_Parent = kine->getp3_Parent();
}
bool DPpoint::operator==( const DPpoint& rhs ) const
{
- bool ok = true;
- if ( TMath::Abs( m12Sq - rhs.m12Sq ) > 1e-6 ) {
- std::cerr << "Problem with m12Sq: " << m12Sq << " != " << rhs.m12Sq << std::endl;
- ok = false;
- }
- if ( TMath::Abs( m13Sq - rhs.m13Sq ) > 1e-6 ) {
- std::cerr << "Problem with m13Sq: " << m13Sq << " != " << rhs.m13Sq << std::endl;
- ok = false;
- }
- if ( TMath::Abs( m23Sq - rhs.m23Sq ) > 1e-6 ) {
- std::cerr << "Problem with m23Sq: " << m23Sq << " != " << rhs.m23Sq << std::endl;
- ok = false;
- }
- if ( TMath::Abs( m12 - rhs.m12 ) > 1e-6 ) {
- std::cerr << "Problem with m12: " << m12 << " != " << rhs.m12 << std::endl;
- ok = false;
- }
- if ( TMath::Abs( m13 - rhs.m13 ) > 1e-6 ) {
- std::cerr << "Problem with m13: " << m13 << " != " << rhs.m13 << std::endl;
- ok = false;
- }
- if ( TMath::Abs( m23 - rhs.m23 ) > 1e-6 ) {
- std::cerr << "Problem with m23: " << m23 << " != " << rhs.m23 << std::endl;
- ok = false;
- }
- if ( TMath::Abs( c12 - rhs.c12 ) > 1e-6 ) {
- std::cerr << "Problem with c12: " << c12 << " != " << rhs.c12 << std::endl;
- ok = false;
- }
- if ( TMath::Abs( c13 - rhs.c13 ) > 1e-6 ) {
- std::cerr << "Problem with c13: " << c13 << " != " << rhs.c13 << std::endl;
- ok = false;
- }
- if ( TMath::Abs( c23 - rhs.c23 ) > 1e-6 ) {
- std::cerr << "Problem with c23: " << c23 << " != " << rhs.c23 << std::endl;
- ok = false;
- }
- if ( TMath::Abs( mPrime - rhs.mPrime ) > 1e-6 ) {
- std::cerr << "Problem with mPrime: " << mPrime << " != " << rhs.mPrime << std::endl;
- ok = false;
- }
- if ( TMath::Abs( thPrime - rhs.thPrime ) > 1e-6 ) {
- std::cerr << "Problem with thPrime: " << thPrime << " != " << rhs.thPrime << std::endl;
- ok = false;
- }
- if ( TMath::Abs( p1_12 - rhs.p1_12 ) > 1e-6 ) {
- std::cerr << "Problem with p1_12: " << p1_12 << " != " << rhs.p1_12 << std::endl;
- ok = false;
- }
- if ( TMath::Abs( p3_12 - rhs.p3_12 ) > 1e-6 ) {
- std::cerr << "Problem with p3_12: " << p3_12 << " != " << rhs.p3_12 << std::endl;
- ok = false;
- }
- if ( TMath::Abs( p2_23 - rhs.p2_23 ) > 1e-6 ) {
- std::cerr << "Problem with p2_23: " << p2_23 << " != " << rhs.p2_23 << std::endl;
- ok = false;
- }
- if ( TMath::Abs( p1_23 - rhs.p1_23 ) > 1e-6 ) {
- std::cerr << "Problem with p1_23: " << p1_23 << " != " << rhs.p1_23 << std::endl;
- ok = false;
- }
- if ( TMath::Abs( p1_13 - rhs.p1_13 ) > 1e-6 ) {
- std::cerr << "Problem with p1_13: " << p1_13 << " != " << rhs.p1_13 << std::endl;
- ok = false;
- }
- if ( TMath::Abs( p2_13 - rhs.p2_13 ) > 1e-6 ) {
- std::cerr << "Problem with p2_13: " << p2_13 << " != " << rhs.p2_13 << std::endl;
- ok = false;
- }
- if ( TMath::Abs( p1_Parent - rhs.p1_Parent ) > 1e-6 ) {
- std::cerr << "Problem with p1_Parent: " << p1_Parent << " != " << rhs.p1_Parent << std::endl;
- ok = false;
- }
- if ( TMath::Abs( p2_Parent - rhs.p2_Parent ) > 1e-6 ) {
- std::cerr << "Problem with p2_Parent: " << p2_Parent << " != " << rhs.p2_Parent << std::endl;
- ok = false;
- }
- if ( TMath::Abs( p3_Parent - rhs.p3_Parent ) > 1e-6 ) {
- std::cerr << "Problem with p3_Parent: " << p3_Parent << " != " << rhs.p3_Parent << std::endl;
- ok = false;
- }
-
- return ok;
+ bool ok = true;
+ if ( TMath::Abs( m12Sq - rhs.m12Sq ) > 1e-6 ) {
+ std::cerr << "Problem with m12Sq: " << m12Sq << " != " << rhs.m12Sq << std::endl;
+ ok = false;
+ }
+ if ( TMath::Abs( m13Sq - rhs.m13Sq ) > 1e-6 ) {
+ std::cerr << "Problem with m13Sq: " << m13Sq << " != " << rhs.m13Sq << std::endl;
+ ok = false;
+ }
+ if ( TMath::Abs( m23Sq - rhs.m23Sq ) > 1e-6 ) {
+ std::cerr << "Problem with m23Sq: " << m23Sq << " != " << rhs.m23Sq << std::endl;
+ ok = false;
+ }
+ if ( TMath::Abs( m12 - rhs.m12 ) > 1e-6 ) {
+ std::cerr << "Problem with m12: " << m12 << " != " << rhs.m12 << std::endl;
+ ok = false;
+ }
+ if ( TMath::Abs( m13 - rhs.m13 ) > 1e-6 ) {
+ std::cerr << "Problem with m13: " << m13 << " != " << rhs.m13 << std::endl;
+ ok = false;
+ }
+ if ( TMath::Abs( m23 - rhs.m23 ) > 1e-6 ) {
+ std::cerr << "Problem with m23: " << m23 << " != " << rhs.m23 << std::endl;
+ ok = false;
+ }
+ if ( TMath::Abs( c12 - rhs.c12 ) > 1e-6 ) {
+ std::cerr << "Problem with c12: " << c12 << " != " << rhs.c12 << std::endl;
+ ok = false;
+ }
+ if ( TMath::Abs( c13 - rhs.c13 ) > 1e-6 ) {
+ std::cerr << "Problem with c13: " << c13 << " != " << rhs.c13 << std::endl;
+ ok = false;
+ }
+ if ( TMath::Abs( c23 - rhs.c23 ) > 1e-6 ) {
+ std::cerr << "Problem with c23: " << c23 << " != " << rhs.c23 << std::endl;
+ ok = false;
+ }
+ if ( TMath::Abs( mPrime - rhs.mPrime ) > 1e-6 ) {
+ std::cerr << "Problem with mPrime: " << mPrime << " != " << rhs.mPrime << std::endl;
+ ok = false;
+ }
+ if ( TMath::Abs( thPrime - rhs.thPrime ) > 1e-6 ) {
+ std::cerr << "Problem with thPrime: " << thPrime << " != " << rhs.thPrime << std::endl;
+ ok = false;
+ }
+ if ( TMath::Abs( p1_12 - rhs.p1_12 ) > 1e-6 ) {
+ std::cerr << "Problem with p1_12: " << p1_12 << " != " << rhs.p1_12 << std::endl;
+ ok = false;
+ }
+ if ( TMath::Abs( p3_12 - rhs.p3_12 ) > 1e-6 ) {
+ std::cerr << "Problem with p3_12: " << p3_12 << " != " << rhs.p3_12 << std::endl;
+ ok = false;
+ }
+ if ( TMath::Abs( p2_23 - rhs.p2_23 ) > 1e-6 ) {
+ std::cerr << "Problem with p2_23: " << p2_23 << " != " << rhs.p2_23 << std::endl;
+ ok = false;
+ }
+ if ( TMath::Abs( p1_23 - rhs.p1_23 ) > 1e-6 ) {
+ std::cerr << "Problem with p1_23: " << p1_23 << " != " << rhs.p1_23 << std::endl;
+ ok = false;
+ }
+ if ( TMath::Abs( p1_13 - rhs.p1_13 ) > 1e-6 ) {
+ std::cerr << "Problem with p1_13: " << p1_13 << " != " << rhs.p1_13 << std::endl;
+ ok = false;
+ }
+ if ( TMath::Abs( p2_13 - rhs.p2_13 ) > 1e-6 ) {
+ std::cerr << "Problem with p2_13: " << p2_13 << " != " << rhs.p2_13 << std::endl;
+ ok = false;
+ }
+ if ( TMath::Abs( p1_Parent - rhs.p1_Parent ) > 1e-6 ) {
+ std::cerr << "Problem with p1_Parent: " << p1_Parent << " != " << rhs.p1_Parent << std::endl;
+ ok = false;
+ }
+ if ( TMath::Abs( p2_Parent - rhs.p2_Parent ) > 1e-6 ) {
+ std::cerr << "Problem with p2_Parent: " << p2_Parent << " != " << rhs.p2_Parent << std::endl;
+ ok = false;
+ }
+ if ( TMath::Abs( p3_Parent - rhs.p3_Parent ) > 1e-6 ) {
+ std::cerr << "Problem with p3_Parent: " << p3_Parent << " != " << rhs.p3_Parent << std::endl;
+ ok = false;
+ }
+
+ return ok;
}
int main( /*int argc, char** argv*/ )
{
- // If you want to use square DP histograms for efficiency,
- // backgrounds or you just want the square DP co-ordinates
- // stored in the toy MC ntuple then set this to kTRUE
- Bool_t squareDP = kTRUE;
-
- // This defines the DP => decay is B+ -> pi+ pi+ pi-
- // Particle 1 = pi+
- // Particle 2 = pi+
- // Particle 3 = pi-
- // The DP is defined in terms of m13Sq and m23Sq
- LauDaughters* daughters = new LauDaughters("B+", "pi+", "pi+", "pi-", squareDP);
-
- LauKinematics* kinematics = daughters->getKinematics();
-
- Double_t m13Sq(0.0), m23Sq(0.0);
-
- DPpoint pos1;
- DPpoint pos2;
-
- bool ok(true);
-
- for ( UInt_t i(0); i < 10; ++i ) {
- pos1.reset();
- pos2.reset();
-
- kinematics->genFlatPhaseSpace( m13Sq, m23Sq );
- kinematics->updateKinematics( m13Sq, m23Sq );
-
- pos1.set(kinematics);
-
- const Double_t m12 = kinematics->getm12();
- const Double_t c12 = kinematics->getc12();
- const Double_t m13 = kinematics->getm13();
- const Double_t c13 = kinematics->getc13();
- const Double_t m23 = kinematics->getm23();
- const Double_t c23 = kinematics->getc23();
-
- // this is just to make sure that we reset all variables so we can notice if things don't get set properly
- kinematics->genFlatPhaseSpace( m13Sq, m23Sq );
- kinematics->updateKinematics( m13Sq, m23Sq );
-
- kinematics->updateKinematicsFrom12( m12, c12 );
- pos2.set(kinematics);
- ok = pos1 == pos2;
- if ( ! ok ) {
- std::cerr << "Problem setting from m12, c12" << std::endl;
- }
-
- // this is just to make sure that we reset all variables so we can notice if things don't get set properly
- kinematics->genFlatPhaseSpace( m13Sq, m23Sq );
- kinematics->updateKinematics( m13Sq, m23Sq );
-
- kinematics->updateKinematicsFrom13( m13, c13 );
- pos2.set(kinematics);
- ok = pos1 == pos2;
- if ( ! ok ) {
- std::cerr << "Problem setting from m13, c13" << std::endl;
- }
-
- // this is just to make sure that we reset all variables so we can notice if things don't get set properly
- kinematics->genFlatPhaseSpace( m13Sq, m23Sq );
- kinematics->updateKinematics( m13Sq, m23Sq );
-
- kinematics->updateKinematicsFrom23( m23, c23 );
- pos2.set(kinematics);
- ok = pos1 == pos2;
- if ( ! ok ) {
- std::cerr << "Problem setting from m23, c23" << std::endl;
- }
-
- }
-
- if ( ! ok ) {
- return EXIT_FAILURE;
- }
-
- return EXIT_SUCCESS;
+ // If you want to use square DP histograms for efficiency,
+ // backgrounds or you just want the square DP co-ordinates
+ // stored in the toy MC ntuple then set this to kTRUE
+ Bool_t squareDP = kTRUE;
+
+ // This defines the DP => decay is B+ -> pi+ pi+ pi-
+ // Particle 1 = pi+
+ // Particle 2 = pi+
+ // Particle 3 = pi-
+ // The DP is defined in terms of m13Sq and m23Sq
+ LauDaughters* daughters = new LauDaughters( "B+", "pi+", "pi+", "pi-", squareDP );
+
+ LauKinematics* kinematics = daughters->getKinematics();
+
+ Double_t m13Sq( 0.0 ), m23Sq( 0.0 );
+
+ DPpoint pos1;
+ DPpoint pos2;
+
+ bool ok( true );
+
+ for ( UInt_t i( 0 ); i < 10; ++i ) {
+ pos1.reset();
+ pos2.reset();
+
+ kinematics->genFlatPhaseSpace( m13Sq, m23Sq );
+ kinematics->updateKinematics( m13Sq, m23Sq );
+
+ pos1.set( kinematics );
+
+ const Double_t m12 = kinematics->getm12();
+ const Double_t c12 = kinematics->getc12();
+ const Double_t m13 = kinematics->getm13();
+ const Double_t c13 = kinematics->getc13();
+ const Double_t m23 = kinematics->getm23();
+ const Double_t c23 = kinematics->getc23();
+
+ // this is just to make sure that we reset all variables so we can notice if things don't get set properly
+ kinematics->genFlatPhaseSpace( m13Sq, m23Sq );
+ kinematics->updateKinematics( m13Sq, m23Sq );
+
+ kinematics->updateKinematicsFrom12( m12, c12 );
+ pos2.set( kinematics );
+ ok = pos1 == pos2;
+ if ( ! ok ) {
+ std::cerr << "Problem setting from m12, c12" << std::endl;
+ }
+
+ // this is just to make sure that we reset all variables so we can notice if things don't get set properly
+ kinematics->genFlatPhaseSpace( m13Sq, m23Sq );
+ kinematics->updateKinematics( m13Sq, m23Sq );
+
+ kinematics->updateKinematicsFrom13( m13, c13 );
+ pos2.set( kinematics );
+ ok = pos1 == pos2;
+ if ( ! ok ) {
+ std::cerr << "Problem setting from m13, c13" << std::endl;
+ }
+
+ // this is just to make sure that we reset all variables so we can notice if things don't get set properly
+ kinematics->genFlatPhaseSpace( m13Sq, m23Sq );
+ kinematics->updateKinematics( m13Sq, m23Sq );
+
+ kinematics->updateKinematicsFrom23( m23, c23 );
+ pos2.set( kinematics );
+ ok = pos1 == pos2;
+ if ( ! ok ) {
+ std::cerr << "Problem setting from m23, c23" << std::endl;
+ }
+ }
+
+ if ( ! ok ) {
+ return EXIT_FAILURE;
+ }
+
+ return EXIT_SUCCESS;
}

File Metadata

Mime Type
application/octet-stream
Expires
Sat, Sep 21, 5:42 PM (1 d, 18 h)
Storage Engine
chunks
Storage Format
Chunks
Storage Handle
WxcMYxUzj8_d
Default Alt Text
(4 MB)

Event Timeline