Skip to content

Commit

Permalink
Merge pull request cms-sw#151 from gpetruc/slc6-root5.34.17
Browse files Browse the repository at this point in the history
Sync SL6 branch to SL5
  • Loading branch information
gpetruc committed Oct 13, 2014
2 parents 25eaa49 + 0ebf44a commit 8674e95
Show file tree
Hide file tree
Showing 42 changed files with 2,349 additions and 128 deletions.
23 changes: 23 additions & 0 deletions data/benchmarks/simple-counting/test-edit.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Simple counting experiment
date 2011.11.18
imax 1 number of channels
jmax 1 number of backgrounds
kmax 1 number of nuisance parameters
------------
bin c
observation 1
------------
bin c c
process S B
process 0 1
rate 1 5.5
------------
dB lnN 1.00 1.30


# edit verb pr ch name pdf value
nuisance edit add S * dB lnN 1.2 overwrite
#nuisance edit drop B c dX ifexists
nuisance edit rename S c dB dS
#nuisance edit rename * * d(.*) CMS_\1
nuisance edit changepdf dS trG
67 changes: 67 additions & 0 deletions data/lhc-hxswg/BRU_rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
=================================
# grand combination has processes
# non-ttH htt: qqH_hww ggH_hww WH_hww WH_htt ZH_hww ZH_htt
# non-ttH hww3l: WH_htt WH_hww
# ttH(bbttww): ttH_[cc,bb,tt,gg,gluglu,ww,zz,zg]
# keep also in mind processes like ggH_SM in two state searches

# first drop old BR unc implementation from individual analyses
nuisance edit drop * * BRhiggs_htt
nuisance edit drop * * BRhiggs_hvv
nuisance edit drop * * BRhiggs_hzz4l
nuisance edit drop * * CMS_hgg_BR

# adding nuisances according to
# https://indico.cern.ch/event/317643/contribution/0/material/0/0.pdf#page=6

# Lines come in pairs:
# - first line takes care of all signal names we know only in cards for given decays
# - second line takes care of special signal names that involve the decay and does it in all cards

#param_alphaS
nuisance edit add ^((W|qq|tt|Z|V|gg)H|VBF)(|_SM)$ h(ww|zz|gg|tt|zg|mm) param_alphaS lnN 1.012
nuisance edit add h(tt|ww|zz|zg|gg|mm) * param_alphaS lnN 1.012
nuisance edit add ^((W|qq|tt|Z|V|gg)H|VBF)(|_SM)$ hbb param_alphaS lnN 0.989
nuisance edit add hbb * param_alphaS lnN 0.989
nuisance edit add ^((W|qq|tt|Z|V|gg)H|VBF)(|_SM)$ hcc param_alphaS lnN 0.942
nuisance edit add hcc * param_alphaS lnN 0.942
nuisance edit add ^((W|qq|tt|Z|V|gg)H|VBF)(|_SM)$ hgluglu param_alphaS lnN 1.055
nuisance edit add hgluglu * param_alphaS lnN 1.055

#param_mB
nuisance edit add ^((W|qq|tt|Z|V|gg)H|VBF)(|_SM)$ h(ww|zz|gg|tt|zg|mm|cc|gluglu) param_mB lnN 0.981
nuisance edit add h(ww|zz|gg|tt|zg|mm|cc|gluglu) * param_mB lnN 0.981
nuisance edit add ^((W|qq|tt|Z|V|gg)H|VBF)(|_SM)$ hbb param_mB lnN 1.014
nuisance edit add hbb * param_mB lnN 1.014

#param_mC
nuisance edit add ^((W|qq|tt|Z|V|gg)H|VBF)(|_SM)$ hcc param_mC lnN 1.062
nuisance edit add hcc * param_mC lnN 1.062

#param_mt

