diff --git a/inc/LauAbsBkgndDPModel.hh b/inc/LauAbsBkgndDPModel.hh index d2cd6e8..c87176d 100644 --- a/inc/LauAbsBkgndDPModel.hh +++ b/inc/LauAbsBkgndDPModel.hh @@ -1,168 +1,174 @@ /* 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 (unnormalised likelihood value / PDF normalisation) 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 the unnormalised likelihood value for the current event /*! \return the unnormalised likelihood values */ virtual Double_t getUnNormValue() const = 0; //! Get PDF normalisation constant /*! \return the PDF normalisation constant */ virtual Double_t getPdfNorm() const = 0; + //! Get maximum PDF height + /*! + \return the PDF maximum height + */ + virtual Double_t getMaxHeight() const = 0; + //! Calculate the likelihood value for a given set of Dalitz plot coordinates /*! \param [in] m13Sq the invariant mass squared of daughters 1 and 3 \param [in] m23Sq the invariant mass squared of daughters 2 and 3 */ virtual void calcLikelihoodInfo(const Double_t m13Sq, const Double_t m23Sq) = 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/LauBkgndDPModel.hh b/inc/LauBkgndDPModel.hh index d34922a..52de1f4 100644 --- a/inc/LauBkgndDPModel.hh +++ b/inc/LauBkgndDPModel.hh @@ -1,185 +1,191 @@ /* 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 #include "LauAbsBkgndDPModel.hh" 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 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 likelihood (unnormalised likelihood value / PDF normalisation) for a given event /*! \param [in] iEvt the event number \return the likelihood value */ virtual Double_t getLikelihood(UInt_t iEvt); //! Get the unnormalised likelihood value for the current event /*! \return the unnormalised likelihood values */ virtual Double_t getUnNormValue() const {return curEvtHistVal_;} //! Get PDF normalisation constant /*! \return the PDF normalisation constant */ virtual Double_t getPdfNorm() const {return pdfNorm_;} + //! Get maximum PDF height + /*! + \return the PDF maximum height + */ + virtual Double_t getMaxHeight() const {return maxPdfHeight_;} + //! Calculate the likelihood value for a given set of Dalitz plot coordinates /*! \param [in] m13Sq the invariant mass squared of daughters 1 and 3 \param [in] m23Sq the invariant mass squared of daughters 2 and 3 */ virtual void calcLikelihoodInfo(const Double_t m13Sq, const Double_t m23Sq); //! 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 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