Page MenuHomeHEPForge

No OneTemporary

diff --git a/inc/LauRealImagCPCoeffSet.hh b/inc/LauRealImagCPCoeffSet.hh
new file mode 100644
index 0000000..9224939
--- /dev/null
+++ b/inc/LauRealImagCPCoeffSet.hh
@@ -0,0 +1,155 @@
+
+// Copyright University of Warwick 2006 - 2013.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+// Authors:
+// Thomas Latham
+// John Back
+// Paul Harrison
+
+/*! \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 "LauParameter.hh"
+
+class LauComplex;
+
+
+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 column headings for a results table
+ /*!
+ \param [out] stream the stream to print to
+ */
+ virtual void printTableHeading(std::ostream& stream);
+
+ //! 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);
+
+ //! 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 LauComplex particleCoeff();
+
+ //! Retrieve the complex coefficient for an antiparticle
+ /*!
+ \return the complex coefficient for an antiparticle
+ */
+ virtual 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
+ */
+ virtual void setCoeffValues( const LauComplex& coeff, const LauComplex& coeffBar );
+
+ //! 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] constFactor a constant factor to multiply the clone's parameters by
+ \return a clone of the coefficient set
+ */
+ virtual LauAbsCoeffSet* createClone(const TString& newName, Double_t constFactor = 1.0);
+
+ protected:
+ //! Copy constructor
+ /*!
+ This creates cloned parameters, not copies.
+ \param [in] rhs the coefficient to clone
+ \param [in] constFactor a constant factor to multiply the clone's parameters by
+ */
+ LauRealImagCPCoeffSet(const LauRealImagCPCoeffSet& rhs, Double_t constFactor = 1.0);
+
+ //! Copy assignment operator
+ /*!
+ This creates cloned parameters, not copies.
+ \param [in] rhs the coefficient to clone
+ */
+ LauRealImagCPCoeffSet& operator=(const LauRealImagCPCoeffSet& rhs);
+
+ private:
+ //! The minimum allowed value
+ Double_t minPar_;
+ //! The maximum allowed value
+ Double_t maxPar_;
+
+ // 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 CP asymmetry
+ LauParameter acp_;
+
+ ClassDef(LauRealImagCPCoeffSet, 0)
+};
+
+#endif
diff --git a/inc/Laura++_LinkDef.h b/inc/Laura++_LinkDef.h
index fada6d8..fc23f72 100644
--- a/inc/Laura++_LinkDef.h
+++ b/inc/Laura++_LinkDef.h
@@ -1,92 +1,93 @@
#ifdef __CINT__
#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;
#pragma link C++ class Lau1DHistPdf;
#pragma link C++ class Lau2DAbsDP;
#pragma link C++ class Lau2DAbsHistDP;
#pragma link C++ class Lau2DCubicSpline;
#pragma link C++ class Lau2DHistDP;
#pragma link C++ class Lau2DHistDPPdf;
#pragma link C++ class Lau2DHistPdf;
#pragma link C++ class Lau2DSplineDP;
#pragma link C++ class LauAbsBkgndDPModel;
#pragma link C++ class LauAbsCoeffSet;
#pragma link C++ class LauAbsDPDynamics;
#pragma link C++ class LauAbsFitModel;
#pragma link C++ class LauAbsPdf;
#pragma link C++ class LauAbsResonance;
#pragma link C++ class LauArgusPdf;
#pragma link C++ class LauAsymmCalc;
#pragma link C++ class LauBelleCPCoeffSet;
#pragma link C++ class LauBelleNR;
#pragma link C++ class LauBelleSymNR;
#pragma link C++ class LauBifurcatedGaussPdf;
#pragma link C++ class LauBkgndDPModel;
#pragma link C++ class LauBreitWignerRes;
#pragma link C++ class LauCacheData;
#pragma link C++ class LauCartesianCPCoeffSet;
#pragma link C++ class LauChebychevPdf;
#pragma link C++ class LauCleoCPCoeffSet;
#pragma link C++ class LauComplex;
#pragma link C++ class LauCPFitModel;
#pragma link C++ class LauCruijffPdf;
#pragma link C++ class LauCrystalBallPdf;
#pragma link C++ class LauDabbaRes;
#pragma link C++ class LauDatabasePDG;
#pragma link C++ class LauDaughters;
#pragma link C++ class LauDPDepBifurGaussPdf;
#pragma link C++ class LauDPDepCruijffPdf;
#pragma link C++ class LauDPDepGaussPdf;
#pragma link C++ class LauDPDepMapPdf;
#pragma link C++ class LauDPDepSumPdf;
#pragma link C++ class LauEffModel;
#pragma link C++ class LauEmbeddedData;
#pragma link C++ class LauExponentialPdf;
#pragma link C++ class LauFitDataTree;
#pragma link C++ class LauFitNtuple;
#pragma link C++ class LauFlatteRes;
#pragma link C++ class LauGaussPdf;
#pragma link C++ class LauGenNtuple;
#pragma link C++ class LauGounarisSakuraiRes;
#pragma link C++ class LauIntegrals;
#pragma link C++ class LauIsobarDynamics;
#pragma link C++ class LauKappaRes;
#pragma link C++ class LauKinematics;
#pragma link C++ class LauKMatrixProdPole;
#pragma link C++ class LauKMatrixProdSVP;
#pragma link C++ class LauKMatrixPropagator;
#pragma link C++ class LauKMatrixPropFactory;
#pragma link C++ class LauLASSBWRes;
#pragma link C++ class LauLASSNRRes;
#pragma link C++ class LauLASSRes;
#pragma link C++ class LauLinearPdf;
#pragma link C++ class LauMagPhaseCoeffSet;
#pragma link C++ class LauMagPhaseCPCoeffSet;
#pragma link C++ class LauNovosibirskPdf;
#pragma link C++ class LauNRAmplitude;
#pragma link C++ class LauParameter;
#pragma link C++ class LauParametricStepFuncPdf;
#pragma link C++ class LauParamFixed;
#pragma link C++ class LauParticlePDG;
#pragma link C++ class LauPrint;
#pragma link C++ class LauRealImagCoeffSet;
+#pragma link C++ class LauRealImagCPCoeffSet;
#pragma link C++ class LauRelBreitWignerRes;
#pragma link C++ class LauResonanceInfo;
#pragma link C++ class LauResonanceMaker;
#pragma link C++ class LauScfMap;
#pragma link C++ class LauSigmaRes;
#pragma link C++ class LauSigmoidPdf;
#pragma link C++ class LauSimpleFitModel;
#pragma link C++ class LauSPlot;
#pragma link C++ class LauString;
#pragma link C++ class LauSumPdf;
#pragma link C++ class LauTextFileParser;
#pragma link C++ class LauVetoes;
#pragma link C++ namespace LauConstants;
#pragma link C++ namespace LauFitter;
#pragma link C++ namespace LauRandom;
#endif
diff --git a/src/LauRealImagCPCoeffSet.cc b/src/LauRealImagCPCoeffSet.cc
new file mode 100644
index 0000000..2856d40
--- /dev/null
+++ b/src/LauRealImagCPCoeffSet.cc
@@ -0,0 +1,202 @@
+
+// Copyright University of Warwick 2006 - 2013.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+// Authors:
+// Thomas Latham
+// John Back
+// Paul Harrison
+
+/*! \file LauRealImagCPCoeffSet.cc
+ \brief File containing implementation of LauRealImagCPCoeffSet class.
+*/
+
+#include <iostream>
+#include <fstream>
+#include <vector>
+using std::cout;
+using std::cerr;
+using std::endl;
+
+#include "TMath.h"
+#include "TRandom.h"
+
+#include "LauRealImagCPCoeffSet.hh"
+#include "LauComplex.hh"
+#include "LauConstants.hh"
+#include "LauParameter.hh"
+#include "LauPrint.hh"
+#include "LauRandom.hh"
+
+ClassImp(LauRealImagCPCoeffSet)
+
+
+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),
+ minPar_(-10.0),
+ maxPar_(+10.0),
+ x_(new LauParameter("X", x, minPar_, maxPar_, xFixed)),
+ y_(new LauParameter("Y", y, minPar_, maxPar_, yFixed)),
+ xbar_(new LauParameter("Xbar", xbar, minPar_, maxPar_, xbarFixed)),
+ ybar_(new LauParameter("Ybar", ybar, minPar_, maxPar_, ybarFixed)),
+ acp_("ACP", 0.0, -1.0, 1.0, kTRUE)
+{
+ // Print message
+ std::cout << "Set component \"" << this->name() << "\" to have x = " << x_->value() << ",\ty = " << y_->value() << ",\t";
+ std::cout << "xbar = " << xbar_->value() << ",\tybar = " << ybar_->value() << "." << std::endl;
+}
+
+LauRealImagCPCoeffSet::LauRealImagCPCoeffSet(const LauRealImagCPCoeffSet& rhs, Double_t constFactor) : LauAbsCoeffSet(rhs.name())
+{
+ minPar_ = rhs.minPar_;
+ maxPar_ = rhs.maxPar_;
+ x_ = rhs.x_->createClone(constFactor);
+ y_ = rhs.y_->createClone(constFactor);
+ xbar_ = rhs.xbar_->createClone(constFactor);
+ ybar_ = rhs.ybar_->createClone(constFactor);
+ acp_ = rhs.acp_;
+}
+
+LauRealImagCPCoeffSet& LauRealImagCPCoeffSet::operator=(const LauRealImagCPCoeffSet& rhs)
+{
+ if (&rhs != this) {
+ this->name(rhs.name());
+ minPar_ = rhs.minPar_;
+ maxPar_ = rhs.maxPar_;
+ x_ = rhs.x_->createClone();
+ y_ = rhs.y_->createClone();
+ xbar_ = rhs.xbar_->createClone();
+ ybar_ = rhs.ybar_->createClone();
+ acp_ = rhs.acp_;
+ }
+ return *this;
+}
+
+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;
+}
+
+void LauRealImagCPCoeffSet::printTableHeading(std::ostream& stream)
+{
+ stream<<"\\begin{tabular}{|l|c|c|c|c|}"<<endl;
+ stream<<"\\hline"<<endl;
+ stream<<"Component & Particle Real Part & Particle Imaginary Part & Antiparticle Real Part & Antiparticle Imaginary Part \\\\"<<endl;
+ stream<<"\\hline"<<endl;
+}
+
+void LauRealImagCPCoeffSet::printTableRow(std::ostream& stream)
+{
+ 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<<"$ \\\\"<<endl;
+}
+
+void LauRealImagCPCoeffSet::randomiseInitValues()
+{
+ if (x_->fixed() == kFALSE && x_->secondStage() == kFALSE) {
+ // Choose a value for "X" between -3.0 and 3.0
+ Double_t value = LauRandom::zeroSeedRandom()->Rndm()*6.0 - 3.0;
+ x_->initValue(value); x_->value(value);
+ }
+ if (y_->fixed() == kFALSE && y_->secondStage() == kFALSE) {
+ // Choose a value for "Y" between -3.0 and 3.0
+ Double_t value = LauRandom::zeroSeedRandom()->Rndm()*6.0 - 3.0;
+ y_->initValue(value); y_->value(value);
+ }
+ if (xbar_->fixed() == kFALSE && xbar_->secondStage() == kFALSE) {
+ // Choose a value for "Delta X" between -3.0 and 3.0
+ Double_t value = LauRandom::zeroSeedRandom()->Rndm()*6.0 - 3.0;
+ xbar_->initValue(value); xbar_->value(value);
+ }
+ if (ybar_->fixed() == kFALSE && ybar_->secondStage() == kFALSE) {
+ // Choose a value for "Delta Y" between -3.0 and 3.0
+ Double_t value = LauRandom::zeroSeedRandom()->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();
+}
+
+LauComplex LauRealImagCPCoeffSet::particleCoeff()
+{
+ return LauComplex( x_->value(), y_->value() );
+}
+
+LauComplex LauRealImagCPCoeffSet::antiparticleCoeff()
+{
+ return LauComplex( xbar_->value(), ybar_->value() );
+}
+
+void LauRealImagCPCoeffSet::setCoeffValues( const LauComplex& coeff, const LauComplex& coeffBar )
+{
+ x_->value( coeff.re() );
+ y_->value( coeff.im() );
+ xbar_->value( coeffBar.re() );
+ ybar_->value( coeffBar.im() );
+}
+
+LauParameter LauRealImagCPCoeffSet::acp()
+{
+ // 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;
+
+ // 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);
+
+ // set the value and error
+ acp_.valueAndErrors(value,error);
+
+ return acp_;
+}
+
+LauAbsCoeffSet* LauRealImagCPCoeffSet::createClone(const TString& newName, Double_t constFactor)
+{
+ LauAbsCoeffSet* clone = new LauRealImagCPCoeffSet( *this, constFactor );
+ clone->name( newName );
+ return clone;
+}
+

File Metadata

Mime Type
text/x-diff
Expires
Tue, Nov 19, 7:10 PM (1 d, 10 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3805775
Default Alt Text
(14 KB)

Event Timeline