#HiggsDecayWidthTHU_hqq
nuisance edit add ^((W|qq|tt|Z|V|gg)H|VBF)(|_SM)$ h(ww|zz|gg|tt|zg|mm|gluglu) HiggsDecayWidthTHU_hqq lnN 0.988
nuisance edit add h(ww|zz|gg|tt|zg|mm|gluglu) * HiggsDecayWidthTHU_hqq lnN 0.988
nuisance edit add ^((W|qq|tt|Z|V|gg)H|VBF)$ h(bb|cc) HiggsDecayWidthTHU_hqq lnN 1.008
nuisance edit add h(bb|cc) * HiggsDecayWidthTHU_hqq lnN 1.008

#HiggsDecayWidthTHU_hvv
nuisance edit add ^((W|qq|tt|Z|V|gg)H|VBF)(|_SM)$ h(ww|zz) HiggsDecayWidthTHU_hvv lnN 1.004
nuisance edit add h(ww|zz) * HiggsDecayWidthTHU_hvv lnN 1.004

#HiggsDecayWidthTHU_hll
nuisance edit add ^((W|qq|tt|Z|V|gg)H|VBF)(|_SM)$ h(tt|mm) HiggsDecayWidthTHU_hll lnN 1.019
nuisance edit add h(tt|mm) * HiggsDecayWidthTHU_hll lnN 1.019

#HiggsDecayWidthTHU_hgg
nuisance edit add ^((W|qq|tt|Z|V|gg)H|VBF)(|_SM)$ hgg HiggsDecayWidthTHU_hgg lnN 1.010
nuisance edit add hgg * HiggsDecayWidthTHU_hgg lnN 1.010

#HiggsDecayWidthTHU_hzg
nuisance edit add ^((W|qq|tt|Z|V|gg)H|VBF)(|_SM)$ hzg HiggsDecayWidthTHU_hzg lnN 1.051
nuisance edit add hzg * HiggsDecayWidthTHU_hzg lnN 1.051

#HiggsDecayWidthTHU_hgluglu
nuisance edit add ^((W|qq|tt|Z|V|gg)H|VBF)(|_SM)$ hgluglu HiggsDecayWidthTHU_hgluglu lnN 1.028
nuisance edit add hgluglu * HiggsDecayWidthTHU_hgluglu lnN 1.028
46 changes: 46 additions & 0 deletions data/tutorials/groupnuisA.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# -S 0
# --fastScan (MultiDimFit)
# --profilingMode (ChannelCompatibilityCheck)


imax 1 # number of channels
jmax 1 # number of processes-1
kmax * # number of nuisance parameters
--------------------------
bin hww
observation 18
--------------------------
bin hww hww
process ggH bkgww
process 0 1
rate 11 7

lumi lnN 1.05 -
theo_ggH lnN 1.10 -
theo_bkgww lnN - 1.10
exp_systww lnN 1.05 1.05
MCstatww lnN 1.01 -

theo group = theo_bkgww theo_ggH
theoB group = theo_bkgww
theoS group = theo_ggH
lumi group = lumi
stat group = MCstatww

#does not exist: error in modeltools
#dummy group = foobar

#empty error
#testempty group

#missing [+]=
#testsyntax group bla bla bla
#testsyntax group -= bla bla bla

#add before define
#add group += lumi

equals group = lumi
equals group += lumi MCstatww
#redefinition error
#equals group = theo_ggH
24 changes: 24 additions & 0 deletions data/tutorials/groupnuisB.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
imax 1 # number of channels
jmax 1 # number of processes-1
kmax * # number of nuisance parameters
--------------------------
bin hgg
observation 25
--------------------------
bin hgg hgg
process ggH bkggg
process 0 1
rate 10 8

lumi lnN 1.05 -
theo_ggH lnN 1.10 -
theo_bkggg lnN - 1.10
exp_systgg lnN 1.05 1.05
MCstatgg lnN 1.01 -

theo group = theo_bkggg theo_ggH
theoB group = theo_bkggg
theoS group = theo_ggH
lumi group = lumi
stat group = MCstatgg

7 changes: 5 additions & 2 deletions interface/Combine.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#include <TString.h>
#include <boost/program_options.hpp>
#include "RooArgSet.h"
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/classification.hpp>

