Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/RooMultiPdf.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 #ifndef ROO_MULTIPDF
0002 #define ROO_MULTIPDF
0003 
0004 #include "RooAbsPdf.h"
0005 #include "RooCategory.h"
0006 #include "RooCategoryProxy.h"
0007 #include "RooListProxy.h"
0008 
0009 class RooMultiPdf : public RooAbsPdf {
0010 public:
0011    enum PenaltyScheme {
0012       PVAL,
0013       AIC
0014    };
0015    RooMultiPdf() {}
0016    RooMultiPdf(const char *name, const char *title, RooCategory &, const RooArgList &_c);
0017    RooMultiPdf(const RooMultiPdf &other, const char *name = nullptr);
0018    TObject *clone(const char *newname) const override { return new RooMultiPdf(*this, newname); }
0019 
0020    inline bool checkIndexDirty() const { return _oldIndex != x; }
0021    inline double getCorrection() const override { return cFactor * static_cast<RooAbsReal *>(corr.at(x))->getVal(); }
0022    inline RooAbsPdf *getCurrentPdf() const { return getPdf(getCurrentIndex()); }
0023    int getNumPdfs() const { return c.size(); }
0024 
0025    inline const RooCategoryProxy &indexCategory() const { return x; }
0026    inline const RooListProxy &getPdfList() const { return c; }
0027 
0028    void setCorrectionFactor(PenaltyScheme penal) { cFactor = penal == AIC ? 1.0 : 0.5; }
0029    void setCorrectionFactor(double penal) { cFactor = penal; }
0030    inline int getCurrentIndex() const { return static_cast<int>(x); }
0031    inline RooAbsPdf *getPdf(int index) const { return static_cast<RooAbsPdf *>(c.at(index)); }
0032    // Always normalized because each pdf is normalized
0033    bool selfNormalized() const override { return true; }
0034 
0035    void getParametersHook(const RooArgSet *nset, RooArgSet *list, bool stripDisconnected) const override;
0036 
0037 protected:
0038    RooListProxy c;
0039    RooListProxy corr;
0040    RooCategoryProxy x;
0041 
0042    int fIndex; // sigh, there should be a better way than this
0043    int nPdfs;  // not used, kept so we didn't have to change the class layout for IO
0044    mutable Int_t _oldIndex;
0045 
0046    Double_t evaluate() const override;
0047    Double_t getLogVal(const RooArgSet *set = nullptr) const override;
0048    double cFactor = 0.5; // correction to 2*NLL by default is -> 2*0.5 per param
0049 
0050 private:
0051    ClassDefOverride(RooMultiPdf, 1) // Multi PDF
0052 };
0053 #endif