-
Notifications
You must be signed in to change notification settings - Fork 393
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #842 from cms-analysis/interference
Accelerated interference models
- Loading branch information
Showing
16 changed files
with
878 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#ifndef CMSExternalMorph_h | ||
#define CMSExternalMorph_h | ||
#include <vector> | ||
|
||
#include "RooAbsReal.h" | ||
#include "RooRealVar.h" | ||
#include "RooRealProxy.h" | ||
|
||
class CMSExternalMorph : public RooAbsReal { | ||
public: | ||
CMSExternalMorph(); | ||
/* | ||
* All subclasses need to provide an edges array of length nbins+1 | ||
* of the observable (x) | ||
* TODO: CMSHistFunc and CMSHistSum do not check the binning is compatible | ||
* with their binning other than having the correct length | ||
*/ | ||
CMSExternalMorph( | ||
const char* name, | ||
const char* title, | ||
RooRealVar& x, | ||
const std::vector<double>& edges | ||
); | ||
CMSExternalMorph(CMSExternalMorph const& other, const char* name = 0); | ||
virtual ~CMSExternalMorph(); | ||
|
||
/* Batch accessor for CMSHistFunc / CMSHistSum, to be overriden by concrete | ||
* implementations. hasChanged() should indicate whether or not | ||
* batchGetBinValues() would return a new vector, given the state of | ||
* any dependent variables. | ||
*/ | ||
virtual bool hasChanged() const = 0; | ||
virtual const std::vector<double>& batchGetBinValues() const = 0; | ||
|
||
protected: | ||
RooRealProxy x_; | ||
std::vector<double> edges_; | ||
|
||
double evaluate() const; | ||
|
||
private: | ||
ClassDef(CMSExternalMorph, 1) | ||
}; | ||
|
||
#endif // CMSExternalMorph_h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#ifndef CMSInterferenceFunc_h | ||
#define CMSInterferenceFunc_h | ||
#include "RooListProxy.h" | ||
#include "SimpleCacheSentry.h" | ||
|
||
#include "CMSExternalMorph.h" | ||
|
||
class _InterferenceEval; | ||
|
||
class CMSInterferenceFunc : public CMSExternalMorph { | ||
public: | ||
CMSInterferenceFunc(); | ||
CMSInterferenceFunc(CMSInterferenceFunc const& other, const char* name = 0); | ||
/* | ||
* For a coefficients list of length n and edges array of length b+1, | ||
* the binscaling nested vector should have b entries (for b bins) with | ||
* each being of length n*(n+1)/2, corresponding to the lower triangular | ||
* elements of the scaling matrix, i.e. (m_00, m_10, m_11, m_20, m_21, m_22, ...) | ||
*/ | ||
CMSInterferenceFunc( | ||
const char* name, | ||
const char* title, | ||
RooRealVar& x, | ||
const std::vector<double>& edges, | ||
const RooArgList& coefficients, | ||
const std::vector<std::vector<double>> binscaling | ||
); | ||
virtual ~CMSInterferenceFunc(); | ||
|
||
virtual TObject* clone(const char* newname) const override { | ||
return new CMSInterferenceFunc(*this, newname); | ||
}; | ||
|
||
void printMultiline( | ||
std::ostream& os, Int_t contents, Bool_t verbose, TString indent | ||
) const override; | ||
|
||
bool hasChanged() const override { return !sentry_.good(); }; | ||
const std::vector<double>& batchGetBinValues() const override; | ||
|
||
protected: | ||
RooListProxy coefficients_; | ||
std::vector<std::vector<double>> binscaling_; | ||
|
||
mutable SimpleCacheSentry sentry_; //! | ||
mutable std::unique_ptr<_InterferenceEval> evaluator_; //! | ||
|
||
private: | ||
void initialize() const; | ||
void updateCache() const; | ||
|
||
ClassDefOverride(CMSInterferenceFunc, 1) | ||
}; | ||
|
||
#endif // CMSInterferenceFunc_h |
Oops, something went wrong.