class TDirectory;
class TTree;
Expand All @@ -22,6 +24,8 @@ extern bool withSystematics;
extern bool doSignificance_, lowerLimit_;
extern float cl;
extern bool bypassFrequentistFit_;
extern std::string setPhysicsModelParameterExpression_;
extern std::string setPhysicsModelParameterRangeExpression_;


class Combine {
Expand Down Expand Up @@ -58,10 +62,9 @@ class Combine {
bool toysFrequentist_;
float expectSignal_;
float expectSignalMass_;
std::string setPhysicsModelParameterExpression_;
std::string setPhysicsModelParameterRangeExpression_;
std::string redefineSignalPOIs_;
std::string freezeNuisances_;
std::string freezeNuisanceGroups_;

// input-output related variables
bool saveWorkspace_;
Expand Down
55 changes: 55 additions & 0 deletions interface/FastTemplate.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include <TH1.h>
#include <TH2.h>
#include <TH3.h>
#include <algorithm>
#include <vector>

Expand All @@ -15,6 +16,7 @@ class FastTemplate {
FastTemplate(const FastTemplate &other) : size_(other.size()), values_(other.values_) {}
FastTemplate(const TH1 &other) : size_(other.GetNbinsX()), values_(size_) { CopyValues(other); }
FastTemplate(const TH2 &other) : size_(other.GetNbinsX()*other.GetNbinsY()), values_(size_) { CopyValues(other); }
FastTemplate(const TH3 &other) : size_(other.GetNbinsX()*other.GetNbinsY()*other.GetNbinsZ()), values_(size_) { CopyValues(other); }
FastTemplate & operator=(const FastTemplate &other) {
if (&other != this) {
size_ = other.size_;
Expand Down Expand Up @@ -42,6 +44,7 @@ class FastTemplate {
void CopyValues(const FastTemplate &other) ;
void CopyValues(const TH1 &other) ;
void CopyValues(const TH2 &other) ;
void CopyValues(const TH3 &other) ;
T & operator[](unsigned int i) { return values_[i]; }
const T & operator[](unsigned int i) const { return values_[i]; }
/// return the full size of the template
Expand Down Expand Up @@ -164,4 +167,56 @@ class FastHisto2D : public FastTemplate {

};

class FastHisto3D : public FastTemplate {
public:
FastHisto3D() : FastTemplate(), binX_(0), binY_(0), binZ_(0),binEdgesX_(), binEdgesY_(), binEdgesZ_(), binWidths_() {}
FastHisto3D(const TH3 &hist, bool normXonly=false) ;
FastHisto3D(const FastHisto3D &other) ;
FastHisto3D & operator=(const FastHisto3D &other) {
if (binX() != other.binX() || binY() != other.binY() || binZ() != other.binZ()) {
size_ = other.size_;
values_ = other.values_;
binWidths_ = other.binWidths_;
binEdgesX_ = other.binEdgesX_;
binEdgesY_ = other.binEdgesY_;
binEdgesZ_ = other.binEdgesZ_;
binX_ = other.binX_;
binY_ = other.binY_;
binZ_ = other.binZ_;
} else CopyValues(other);
return *this;
}
~FastHisto3D() { }
void swap(FastHisto3D &other) {
std::swap(size_, other.size_);
std::swap(binX_, other.binX_);
std::swap(binY_, other.binY_);
std::swap(binZ_, other.binZ_);
std::swap(values_, other.values_);
std::swap(binWidths_, other.binWidths_);
std::swap(binEdgesX_, other.binEdgesX_);
std::swap(binEdgesY_, other.binEdgesY_);
std::swap(binEdgesZ_, other.binEdgesZ_);
}
T GetAt(const T &x, const T &y, const T &z) const ;
T IntegralWidth() const ;
unsigned int binX() const { return binX_; }
unsigned int binY() const { return binY_; }
unsigned int binZ() const { return binZ_; }
void Normalize() {
T sum = IntegralWidth();
if (sum > 0) Scale(1.0f/sum);
}
/// For each X, normalize along Y
void NormalizeXSlices() ;

void Dump() const ;
private:
unsigned int binX_, binY_, binZ_;
AT binEdgesX_;
AT binEdgesY_;
AT binEdgesZ_;
AT binWidths_;

};
#endif
2 changes: 1 addition & 1 deletion interface/FitterAlgoBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class FitterAlgoBase : public LimitAlgo {
RooArgSet parametersToFreeze_;

static bool saveNLL_, keepFailures_, protectUnbinnedChannels_;
static float nllValue_;
static double nllValue_, nll0Value_;
std::auto_ptr<RooAbsReal> nll;
// method that is implemented in the subclass
virtual bool runSpecific(RooWorkspace *w, RooStats::ModelConfig *mc_s, RooStats::ModelConfig *mc_b, RooAbsData &data, double &limit, double &limitErr, const double *hint) = 0;
Expand Down
6 changes: 4 additions & 2 deletions interface/HZZ4LRooPdfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ class RooaDoubleCBxBW : public RooAbsPdf {
public:
RooaDoubleCBxBW();
RooaDoubleCBxBW(const char *name, const char *title,
RooAbsReal& _x,
RooAbsReal& _x,
RooAbsReal& _shift,
RooAbsReal& _sigma,
RooAbsReal& _alphaL,
Expand All @@ -700,7 +700,8 @@ class RooaDoubleCBxBW : public RooAbsPdf {
unsigned _nR,
RooAbsReal& _thetaL,
RooAbsReal& _thetaR,
bool _computeActualCB
bool _computeActualCB,
bool _tailOnly
);
RooaDoubleCBxBW(const RooaDoubleCBxBW& other, const char* name=0) ;
virtual TObject* clone(const char* newname) const { return new RooaDoubleCBxBW(*this,newname); }
Expand All @@ -720,6 +721,7 @@ class RooaDoubleCBxBW : public RooAbsPdf {
RooRealProxy thetaL;
RooRealProxy thetaR;
bool computeActualCB;
bool tailOnly;

Double_t evaluate() const ;
Double_t evaluateDoubleCB() const ;
Expand Down
53 changes: 53 additions & 0 deletions interface/HZZ4L_RooSpinZeroPdf.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*****************************************************************************
* Project: RooFit *
* *
* This code was autogenerated by RooClassFactory *
*****************************************************************************/

#ifndef HZZ4L_ROOSPINZEROPDF
#define HZZ4L_ROOSPINZEROPDF

#include "RooAbsPdf.h"
#include "RooRealProxy.h"
#include "RooRealVar.h"
#include "RooCategoryProxy.h"
#include "RooAbsReal.h"
#include "RooAbsCategory.h"
#include "TH3F.h"
#include "TH1.h"
#include "RooDataHist.h"
#include "RooHistFunc.h"
using namespace RooFit;
class HZZ4L_RooSpinZeroPdf : public RooAbsPdf {
protected:

RooRealProxy kd ;
RooRealProxy kdint ;
RooRealProxy ksmd ;
RooRealProxy fai ;
RooListProxy _coefList ; // List of funcficients
// TIterator* _coefIter ; //! Iterator over funcficient lis
Double_t evaluate() const ;
public:
HZZ4L_RooSpinZeroPdf() {} ;
HZZ4L_RooSpinZeroPdf(const char *name, const char *title,
RooAbsReal& _kd,
RooAbsReal& _kdint,
RooAbsReal& _ksmd,
RooAbsReal& _fai,
const RooArgList& inCoefList);

HZZ4L_RooSpinZeroPdf(const HZZ4L_RooSpinZeroPdf& other, const char* name=0) ;
virtual TObject* clone(const char* newname) const { return new HZZ4L_RooSpinZeroPdf(*this,newname); }
inline virtual ~HZZ4L_RooSpinZeroPdf() {}

Int_t getAnalyticalIntegral(RooArgSet& allVars, RooArgSet& analVars, const char* rangeName=0) const ;
Double_t analyticalIntegral(Int_t code, const char* rangeName=0) const ;
const RooArgList& coefList() const { return _coefList ; }

private:

ClassDef(HZZ4L_RooSpinZeroPdf,1) // Your description goes here...
};

#endif
Loading

0 comments on commit 8674e95

Please sign in to comment.